Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
**** Backport of 131823, 131838 and 131839 ****
Browse files Browse the repository at this point in the history
2009-04-16  Martin Baulig  <martin@ximian.com>

	**** Backport of 131838 ****

	Add support for 'source ranges' - instead of only using line
	numbers, we now use a struct containing 'StartLine', 'EndLine',
	'StartColumn' and 'EndColumn'.

	* classes/Method.cs
	(LineEntry.SourceRange): New public field.

	* classes/SourceAddress.cs
	(SourceAddress.HasSourceRange): New public property.
	(SourceAddress.SourceRange): New public property.
	(SourceRange): New public struct.

2009-04-15  Martin Baulig  <martin@ximian.com>

	**** Backport of 131823 ****

	* classes/SourceAddress.cs
	(SourceAddress): Rename `SourceOffset' -> `LineOffset' and
	`SourceRange' -> `LineRange'.

2009-04-16  Martin Baulig  <martin@ximian.com>

	**** Backport of 131838 and 131839 ****

	* MonoSymbolTable.cs
	(SourceRangeEntry): New public class.
	(LineNumberEntry.SourceRange): New public field.
	(LineNumberTable): Add support for source ranges.
	(LineNumberTable.DW_LNE_MONO_set_source_range): New private
	extended opcode to encode source ranges.

	* MonoSymbolWriter.cs
	(MonoSymbolWriter.MarkSequencePoint): Add overloaded version
	supporting source ranges.

svn path=/branches/mono-2-4/debugger/; revision=133137
  • Loading branch information
Martin Baulig committed Apr 30, 2009
1 parent c812163 commit 1d12899
Show file tree
Hide file tree
Showing 12 changed files with 276 additions and 39 deletions.
24 changes: 24 additions & 0 deletions ChangeLog
@@ -1,3 +1,27 @@
2009-04-16 Martin Baulig <martin@ximian.com>

**** Backport of 131838 ****

Add support for 'source ranges' - instead of only using line
numbers, we now use a struct containing 'StartLine', 'EndLine',
'StartColumn' and 'EndColumn'.

* classes/Method.cs
(LineEntry.SourceRange): New public field.

* classes/SourceAddress.cs
(SourceAddress.HasSourceRange): New public property.
(SourceAddress.SourceRange): New public property.
(SourceRange): New public struct.

2009-04-15 Martin Baulig <martin@ximian.com>

**** Backport of 131823 ****

* classes/SourceAddress.cs
(SourceAddress): Rename `SourceOffset' -> `LineOffset' and
`SourceRange' -> `LineRange'.

2009-04-14 Martin Baulig <martin@ximian.com>

**** Backport of 130661, 130759, 131797 and 131798 ****
Expand Down
8 changes: 4 additions & 4 deletions backend/SingleSteppingEngine.cs
Expand Up @@ -1222,13 +1222,13 @@ Operation frame_changed (TargetAddress address, Operation operation)
if (source == null)
return null;

if ((source.SourceOffset > 0) && (source.SourceRange > 0)) {
if ((source.LineOffset > 0) && (source.LineRange > 0)) {
// We stopped between two source lines. This normally
// happens when returning from a method call; in this
// case, we need to continue stepping until we reach the
// next source line.
return new OperationStep (this, new StepFrame (
address - source.SourceOffset, address + source.SourceRange,
address - source.LineOffset, address + source.LineRange,
null, language, StepMode.SourceLine), operation.Result);
}

Expand Down Expand Up @@ -1436,8 +1436,8 @@ StepFrame CreateStepFrame ()
// SourceOffset; the next source line will start at the current
// address plus SourceRange.

int offset = frame.SourceAddress.SourceOffset;
int range = frame.SourceAddress.SourceRange;
int offset = frame.SourceAddress.LineOffset;
int range = frame.SourceAddress.LineRange;

TargetAddress start = frame.TargetAddress - offset;
TargetAddress end = frame.TargetAddress + range;
Expand Down
8 changes: 4 additions & 4 deletions backend/arch/DwarfReader.cs
Expand Up @@ -2629,11 +2629,11 @@ void read_line_numbers ()
start_row = start.Row;
end_row = end.Row;

debug ("DTM - READ LNT: {0} {1} - {2} {3}", start.SourceOffset,
start.SourceRange, end.SourceOffset, end.SourceRange);
debug ("DTM - READ LNT: {0} {1} - {2} {3}", start.LineOffset,
start.LineRange, end.LineOffset, end.LineRange);

SetMethodBounds (StartAddress + start.SourceRange,
EndAddress - end.SourceOffset);
SetMethodBounds (StartAddress + start.LineRange,
EndAddress - end.LineOffset);

source = subprog.dwarf.GetMethodSource (subprog, start_row, end_row);

Expand Down
2 changes: 1 addition & 1 deletion build/Makefile.am
Expand Up @@ -4,7 +4,7 @@ bin_SCRIPTS = mdb mdb-symbolreader

two_SCRIPTS = mdb.exe mdb-symbolreader.exe

MCS_FLAGS = -debug -define:DEBUG -nowarn:0169,0067
MCS_FLAGS = -debug -define:DEBUG -define:DEBUGGER_SOURCE -nowarn:0169,0067

if MARTIN_PRIVATE
# Enable some more stuff for me.
Expand Down
7 changes: 7 additions & 0 deletions classes/Method.cs
Expand Up @@ -45,17 +45,24 @@ public struct LineEntry : IComparable {
public readonly int File;
public readonly int Line;
public readonly bool IsHidden;
public readonly SourceRange? SourceRange;

public LineEntry (TargetAddress address, int file, int line)
: this (address, file, line, false)
{ }

public LineEntry (TargetAddress address, int file, int line, bool is_hidden)
: this (address, file, line, is_hidden, null)
{ }

public LineEntry (TargetAddress address, int file, int line, bool is_hidden,
SourceRange? source_range)
{
this.Address = address;;
this.File = file;
this.Line = line;
this.IsHidden = is_hidden;
this.SourceRange = source_range;
}

public int CompareTo (object obj)
Expand Down
63 changes: 50 additions & 13 deletions classes/SourceAddress.cs
Expand Up @@ -19,18 +19,26 @@ public class SourceAddress : DebuggerMarshalByRefObject
{
SourceFile file;
SourceBuffer buffer;
SourceRange? source_range;
int row;
int source_offset;
int source_range;
int line_offset;
int line_range;

public SourceAddress (SourceFile file, SourceBuffer buffer, int row,
int offset, int range)
int line_offset, int line_range)
{
this.file = file;
this.buffer = buffer;
this.row = row;
this.source_offset = offset;
this.source_range = range;
this.line_offset = line_offset;
this.line_range = line_range;
}

public SourceAddress (SourceFile file, SourceBuffer buffer, int row,
int line_offset, int line_range, SourceRange? source_range)
: this (file, buffer, row, line_offset, line_range)
{
this.source_range = source_range;
}

public SourceFile SourceFile {
Expand All @@ -56,15 +64,27 @@ public class SourceAddress : DebuggerMarshalByRefObject
}
}

public int SourceRange {
public bool HasSourceRange {
get {
return source_range != null;
}
}

public SourceRange SourceRange {
get {
return source_range.Value;
}
}

public int LineRange {
get {
return source_range;
return line_range;
}
}

public int SourceOffset {
public int LineOffset {
get {
return source_offset;
return line_offset;
}
}

Expand All @@ -86,20 +106,37 @@ public override string ToString ()
builder.Append (" line ");
builder.Append (Row);
}
if (SourceOffset > 0) {
if (LineOffset > 0) {
builder.Append (" (");
builder.Append ("offset ");
builder.Append (SourceOffset);
builder.Append (LineOffset);
builder.Append (")");
}
if (SourceRange > 0) {
if (LineRange > 0) {
builder.Append (" (");
builder.Append ("range ");
builder.Append (SourceRange);
builder.Append (LineRange);
builder.Append (")");
}

return builder.ToString ();
}
}

[Serializable]
public struct SourceRange
{
public readonly int StartLine;
public readonly int EndLine;
public readonly int StartColumn;
public readonly int EndColumn;

public SourceRange (int start_line, int end_line, int start_col, int end_col)
{
this.StartLine = start_line;
this.EndLine = end_line;
this.StartColumn = start_col;
this.EndColumn = end_col;
}
}
}
8 changes: 4 additions & 4 deletions frontend/Command.cs
Expand Up @@ -1021,8 +1021,8 @@ protected override object DoExecute (ScriptingContext context)
start = method.StartAddress; end = method.EndAddress;
} else {
SourceAddress source = CurrentFrame.SourceAddress;
start = CurrentFrame.TargetAddress - source.SourceOffset;
end = CurrentFrame.TargetAddress + source.SourceRange;
start = CurrentFrame.TargetAddress - source.LineOffset;
end = CurrentFrame.TargetAddress + source.LineRange;
}

foreach (AssemblerLine insn in asm.Lines) {
Expand Down Expand Up @@ -2290,8 +2290,8 @@ protected override object DoExecute (ScriptingContext context)
TargetAddress address = CurrentFrame.TargetAddress;

context.Print ("Source: {0}", source);
context.Print ("{0} - {1}", address - source.SourceOffset,
address + source.SourceRange);
context.Print ("{0} - {1}", address - source.LineOffset,
address + source.LineRange);
}
return null;
}
Expand Down
13 changes: 10 additions & 3 deletions languages/mono/MonoSymbolFile.cs
Expand Up @@ -1640,7 +1640,7 @@ public override SourceAddress Lookup (TargetAddress address)
(int) (Addresses [0].Address - address));
}

SourceAddress create_address (LineEntry entry, int offset, int range)
SourceAddress create_address (LineEntry entry, int line_offset, int line_range)
{
SourceFile file = null;
SourceBuffer buffer = null;
Expand All @@ -1654,7 +1654,7 @@ SourceAddress create_address (LineEntry entry, int offset, int range)
buffer = Method.MethodSource.SourceBuffer;
}

return new SourceAddress (file, buffer, entry.Line, offset, range);
return new SourceAddress (file, buffer, entry.Line, line_offset, line_range, entry.SourceRange);
}

public override void DumpLineNumbers ()
Expand Down Expand Up @@ -1728,7 +1728,14 @@ protected class MonoMethodLineNumberTable : MonoLineNumberTable
int file = lne.File != entry.CompileUnit.SourceFile.Index ? lne.File : 0;
bool hidden = lne.IsHidden;

lines.Add (new LineEntry (address, file, lne.Row, hidden));
SourceRange? range = null;
if (lne.SourceRange != null)
range = new SourceRange (lne.SourceRange.StartLine, lne.SourceRange.EndLine,
lne.SourceRange.StartColumn, lne.SourceRange.EndColumn);

Console.WriteLine ("GENERATE LINE: {0} {1} {2}", lne, lne.Row, lne.SourceRange != null);

lines.Add (new LineEntry (address, file, lne.Row, hidden, range));
last_line = lne.Row;
}

Expand Down
15 changes: 15 additions & 0 deletions symbolwriter/ChangeLog
@@ -1,3 +1,18 @@
2009-04-16 Martin Baulig <martin@ximian.com>

**** Backport of 131838 and 131839 ****

* MonoSymbolTable.cs
(SourceRangeEntry): New public class.
(LineNumberEntry.SourceRange): New public field.
(LineNumberTable): Add support for source ranges.
(LineNumberTable.DW_LNE_MONO_set_source_range): New private
extended opcode to encode source ranges.

* MonoSymbolWriter.cs
(MonoSymbolWriter.MarkSequencePoint): Add overloaded version
supporting source ranges.

2009-03-31 Martin Baulig <martin@ximian.com>

* MdbSymbolReader.cs
Expand Down
11 changes: 9 additions & 2 deletions symbolwriter/MdbSymbolReader.cs
Expand Up @@ -225,8 +225,15 @@ public void PrintLineNumberTables ()
seen_files.Add (line.File, true);
}

Message (" Line {0}:{1}:{2}{3}", line.File, line.Row, line.Offset,
line.IsHidden ? " (hidden)" : "");
string range = "";
if (line.SourceRange != null) {
SourceRangeEntry sre = (SourceRangeEntry) line.SourceRange;
range = String.Format (" - {0} {1} {2} {3}", sre.StartLine, sre.EndLine,
sre.StartColumn, sre.EndColumn);
}

Message (" Line {0}:{1}:{2:x}{3}{4}", line.File, line.Row, line.Offset,
line.IsHidden ? " (hidden)" : "", range);
}
}
}
Expand Down

0 comments on commit 1d12899

Please sign in to comment.