From: "Wu Zhou" <woodzltc@cn.ibm.com>
To: "Daniel Jacobowitz" <drow@false.org>
Cc: <gdb-patches@sources.redhat.com>
Subject: Re: about how to add support to new c++ compiler in GDB
Date: Fri, 29 Apr 2005 07:28:00 -0000 [thread overview]
Message-ID: <02ab01c54c8c$f3e4aeb0$4186b509@ibmcsdl9m89c83> (raw)
In-Reply-To: <012801c54c64$5b02d500$4186b509@ibmcsdl9m89c83>
> 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 : <d71>
next prev parent reply other threads:[~2005-04-29 7:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 2:54 Wu Zhou
2005-04-26 3:18 ` Daniel Jacobowitz
2005-04-26 9:53 ` Wu Zhou
2005-04-26 13:20 ` Daniel Jacobowitz
2005-04-27 20:09 ` Daniel Jacobowitz
[not found] ` <019101c54bc9$20360cd0$4186b509@ibmcsdl9m89c83>
[not found] ` <20050428131902.GB29277@nevyn.them.org>
2005-04-29 2:37 ` Wu Zhou
2005-04-29 7:28 ` Wu Zhou [this message]
2005-04-29 13:10 ` Daniel Jacobowitz
2005-04-28 6:34 woodzltc
2005-05-09 12:42 Wu Zhou
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='02ab01c54c8c$f3e4aeb0$4186b509@ibmcsdl9m89c83' \
--to=woodzltc@cn.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.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