From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17908 invoked by alias); 20 Sep 2002 23:16:43 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 17900 invoked from network); 20 Sep 2002 23:16:42 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 20 Sep 2002 23:16:42 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17sXwt-0001X6-00; Fri, 20 Sep 2002 19:16:39 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17sX0s-0001Fz-00; Fri, 20 Sep 2002 19:16:42 -0400 Date: Fri, 20 Sep 2002 16:16:00 -0000 From: Daniel Jacobowitz To: Peter Jay Salzman Cc: Gdb Mailing List Subject: Re: another conditional breakpoint question Message-ID: <20020920231642.GB4807@nevyn.them.org> Mail-Followup-To: Peter Jay Salzman , Gdb Mailing List References: <20020920201304.GA29419@dirac.org> <20020920220444.GA2765@nevyn.them.org> <20020920223606.GA31067@dirac.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020920223606.GA31067@dirac.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-09/txt/msg00327.txt.bz2 On Fri, Sep 20, 2002 at 03:36:06PM -0700, Peter Jay Salzman wrote: > begin Daniel Jacobowitz > > On Fri, Sep 20, 2002 at 01:13:04PM -0700, Peter Jay Salzman wrote: > > > in the program: > > > > > > #include > > > 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. > > hi daniel, > > i see what you mean. but then i'm confused why strlen works. > > 18 int main(void) > 19 { > 20 char *string = "GNU/Linux"; > 21 char revstring[255]; > 22 > 23 reverse(string, revstring); > 24 printf("%s\n", revstring); > 25 > 26 return 0; > 27 } > > (gdb) break 21 if strlen(string) == 9 > Breakpoint 3 at 0x8048440: file string_reverse.c, line 21. It returns an int. That's what GDB assumes when it has no better information. You get lucky. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer