[vox-tech] gdb conditional breaking
Peter Jay Salzman
vox-tech@lists.lugod.org
Thu, 19 Sep 2002 23:09:02 -0700
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:
1. the library is linked to your application
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