From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8984 invoked by alias); 20 Jun 2002 09:16:22 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 8840 invoked by uid 71); 20 Jun 2002 09:16:09 -0000 Resent-Date: 20 Jun 2002 09:16:09 -0000 Resent-Message-ID: <20020620091609.8839.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jcownie@etnus.com Received: (qmail 6675 invoked from network); 20 Jun 2002 09:13:23 -0000 Received: from unknown (HELO pc4) (62.30.77.62) by sources.redhat.com with SMTP; 20 Jun 2002 09:13:23 -0000 Received: from jcownie by etnus.com with local (MasqMail 0.1.16) id 17Ky0I-0xr-00 for gcc-gnats@gcc.gnu.org; Thu, 20 Jun 2002 10:13:22 +0100 Message-Id: <17Ky0I-0xr-00@etnus.com> Date: Thu, 20 Jun 2002 03:06:00 -0000 From: jcownie@etnus.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: c++/7081: DWARF enhancements for C++ X-SW-Source: 2002-06/txt/msg00447.txt.bz2 List-Id: >Number: 7081 >Category: c++ >Synopsis: DWARF enhancements for C++ >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: change-request >Submitter-Id: net >Arrival-Date: Thu Jun 20 02:16:04 PDT 2002 >Closed-Date: >Last-Modified: >Originator: James Cownie >Release: 3.1 >Organization: Etnus LLC >Environment: System: Linux pc4 2.4.18 #1 Tue Apr 2 10:17:01 BST 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: /home1/GNU/gcc-3.1/configure >Description: 1) g++ emits classes in DWARF with the DW_TAG_structure_type rather than the DW_TAG_class_type which is suggested in the DWARF V3 specification. This makes it hard for a debugger to show the type name correctly since it can't tell whether the class was _really_ introduced by the class or struct keywords. 2) g++ does not emit any debug information for the vtable pointer in classes with virtual functions. It would be much nicer if this information were emitted (tagged with AT_artificial), since it's often very useful to be able to see the vtable pointer while debugging, as that's how one can work out which class an object _actually_ is when one is looking at a base class pointer. >How-To-Repeat: Using code like this #define class_body(classname) \ { \ char * classname##_data; \ public: \ classname () { classname##_data = #classname " data"; } \ virtual char * get_##classname##_data () { return classname##_data; } \ } class A class_body (A); class B class_body (B); class foo: virtual public A, public B class_body (foo); int main (int argc, char **argv) { foo f00; int i = 1; } Compile it and use readelf to look at the dwarf. One can then observe 1) <1>: Abbrev Number: 7 (DW_TAG_structure_type) DW_AT_sibling : <1b3> DW_AT_name : foo DW_AT_byte_size : 20 DW_AT_decl_file : 1 DW_AT_decl_line : 12 DW_AT_containing_type: <2e1> So "foo" is a "struct", not a "class". 2) Eliding the member functions, the contents of class foo are <1>: Abbrev Number: 7 (DW_TAG_structure_type) DW_AT_sibling : <1b3> DW_AT_name : foo DW_AT_byte_size : 20 DW_AT_decl_file : 1 DW_AT_decl_line : 12 DW_AT_containing_type: <2e1> <2>: Abbrev Number: 8 (DW_TAG_inheritance) DW_AT_type : <227> DW_AT_data_member_location: 6 byte block: 12 6 3c 1c 6 22 (DW_OP_dup; DW_OP_deref; DW_OP_lit12; DW_OP_minus; DW_OP_deref; DW_OP_plus; ) DW_AT_virtuality : 1 (virtual) DW_AT_accessibility: 1 (public) <2>: Abbrev Number: 9 (DW_TAG_inheritance) DW_AT_type : <2e1> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0; ) DW_AT_accessibility: 1 (public) <2>: Abbrev Number: 10 (DW_TAG_member) DW_AT_name : foo_data DW_AT_decl_file : 1 DW_AT_decl_line : 12 DW_AT_type : DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8; ) DW_AT_accessibility: 3 (private) So there is no information about the vtable pointer. >Fix: >Release-Note: >Audit-Trail: >Unformatted: