l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2002 Sep 20 09:07

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] gdb conditional breaking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[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:

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
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.