Conditional Breakpoints in the Take Command Batch Debugger

We have added conditional breakpoints to the batch debugger in Take Command 12.10. In previous versions, a breakpoint was unconditional – you set it by clicking in the left margin, and the batch debugger would stop when it reached the breakpoint.

In 12.10, you can tell the debugger to stop the nth time it reaches a breakpoint (very useful in loops when you only want the breakpoint after a certain number of iterations). You can also optionally specify a conditional expression.

There is a new tabbed window at the bottom of the debugger window (“Breakpoints”) that displays all your breakpoints by Line (line number in the batch file), Count (number of times this breakpoint has been reached), Break >= (the optional Count where you want to break), and Condition (the optional conditional expression).

For example, let’s create a batch file called SQUARE.BTM that has a DO loop:

DO i=1 to 50 by 1
echo i = %i
set square=%@eval[i*i] echo %i squared = %square
ENDDO

Now click in the left margin on line four to set a breakpoint on the”echo %i squared = %square” command.

If we start the debugger and click on “Run to Breakpoint”, we will stop on line four 50 times. But if we want to ignore the first 29 loop iterations, we can click on the tab for the Breakpoints window, double click on the “Break >=” column, and enter 30. Click on “Run to Breakpoint”, and the debugger will break at the 30th iteration (and all subsequent iterations until the end).

What if we only want to break if i >= 30 and i <= 32? We can do a break on a conditional expression. Clear the “Break >=” column, and double-click on the “Condition” column. Enter:

%i ge 30 .and. %i le 32

Now the debugger will only break when i is 30, 31, or 32.

You can use any of the conditional operators from the IF / IFF tests for your conditional breakpoints.

Take Command will save your breakpoints and conditions when the batch file is saved, and restore them when the file is reloaded. The breakpoint save file will be named “filename.ext.bp”, so in the case of SQUARE.BTM you will see a breakpoint file named SQUARE.BTM.BP in the same directory.

If you’d like to request a new batch debugger feature, click on the orange Feedback button at http://jpsoft.com.

Add Comment

Required fields are marked *. Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>