public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17435] New: "info vtbl" doesn't respect "set print object on"
@ 2014-09-26 15:06 tromey at sourceware dot org
0 siblings, 0 replies; only message in thread
From: tromey at sourceware dot org @ 2014-09-26 15:06 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17435
Bug ID: 17435
Summary: "info vtbl" doesn't respect "set print object on"
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: tromey at sourceware dot org
Compile this program with g++ -g
struct Base1
{
virtual void b1() { }
int mb1;
Base1() : mb1(0) { }
};
struct Base2
{
virtual void b2() { }
int mb2;
Base2() : mb2(3) { }
};
struct Der : public Base1, Base2
{
int x, y;
Der(): x(5), y(6) { }
void b1() { }
void b2() { }
};
int main()
{
Base1* b1 = new Der();
Base2* b2 = new Der();
Der* d = new Der();
return 0;
}
Now break on the "return" and run it under "gdb -nx".
Without "set print object on" I get:
(gdb) p b1
$1 = (Base1 *) 0x602010
(gdb) info vtbl b1
vtable for 'Base1' @ 0x4008f0 (subobject @ 0x602010):
[0]: 0x40080c <Der::b1()>
This seems basically reasonable, but now try with
"set print object on":
(gdb) set print object on
(gdb) p b1
$2 = (Der *) 0x602010
(gdb) info vtbl b1
vtable for 'Base1' @ 0x4008f0 (subobject @ 0x602010):
[0]: 0x40080c <Der::b1()>
I expected this to print the vtable of the full object,
just as "print" did. I can make it happen manually
using a cast:
(gdb) info vtbl (Der *) b1
vtable for 'Der' @ 0x4008f0 (subobject @ 0x602010):
[0]: 0x40080c <Der::b1()>
[1]: 0x400816 <Der::b2()>
vtable for 'Base2' @ 0x400910 (subobject @ 0x602020):
[0]: 0x400820 <non-virtual thunk to Der::b2()>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-09-26 15:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 15:06 [Bug c++/17435] New: "info vtbl" doesn't respect "set print object on" tromey at sourceware dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).