* [RFC] GDB prints internal error with C++ application produced by XLC.
@ 2005-04-14 1:38 Manoj Iyer
2005-04-14 3:08 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Manoj Iyer @ 2005-04-14 1:38 UTC (permalink / raw)
To: gdb-patches
I submitted this patch to the list almost a month ago, I got good feed
back from other maintainers/developers (Daniel, Joel) but I have not got
any feed back/acceptance from the Dwarf maintainer, I have pinged the
dwarf maintainer numerous times for a response. Is there any super
maintainer who can review & approve my patch? Or shall I just commit it if
I dont get any response saying otherwise in 2 weeks? Please see below for
the details of this patch...
GDB prints internal error with C++ application produced by XLC.
=============== Test Case ========================
/* This testcase written by Lu Yang <luyang@ca.ibm.com> */
template<class T> class X;
template <class T>
class Y {
friend class X<T>;
public:
T f();
};
template <class T>
class X {
public:
friend inline T Y<T>::f();
static T a;
};
template <class T> inline T Y<T>::f() {return X<T>::a;}
template<> int X<int>::a =5;
int main() {
Y<int> obj;
if (obj.f() == 5)
return 55;
else
return 66;
}
====================== End Test Case =====================
When the above testcase is compiled -m64 by XLC, GDB generates an internal
error:
"internal-error: could not find partial DIE in cache"
GCC creates a DWARF TAG for "a" as DW_TAG_variable and XLC creates
DW_TAG_member. GDB throws away TAGS that it find as uninteresting. In this
case DW_TAG_member. (this is in dwarf2read.c function:
load_partial_dies(). )
GCC created DWARF information
-------------------------------
<2><102>: Abbrev Number: 13 (DW_TAG_variable)
DW_AT_name : a
DW_AT_decl_file : 1
DW_AT_decl_line : 13
DW_AT_MIPS_linkage_name: _ZN1XIiE1aE
DW_AT_type : <d5>
DW_AT_external : 1
DW_AT_declaration : 1
XLC created DWARF information
------------------------------
<2><96>: Abbrev Number: 5 (DW_TAG_member)
DW_AT_name : a
DW_AT_accessibility: 1 (public)
DW_AT_declaration : 1
DW_AT_type : <78>
GCC in this case is producing wrong information. According to DWARF
spec:
" If the variable entry represents the defining declaration for a C++
static data member of a structure, class or union, the entry has a
DW_AT_specification attribute, whose value is a reference to the debugging
information entry representing the declaration of this data member. The
referenced entry has the tag DW_TAG_member and will be a child of some
class, structure or union type entry. "
So I think GDB needs to handle the DW_TAG_member and not skip it, when
dealing with C++.
Here is a patch to GDB that will fix this problem
================ Patch to gdb ==================
2005-02-15 Manoj Iyer <manjo@austin.ibm.com>
* dwarf2read.c (load_partial_dies): Save DIE with tag
DW_TAG_member, generated by XLC when compiling C++ application.
diff -Naur ./old/src/gdb/dwarf2read.c ./new/src/gdb/dwarf2read.c
--- ./old/src/gdb/dwarf2read.c 2005-02-15 11:13:05.000000000 -0600
+++ ./new/src/gdb/dwarf2read.c 2005-02-22 10:24:08.000000000 -0600
@@ -5167,7 +5167,8 @@
&& abbrev->tag != DW_TAG_enumerator
&& abbrev->tag != DW_TAG_subprogram
&& abbrev->tag != DW_TAG_variable
- && abbrev->tag != DW_TAG_namespace)
+ && abbrev->tag != DW_TAG_namespace
+ && abbrev->tag != DW_TAG_member)
{
/* Otherwise we skip to the next sibling, if any. */
info_ptr = skip_one_die (info_ptr + bytes_read, abbrev, cu);
========================= END PATCH ======================
ok to commit? Or If I dont get any negative response within 2 weeks or so
shall I commit it anyway?
Thanks
-----
manjo
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Cogito ergo sum +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC] GDB prints internal error with C++ application produced by XLC.
2005-04-14 1:38 [RFC] GDB prints internal error with C++ application produced by XLC Manoj Iyer
@ 2005-04-14 3:08 ` Daniel Jacobowitz
2005-04-14 3:09 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-04-14 3:08 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb-patches
On Wed, Apr 13, 2005 at 09:12:26PM -0500, Manoj Iyer wrote:
> Or If I dont get any negative response within 2 weeks or so
> shall I commit it anyway?
No, don't do that.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] GDB prints internal error with C++ application produced by XLC.
2005-04-14 3:08 ` Daniel Jacobowitz
@ 2005-04-14 3:09 ` Daniel Jacobowitz
2005-04-14 16:15 ` Manoj Iyer
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-04-14 3:09 UTC (permalink / raw)
To: Manoj Iyer, gdb-patches
On Wed, Apr 13, 2005 at 11:08:32PM -0400, Daniel Jacobowitz wrote:
> On Wed, Apr 13, 2005 at 09:12:26PM -0500, Manoj Iyer wrote:
> > Or If I dont get any negative response within 2 weeks or so
> > shall I commit it anyway?
>
> No, don't do that.
By the way, I have since posted a more complete patch which should
obsolete this one. If you'd like, you could try it on your test.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC] GDB prints internal error with C++ application produced by XLC.
2005-04-14 3:09 ` Daniel Jacobowitz
@ 2005-04-14 16:15 ` Manoj Iyer
0 siblings, 0 replies; 4+ messages in thread
From: Manoj Iyer @ 2005-04-14 16:15 UTC (permalink / raw)
To: gdb-patches
Daniel,
> > No, don't do that.
Ok, that is good to know... :-)
> By the way, I have since posted a more complete patch which should
> obsolete this one. If you'd like, you could try it on your test.
Which is fine by me, coz all I wanted was to see a fix for that error
message. Did you include my patch in yours? Coz I remember a conversation
where u had mentioned that you were waiting for my patch to makeit into
the source base.
Thanks
Manjo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-04-14 16:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-14 1:38 [RFC] GDB prints internal error with C++ application produced by XLC Manoj Iyer
2005-04-14 3:08 ` Daniel Jacobowitz
2005-04-14 3:09 ` Daniel Jacobowitz
2005-04-14 16:15 ` Manoj Iyer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox