June 2017
Intermediate to advanced
478 pages
13h 14m
English
Sometimes a program will start to misbehave after it has been running for a while, and you would like to know what it is doing. The GDB attach feature does exactly this. I call it just-in-time debugging. It is available with both native and remote debug sessions.
In the case of remote debugging, you need to find the PID of the process to be debugged and pass it to gdbserver with the --attach option. For example, if the PID is 109, you would type this:
# gdbserver --attach :10000 109Attached; pid = 109Listening on port 10000
This forces the process to stop as if it were at a breakpoint, allowing you to start your cross GDB in the normal way and connect to gdbserver. When you are done, you can detach, allowing the program ...
Read now
Unlock full access