Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Expanding macros in breakpoint conditions
@ 2013-10-21 16:53 Eli Zaretskii
  2013-10-21 17:09 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2013-10-21 16:53 UTC (permalink / raw)
  To: gdb

I was tripped by GDB today when I set a conditioned breakpoint, like
this:

  (gdb) break foobar.c:1234 if FOO > 24.5

where FOO is a macro that expands to some_struct.foo.  Then I ran the
program, and it didn't stop at the breakpoint, although the condition
surely held at some point, and that location is in a loop the program
goes through repeatedly, many times.

Then I did

  (gdb) break foobar.c:1234 if some_struct.foo > 24.5

and re-ran the program.  This time, it did stop.  Moreover, GDB does
know about the macro, because right after it stop, I typed this:

  (gdb) p FOO
  $1 = 25.001

So my question is: is GDB supposed to expand macros in breakpoint
conditions?

This was with GDB 7.6.1 on Windows debugging a MinGW program compiled
with GCC 4.7.2.

TIA


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Expanding macros in breakpoint conditions
  2013-10-21 16:53 Expanding macros in breakpoint conditions Eli Zaretskii
@ 2013-10-21 17:09 ` Tom Tromey
  2013-10-23 17:04   ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2013-10-21 17:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Eli> So my question is: is GDB supposed to expand macros in breakpoint
Eli> conditions?

Yes, it should work under the conditions you describe -- namely when the
macro information is available.

I don't think there are any known macro expansion bugs here, either.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Expanding macros in breakpoint conditions
  2013-10-21 17:09 ` Tom Tromey
@ 2013-10-23 17:04   ` Eli Zaretskii
  2013-10-23 17:26     ` Tom Tromey
  2013-10-23 17:33     ` Keith Seitz
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2013-10-23 17:04 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb

> From: Tom Tromey <tromey@redhat.com>
> Cc: gdb@sourceware.org
> Date: Mon, 21 Oct 2013 11:09:47 -0600
> 
> >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> Eli> So my question is: is GDB supposed to expand macros in breakpoint
> Eli> conditions?
> 
> Yes, it should work under the conditions you describe -- namely when the
> macro information is available.
> 
> I don't think there are any known macro expansion bugs here, either.

Thanks.  I took a closer look, and discovered that the problem was
different.  It started as a cockpit error: instead of typing

  (gdb) break foo.c:707

I typed

  (gdb) break foo:707

(i.e., I forgot the .c extension).  File foo.c defines a function foo,
so what GDB did was put the breakpoint at entry to the function.

What I don't understand is why didn't GDB issue an error message in
this case.  There's no label '707' in that function.  Looks like the
linespec parser silently rejected the ":707" part, without telling
me.  It would be nice if it didn't do this silently.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Expanding macros in breakpoint conditions
  2013-10-23 17:04   ` Eli Zaretskii
@ 2013-10-23 17:26     ` Tom Tromey
  2013-10-23 17:33     ` Keith Seitz
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2013-10-23 17:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

Eli> What I don't understand is why didn't GDB issue an error message in
Eli> this case.  There's no label '707' in that function.  Looks like the
Eli> linespec parser silently rejected the ":707" part, without telling
Eli> me.  It would be nice if it didn't do this silently.

It seems like a bug to me.

Tom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Expanding macros in breakpoint conditions
  2013-10-23 17:04   ` Eli Zaretskii
  2013-10-23 17:26     ` Tom Tromey
@ 2013-10-23 17:33     ` Keith Seitz
  2013-10-23 18:08       ` Eli Zaretskii
  1 sibling, 1 reply; 6+ messages in thread
From: Keith Seitz @ 2013-10-23 17:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

On 10/23/2013 10:04 AM, Eli Zaretskii wrote:
> What I don't understand is why didn't GDB issue an error message in
> this case.  There's no label '707' in that function.  Looks like the
> linespec parser silently rejected the ":707" part, without telling
> me.  It would be nice if it didn't do this silently.

My original submission for the linespec rewrite did actually do this, 
but to maintain backward compatibility, I was asked to remove it.

Perhaps a warning or complaint might be a suitable compromise until this 
is properly implemented?

Keith


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Expanding macros in breakpoint conditions
  2013-10-23 17:33     ` Keith Seitz
@ 2013-10-23 18:08       ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2013-10-23 18:08 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb

> Date: Wed, 23 Oct 2013 10:33:18 -0700
> From: Keith Seitz <keiths@redhat.com>
> CC: gdb@sourceware.org
> 
> My original submission for the linespec rewrite did actually do this, 
> but to maintain backward compatibility, I was asked to remove it.

Makes sense.

> Perhaps a warning or complaint might be a suitable compromise until this 
> is properly implemented?

Yes, a warning is certainly good enough.  It would have caught my
attention right there and then.

Thanks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-10-23 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21 16:53 Expanding macros in breakpoint conditions Eli Zaretskii
2013-10-21 17:09 ` Tom Tromey
2013-10-23 17:04   ` Eli Zaretskii
2013-10-23 17:26     ` Tom Tromey
2013-10-23 17:33     ` Keith Seitz
2013-10-23 18:08       ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox