From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28221 invoked by alias); 6 Jan 2004 18:41:52 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28214 invoked from network); 6 Jan 2004 18:41:51 -0000 Received: from unknown (HELO hawaii.kealia.com) (209.3.10.89) by sources.redhat.com with SMTP; 6 Jan 2004 18:41:51 -0000 Received: by hawaii.kealia.com (Postfix, from userid 2049) id 24084C6C4; Tue, 6 Jan 2004 10:41:51 -0800 (PST) To: Michael Elizabeth Chastain Cc: gdb-patches@sources.redhat.com Subject: Re: [rfc/cp] method stub assertions References: <20040106042841.584854B35A@berman.michael-chastain.com> <20040106170522.GA29597@nevyn.them.org> From: David Carlton Date: Tue, 06 Jan 2004 18:41:00 -0000 In-Reply-To: <20040106170522.GA29597@nevyn.them.org> (Daniel Jacobowitz's message of "Tue, 6 Jan 2004 12:05:23 -0500") Message-ID: User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Rational FORTRAN, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-01/txt/msg00143.txt.bz2 On Tue, 6 Jan 2004 12:05:23 -0500, Daniel Jacobowitz 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