a

Format: a { cmds }

(Also Format: a num modifier) See a.

Creates a new assertion with the given command list cmds.

Assertions are lists of commands that are executed before every statement. This means that if there is even one active assertion, the program will be automatically single-stepped. This has a significant impact on the debugger's speed of execution.

This is an example of an assertion:
a { if { (foo!=$foo) { $foo=foo;print /d foo; if (foo>9) {x} } } }

This command will create an assertion to report the changing value of some global, foo, and stop if it ever exceeds some value. It uses a debugger special variable to keep track of the old value of foo.

Another example:
a { if (foo > (bar-9)*10) {A;x 1;c} else {bar -= 10} }

This assertion checks the condition. If it is false, bar is decremented by 10. If it is true, assertions are suspended, assertion mode is exited, and the program continues at normal speed. Without the number 1 after the x command, the c command would not have been reached. See x.

There are some restrictions on using this command. Using local variables is not recommended since they will most likely go out of scope when a subroutine is entered and can cause unspecified results. Assertions are also not recommended when using shared libraries for similar reasons.

See also watchpoint.


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.