This is the mail archive of the archer@sourceware.org mailing list for the Archer 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: C++ virtual methods table printing does not work


On Mon, 22 Dec 2008 23:38:41 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> 
> Jan> Minor point is even if GCC would provide the info I would prefer
> Jan> the naming `_vptr$CLASS' over `_vptr.CLASS' as currently it is
> Jan> not much intuitive:
> 
> We could supply a convenience function in Python, rather than
> inventing a new syntax.  What do you think?

The basic question is whether to display it the separate or combined form:

(separate)
(gdb) p var
$1 = {_vptr$base1 = {func1 = 0x400380 <base1::func1()>}, _vptr$base2 = {func2 = 0x400390 <base2::func2()>}, field = 0}
(gdb) ptype var
type = struct derived {
    struct {
        int (*func1)(void);
    } _vptr$base1;
    struct {
        int (*func2)(void);
    } _vptr$base2;
    int field;
}

(combined)
(gdb) p var
$1 = {_vptr = {base1 = {func1 = 0x400380 <base1::func1()>}, base2 = {func2 = 0x400390 <base2::func2()>}}, field = 0}
(gdb) ptype var
type = struct derived {
    struct {
        struct {
            int (*func1)(void);
        } base1;
        struct {
            int (*func2)(void);
        } base2;
    } _vptr;
    int field;
}

The current GCC DW_AT_name form `_vptr.CLASSNAME' IMO suggest to display the
combined form (which is not directly achievable in DWARF as DW_TAG_inheritance
would pick up `struct _vptr' only from the first inherited class).

My suggestion of `_vptr$CLASS' would require no GDB changes (after GCC PR
debug/11208) to get the separate printing form.   With the goal of the
combined form sure the current DW_AT_name `_vptr.CLASS' is more appropriate.

Python pretty printer would also need to implement the right completer part.


Regards,
Jan

Attachment: virtual.C
Description: Text document


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