This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: rules for conditional breakpoints


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]