This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: another conditional breakpoint question
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Peter Jay Salzman <p at dirac dot org>
- Cc: Gdb Mailing List <gdb at sources dot redhat dot com>
- Date: Fri, 20 Sep 2002 18:04:44 -0400
- Subject: Re: another conditional breakpoint question
- References: <20020920201304.GA29419@dirac.org>
On Fri, Sep 20, 2002 at 01:13:04PM -0700, Peter Jay Salzman wrote:
> in the program:
>
> #include <math.h>
> int main(void)
> {
> double i = 0.0;
> double j = cos(i);
> return 0;
> }
>
> i set a breakpoint which should never be reached:
>
> p@satan% gdb mymath
> (gdb) break main if cos(0.0) > 1000.0
> Breakpoint 1 at 0x8048426: file mymath.c, line 5.
>
> (gdb) run
> Breakpoint 1, main () at mymath.c:5
> 5 double i = 0.0;
>
> considering that cosine should be greater than 1 for a real variable,
> this is quite strange!
>
>
> i don't know if this is related, but i notice that cos(0) doesn't have a
> value of 1.0. not even close:
>
> (gdb) p cos(0)
> $3 = 14368
>
> but just in case gdb doesn't know that cos() returns a double, i also
> tried:
>
> (gdb) p/f cos(0.0)
> $1 = 2.00890148e-41
>
> neither of these are even close to being right.
>
>
> can someone tell me why gdb is reaching that breakpoint which should
> never be reaced? and is there any way of getting gdb to tell me that
> cos(0) is supposed to be equal to 1? :*)
You don't have debug information in your libraries. Try:
(gdb) ptype cos
to see what I mean. You need debugging info if you want that to wokr.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer