Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Eclipse Debugger Events
Eclipse Debugger Events [message #677542] Wed, 08 June 2011 18:59 Go to next message
Alan  is currently offline Alan Friend
Messages: 2
Registered: June 2011
Junior Member
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 08:48 Go to previous message
Alan  is currently offline Alan Friend
Messages: 2
Registered: June 2011
Junior Member
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
Previous Topic:Objective C support
Next Topic:Help on loading a core
Goto Forum:
  


Current Time: Fri Apr 26 01:33:01 GMT 2024

Powered by FUDForum. Page generated in 0.03741 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top