190
Chapter 22. Canned Sequences of Commands
document
commandname
Document the user-defined command
commandname
, so that it can be accessed by
help
. The
command
commandname
must already be defined. This command reads lines of documentation
just as
define
reads the lines of the command definition, ending with
end
. After the
document
command is finished,
help
on command
commandname
displays the documentation you have
written.
You may use the
document
command again to change the documentation of a command. Re-
defining the command with
define
does not change the documentation.
help user-defined
List all user-defined commands, with the first line of the documentation (if any) for each.
show user
show user
commandname
Display the gdb commands used to define
commandname
(but not its documentation). If no
commandname
is given, display the definitions for all user-defined commands.
show max-user-call-depth
set max-user-call-depth
The value of
max-user-call-depth
controls how many recursion levels are allowed in user-
defined commands before GDB suspects an infinite recursion and aborts the command.
When user-defined commands are executed, the commands of the definition are not printed. An error
in any command stops execution of the user-defined command.
If used interactively, commands that would ask for confirmation proceed without asking when used
inside a user-defined command. Many gdb commands that normally print messages to say what they
are doing omit the messages when used in a user-defined command.
22.2. User-defined command hooks
You may define
hooks
, which are a special kind of user-defined command. Whenever you run the
command
foo
, if the user-defined command
hook-foo
exists, it is executed (with no arguments)
before that command.
A hook may also be defined which is run after the command you executed. Whenever you run the
command
foo
, if the user-defined command
hookpost-foo
exists, it is executed (with no arguments)
after that command. Post-execution hooks may exist simultaneously with pre-execution hooks, for the
same command.
It is valid for a hook to call the command which it hooks. If this occurs, the hook is not re-executed,
thereby avoiding infinte recursion.
In addition, a pseudo-command,
stop
exists. Defining (
hook-stop
) makes the associated commands
execute every time execution stops in your program: before breakpoint commands are run, displays
are printed, or the stack frame is printed.
For example, to ignore
SIGALRM
signals while single-stepping, but treat them normally during normal
execution, you could define:
define hook-stop
handle SIGALRM nopass
end
define hook-run
Содержание ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Страница 1: ...Red Hat Enterprise Linux 4 Debugging with gdb ...
Страница 12: ...2 Chapter 1 Debugging with gdb ...
Страница 28: ...18 Chapter 4 Getting In and Out of gdb ...
Страница 34: ...24 Chapter 5 gdb Commands ...
Страница 44: ...34 Chapter 6 Running Programs Under gdb ...
Страница 68: ...58 Chapter 8 Examining the Stack ...
Страница 98: ...88 Chapter 10 Examining Data ...
Страница 112: ...102 Chapter 12 Tracepoints ...
Страница 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Страница 138: ...128 Chapter 14 Using gdb with Different Languages ...
Страница 144: ...134 Chapter 15 Examining the Symbol Table ...
Страница 170: ...160 Chapter 19 Debugging remote programs ...
Страница 198: ...188 Chapter 21 Controlling gdb ...
Страница 204: ...194 Chapter 22 Canned Sequences of Commands ...
Страница 206: ...196 Chapter 23 Command Interpreters ...
Страница 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Страница 296: ...286 Chapter 27 gdb Annotations ...
Страница 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Страница 322: ...312 Chapter 30 Using History Interactively ...
Страница 362: ...352 Appendix D gdb Remote Serial Protocol ...
Страница 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Страница 386: ...376 Appendix G GNU Free Documentation License ...
Страница 410: ......