Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Peter Jay Salzman <p@dirac.org>
Cc: Eli Zaretskii <eliz@is.elta.co.il>,
	Gdb Mailing List <gdb@sources.redhat.com>
Subject: Re: rules for conditional breakpoints
Date: Thu, 26 Sep 2002 07:23:00 -0000	[thread overview]
Message-ID: <20020926142354.GA29419@nevyn.them.org> (raw)
In-Reply-To: <20020926064006.GA25116@dirac.org>

On Wed, Sep 25, 2002 at 11:40:06PM -0700, Peter Jay Salzman wrote:
> hi eli,
> 
> unfortunately, the user manual doesn't really say much about this.  the
> relevent section is 5.1.6 (break conditions) which references section
> 8.1 (expressions).
> 
> in the first paragraph os 5.1.6:
> 
>    A condition is just a Boolean expression in your programming language
>    (see section 8.1 Expressions).
> 
> but this is where my confusion is coming from.  here is a boolean
> expression:
> 
>    break main if cos(0.0) == 1.0
> 
> the condition "cos(0.0) == 1.0" is a boolean expression.  it's either
> true or false.  yet it's not valid in a conditional breakpoint.

If you had debugging information in your library, it would work, as I
tried to explain last time.  Or you can do this:

(gdb) set $p = (double (*) (double)) cos
(gdb) ptype $p
type = double (*)()
(gdb) p cos(2.)
$2 = 14880
(gdb) p $p(2.)
$4 = -0.41614683654714241

> looking further down the section 5.1.6, it mentions that user defined
> functions are allowed in conditions.
> 
> 
> 
> looking at section 8.1, it has something relevent:
> 
>    Any kind of constant, variable or operator defined by the programming
>    language you are using is valid in an expression in GDB.  This
>    includes conditional expressions, function calls, casts and string
>    constants.  It unfortunately does no include symbols defined by
>    preprocessor #define commands.

That's out of date.  Macros work now if you have the right debug info.

> this is kind of ambiguous whether "the programming language" includes
> glibc or not.  if it doesn't, then i'm unsure what "functions" this
> paragraph is talking about.  if it does, then it directly conflicts with
> my "cos(0.0) == 1.0" as an example of something that should work but
> doesn't.

Perhaps it could be clearer.  What it means is, the _concept_ of a
function call, as an operation, is valid.  The function you call has to
be defined with debug info.  This is actually misleading since a lot of
what is in glibc is specified by the language standard...


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-09-26 14:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-25 22:10 Peter Jay Salzman
2002-09-25 22:53 ` Eli Zaretskii
2002-09-25 23:40   ` Peter Jay Salzman
2002-09-26  7:23     ` Daniel Jacobowitz [this message]
2002-09-26 13:55   ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020926142354.GA29419@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb@sources.redhat.com \
    --cc=p@dirac.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox