Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: David Carlton <carlton@kealia.com>
To: Michael Elizabeth Chastain <mec.gnu@mindspring.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfc/cp] method stub assertions
Date: Tue, 06 Jan 2004 18:41:00 -0000	[thread overview]
Message-ID: <yf2ptdwx6kw.fsf@hawaii.kealia.com> (raw)
In-Reply-To: <20040106170522.GA29597@nevyn.them.org> (Daniel Jacobowitz's message of "Tue, 6 Jan 2004 12:05:23 -0500")

On Tue, 6 Jan 2004 12:05:23 -0500, Daniel Jacobowitz <drow@mvista.com> said:

> The debug information for A::bad6 does not specify that it is a
> method.  Rather only the debug info for class A specifies that it
> has a method named A::bad6.

I'm coming into this discussion late (without closely reading all of
it, no less), so I may be missing something, but I wouldn't phrase
things this way.  I've compiled the following file (g++ -g -S -dA)

class C {
  public:
    int foo();
};

int C::foo() {
    return 1;
}

and get, among other things, this output:

# Start of debug info for C.

	.uleb128 0x2	# (DIE (0x25) DW_TAG_structure_type)
	.long	0x8f	# DW_AT_sibling
	.ascii "C\0"	# DW_AT_name
	.byte	0x1	# DW_AT_byte_size
	.byte	0x1	# DW_AT_decl_file
	.byte	0x1	# DW_AT_decl_line
...

# Debug info for declaration for C::foo.

	.uleb128 0x7	# (DIE (0x76) DW_TAG_subprogram)
	.byte	0x1	# DW_AT_external
	.ascii "foo\0"	# DW_AT_name
	.byte	0x1	# DW_AT_decl_file
	.byte	0x3	# DW_AT_decl_line
	.long	.LC6	# DW_AT_MIPS_linkage_name: "_ZN1C3fooEv"
	.long	0xa6	# DW_AT_type
	.byte	0x1	# DW_AT_declaration

...

# Done with debug info for C.

	.byte	0x0	# end of children of DIE 0x25

...

# Start of debug info for definition of C::foo.

	.uleb128 0xc	# (DIE (0xad) DW_TAG_subprogram)
	.long	0xcf	# DW_AT_sibling
	.long	0x76	# DW_AT_specification


That DW_AT_specification in the definition of C::foo refers to DIE
0x76, which is the declaration for C::foo.  And the declaration for
C::foo is nested within the die for C.  So if we're reading the
definition for C::foo, it wouldn't be hard at all to find out that the
DW_TAG_subprogram in question is in fact a method of a class instead
of a free function: follow the specification, and look at its parent
DIE.  (It would have been hard a few months ago, but it's not hard
now. :-) )

David Carlton
carlton@kealia.com


  reply	other threads:[~2004-01-06 18:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-06  4:28 Michael Elizabeth Chastain
2004-01-06  4:43 ` Daniel Jacobowitz
2004-01-06 17:05 ` Daniel Jacobowitz
2004-01-06 18:41   ` David Carlton [this message]
2004-01-06 19:05     ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2004-01-06 18:24 Michael Elizabeth Chastain
2004-01-06 19:02 ` Daniel Jacobowitz
2004-01-06  0:12 Michael Elizabeth Chastain
2004-01-06  2:51 ` Daniel Jacobowitz
2004-01-05 20:51 Michael Elizabeth Chastain
2004-01-05 11:50 [rfc/cp] take 2: method stubs asserts Michael Elizabeth Chastain
2004-01-05  0:50 ` [rfc/cp] method stub assertions Michael Elizabeth Chastain
2004-01-05  1:56   ` Daniel Jacobowitz
2004-01-05 19:23   ` Daniel Jacobowitz
2004-01-05  2:32 Michael Elizabeth Chastain
2004-01-05  2:33 ` Daniel Jacobowitz

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=yf2ptdwx6kw.fsf@hawaii.kealia.com \
    --to=carlton@kealia.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mec.gnu@mindspring.com \
    /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