-
For help on any command or usage of debug, use the help
command to display a list of commands and internal help topics (such
as for help on specific debug internal variables).
Some examples:
help
help expr
help release
help %db_lang
help C++
-
debug internal variables are preceded with a % character.
So %lang is used to identify the debug internal
variable for setting the current language.
-
debug command line editing can be improved by switching it
to vi or emacs mode by setting the %mode
debug variable (for example: set %mode=vi).
-
The debug command line can have redirection symbols and pipes used
with any command.
dbx only offers redirection with certain commands such
as run and dump.
-
You can specify breakpoints on static fns (or reference static
data) but you must explicitly specify the filename the fn/variable
resides in in the expression or already
have the debugger stopped in the file in question.
stop malloc.c@checkmsg
stop file.c@static_fn
print file.c@static_data
-
All signals are trapped by default (suppress sigcld, sigalrm):
signal -d -i sigcld sigalrm
and forked processes are followed by default.
{debug|create} -f none
run -f
set %follow "none"
release
-
When a process is not loaded or a process is completed, many commands
that are irrelevant to a process are disabled along with those that
are not.
For example: listing a file, and listing breakpoints.
-
debug runs by default in its own X window; suppressable with -ic
or by unsetting $DISPLAY; not specifiable from defaults file
so can tweak it permanently.
You can use a shell alias; for example:
alias dbg='debug -ic'
-
In the command debug cmdline, the first token is a
filename that is not searched for in PATH
(i.e., it must be specified as an absolute (or relative) pathname
if the binary is not in the current working directory.
This also applies to the internal create command.
-
Print "v" -> outputs "v" (quoted - instead of v)
-
^D doesn't exit debugger; use quit or exit.
-
debug uses two expression parsers: one for the command line
constructs and another for C/C++ expressions.
The combination of the two can lead to unexpected effects and
demand non-obvious syntax (e.g., empty string inclusion).
-
Aliases are set and removed in unique ways (that is, more like macro
replacement than other assignments).
To set:
alias name list_of_replacement_tokens
To remove:
alias -r
-
Substituting args are not expanded inside quoted strings
or specifiable with brackets or parentheses (in disambiguating ${} forms):
$[0-9]
$*
$#
-
In debug, use aliases and blocks (enclosed in brackets: {...}) to
define user functions.
-
By default debug will attempt to also debug forked child processes.
The %follow system variable controls this behaviour and should be
set to none (from the default all) to disable this.
-
The threads of control of a process that debug knows about can be
displayed with the ps command and the current switched by
setting the %proc system variable or the -p switch on
many commands.
Notification of thread state change (create, exit, suspend,
continue, etc.) can be controlled with the %thread_change variable.
The default value is stop, indicating to print a message and stop
the thread if possible.
To disable both notification and stopping set it to ignore.