debug, continue until a condition is true

hi, all. in studio debugger, how to set a condition, so it can make the code run bw breakpoints 400+ times, until the condition i set becomes true.
[154 byte] By [alvinhonga] at [2007-11-27 4:23:41]
# 1

Hi

At the dbx prompt, type

help event specification

and you'll see all of the (many) options for controlling breakpoints.

An alternative (if you have the source code and can rebuild easily) is to modify the code, something like this:

static int count = 0;

if (++count == 400)

{

count = count; /* put a breakpoint here */

}

Paul

Paul_Floyda at 2007-7-12 9:31:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

thanks paul, but my problem is far more complex.

in my code, i need to match words in two files(stupid uni project), in the output, it missed couple of matches. now i know which matches are missing, so i need to set a guard in debugger, so when i reach that match, i know what went wrong. since i don't want to press continue 400 times, so i need debugger to do it for me.

alvinhonga at 2007-7-12 9:31:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

dbx is quite advanced in this area.

You can do conditional breakpoints

stop <location> -if <any condition, even function calls here>

or counting breakpoints

stop <location> -count 400

If you do not want to muck with command line I'm pretty much sure IDE has adequate visual way of setting these breakpoints.

regards,

__Fedor.

SFVa at 2007-7-12 9:31:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4

Start with "help event specification". Here are some examples:

stop in func -if 0 == strcmp(string1, "problem_string")

This will make dbx call strcmp every time 'func' is called. So it can

be a little bit slow if the function is in a tight loop.

You can also find the exact number of calls and do it that way.

There's an example here:

http://blogs.sun.com/quenelle/entry/stopping_right_before_your_crash

Hopefully that's enough to get you started.

ChrisQuenellea at 2007-7-12 9:31:20 > top of Java-index,Development Tools,Solaris and Linux Development Tools...