Author: joshua
Date: 2006-09-24 11:20:00 -0400 (Sun, 24 Sep 2006)
New Revision: 65859

Modified:
   trunk/mcs/class/Mono.CompilerServices.SymbolWriter/ChangeLog
   trunk/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
Log:
Allow the Mono.CompilerServices.SymbolWriter.MonoSymbolFile class to be created 
without passing a System.Reflection.Assembly so that we can use this lib with 
Cecil.

Modified: trunk/mcs/class/Mono.CompilerServices.SymbolWriter/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.CompilerServices.SymbolWriter/ChangeLog        
2006-09-24 15:04:39 UTC (rev 65858)
+++ trunk/mcs/class/Mono.CompilerServices.SymbolWriter/ChangeLog        
2006-09-24 15:20:00 UTC (rev 65859)
@@ -1,3 +1,9 @@
+2006-09-24  Joshua Tauberer  <[EMAIL PROTECTED]>
+
+       * MonoSymbolFile.cs: Allow MonoSymbolFile to be created
+         without passing a System.Reflection.Assembly, so we can
+         use this with Cecil.  Only the GUID check is avoided.
+
 2005-09-14  Martin Baulig  <[EMAIL PROTECTED]>
 
        * MonoSymbolTable.cs (OffsetTable): Bump version to 39.
@@ -26,7 +32,7 @@
 2005-04-04  Marek Safar  <[EMAIL PROTECTED]>
 
        * MonoSymbolFile.cs: Removed unused fields.
-
+
 2005-02-10  Martin Baulig  <[EMAIL PROTECTED]>
 
        * MonoSymbolFile.cs

Modified: trunk/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
===================================================================
--- trunk/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs        
2006-09-24 15:04:39 UTC (rev 65858)
+++ trunk/mcs/class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs        
2006-09-24 15:20:00 UTC (rev 65859)
@@ -72,7 +72,7 @@
                        return base.Read7BitEncodedInt ();
                }
        }
-
+       
        internal class MonoDebuggerSupport
        {
                static GetMethodTokenFunc get_method_token;
@@ -300,14 +300,19 @@
                                        "Cannot read symbol file `{0}'", 
filename);
                        }
 
-                       Module[] modules = assembly.GetModules ();
-                       Guid assembly_guid = MonoDebuggerSupport.GetGuid 
(modules [0]);
-
-                       if (guid != assembly_guid)
-                               throw new MonoSymbolFileException (
-                                       "Symbol file `{0}' does not match 
assembly `{1}'",
-                                       filename, assembly.Location);
-
+                       if (assembly != null) {
+                               // Check that the MDB file matches the 
assembly, if we have been
+                               // passed an assembly.
+                               
+                               Module[] modules = assembly.GetModules ();
+                               Guid assembly_guid = 
MonoDebuggerSupport.GetGuid (modules [0]);
+       
+                               if (guid != assembly_guid)
+                                       throw new MonoSymbolFileException (
+                                               "Symbol file `{0}' does not 
match assembly `{1}'",
+                                               filename, assembly.Location);
+                       }
+                       
                        method_hash = new Hashtable ();
                        source_file_hash = new Hashtable ();
                }
@@ -320,6 +325,11 @@
                        return new MonoSymbolFile (name, assembly);
                }
 
+               public static MonoSymbolFile ReadSymbolFile (string mdbFilename)
+               {
+                       return new MonoSymbolFile (mdbFilename, null);
+               }
+
                public Assembly Assembly {
                        get { return assembly; }
                }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to