From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11020 invoked by alias); 29 Apr 2005 07:28:46 -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 10882 invoked from network); 29 Apr 2005 07:28:33 -0000 Received: from unknown (HELO ausmtp01.au.ibm.com) (202.81.18.186) by sourceware.org with SMTP; 29 Apr 2005 07:28:33 -0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp01.au.ibm.com (8.12.10/8.12.10) with ESMTP id j3T7UY4q305442 for ; Fri, 29 Apr 2005 17:30:38 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.250.237]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j3T7Uw1t045604 for ; Fri, 29 Apr 2005 17:30:58 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.12.11/8.13.3) with ESMTP id j3T7SDcR003394 for ; Fri, 29 Apr 2005 17:28:13 +1000 Received: from ibmcsdl9m89c83 (ibmcsdl-9m89c83.cn.ibm.com [9.181.134.65]) by d23av04.au.ibm.com (8.12.11/8.12.11) with SMTP id j3T7S9wG003321; Fri, 29 Apr 2005 17:28:12 +1000 Message-ID: <02ab01c54c8c$f3e4aeb0$4186b509@ibmcsdl9m89c83> From: "Wu Zhou" To: "Daniel Jacobowitz" Cc: References: <001f01c54a0b$146e8450$7286b509@ibmcsdl9m89c83> <20050426031822.GA4998@nevyn.them.org> <20050427200901.GA25180@nevyn.them.org> <019101c54bc9$20360cd0$4186b509@ibmcsdl9m89c83> <20050428131902.GB29277@nevyn.them.org> <012801c54c64$5b02d500$4186b509@ibmcsdl9m89c83> Subject: Re: about how to add support to new c++ compiler in GDB Date: Fri, 29 Apr 2005 07:28:00 -0000 X-SW-Source: 2005-04/txt/msg00418.txt.bz2 > BTW. I had verify your patch, It did worked. No SEGV error any more. > Althought there are still some error, most of them should be XLC specific I > believe. I could work with XLC guys to improve them. Daniel, after playing with your patch for some more time, I had the following questions. Would you please answer these? Thanks a lot! 1. Could you please add the following code to let GDB get the vtable pointer from XLC-generated code? --- dwarf2read.c 2005-04-29 07:49:59.070865984 -0700 +++ dwarf2read.c.zw 2005-04-29 07:53:05.715856648 -0700 @@ -4031,6 +4031,28 @@ } } } + else if (cu->producer + && strncmp (cu->producer, + "IBM(R) XL C/C++ Advanced Edition V7.0 for Linux(R)", 50) == 0) + { + /* The IBM XLC compiler does not provide direct indication + of the containing type, but the vtable pointer is + always named __vfp. */ + + int i; + + for (i = TYPE_NFIELDS (type) - 1; + i >= TYPE_N_BASECLASSES (type); + --i) + { + if (strcmp (TYPE_FIELD_NAME (type, i), "__vfp") == 0) + { + TYPE_VPTR_FIELDNO (type) = i; + TYPE_VPTR_BASETYPE (type) = type; + break; + } + } + } } do_cleanups (back_to); 2. I am curious about how your code skip the vtable pointer while printing out the definition of a virtual class. As I understand this, there should be some code in function c_type_print_base to skip member named "__vptr", just like how the following code skip "_vptr.CLASSNAME": if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0 && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5])) continue; To make it more general, I am now thinking of adding the following code to achieve this: if (i == TYPE_VPTR_FIELDNO(type) && type == TYPE_VPTR_BASETYPE (type)) continue; Do you think that it make any sense? 3. After applying your patch and running gdb testsuite against IBM's xlc++ compiler, I found a strange behavior: GDB can't print out the virtual modifier of any class's virtual function. To name an example, the class VB in virtfunc.cc is defined as below: class VB { public: int vb; int fvb(); virtual int vvb(); }; "ptype VB" will output the following: type = class VB { public: int vb; int fvb(); int vvb(); } The debuginfo for function vvb is attached below, wishing that it could help identify the cause. Thanks. <2><2fb>: Abbrev Number: 12 (DW_TAG_subprogram) DW_AT_sibling : <325> DW_AT_name : vvb DW_AT_accessibility: 1 (public) DW_AT_declaration : 1 DW_AT_type : <235> DW_AT_virtuality : 1 (virtual) DW_AT_vtable_elem_location: 5 byte block: 23 0 6 23 4 (DW_OP_plus_uconst: 0; DW_OP_deref; DW_OP_plus_uconst: 4) DW_AT_MIPS_linkage_name: _ZN2VB3vvbEv <3><31e>: Abbrev Number: 11 (DW_TAG_formal_parameter) DW_AT_artificial : 1 DW_AT_type :