Browse Source

Step out implemented using step over (Forum-7690);

More logging information for steppers; 
Function expiration check disabled

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1402 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
eb9675e621
  1. 6
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs
  2. 5
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  3. 24
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs
  4. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

6
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs

@ -95,10 +95,10 @@ namespace Debugger
Thread thread = debugger.GetThread(pThread); Thread thread = debugger.GetThread(pThread);
Stepper stepper = thread.GetStepper(pStepper); Stepper stepper = thread.GetStepper(pStepper);
debugger.TraceMessage(" - stepper info: " + stepper.Operation + " in " + stepper.Function.Name + " pause = " + stepper.PauseWhenComplete); debugger.TraceMessage(" - stepper info: " + stepper.ToString());
// There is a race condition: The tracking step out can be triggered after stepping step over // There is a race condition: The tracking step out can be triggered after stepping step over
thread.CheckExpirationOfFunctions(); //thread.CheckExpirationOfFunctions();
thread.Steppers.Remove(stepper); thread.Steppers.Remove(stepper);
stepper.OnStepComplete(); stepper.OnStepComplete();
@ -415,7 +415,7 @@ namespace Debugger
public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType exceptionType, uint dwFlags) public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType exceptionType, uint dwFlags)
{ {
EnterCallback(PausedReason.Exception, "Exception2", pThread); EnterCallback(PausedReason.Exception, "Exception2 (type=" + exceptionType.ToString() + ")", pThread);
// This callback is also called from Exception(...)!!!! (the .NET 1.1 version) // This callback is also called from Exception(...)!!!! (the .NET 1.1 version)
// Whatch out for the zeros and null! // Whatch out for the zeros and null!

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

@ -133,7 +133,7 @@ namespace Debugger
methodProps = module.MetaData.GetMethodProps(corFunction.Token); methodProps = module.MetaData.GetMethodProps(corFunction.Token);
// Expiry the function when it is finished // Expiry the function when it is finished
stepOutStepper = new Stepper(this); stepOutStepper = new Stepper(this, "Function Tracker");
stepOutStepper.StepOut(); stepOutStepper.StepOut();
stepOutStepper.PauseWhenComplete = false; stepOutStepper.PauseWhenComplete = false;
stepOutStepper.StepComplete += delegate { stepOutStepper.StepComplete += delegate {
@ -198,7 +198,8 @@ namespace Debugger
public void StepOut() public void StepOut()
{ {
stepOutStepper.PauseWhenComplete = true; Stepper stepper = new Stepper(this);
stepper.StepOut();
debugger.Continue(); debugger.Continue();
} }

24
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Stepper.cs

@ -16,6 +16,7 @@ namespace Debugger
public enum StepperOperation {Idle, StepIn, StepOver, StepOut}; public enum StepperOperation {Idle, StepIn, StepOver, StepOut};
Function function; Function function;
string name;
ICorDebugStepper corStepper; ICorDebugStepper corStepper;
StepperOperation operation = StepperOperation.Idle; StepperOperation operation = StepperOperation.Idle;
bool pauseWhenComplete = true; bool pauseWhenComplete = true;
@ -34,6 +35,12 @@ namespace Debugger
} }
} }
public string Name {
get {
return name;
}
}
public StepperOperation Operation { public StepperOperation Operation {
get { get {
return operation; return operation;
@ -49,6 +56,11 @@ namespace Debugger
} }
} }
public Stepper(Function function, string name): this(function)
{
this.name = name;
}
public Stepper(Function function) public Stepper(Function function)
{ {
this.function = function; this.function = function;
@ -75,10 +87,15 @@ namespace Debugger
return this.corStepper == corStepper; return this.corStepper == corStepper;
} }
// NOTE: corStepper.StepOut(); finishes when pevious frame is activated, not when function is exited
// this is important for events with multiple handlers
// NOTE: StepRange callbacks go first (probably in order),
// StepOut callback are called after that
public void StepOut() public void StepOut()
{ {
operation = StepperOperation.StepOut; operation = StepperOperation.StepOut;
corStepper.StepOut(); // corStepper.StepOut(); Don't! see note
corStepper.StepRange(false, new int[] {0, int.MaxValue});
} }
public void StepIn(int[] ranges) public void StepIn(int[] ranges)
@ -92,5 +109,10 @@ namespace Debugger
operation = StepperOperation.StepOver; operation = StepperOperation.StepOver;
corStepper.StepRange(false /* step over */, ranges); corStepper.StepRange(false /* step over */, ranges);
} }
public override string ToString()
{
return string.Format("{0} in {1} pause={2} {3}", Operation, Function.Name, PauseWhenComplete, name);
}
} }
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -251,6 +251,8 @@ namespace Debugger
// NOTE: During evlulation some chains may be temporaly removed // NOTE: During evlulation some chains may be temporaly removed
// NOTE: When two events are invoked, step outs ocurr at once when all is done // NOTE: When two events are invoked, step outs ocurr at once when all is done
// NOTE: Step out works properly for exceptions
// NOTE: Step over works properly for exceptions
internal void CheckExpirationOfFunctions() internal void CheckExpirationOfFunctions()
{ {
if (debugger.Evaluating) return; if (debugger.Evaluating) return;

Loading…
Cancel
Save