Author: martin
Date: 2008-02-19 08:35:16 -0500 (Tue, 19 Feb 2008)
New Revision: 96139

Modified:
   branches/martin/debugger-terrania/symbolwriter/ChangeLog
   branches/martin/debugger-terrania/symbolwriter/MonoSymbolFile.cs
   branches/martin/debugger-terrania/symbolwriter/MonoSymbolTable.cs
Log:
2008-02-19  Martin Baulig  <[EMAIL PROTECTED]>

        * MonoSymbolFile.cs
        (MonoSymbolFile.Version): New public readonly field.
        (MonoSymbolFile.CompatibilityMode): Likewise; this is enabled if
        we're reading an old `39' file.

        * MonoSymbolTable.cs
        (OffsetTable.CompatibilityVersion): New public const; we keep
        backwards compatibility with this version.
        (MethodEntry): Check `file.CompatiblityMode'.



Modified: branches/martin/debugger-terrania/symbolwriter/ChangeLog
===================================================================
--- branches/martin/debugger-terrania/symbolwriter/ChangeLog    2008-02-19 
13:31:26 UTC (rev 96138)
+++ branches/martin/debugger-terrania/symbolwriter/ChangeLog    2008-02-19 
13:35:16 UTC (rev 96139)
@@ -1,5 +1,17 @@
 2008-02-19  Martin Baulig  <[EMAIL PROTECTED]>
 
+       * MonoSymbolFile.cs
+       (MonoSymbolFile.Version): New public readonly field.
+       (MonoSymbolFile.CompatibilityMode): Likewise; this is enabled if
+       we're reading an old `39' file.
+
+       * MonoSymbolTable.cs
+       (OffsetTable.CompatibilityVersion): New public const; we keep
+       backwards compatibility with this version.
+       (MethodEntry): Check `file.CompatiblityMode'.
+
+2008-02-19  Martin Baulig  <[EMAIL PROTECTED]>
+
        * MonoSymbolWriter.cs
        (MonoSymbolWriter.SetRealMethodName): New public method.
 

Modified: branches/martin/debugger-terrania/symbolwriter/MonoSymbolFile.cs
===================================================================
--- branches/martin/debugger-terrania/symbolwriter/MonoSymbolFile.cs    
2008-02-19 13:31:26 UTC (rev 96138)
+++ branches/martin/debugger-terrania/symbolwriter/MonoSymbolFile.cs    
2008-02-19 13:35:16 UTC (rev 96139)
@@ -139,6 +139,9 @@
                int last_source_index;
                int last_namespace_index;
 
+               public readonly int Version = OffsetTable.Version;
+               public readonly bool CompatibilityMode = false;
+
                public int NumLineNumbers;
 
                public MonoSymbolFile ()
@@ -318,15 +321,20 @@
                                        throw new MonoSymbolFileException (
                                                "Symbol file `{0}' is not a 
valid " +
                                                "Mono symbol file", filename);
-                               if (version != OffsetTable.Version)
+                               if ((version != OffsetTable.Version) &&
+                                   (version != 
OffsetTable.CompatibilityVersion))
                                        throw new MonoSymbolFileException (
                                                "Symbol file `{0}' has version 
{1}, " +
                                                "but expected {2}", filename, 
version,
                                                OffsetTable.Version);
 
+                               Version = (int) version;
+                               if (version == OffsetTable.CompatibilityVersion)
+                                       CompatibilityMode = true;
+
                                guid = new Guid (reader.ReadBytes (16));
 
-                               ot = new OffsetTable (reader);
+                               ot = new OffsetTable (reader, (int) version);
                        } catch {
                                throw new MonoSymbolFileException (
                                        "Cannot read symbol file `{0}'", 
filename);

Modified: branches/martin/debugger-terrania/symbolwriter/MonoSymbolTable.cs
===================================================================
--- branches/martin/debugger-terrania/symbolwriter/MonoSymbolTable.cs   
2008-02-19 13:31:26 UTC (rev 96138)
+++ branches/martin/debugger-terrania/symbolwriter/MonoSymbolTable.cs   
2008-02-19 13:35:16 UTC (rev 96139)
@@ -72,6 +72,7 @@
        public struct OffsetTable
        {
                public const int  Version = 40;
+               public const int  CompatibilityVersion = 39;
                public const long Magic   = 0x45e82623fd7fa614;
 
                #region This is actually written to the symbol file
@@ -90,7 +91,7 @@
                public int AnonymousScopeTableSize;
                #endregion
 
-               internal OffsetTable (BinaryReader reader)
+               internal OffsetTable (BinaryReader reader, int version)
                {
                        TotalFileSize = reader.ReadInt32 ();
                        DataSectionOffset = reader.ReadInt32 ();
@@ -102,9 +103,16 @@
                        MethodTableOffset = reader.ReadInt32 ();
                        MethodTableSize = reader.ReadInt32 ();
                        TypeCount = reader.ReadInt32 ();
-                       AnonymousScopeCount = reader.ReadInt32 ();
-                       AnonymousScopeTableOffset = reader.ReadInt32 ();
-                       AnonymousScopeTableSize = reader.ReadInt32 ();
+
+                       if (version == CompatibilityVersion) {
+                               AnonymousScopeCount = 0;
+                               AnonymousScopeTableOffset = 0;
+                               AnonymousScopeTableSize = 0;
+                       } else {
+                               AnonymousScopeCount = reader.ReadInt32 ();
+                               AnonymousScopeTableOffset = reader.ReadInt32 ();
+                               AnonymousScopeTableSize = reader.ReadInt32 ();
+                       }
                }
 
                internal void Write (BinaryWriter bw)
@@ -819,10 +827,6 @@
                        set { index = value; }
                }
 
-               public static int Size {
-                       get { return 52; }
-               }
-
                internal MethodEntry (MonoSymbolFile file, MyBinaryReader 
reader, int index)
                {
                        this.SymbolFile = file;
@@ -842,15 +846,17 @@
                        NamespaceID = reader.ReadInt32 ();
                        LocalNamesAmbiguous = reader.ReadInt32 () != 0;
 
-                       NumCodeBlocks = reader.ReadInt32 ();
-                       CodeBlockTableOffset = reader.ReadInt32 ();
+                       if (!file.CompatibilityMode) {
+                               NumCodeBlocks = reader.ReadInt32 ();
+                               CodeBlockTableOffset = reader.ReadInt32 ();
 
-                       NumScopeVariables = reader.ReadInt32 ();
-                       ScopeVariableTableOffset = reader.ReadInt32 ();
+                               NumScopeVariables = reader.ReadInt32 ();
+                               ScopeVariableTableOffset = reader.ReadInt32 ();
 
-                       RealNameOffset = reader.ReadInt32 ();
-                       if (RealNameOffset != 0)
-                               RealName = file.ReadString (RealNameOffset);
+                               RealNameOffset = reader.ReadInt32 ();
+                               if (RealNameOffset != 0)
+                                       RealName = file.ReadString 
(RealNameOffset);
+                       }
 
                        SourceFile = file.GetSourceFile (SourceFileIndex);
 

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to