User forums > Using Code::Blocks

How to debug the "fork()" program?

(1/1)

gonboy:

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?

Belette13:
The fork method is very problematic. Why can't it work fine like any other compiler?????

oBFusCATed:

--- Quote from: 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?????

--- End quote ---
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

eranif:

--- Quote from: 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?



--- End quote ---

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

Eran

Navigation

[0] Message Index

Go to full version