User`s guide
68
Chapter 6: Controlling Program Execution
(dbx) trace arg_process.curarg
Process 2395: [7] trace .test.arg_process.curarg in
arg_process
When you execute your program, whenever curarg changes, dbx prints its
old and new values:
(dbx) run
[7] curarg changed before [arg_process: line 53]:
new value = (nil);
[7] curarg changed before [arg_process: line 86]:
old value = 0;
new value = 0x7fffc7e5 = "-i";
[7] curarg changed before [arg_process: line 86]:
old value = 2147469285;
new value = 0x7fffc7eb = "names.out";
[7] curarg changed before [arg_process: line 86]:
old value = 2147469291;
new value = 0x7fffc7f5 = "names.in";
Writing Conditional Commands
A conditional command created with the when command is similar to a
breakpoint set with the stop command, except that rather than stopping
when certain conditions are met, dbx executes a list of commands. The
command list can consist of any dbx commands, separated by semicolons if
you include more than one command in the command list. Additionally, you
can use the keyword stop in the command list to stop execution, just like a
breakpoint.
Each conditional command is assigned a number when you create it. You use
this number to reference the conditional command in the various commands
provided for manipulating conditional commands (for example, disable,
enable, and delete, all described in “Managing Breakpoints, Traces, and
Conditional Commands” on page 70).
The syntax of the when command is:
when [expression|variable] {command-list}
Inspects the value before executing each source line. If it has
changed, executes the command list.