whossa
whossa

Reputation: 201

Debug a subprocess using gdb from eclipse cdt

As the question indicating, i'm now facing a problem that one server process will fork a subprocess and i want to debug the child process. Anyone knows how to do this from eclipse CDT using gdb?

BTW: This child process may be spawned from an executable/shell script.

Upvotes: 2

Views: 557

Answers (1)

whossa
whossa

Reputation: 201

My working envrionment is RHEL6-64bit EclipseJuno+CDT gdb7.5, and I want to debug the child process spawned via fork/exec without any additional work for the child process.

My step is as below: 1. attach to or start a parent process from eclipse 2. use the gdb console in eclipse to ensure symbol file loaded via symbol 3. add catch point to capture exec event catch exec 4. Run program when the it hits to the exec point 5. add break point via gdb console in eclipse

Note:never add break point via eclipse, otherwise the gdb will crash

Then you will hit the break point in the child process! Seemingly, this is a bug for gdb7.5!

Upvotes: 1

Related Questions