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


 
end
define hook-continue
handle SIGLARM pass
end
You can define a hook for any single-word command in GDB, and not for command
aliases; Also you should define a hook for the basic command name, for example,
backtrace rather than bt. If an error occurs during the execution of your hook,
execution of GDB commands stops and GDB issues a prompt (before the command
that you actually typed had a chance to run).
If you try to define a hook which does not match any known command, GDB issues a
warning from the define command.
18.3 Command files
A command file for GDB is a file of lines that are GDB commands. Comments (lines
starting with #) may also be included. An empty line in a command file does nothing;
it does not mean to repeat the last command, as it would from the terminal.
When you start GDB, it executes commands from its init files. These are files named
.gdbinit on UNIX. During startup, GDB does the following:
1. Read the init file (if any) in your home directory.
4
2. Process command-line options and operands.
3. Read the init file (if any) in the current working directory,
4. Read the init file (if any) in the /tmp directory if the GDB_PROCESS_TMP_GDBINIT
environment variable is set.
5. Read command files specified by the `-x' option.
The init file in your home directory can set options (such as `set complaints') that affect
subsequent processing of command line options and operands. Init files are not executed
if you use the `-nx' option (see “Choosing modes” (page 27)).
It can be useful to create a `.gdbinit' file in the directory where you are debugging an
application. This file will set the actions that apply for this application.
For example, one might add lines like:
dir /usr/src/path/to/source/files
to add source directories or:
break fatal
to set breakpoints on fatal error routines or diagnostic routines.
On some configurations of GDB, the init file is known by a different name (these are
typically environments where a specialized form of GDB may need to coexist with
other forms, hence a different name for the specialized version's init file). These are
the environments with special init file names:
18.3 Command files 289