Format
- trace [if condition]
- trace procedure [if condition]
- trace [variable] at sourceline [if condition]
- trace [variable] in procedure [if condition]
- trace sourceline [if condition]
- trace expression at sourceline [if condition]
Description
The trace subcommand prints tracing information for the
specified procedure, function,
source line, expression, or variable when the program runs. A condition
can be specified. The dbx debug program associates a number
with each trace subcommand. To view these numbers, use the status subcommand.
To turn tracing off, use the delete subcommand.
Options
- atsourceline
- Specifies the source line at which to find the expression being
traced.
- ifcondition
- Specifies a condition for the beginning of the trace. The trace
begins only ifcondition is true.
- inprocedure
- Specifies the procedure in which to find the procedure or variable
being traced.
Usage notes
The trace subcommand can be run only while the dbx debug
program is running.
Examples
- To trace each call to the printf() procedure, enter:
trace printf
- To trace each execution of line 22 in the hello.c file,
enter:
trace "hello.c":22
- To trace changes to the x variable within the main procedure, enter:
trace x in main
- To trace at line 52 only when mutex $m1 is not held, enter:
trace at 52 if $m2.lock == 0
Related information
The tracei subcommand.