Browse Source

Function.GetSegmentForOffet is a bit more forgiving

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@674 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
5475eeea0d
  1. 40
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

40
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -47,7 +47,7 @@ namespace DebuggerLibrary @@ -47,7 +47,7 @@ namespace DebuggerLibrary
public bool HasSymbols {
get {
return symMethod != null;
return GetSegmentForOffet(0) != null;
}
}
@ -218,13 +218,13 @@ namespace DebuggerLibrary @@ -218,13 +218,13 @@ namespace DebuggerLibrary
SourcecodeSegment GetSegmentForOffet(uint offset)
{
ISymbolMethod symMethod;
symMethod = this.symMethod;
symMethod = this.symMethod;
if (symMethod == null) {
return null;
}
int sequencePointCount = symMethod.SequencePointCount;
int sequencePointCount = symMethod.SequencePointCount;
int[] offsets = new int[sequencePointCount];
int[] startLine = new int[sequencePointCount];
@ -242,27 +242,27 @@ namespace DebuggerLibrary @@ -242,27 +242,27 @@ namespace DebuggerLibrary
endLine,
endColumn
);
SourcecodeSegment retVal = new SourcecodeSegment();
// Get i for which: offsets[i] <= corInstructionPtr < offsets[i + 1]
// Get i for which: offsets[i] <= offset < offsets[i + 1]
// or fallback to first element if offset < offsets[0]
for (int i = sequencePointCount - 1; i >= 0; i--) // backwards
if (offsets[i] <= offset)
{
if (offsets[i] <= offset || i == 0) {
// Set inforamtion about current IL range
ICorDebugCode code;
corFunction.GetILCode(out code);
uint codeSize;
code.GetSize(out codeSize);
retVal.ILOffset = (int)offset;
retVal.ILStart = offsets[i];
retVal.ILEnd = (i + 1 < sequencePointCount) ? offsets[i + 1] : (int)codeSize;
// 0xFeeFee means "code generated by compiler"
// If we are in generated sequence use to closest real one instead,
// extend the ILStart and ILEnd to include the 'real' sequence
// Look ahead for 'real' sequence
while (i + 1 < sequencePointCount && startLine[i] == 0xFeeFee) {
i++;
@ -277,17 +277,17 @@ namespace DebuggerLibrary @@ -277,17 +277,17 @@ namespace DebuggerLibrary
if (startLine[i] == 0xFeeFee) {
return null;
}
retVal.ModuleFilename = module.FullPath;
retVal.SourceFullFilename = Doc[i].URL;
retVal.StartLine = startLine[i];
retVal.StartColumn = startColumn[i];
retVal.EndLine = endLine[i];
retVal.EndColumn = endColumn[i];
List<int> stepRanges = new List<int>();
for (int j = 0; j < sequencePointCount; j++) {
// Step over compiler generated sequences and current statement
@ -307,9 +307,9 @@ namespace DebuggerLibrary @@ -307,9 +307,9 @@ namespace DebuggerLibrary
}
}
}
retVal.StepRanges = stepRanges.ToArray();
return retVal;
}
return null;

Loading…
Cancel
Save