|
|
|
@ -185,13 +185,22 @@ namespace DebuggerLibrary
@@ -185,13 +185,22 @@ namespace DebuggerLibrary
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the information about the next statement to be executed.
|
|
|
|
|
///
|
|
|
|
|
/// Throws NextStatementNotAviableException on error.
|
|
|
|
|
/// Returns null on error.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public SourcecodeSegment NextStatement { |
|
|
|
|
get { |
|
|
|
|
return GetSegmentForOffet(corInstructionPtr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns null on error.
|
|
|
|
|
///
|
|
|
|
|
/// 'ILStart <= ILOffset <= ILEnd' and this range includes at least
|
|
|
|
|
/// the returned area of source code. (May incude some extra compiler generated IL too)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public SourcecodeSegment NextStatement { |
|
|
|
|
get { |
|
|
|
|
SourcecodeSegment GetSegmentForOffet(uint offset) |
|
|
|
|
{ |
|
|
|
|
ISymbolMethod symMethod; |
|
|
|
|
|
|
|
|
|
symMethod = this.symMethod; |
|
|
|
@ -218,12 +227,11 @@ namespace DebuggerLibrary
@@ -218,12 +227,11 @@ namespace DebuggerLibrary
|
|
|
|
|
endColumn |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
uint corInstructionPtr = this.corInstructionPtr; // cache
|
|
|
|
|
SourcecodeSegment retVal = new SourcecodeSegment(); |
|
|
|
|
|
|
|
|
|
// Get i for which: offsets[i] <= corInstructionPtr < offsets[i + 1]
|
|
|
|
|
for (int i = sequencePointCount - 1; i >= 0; i--) // backwards
|
|
|
|
|
if (offsets[i] <= corInstructionPtr) |
|
|
|
|
if (offsets[i] <= offset) |
|
|
|
|
{ |
|
|
|
|
// Set inforamtion about current IL range
|
|
|
|
|
ICorDebugCode code; |
|
|
|
@ -231,7 +239,7 @@ namespace DebuggerLibrary
@@ -231,7 +239,7 @@ namespace DebuggerLibrary
|
|
|
|
|
uint codeSize; |
|
|
|
|
code.GetSize(out codeSize); |
|
|
|
|
|
|
|
|
|
retVal.ILOffset = (int)corInstructionPtr; |
|
|
|
|
retVal.ILOffset = (int)offset; |
|
|
|
|
retVal.ILStart = offsets[i]; |
|
|
|
|
retVal.ILEnd = (i + 1 < sequencePointCount) ? offsets[i + 1] : (int)codeSize; |
|
|
|
|
|
|
|
|
@ -290,6 +298,46 @@ namespace DebuggerLibrary
@@ -290,6 +298,46 @@ namespace DebuggerLibrary
|
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public SourcecodeSegment CanSetIP(string filename, int line, int column) |
|
|
|
|
{ |
|
|
|
|
return SetIP(true, filename, line, column); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public SourcecodeSegment SetIP(string filename, int line, int column) |
|
|
|
|
{ |
|
|
|
|
return SetIP(false, filename, line, column); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SourcecodeSegment SetIP(bool simulate, string filename, int line, int column) |
|
|
|
|
{ |
|
|
|
|
SourcecodeSegment suggestion = new SourcecodeSegment(filename, line, column, column); |
|
|
|
|
ICorDebugFunction corFunction; |
|
|
|
|
int ilOffset; |
|
|
|
|
if (!suggestion.GetFunctionAndOffset(debugger, false, out corFunction, out ilOffset)) { |
|
|
|
|
return null; |
|
|
|
|
} else { |
|
|
|
|
uint token; |
|
|
|
|
corFunction.GetToken(out token); |
|
|
|
|
if (token != methodProps.Token) { |
|
|
|
|
return null; |
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
if (simulate) { |
|
|
|
|
corILFrame.CanSetIP((uint)ilOffset); |
|
|
|
|
} else { |
|
|
|
|
corILFrame.SetIP((uint)ilOffset); |
|
|
|
|
Thread thread = debugger.CurrentThread; |
|
|
|
|
debugger.OnDebuggingResumed(); |
|
|
|
|
thread.CurrentFunction = thread.LastFunctionWithLoadedSymbols; |
|
|
|
|
debugger.OnDebuggingPaused(PausedReason.SetIP); |
|
|
|
|
} |
|
|
|
|
} catch { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
return GetSegmentForOffet((uint)ilOffset); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public VariableCollection GetVariables() |
|
|
|
|