Debugging Running Processes165
5.10Debugging Running Processes
In addition to stand-alone programs, running processes can also be debugged using GNU debug-
ger. The procedure is as follows:
1.
Start the process that you want to debug.
2.
Use the
ps
command to find the process ID of the running process.
3.
Start
gdb.
4.
Load the file containing the symbol table into
gdb.
5.
Use the
attach
command to attach to the running process to
gdb
.
6.
Continue debugging as usual.
In this section we shall attach to a process created by executing the
sumf
program that we
created earlier in this chapter. This program requires input of two numbers. After starting, the
process waits for the user to input these two numbers. You can open a new terminal window at
Figure5-2 The
gdb
split window inside GNU Emacs.
Next Page >>
<< Previous Page
Back to the Table of Contents