“Bill Caroselli (Q-TPS)” <QTPS@earthlink.net> wrote:
His issue was looking at a process that had just fork()ed.
It won’t be stoped.
It should be.
blah.c:
printf(“fork returned %d\n”, fork());
I step over this line in wd.
I find the parent and child:
12 2981 //61/home/dagibbs/blah 10o HELD — 4096 16k
12 9185 //61/home/dagibbs/blah 10o HELD — 4096 16k
Of course, I used wd not wvideo – but I’m pretty sure the behaviour
is the same. The debugger spawns all children HELD.
When I do “wd :blah 9185”, I get control.
I put a breakpoint at the next line, then tell it to run, and it does
so.
If you need to STOP it, put a little delay loop right after the
fork() ten you can set a break point on the instruction after
the loop and terminate the loop.
In code:
pid = fork();
if( pid == 0 )
{
// this is the child
x=1;
while(x) sleep(1);
nextinstruction;
…
}
Ugh. If you are doing something like this, and not using the debugger
on the parent, but want to debug the child, a lot cleaner would be:
pid = fork();
if (pid == 0)
{
/* this is the child /
raise( SIGSTOP );
/ rest of child */
}
Then, you can either attach to it with the debugger – or if you
don’t want to, just "kill -s SIGCONT ", or
“slay -s SIGCONT progname” and only say yes for the child.
-David
Then you can load wvideo with the symbol and source files, set a breakpoint on nextinstruction, and set x=0.
“David Gibbs” <> dagibbs@qnx.com> > wrote in message news:a8vbl3$p47$> 4@nntp.qnx.com> …
“Bill Caroselli (Q-TPS)” <> QTPS@earthlink.net> > wrote:
You have to tell wvideo the names of the symbol and source files. I don’t
remember how to do that. But you can look at the menu, I think.
wvideo :symbol_file pid
Or, you can switch to assembly view – you will then see the
assembly at the current point. Even after loading the symbols,
you won’t see anything unless you’re in assembly view – the program
is usually stopped at the start of the C initialization code, before
main() is called.
Normally, you would put a breakpoint at the start of main(), then
tell the program to continue. Then debug the new program from
main() onwards.
-David
–
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.
–
QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.