PDA

View Full Version : Creating a CLI Conditional Break Macro



Josh-TotalView-Tech
07-17-2006, 09:18 AM
Sometimes, using the CLI can greatly simplify debugging activities. For example, setting an eval point that stops execution isn't difficult in the GUI, but you do have to remember the syntax. As an alternative, you can write a simple CLI macro that does this for you. For example,

proc conditional_break {loc cond} {

set expr "if ($cond) \$stop"

dbreak $loc -e $expr
}
alias cb conditional_break

So, for example, if you would like to create an eval point on line 47 that stops execution when the variable my_var equals 20, all you would now need to do is open a CLI window and type:

cb 47 {my_var==20}

If you placed this macro in your tvdrc startup file, it will be there waiting for you whenever you need it.