Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Howto debug C-code with forks
Howto debug C-code with forks [message #1709010] Wed, 23 September 2015 09:50 Go to next message
star bright is currently offline star brightFriend
Messages: 17
Registered: September 2015
Junior Member
I get the debugging work with gdbserver at the device (cross compiled). The issue is, how to follow a fork?
Different threads I can observe in the debug window, but how about forks?
Re: Howto debug C-code with forks [message #1709038 is a reply to message #1709010] Wed, 23 September 2015 13:15 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
Run->Debug Configurations...
then select the launch you use.
Go to the Debugger subtab and at the bottom select "Automatically debug forked processes" You need GDB 7.2 or higher to do this.

Marc
Re: Howto debug C-code with forks [message #1709118 is a reply to message #1709038] Thu, 24 September 2015 08:07 Go to previous messageGo to next message
star bright is currently offline star brightFriend
Messages: 17
Registered: September 2015
Junior Member
Thanks Marc. Indeed I have a 7.8.1 version. This seems to be a very global setting, so no change during runtime?T
his selection is not available in this debugger-subtab in Luna, but only in Mars.
Unfortunatly I currently stick on Luna for Yocto. Maybe next Yocto release supports Mars.
Anyhow, thanks for this information. Did you ever used that - if so how is your experience?
Re: Howto debug C-code with forks [message #1709146 is a reply to message #1709118] Thu, 24 September 2015 13:09 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
Debugging forked processes, and it's option in the Debugger subtab (not the main subtab) has been there much before luna:
https://wiki.eclipse.org/CDT/User/NewIn80#Multi-process_Debugging

If for some reason you still cannot find this option, you can add the following command to your .gdbinit file:
set detach-on-fork off
and I believe it will have the exact same effect.

Marc
Re: Howto debug C-code with forks [message #1709265 is a reply to message #1709146] Fri, 25 September 2015 12:35 Go to previous messageGo to next message
star bright is currently offline star brightFriend
Messages: 17
Registered: September 2015
Junior Member
Mh, not sure I get it. Wiki talks about "only Non-Stop debugging sessions".
Is this without activating in Debug Config/Debugger/Stop on startup?
I didn't had a .gdbinit, so I created one with "set detach-on-fork off".
But both changes doesn't make a difference. The icon in the WIKI (that looks like a rotated Z) is greyed out here.
Re: Howto debug C-code with forks [message #1709286 is a reply to message #1709265] Fri, 25 September 2015 15:43 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
Ah yes, to get multi-process debugging you need to enable non-stop debugging.
CDT does not support multi-process with all-stop.

Another way to do this is to stick to single-process debug but follow the child instead of the parent.
To do that, in your .gdbinit file use the command
set follow-fork-mode child

Marc

Re: Howto debug C-code with forks [message #1709653 is a reply to message #1709286] Wed, 30 September 2015 05:25 Go to previous message
star bright is currently offline star brightFriend
Messages: 17
Registered: September 2015
Junior Member
Thanks Marc, I am off these days but will try this. Definitely a great help.
Previous Topic:Formatting complex member variables
Next Topic:how to integrate CDT Into Eclipse which are with Jave EE?
Goto Forum:
  


Current Time: Fri Apr 26 19:00:17 GMT 2024

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

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

Back to the top