HP (Hewlett-Packard) 5992-4701 Computer Hardware User Manual


 
NOTE:
To use attach, your program must be running in an environment which supports
processes; for example, attach does not work for programs on bare-board targets
that lack an operating system.
You must also have permission to send the process a signal.
When you use attach, the debugger finds the program running in the process
first by looking in the current working directory, then (if the program is not found)
by using the source file search path (see “Specifying source directories” (page 79)).
You can also use the file command to load the program. See “Commands to
specify files” (page 125).
GDB stops the process being attached for debugging. You can examine and modify
an attached process with the GDB commands that are available when you start
processes with run. You can insert breakpoints; you can step and continue; you
can modify storage. See “Breakpoints” (page 51). If you want the process to
continue running, you can use the continue command after attaching GDB to
the process.
detach
When you have finished debugging the attached process, you can use the
detach command to release it from GDB control. The process continues
its execution after being detached. After the detach command, that process
and GDB become completely independent once more, and you are ready
to attach another process or start one with run. detach does not repeat
if you press RET again after executing the command.
If you exit GDB or use the run command while you have an attached process, you kill
that process. By default, GDB asks for confirmation if you try to do either of these
things; you can control whether or not you need to confirm by using the set confirm
command (see “Optional warnings and messages” (page 284)).
NOTE: When GDB attaches to a running program you may get a message saying
"Attaching to process #nnnnn failed."
The most likely cause for this message is that you have attached to a process that was
started across an NFS mount. Versions of the HP-UX kernel before 11.x have a restriction
that prevents a debugger from attaching to a process started from an NFS mount, unless
the mount was made non-interruptible with the -nointr flag, see mount(1).
4.8 Killing the child process
Following command is used to kill the child process:
kill
Kill the child process in which your program is running under GDB.
The kill command is useful if you wish to debug a core dump instead of a running
process. GDB ignores any core dump file while your program is running.
4.8 Killing the child process 45