using System.Reflection;
using System.Collections;
using System.Text;
+using System.Threading;
using System.IO;
namespace Mono.CompilerServices.SymbolWriter
static GetMethodFunc get_method;
static GetLocalTypeFromSignatureFunc local_type_from_sig;
static GetGuidFunc get_guid;
+ static CheckRuntimeVersionFunc check_runtime_version;
delegate Type GetTypeFunc (Assembly assembly, int token);
delegate int GetMethodTokenFunc (Assembly assembly, MethodBase method);
delegate MethodBase GetMethodFunc (Assembly assembly, int token);
delegate Type GetLocalTypeFromSignatureFunc (Assembly assembly, byte[] sig);
delegate Guid GetGuidFunc (Module module);
+ delegate string CheckRuntimeVersionFunc (string filename);
static Delegate create_delegate (Type type, Type delegate_type, string name)
{
get_guid = (GetGuidFunc) create_delegate (
typeof (Module), typeof (GetGuidFunc), "Mono_GetGuid");
+
+ check_runtime_version = (CheckRuntimeVersionFunc) create_delegate (
+ typeof (Assembly), typeof (CheckRuntimeVersionFunc),
+ "MonoDebugger_CheckRuntimeVersion");
}
public static Type GetType (Assembly assembly, int token)
return local_type_from_sig (assembly, sig);
}
+ public static string CheckRuntimeVersion (string filename)
+ {
+ return check_runtime_version (filename);
+ }
+
public static Guid GetGuid (Module module)
{
return get_guid (module);
long offset_table_offset = bw.BaseStream.Position;
ot.Write (bw);
+ //
+ // Sort the methods according to their tokens and update their index.
+ //
+ methods.Sort ();
+ for (int i = 0; i < methods.Count; i++)
+ ((MethodEntry) methods [i]).Index = i + 1;
+
//
// Write data sections.
//
ot.DataSectionSize = (int) bw.BaseStream.Position - ot.DataSectionOffset;
//
- // Sort the methods according to their tokens and write
- // the method table.
+ // Write the method index table.
//
- methods.Sort ();
ot.MethodTableOffset = (int) bw.BaseStream.Position;
for (int i = 0; i < methods.Count; i++) {
MethodEntry entry = (MethodEntry) methods [i];
FileStream stream = new FileStream (filename, FileMode.Open, FileAccess.Read);
reader = new MyBinaryReader (stream);
+ Guid guid;
+
try {
long magic = reader.ReadInt64 ();
long version = reader.ReadInt32 ();
"Symbol file `{0}' has version {1}, " +
"but expected {2}", filename, version,
OffsetTable.Version);
+
+ guid = new Guid (reader.ReadBytes (16));
+
ot = new OffsetTable (reader);
} catch {
throw new MonoSymbolFileException (
"Cannot read symbol file `{0}'", filename);
}
- Guid guid = new Guid (reader.ReadBytes (16));
Module[] modules = assembly.GetModules ();
Guid assembly_guid = MonoDebuggerSupport.GetGuid (modules [0]);