This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

how to debug a child process?


Hello List,

This is my first time using GDB to debug a child process, although I used it for multi-threaded program before. I followed the manual: (1) setting a sleep in child right after fork(), then attach to the child (tried both with just this single GDB and with another GDB hooked to the parent). Now I observed two things

(1) sleep() immediately returns if I continue after the successful attachment
(2) if I set any breakpoint in the child then continue, then when the point is hit, the child *still* receives a SIGTRAP


I guess (1) is related to the ways GDB interrupts a running process, which is understandable; but for (2), the GDB session will switch to the parent process and I cannot debug the child process at all.

Any help will be appreciated,

Kai


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]