Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: gonboy on August 13, 2008, 03:03:15 am

Title: How to debug the "fork()" program?
Post by: gonboy on August 13, 2008, 03:03:15 am

1 -    You can get  the return value of fork(),so you can debug it. eg pid = 0, in the children process, pid >0 ,in the father process.

        But if I want to debug the father and children process at the same time ,how to do?

2 -    How do you know which process will be run ? why?

Title: Re: How to debug the "fork()" program?
Post by: Belette13 on November 30, 2010, 09:44:01 pm
The fork method is very problematic. Why can't it work fine like any other compiler?????
Title: Re: How to debug the "fork()" program?
Post by: oBFusCATed on December 01, 2010, 01:15:48 am
The fork method is very problematic. Why can't it work fine like any other compiler?????
Compiler or debugger?

As far as I know forks works perfectly using gcc as compiler.
And here is some info related to the debugger: http://sourceware.org/gdb/onlinedocs/gdb/Forks.html

I'm not sure if gdb supports debugging both parent and child, I've not read the above page  :lol: :P
Title: Re: How to debug the "fork()" program?
Post by: eranif on December 01, 2010, 06:57:41 am

1 -    You can get  the return value of fork(),so you can debug it. eg pid = 0, in the children process, pid >0 ,in the father process.

        But if I want to debug the father and children process at the same time ,how to do?

2 -    How do you know which process will be run ? why?



Here, let me google that for you:
http://tinyurl.com/2fcpot8 (http://tinyurl.com/2fcpot8)

Eran