Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » debugContextEvent information(target suspended, terminated or not suspended?)
debugContextEvent information [message #997479] Mon, 07 January 2013 17:42 Go to next message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
hello.

i have written a plug-in and added him as debugContextListener through the debugUITools, and i know that if i want to send commands to the gdb i need to wait till the target being debugged is suspended, otherwise any action of sending commands to the gdb will end in exception of 'Target is not Suspended' or 'Target is Terminated'.

my question, when i enter the 'if' in debugContextChanged(debugContextEvent event) method, how can i know if the target being debugged is suspended in order to send commands to the gdb?

here is the debugContextChanged(debugContextEvent event) method:

public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
//check if the target is suspended before
//sending commands to the gdb
}
}

and this is how i added the plug-in as debugContextListener:

DebugUITools.getDebugContextManager().getContextService(getSite().getWorkbenchWindow()).addDebugContextListener(this);

thanks in advance.
Re: debugContextEvent information [message #997495 is a reply to message #997479] Mon, 07 January 2013 19:21 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
First, be careful to use the DSF-GDB integration of CDT. Previously, we used CDI-GDB but that is no longer being enhanced, as we have switched to DSF-GDB.

The code for that integration is in
o.e.cdt.dsf.gdb
o.e.cdt.dsf.gdb.ui

DSF is the Debugger Services Framework and provides Services for the different debugger features. In your case, to know about the run state you would use the IRunControl.java service. For example you would call IRunControl.isSuspended(...). You could also listen for IRunControl.ISuspendedDMEvent and keep track of the current run state in your class.

To send command to GDB, you would use the ICommandControlService.

You will need to look at the code to learn how to use these services.

Marc
Re: debugContextEvent information [message #997584 is a reply to message #997495] Tue, 08 January 2013 13:23 Go to previous messageGo to next message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
thanks marc, for the help.

currently i'm using the debugger process output stream to send commands to the gdb.

what i wanted to ask is, if you can show me the syntax of checking if the process being debugged is suspended, throught IRunControl?

if you could show me the syntax inside the debugContextChanged method, i would be grateful.


public void debugContextChanged(DebugContextEvent event) {
if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
//check if the target is suspended before
//sending commands to the gdb
}
}

thanks a lot, ben.
Re: debugContextEvent information [message #997585 is a reply to message #997495] Tue, 08 January 2013 13:27 Go to previous messageGo to next message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
if you have any comments on the things i do, please share them with me.

thanks

[Updated on: Tue, 08 January 2013 13:28]

Report message to a moderator

Re: debugContextEvent information [message #997593 is a reply to message #997585] Tue, 08 January 2013 14:07 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
I don't have a direct example but you can look at:
BreakpointVMProvider.fDebugContextListener.debugContextChanged
and at any code that calls IRunControl.isSuspended()

Marc
Re: debugContextEvent information [message #997681 is a reply to message #997593] Tue, 08 January 2013 14:38 Go to previous messageGo to next message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
i have looked at the source code of BreakpointVMProvider, but i did'nt see the use of isSusppended of IRunControl.

is there somewhere else i can see it?

thanks.

[Updated on: Tue, 08 January 2013 14:38]

Report message to a moderator

Re: debugContextEvent information [message #997698 is a reply to message #997681] Tue, 08 January 2013 15:11 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
o.e.cdt.dsf.gdb.internal.ui.commands.GdbReverseToggleCommand#isExecutable
Re: debugContextEvent information [message #997805 is a reply to message #997698] Tue, 08 January 2013 19:25 Go to previous message
ben agai is currently offline ben agaiFriend
Messages: 36
Registered: July 2012
Member
thanks, i have seen it.

but i have a question, i see that the IRunControl.isSuspended method receives IRunControl.IExecutionDMContext context as parameter.
from where can i get the IRunControl.IExecutionDMContext to give as a parameter to the function?

and do i need to create an IRunControl, or can i somehow get one?

thanks.
Previous Topic:GDB take a while to display variable
Next Topic:how eclipse synchronizes its views?
Goto Forum:
  


Current Time: Thu Mar 28 10:03:51 GMT 2024

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

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

Back to the top