internal MonoSymbolFile(MonoLanguageBackend language, Process process,
TargetMemoryAccess memory, TargetAddress address)
{
this.MonoLanguage = language;
this.TargetMemoryInfo = memory.TargetMemoryInfo;
this.Architecture = process.Architecture;
this.process = process;
ThreadManager = process.ThreadManager;
int address_size = TargetMemoryInfo.TargetAddressSize;
int int_size = TargetMemoryInfo.TargetIntegerSize;
ranges = ArrayList.Synchronized (new ArrayList ());
range_hash = Hashtable.Synchronized (new Hashtable ());
type_hash = Hashtable.Synchronized (new Hashtable ());
class_entry_by_token = Hashtable.Synchronized (new Hashtable ());
Index = memory.ReadInteger (address);
address += int_size;
TargetAddress image_file_addr = memory.ReadAddress (address);
address += address_size;
ImageFile = memory.ReadString (image_file_addr);
MonoImage = memory.ReadAddress (address);
address += address_size;
TargetAddress type_table_ptr = memory.ReadAddress (address);
address += address_size;
TypeTable = MonoTypeTable.CreateTypeTable (this, memory, type_table_ptr);
string shadow_location = language.GetShadowCopyLocation (ImageFile);
if (shadow_location != null)
ImageFile = shadow_location;
try {
Assembly = Cecil.AssemblyDefinition.ReadAssembly (ImageFile);
} catch (Exception ex) {
throw new SymbolTableException (
"Cannot load symbol file `{0}': {1}", ImageFile, ex);
}
ModuleDefinition = Assembly.MainModule;
Report.Debug (DebugFlags.JitSymtab, "SYMBOL TABLE READER: {0}", ImageFile);
string mdb_file = ImageFile + ".mdb";
try {
File = C.MonoSymbolFile.ReadSymbolFile (ModuleDefinition, mdb_file);
if (File == null)
Report.Error ("Cannot load symbol file `{0}'", mdb_file);
else if (ModuleDefinition.Mvid != File.Guid) {
Report.Error ("Symbol file `{0}' does not match assembly `{1}'",
mdb_file, ImageFile);
File = null;
}
} catch (C.MonoSymbolFileException ex) {
Report.Error (ex.Message);
} catch (Exception ex) {
Report.Error ("Cannot load symbol file `{0}': {1}", mdb_file, ex);
}
symtab = new MonoSymbolTable (this);
name = Assembly.Name.FullName;
module = process.Session.GetModule (name);
if (module == null) {
module = process.Session.CreateModule (name, this);
} else {
module.LoadModule (this);
}
#if FIXME
if ((File != null) && (File.OffsetTable.IsAspxSource)) {
Console.WriteLine ("ASPX SOURCE: {0} {1}", this, File);
}
#endif
process.SymbolTableManager.AddSymbolFile (this);
}