Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to debug forked processes
How to debug forked processes [message #854739] Tue, 24 April 2012 07:47 Go to next message
chris Fowler is currently offline chris FowlerFriend
Messages: 4
Registered: March 2012
Junior Member
Hi,

I have a setup where a server calls fork() and then from the child process it will launch a program using execv();

My issue is once it has done this the forked process is not debuggable. I have tried enabling debug forked processes in the CDT settting (I am on indigo) but it doesn't work.

Is there some setting in the gdbinit or something to get this running?

Thanks
Re: How to debug forked processes [message #854747 is a reply to message #854739] Tue, 24 April 2012 07:57 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Here are the requirements for multi-process debugging.
http://wiki.eclipse.org/CDT/User/FAQ#How_do_I_use_multi-process_debugging.3F


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: How to debug forked processes [message #854763 is a reply to message #854747] Tue, 24 April 2012 08:13 Go to previous messageGo to next message
chris Fowler is currently offline chris FowlerFriend
Messages: 4
Registered: March 2012
Junior Member
hmm I have definitely tried the 2nd option of ticking the debug forked processes and it never hit any of the breakpoints in any of the forked processes.

I will try the disconnect and reconnect approach again tomorrrow, I am pretty sure I tried that as well.

thanks
Re: How to debug forked processes [message #854779 is a reply to message #854763] Tue, 24 April 2012 08:27 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
If it does not work you can have a look a the gdb output
http://wiki.eclipse.org/CDT/User/FAQ#I.27ve_been_asked_for_.27gdb_traces.27.2C_where_can_I_find_them.3F


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: How to debug forked processes [message #855070 is a reply to message #854779] Tue, 24 April 2012 13:50 Go to previous message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 285
Registered: July 2009
Senior Member
We may not be handling the execv() call.
Try the GDB option (in your .gdbinit, or typing it in the gdb console:
set follow-exec-mode <?>
http://sourceware.org/gdb/onlinedocs/gdb/Forks.html

If that works and you'd like to have that in Eclipse, please open a bug.
http://bugs.eclipse.org/bugs

Thanks

Marc
Previous Topic:make: *** [scd_cmd_1] Error for no reason
Next Topic:Terminate running process
Goto Forum:
  


Current Time: Fri Dec 19 11:46:47 GMT 2014

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

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