Eclipse Debugger Events [message #677542] |
Wed, 08 June 2011 14:59  |
Eclipse User |
|
|
|
In my Eclipse plugin, I would like to be notified on debugger events (e.g. when stepping or a breakpoint is hit). I've managed to get this working in a JDT environment by subscribing to debug events using this code:
DebugPlugin.getDefault().addDebugEventListener(this);
Which gives this event handler:
public void handleDebugEvents(DebugEvent[] events)
{
}
In JDT this is fired on Breakpoint or Suspend events and I was hoping the behaviour would be the same in CDT. However, it is not. I only get two Create events at the start of the debug session:
DebugEvent[org.eclipse.cdt.dsf.gdb.launching.GDBProcess@ae0aae, CREATE, UNSPECIFIED] DebugEvent[org.eclipse.debug.core.model.RuntimeProcess@920d5d, CREATE, UNSPECIFIED]
Is there a generic solution that wouldn't require specific dependencies on JDT or CDT?
Thanks, Alan
|
|
|
Re: Eclipse Debugger Events [message #682016 is a reply to message #677542] |
Fri, 10 June 2011 04:48  |
Eclipse User |
|
|
|
I did find a solution. Here it is in case it helps others:
You can use the method outlined above to listen for debug events when the session is created and terminated.
For any stepping events, one way I found was to register an IExecutionListener to be notified of all commands that take place in the Eclipse workspace. You can register an execution listener by getting hold of an ICommandService as follows:
ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)
Then add an execution listener:
commandService.addExecutionListener(this);
This will give you various event handlers (notHandled, postExecuteFailure, postExecuteSuccess, preExecute) from which you can filter by the commandId value.
I hope this helps someone else.
Alan
|
|
|
Powered by
FUDForum. Page generated in 0.08019 seconds