diff --git a/MonoDevelop/Mono.Debugging/Mono.Debugging.Soft/SoftDebuggerSession.cs b/MonoDevelop/Mono.Debugging/Mono.Debugging.Soft/SoftDebuggerSession.cs index 7302fc9..8f70343 100644 --- a/MonoDevelop/Mono.Debugging/Mono.Debugging.Soft/SoftDebuggerSession.cs +++ b/MonoDevelop/Mono.Debugging/Mono.Debugging.Soft/SoftDebuggerSession.cs @@ -413,9 +413,11 @@ namespace Mono.Debugging.Soft return GetThreadBacktrace (GetThread (processId, threadId)); } - Backtrace GetThreadBacktrace (ThreadMirror thread) + public Backtrace GetThreadBacktrace (ThreadMirror thread) { - return new Backtrace (new SoftDebuggerBacktrace (this, thread)); + var bt = new Backtrace (new SoftDebuggerBacktrace (this, thread)); + bt.Attach (this); + return bt; } protected override ThreadInfo[] OnGetThreads (long processId) @@ -510,6 +512,7 @@ namespace Mono.Debugging.Soft bi.Req = vm.SetBreakpoint (bi.Location.Method, bi.Location.ILOffset); bi.Req.Enabled = bi.Enabled; breakpoints [bi.Req] = bi; + OnBreakpointBound (bp, (BreakpointEventRequest) bi.Req); } void InsertCatchpoint (Catchpoint cp, BreakInfo bi, TypeMirror excType) @@ -519,6 +522,10 @@ namespace Mono.Debugging.Soft bi.Req.Enabled = bi.Enabled; } + protected virtual void OnBreakpointBound (Breakpoint bp, BreakpointEventRequest request) + { + } + Location FindLocation (string file, int line) { if (!started) @@ -573,10 +580,13 @@ namespace Mono.Debugging.Soft while (true) { try { Event e = vm.GetNextEvent (); - if (e is VMDeathEvent || e is VMDisconnectEvent) + if (e is VMDeathEvent || e is VMDisconnectEvent) { + OnVMDeathEvent (); break; + } HandleEvent (e); } catch (VMDisconnectedException ex) { + OnVMDeathEvent (); OnDebuggerOutput (true, ex.ToString ()); break; } catch (Exception ex) { @@ -613,6 +623,8 @@ namespace Mono.Debugging.Soft Console.WriteLine ("pp event: " + e); #endif + OnHandleEvent (e); + if (e is AssemblyLoadEvent) { AssemblyLoadEvent ae = (AssemblyLoadEvent)e; bool isExternal = !UpdateAssemblyFilters (ae.Assembly) && userAssemblyNames != null; @@ -625,6 +637,7 @@ namespace Mono.Debugging.Soft var t = vm.RootDomain.Corlib.GetType ("System.Exception", false, false); if (t != null) ResolveBreakpoints (t); + OnVMStartEvent ((VMStartEvent) e); } if (e is TypeLoadEvent) { @@ -686,6 +699,15 @@ namespace Mono.Debugging.Soft } } + protected virtual void OnHandleEvent (Event e) + { } + + protected virtual void OnVMStartEvent (VMStartEvent e) + { } + + protected virtual void OnVMDeathEvent () + { } + public ObjectMirror GetExceptionObject (ThreadMirror thread) { ObjectMirror obj; @@ -804,6 +826,7 @@ namespace Mono.Debugging.Soft return OnCustomBreakpointAction (bp.CustomActionId, binfo); case HitAction.PrintExpression: { string exp = EvaluateTrace (thread, bp.TraceExpression); + OnDebuggerOutput (false, exp + "\n"); UpdateLastTraceValue (binfo, exp); return true; }