Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2002-10-13 20:47:04 +0400
committerMartin Baulig <martin@novell.com>2002-10-13 20:47:04 +0400
commit5751f8c72a3b7a2a83e9faaef985cf814150ab78 (patch)
tree09fb67bdf4707233e3346253181803d56d481d5f /mcs
parentac5a52054d80c528ecc09dd99a1fe2239f0490a2 (diff)
2002-10-13 Martin Baulig <martin@gnome.org>
* MonoSymbolTable.cs: Set version number to 27. Added a source file table which is used to search a method by source file + line number. svn path=/trunk/mcs/; revision=8217
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/Mono.CSharp.Debugger/ChangeLog5
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs112
-rw-r--r--mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs25
3 files changed, 139 insertions, 3 deletions
diff --git a/mcs/class/Mono.CSharp.Debugger/ChangeLog b/mcs/class/Mono.CSharp.Debugger/ChangeLog
index fc8a5bd51c0..143ecdd651a 100644
--- a/mcs/class/Mono.CSharp.Debugger/ChangeLog
+++ b/mcs/class/Mono.CSharp.Debugger/ChangeLog
@@ -1,3 +1,8 @@
+2002-10-13 Martin Baulig <martin@gnome.org>
+
+ * MonoSymbolTable.cs: Set version number to 27. Added a source
+ file table which is used to search a method by source file + line number.
+
2002-09-21 Martin Baulig <martin@gnome.org>
* MonoSymbolTable.cs: Set version number to 26. Removed all the dynamic
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
index aaa0bc3d4c3..ab6af05af19 100644
--- a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTable.cs
@@ -18,7 +18,7 @@ namespace Mono.CSharp.Debugger
{
public struct OffsetTable
{
- public const int Version = 26;
+ public const int Version = 27;
public const long Magic = 0x45e82623fd7fa614;
public int total_file_size;
@@ -31,6 +31,9 @@ namespace Mono.CSharp.Debugger
public int line_number_table_size;
public int local_variable_table_offset;
public int local_variable_table_size;
+ public int source_file_table_offset;
+ public int source_file_table_size;
+ public int source_file_count;
public int type_count;
public int type_index_table_offset;
public int type_index_table_size;
@@ -47,6 +50,9 @@ namespace Mono.CSharp.Debugger
line_number_table_size = reader.ReadInt32 ();
local_variable_table_offset = reader.ReadInt32 ();
local_variable_table_size = reader.ReadInt32 ();
+ source_file_table_offset = reader.ReadInt32 ();
+ source_file_table_size = reader.ReadInt32 ();
+ source_file_count = reader.ReadInt32 ();
type_count = reader.ReadInt32 ();
type_index_table_offset = reader.ReadInt32 ();
type_index_table_size = reader.ReadInt32 ();
@@ -64,6 +70,9 @@ namespace Mono.CSharp.Debugger
bw.Write (line_number_table_size);
bw.Write (local_variable_table_offset);
bw.Write (local_variable_table_size);
+ bw.Write (source_file_table_offset);
+ bw.Write (source_file_table_size);
+ bw.Write (source_file_count);
bw.Write (type_count);
bw.Write (type_index_table_offset);
bw.Write (type_index_table_size);
@@ -142,6 +151,107 @@ namespace Mono.CSharp.Debugger
}
}
+ public class SourceFileEntry
+ {
+ public readonly string SourceFile;
+ public readonly MethodSourceEntry[] Methods = null;
+
+ ArrayList methods;
+ int count;
+
+ internal SourceFileEntry (string source_file)
+ {
+ this.SourceFile = source_file;
+ this.methods = new ArrayList ();
+ this.count = 0;
+ }
+
+ internal void AddMethod (MethodSourceEntry method)
+ {
+ methods.Add (method);
+ count++;
+ }
+
+ internal void Write (BinaryWriter bw)
+ {
+ byte[] name = Encoding.UTF8.GetBytes (SourceFile);
+ bw.Write ((int) name.Length);
+ bw.Write (name);
+
+ methods.Sort ();
+ bw.Write (methods.Count);
+ foreach (MethodSourceEntry method in methods)
+ method.Write (bw);
+ }
+
+ public SourceFileEntry (IMonoBinaryReader reader)
+ {
+ int name_length = reader.ReadInt32 ();
+ byte[] name = reader.ReadBuffer (name_length);
+ SourceFile = Encoding.UTF8.GetString (name);
+
+ count = reader.ReadInt32 ();
+ Methods = new MethodSourceEntry [count];
+ for (int i = 0; i < count; i++)
+ Methods [i] = new MethodSourceEntry (reader);
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("SourceFileEntry ({0}:{1})", SourceFile, count);
+ }
+ }
+
+ public class MethodSourceEntry : IComparable
+ {
+ public readonly int Index;
+ public readonly int FileOffset;
+ public readonly int StartRow;
+ public readonly int EndRow;
+
+ public MethodSourceEntry (int index, int file_offset, int start, int end)
+ {
+ this.Index = index;
+ this.FileOffset = file_offset;
+ this.StartRow = start;
+ this.EndRow = end;
+ }
+
+ public MethodSourceEntry (IMonoBinaryReader reader)
+ {
+ Index = reader.ReadInt32 ();
+ FileOffset = reader.ReadInt32 ();
+ StartRow = reader.ReadInt32 ();
+ EndRow = reader.ReadInt32 ();
+ }
+
+ internal void Write (BinaryWriter bw)
+ {
+ bw.Write (Index);
+ bw.Write (FileOffset);
+ bw.Write (StartRow);
+ bw.Write (EndRow);
+ }
+
+ public int CompareTo (object obj)
+ {
+ MethodSourceEntry method = (MethodSourceEntry) obj;
+
+ if (method.StartRow < StartRow)
+ return -1;
+ else if (method.StartRow > StartRow)
+ return 1;
+ else
+ return 0;
+ }
+
+ public override string ToString ()
+ {
+ return String.Format ("MethodSourceEntry ({0}:{1}:{2}:{3})",
+ Index, FileOffset, StartRow, EndRow);
+ }
+ }
+
public class MethodEntry
{
public readonly int Token;
diff --git a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs
index 3a7c3cf4036..4e8e1595b9d 100644
--- a/mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs
+++ b/mcs/class/Mono.CSharp.Debugger/MonoSymbolTableWriter.cs
@@ -71,6 +71,8 @@ namespace Mono.CSharp.Debugger
}
ot.source_table_size = (int) bw.BaseStream.Position - ot.source_table_offset;
+ Hashtable source_table = new Hashtable ();
+
//
// Write line number table
//
@@ -162,15 +164,34 @@ namespace Mono.CSharp.Debugger
//
ot.method_count = methods.Count;
ot.method_table_offset = (int) bw.BaseStream.Position;
- foreach (MethodEntry entry in methods)
+ for (int i = 0; i < methods.Count; i++) {
+ MethodEntry entry = (MethodEntry) methods [i];
+ SourceFileEntry source = (SourceFileEntry) source_table [entry.SourceFileOffset];
+ if (source == null) {
+ source = new SourceFileEntry (entry.SourceFile);
+ source_table.Add (entry.SourceFileOffset, source);
+ }
+
+ source.AddMethod (new MethodSourceEntry (
+ i, (int) bw.BaseStream.Position, entry.StartRow, entry.EndRow));
+
entry.Write (bw);
+ }
ot.method_table_size = (int) bw.BaseStream.Position - ot.method_table_offset;
- ot.type_count = last_type_index;
+ //
+ // Write source file table.
+ //
+ ot.source_file_count = source_table.Count;
+ ot.source_file_table_offset = (int) bw.BaseStream.Position;
+ foreach (SourceFileEntry source in source_table.Values)
+ source.Write (bw);
+ ot.source_file_table_size = (int) bw.BaseStream.Position - ot.source_file_table_offset;
//
// Write offset table
//
+ ot.type_count = last_type_index;
ot.total_file_size = (int) bw.BaseStream.Position;
bw.Seek ((int) offset_table_offset, SeekOrigin.Begin);
ot.Write (bw);