Next Meeting: September 15: Scratch: programming for children and other not-yet-programmers Next Installfest: TBD Latest News: Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk Page last updated: 2002 Sep 20 09:07
[vox-tech] gdb conditional breaking

# [vox-tech] gdb conditional breaking

```hi lugod,

the gdb user's manual doesn't have a lot to say about conditional
breaking, but i think i'm beginning to understand it more thoroughly.

first of all, you can use all the boolean expressions you'd expect to be
able to use.

break 1 if x > 0
break 2 if y <= x

parenthesis seem to be purely optional.

break 3 if (! x >= -1)

but there's more to the story.  you can use functions too.  here's a
test program:

#include <math.h>

int main(void)
{
double i = 0.0;
double j = M_PI;
double k = -1;

double l = cos(i);
double m = y0(i);

return 0;
}

where y0 is a bessel function of the 2nd kind (a von neumann function)
of the zeroth order.  it's a solution to one of the angular equations
that comes out of separation of variables of laplace's equation in
spherical coordinates.

but anyway...

you can use functions, like math functions.  but with a privisio.

(gdb) break main if cos(3) == 0
Breakpoint 1 at 0x8048456: file math.c, line 5.

(gdb) break main if sin(3) == 0
No symbol "sin" in current context.

(gdb) break main if exp(3) == 0
No symbol "exp" in current context.

(gdb) break main if y0(3) == 0
Note: breakpoint 1 also set at pc 0x8048456.
Breakpoint 2 at 0x8048456: file math.c, line 5.

(gdb) break main if y1(3) == 0
No symbol "y1" in current context.

so it appears that here's the rule:

you're allowed to use any function, even library functions, provided that:

2. you actually _use_ the function somewhere in your code.

to be honest, i'm not the least surprised by condition 1, but i'm
very surprised by condition 2.

does anyone have anything to add to this?

pete

--
Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech

```