This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 0/2] physname reg.: C++ breakpoints / linespec fixes
On Wed, 08 Jun 2011 16:43:07 +0200, Jan Kratochvil wrote:
> But for example `file:func' is currently implemented only in linespec and it
> should be supported even by expressions - see the bottom example.
[...]
> ==> a/f.c <==
> static void f (void) {}
> void x (void) { f (); }
>
> ==> b/f.c <==
> static void f (void) {}
> void y (void) { f (); }
>
> ==> m.c <==
> extern void x (void);
> extern void y (void);
> int
> main (void)
> {
> x ();
> y ();
> return 0;
> }
>
> gcc -o m a/f.c b/f.c m.c -Wall -g
> (gdb) b a/f.c:f
> Breakpoint 1 at 0x400478: file a/f.c, line 1.
> (gdb) b b/f.c:f
> Breakpoint 2 at 0x40048c: file b/f.c, line 1.
> (gdb) b f
> Note: breakpoint 2 also set at pc 0x40048c.
> Breakpoint 3 at 0x40048c: file b/f.c, line 1.
> (gdb) p f
> $1 = {void (void)} 0x400488 <f>
> (gdb) p a/f.c:f
> No symbol "a" in current context.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = it should work.
> (gdb) p b/f.c:f
> No symbol "b" in current context.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = it should work.
I forgot it is doable in expressions, just with a different syntax than in
linespec:
(gdb) p 'a/f.c'::f
$1 = {void (void)} 0x400474 <f>
(gdb) p 'b/f.c'::f
$2 = {void (void)} 0x400488 <f>
Regards,
Jan