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?
The fork method is very problematic. Why can't it work fine like any other compiler?????
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?????
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
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?
Here, let me google that for you:
http://tinyurl.com/2fcpot8 (http://tinyurl.com/2fcpot8)
Eran