Permalink
Browse files

Support removing breakpoints while the target is running.

2009-08-05  Martin Baulig  <martin@ximian.com>

	Support removing breakpoints while the target is running.

	* backend/ProcessServant.cs
	(ProcessServant.ExceptionCatchPoints): Removed; the session now
	maintains exception catchpoints.

	* backend/SingleSteppingEngine.cs
	(SSE.ActivatePendingBreakpoints): We now also handle removals.
	(SSE.OperationRemoveBreakpoint): New operation to remove a managed
	breakpoint.

	* classes/Breakpoint.cs
	(Breakpoint.NeedsActivation): New public property; event handlers
	don't need any activation.

	* classes/DebuggerSession.cs
	(DebuggerSession.InsertExceptionCatchPoint): Exception catchpoints
	don't need to be activated.
	(DebuggerSession.ExceptionCatchPoints): The session now maintains
	all exception catchpoints; moved here from `ProcessServant'.
	(DebuggerSession.RemoveBreakpoint): Immediately remove the
	breakpoint from our list, but don't actually delete it - the
	target doesn't need to be stopped to call this method, the method
	is queued for removal during Process.ActivatePendingBreakpoints().

	* classes/Process.cs
	(Process.ActivatePendingBreakpoints): Don't block, return a
	`CommandResult' you can wait on.

svn path=/trunk/debugger/; revision=139425
  • Loading branch information...
1 parent c306977 commit 22c3d982249c6f529e5c31b0c470079a752916ae Martin Baulig committed Aug 5, 2009
View
@@ -1,5 +1,36 @@
2009-08-05 Martin Baulig <martin@ximian.com>
+ Support removing breakpoints while the target is running.
+
+ * backend/ProcessServant.cs
+ (ProcessServant.ExceptionCatchPoints): Removed; the session now
+ maintains exception catchpoints.
+
+ * backend/SingleSteppingEngine.cs
+ (SSE.ActivatePendingBreakpoints): We now also handle removals.
+ (SSE.OperationRemoveBreakpoint): New operation to remove a managed
+ breakpoint.
+
+ * classes/Breakpoint.cs
+ (Breakpoint.NeedsActivation): New public property; event handlers
+ don't need any activation.
+
+ * classes/DebuggerSession.cs
+ (DebuggerSession.InsertExceptionCatchPoint): Exception catchpoints
+ don't need to be activated.
+ (DebuggerSession.ExceptionCatchPoints): The session now maintains
+ all exception catchpoints; moved here from `ProcessServant'.
+ (DebuggerSession.RemoveBreakpoint): Immediately remove the
+ breakpoint from our list, but don't actually delete it - the
+ target doesn't need to be stopped to call this method, the method
+ is queued for removal during Process.ActivatePendingBreakpoints().
+
+ * classes/Process.cs
+ (Process.ActivatePendingBreakpoints): Don't block, return a
+ `CommandResult' you can wait on.
+
+2009-08-05 Martin Baulig <martin@ximian.com>
+
* backend/server/x86_64-arch.c
(find_code_buffer_slot): Return a different slot each time we're
called until we iterated over the entire buffer; it looks like
@@ -1,10 +1,25 @@
using System;
+using System.Collections.Generic;
using Mono.Debugger.Languages;
+using Mono.Debugger.Languages.Mono;
namespace Mono.Debugger.Backend
{
+ internal class PendingBreakpointQueue : Queue<KeyValuePair<FunctionBreakpointHandle,BreakpointHandle.Action>>
+ {
+ public void Add (FunctionBreakpointHandle handle, BreakpointHandle.Action action)
+ {
+ Enqueue (new KeyValuePair<FunctionBreakpointHandle, BreakpointHandle.Action> (handle, action));
+ }
+ }
+
internal abstract class BreakpointHandle : DebuggerMarshalByRefObject
{
+ internal enum Action {
+ Insert,
+ Remove
+ }
+
public readonly Breakpoint Breakpoint;
protected BreakpointHandle (Breakpoint breakpoint)
@@ -14,6 +29,8 @@ protected BreakpointHandle (Breakpoint breakpoint)
public abstract void Insert (Inferior target);
+ public abstract void Remove (Inferior target);
+
public abstract void Insert (Thread target);
public abstract void Remove (Thread target);
@@ -39,6 +56,13 @@ public override void Insert (Thread target)
throw new InternalError ();
}
+ public override void Remove (Inferior target)
+ {
+ if (index > 0)
+ target.RemoveBreakpoint (this);
+ index = -1;
+ }
+
public override void Remove (Thread target)
{
if (index > 0)
@@ -77,7 +101,7 @@ public override void Insert (Inferior inferior)
has_breakpoint = true;
}
- internal void Remove (Inferior inferior)
+ public override void Remove (Inferior inferior)
{
if (has_breakpoint)
inferior.RemoveBreakpoint (this);
@@ -91,6 +115,10 @@ internal class FunctionBreakpointHandle : BreakpointHandle
bool has_load_handler;
int line = -1, column;
+ internal int Index {
+ get; private set;
+ }
+
public FunctionBreakpointHandle (Breakpoint bpt, TargetFunctionType function, int line)
: this (bpt, function, line, -1)
{ }
@@ -102,20 +130,14 @@ public FunctionBreakpointHandle (Breakpoint bpt, TargetFunctionType function, in
this.function = function;
this.line = line;
this.column = column;
+
+ this.Index = MonoLanguageBackend.GetUniqueID ();
}
internal TargetFunctionType Function {
get { return function; }
}
- internal bool Insert (SingleSteppingEngine sse)
- {
- if (has_load_handler)
- return false;
-
- throw new InternalError ();
- }
-
public override void Insert (Inferior target)
{
throw new InternalError ();
@@ -153,6 +175,11 @@ internal void MethodLoaded (TargetAccess target, Method method)
}
}
+ public override void Remove (Inferior target)
+ {
+ throw new InternalError ();
+ }
+
public override void Remove (Thread target)
{
target.RemoveBreakpoint (this);
@@ -398,7 +398,7 @@ internal void InitializeThreads (Inferior inferior)
Inferior.StackFrame iframe = inferior.GetCurrentFrame (false);
engine.SetMainReturnAddress (iframe.StackPointer);
engine.ProcessServant.OnProcessReachedMainEvent ();
- resume_target = !engine.OnModuleLoaded (null);
+ resume_target = !engine.InitializeBreakpoints ();
return true;
}
View
@@ -874,27 +874,6 @@ public void ActivatePendingBreakpoints (CommandResult result)
}
//
- // Breakpoints and exception handlers
- //
-
- static int next_exception_index = 0;
- internal int AddExceptionCatchPoint (ExceptionCatchPoint catchpoint)
- {
- int index = ++next_exception_index;
- exception_handlers.Add (index, catchpoint);
- return index;
- }
-
- internal void RemoveExceptionCatchPoint (int index)
- {
- exception_handlers.Remove (index);
- }
-
- internal ExceptionCatchPoint[] ExceptionCatchPoints {
- get { return exception_handlers.Values.ToArray (); }
- }
-
- //
// IDisposable
//
Oops, something went wrong.

0 comments on commit 22c3d98

Please sign in to comment.