From: Joost van der Sluis <joost@cnoc.nl>
To: gdb@sourceware.org
Subject: Re: Handling of c++ function members
Date: Tue, 27 Sep 2011 15:05:00 -0000 [thread overview]
Message-ID: <1317135598.27942.29.camel@feddie.cnoc.lan> (raw)
In-Reply-To: <1317070857.17681.11.camel@feddie.cnoc.lan>
On Mon, 2011-09-26 at 23:00 +0200, Joost van der Sluis wrote:
> On Mon, 2011-09-26 at 16:38 -0400, Daniel Jacobowitz wrote:
> > On Mon, Sep 26, 2011 at 12:46 PM, Joost van der Sluis <joost@cnoc.nl> wrote:
> >
> > Can you be a little more specific, maybe an example?
> >
> What I understood is, that DW_AT_vtable_elem_location should contain a
> Dwarf-block that calculates the location of a pointer in which the
> location of the function member is stored.
If you need an example, you can compile the wikipedia
virtual-function-example (after fixing compilation by adding the
declaration of 'it') http://en.wikipedia.org/wiki/Virtual_function
objdump -W of the function 'eat' in that example:
<1><1902>: Abbrev Number: 66 (DW_TAG_class_type)
<1903> DW_AT_name : (indirect string, offset: 0x17e6): Animal
<1907> DW_AT_byte_size : 8
<1908> DW_AT_decl_file : 2
<1909> DW_AT_decl_line : 4
<190a> DW_AT_containing_type: <0x1902>
<190e> DW_AT_sibling : <0x19be>
<2><1953>: Abbrev Number: 69 (DW_TAG_subprogram)
<1954> DW_AT_external : 1
<1955> DW_AT_name : eat
<1959> DW_AT_decl_file : 2
<195a> DW_AT_decl_line : 6
<195b> DW_AT_MIPS_linkage_name: (indirect string, offset: 0xad3): _ZNK6Animal3eatEv
<195f> DW_AT_virtuality : 1 (virtual)
<1960> DW_AT_vtable_elem_location: 2 byte block: 10 0 (DW_OP_constu: 0)
<1963> DW_AT_containing_type: <0x1902>
<1967> DW_AT_accessibility: 1 (public)
<1968> DW_AT_declaration : 1
<1969> DW_AT_object_pointer: <0x1971>
<196d> DW_AT_sibling : <0x1978>
<3><1971>: Abbrev Number: 25 (DW_TAG_formal_parameter)
<1972> DW_AT_type : <0x2a55>
<1976> DW_AT_artificial : 1
> But it seems to me that gcc stores the index of the function member
> within some vtable in DW_AT_vtable_elem_location, instead of the memory
> address itself. In gnu-v2-abi.c there is some code that 'knows' how this
> vtable is organized so it is able to calculate the location of the
> method-pointer.
>
> And there are two thing's I'm not sure about: gcc stores
> DW_AT_containing_type in the debug-info, with the 'parent' entry of the
> DW_TAG_subprogram entry. To me it looks that this is duplicated
> information, and not specified in the Dwarf-specs. Secondly I do not
> understand where the DW_AT_object_pointer is used for?
DW_AT_containing_type is placed into NFN's Context field by dwarf2read.
Regards,
Joost van der Sluis.
next prev parent reply other threads:[~2011-09-27 15:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-26 16:46 Joost van der Sluis
2011-09-26 20:38 ` Daniel Jacobowitz
2011-09-26 21:01 ` Joost van der Sluis
2011-09-27 15:05 ` Joost van der Sluis [this message]
2011-09-27 16:01 ` Joost van der Sluis
2011-09-30 14:42 ` Daniel Jacobowitz
2011-09-30 15:53 ` Joost van der Sluis
2011-09-30 18:50 ` Jan Kratochvil
2011-09-30 20:37 ` Joost van der Sluis
2011-10-02 13:51 ` Joost van der Sluis
2011-10-05 18:56 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1317135598.27942.29.camel@feddie.cnoc.lan \
--to=joost@cnoc.nl \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).