From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21480 invoked by alias); 20 Sep 2002 13:46:02 -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 21402 invoked from network); 20 Sep 2002 13:45:59 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 20 Sep 2002 13:45:59 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 17sP2b-0000kv-00 for ; Fri, 20 Sep 2002 09:45:57 -0500 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 17sO6X-0001bt-00 for ; Fri, 20 Sep 2002 09:45:57 -0400 Date: Fri, 20 Sep 2002 06:46:00 -0000 From: Daniel Jacobowitz To: Gdb Mailing List Subject: Re: question about conditional breaking Message-ID: <20020920134556.GA6047@nevyn.them.org> Mail-Followup-To: Gdb Mailing List References: <20020920073648.GA21072@dirac.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020920073648.GA21072@dirac.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-09/txt/msg00310.txt.bz2 On Fri, Sep 20, 2002 at 12:36:48AM -0700, Peter Jay Salzman wrote: > dear gdb mailing list, > > 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, we know that the boolean expressions you'd expect to be able to > use, work as advertised. > > break 1 if x > 0 > break 2 if y <= x > > parenthesis seem to be purely optional. > > break 3 if (! x >= -1) > > > but there seems to be more to the story. you can use functions too. > here's a test program: > > #include > > int main(void) > { > 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 seems like you can use functions, like math library 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 > shocked by condition 2. You can use any C expression that GDB can evaluate to a value; see the 'print' command. (2) should not be necessary if you have shared libraries; but if you don't, then the function is likely to not be present in the application unless you used it. GDB can't call functions that aren't there. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer