From: Keith Seitz <keiths@redhat.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: [RFA] Java DWARF fixes (was Re: [RFA] dwarf2_physname FINAL)
Date: Thu, 25 Mar 2010 18:31:00 -0000 [thread overview]
Message-ID: <4BABABE5.8020201@redhat.com> (raw)
In-Reply-To: <201003251020.o2PAKxUe014290@d12av02.megacenter.de.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]
On 03/25/2010 03:20 AM, Ulrich Weigand wrote:
>> I should think so... :-) If maintainers wish it so, it will be done.
>
> I'd appreciate that, thanks!
I've appended this to the attached patch.
>> No, it's not. I have a patch for this, but I've noticed some other
>> little java regressions (which are not tested by the test suite), so I
>> am going to delay submitting my patch until I can get the problems all
>> worked out.
My problems turned out to stem from another GCC debuginfo problem,
described in gcc/43521 (out-of-line debuginfo for class methods does not
mark "this" ptr with DW_AT_artificial).
I've worked around the issue in the attached patch, which should fix all
the problems with Java that the dwarf2_physname patch introduced (or at
least all the problems that anyone has yet noticed :-).
Ok?
Keith
ChangeLog
2010-03-25 Keith Seitz <keiths@redhat.com>
* dwarf2read.c (read_subroutine_type): If the compilation unit
language is Java, mark any formal parameter named "this" as
artificial (GCC/43521).
(dwarf2_name): Add special handling for Java constructors.
testsuite/ChangeLog
2010-03-25 Keith Seitz <keiths@redhat.com>
* gdb.java/jprint.exp: XFAIL printing of static class members
because of GCC debuginfo problem.
[-- Attachment #2: java-dwarf.patch --]
[-- Type: text/plain, Size: 2913 bytes --]
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.372
diff -u -p -r1.372 dwarf2read.c
--- dwarf2read.c 22 Mar 2010 13:21:39 -0000 1.372
+++ dwarf2read.c 25 Mar 2010 18:25:53 -0000
@@ -5932,7 +5932,18 @@ read_subroutine_type (struct die_info *d
if (attr)
TYPE_FIELD_ARTIFICIAL (ftype, iparams) = DW_UNSND (attr);
else
- TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
+ {
+ TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0;
+
+ /* GCC/43521: In java, the formal parameter
+ "this" is sometimes not marked with DW_AT_artificial. */
+ if (cu->language == language_java)
+ {
+ const char *name = dwarf2_name (child_die, cu);
+ if (name && !strcmp (name, "this"))
+ TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 1;
+ }
+ }
TYPE_FIELD_TYPE (ftype, iparams) = die_type (child_die, cu);
iparams++;
}
@@ -9159,6 +9170,34 @@ dwarf2_name (struct die_info *die, struc
/* These tags always have simple identifiers already; no need
to canonicalize them. */
return DW_STRING (attr);
+ case DW_TAG_subprogram:
+ /* Java constructors will all be named "<init>", so return
+ the class name when we see this special case. */
+ if (cu->language == language_java
+ && DW_STRING (attr) != NULL
+ && strcmp (DW_STRING (attr), "<init>") == 0)
+ {
+ struct dwarf2_cu *spec_cu = cu;
+ struct die_info *spec_die;
+
+ /* GCJ will output '<init>' for Java constructor names.
+ For this special case, return the name of the parent class. */
+
+ /* GCJ may output suprogram DIEs with AT_specification set.
+ If so, use the name of the specified DIE. */
+ spec_die = die_specification (die, &spec_cu);
+ if (spec_die != NULL)
+ return dwarf2_name (spec_die, spec_cu);
+
+ do
+ {
+ die = die->parent;
+ if (die->tag == DW_TAG_class_type)
+ return dwarf2_name (die, cu);
+ }
+ while (die->tag != DW_TAG_compile_unit);
+ }
+ /* fall through */
default:
if (!DW_STRING_IS_CANONICAL (attr))
{
Index: testsuite/gdb.java/jprint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.java/jprint.exp,v
retrieving revision 1.12
diff -u -p -r1.12 jprint.exp
--- testsuite/gdb.java/jprint.exp 9 Mar 2010 18:08:05 -0000 1.12
+++ testsuite/gdb.java/jprint.exp 25 Mar 2010 18:25:53 -0000
@@ -86,5 +86,8 @@ if ![set_lang_java] then {
gdb_test "call x.addk(44)" "adding k gives 121\r\n.*= 121.*" "inherited virtual fn call"
# Regression test for a crasher.
+ # GCC does not output location information for static class members,
+ # so GDB will report these as "optimized out". See gcc/43260.
+ setup_xfail *-*-* gcc/43260
gdb_test "print *jprint.props" " = .*" "print a java.util.Properties"
}
next prev parent reply other threads:[~2010-03-25 18:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 22:52 [RFA] dwarf2_physname FINAL Keith Seitz
2010-03-05 21:54 ` Tom Tromey
2010-03-05 22:12 ` Keith Seitz
2010-03-08 6:18 ` Joel Brobecker
2010-03-09 18:10 ` Keith Seitz
2010-03-10 8:11 ` [commit/dwarf2/Ada] Adjust handling of Ada DIEs after dwarf2_physname patch Joel Brobecker
2010-03-23 20:25 ` [RFA] dwarf2_physname FINAL Ulrich Weigand
2010-03-24 20:24 ` Keith Seitz
2010-03-25 10:21 ` Ulrich Weigand
2010-03-25 18:31 ` Keith Seitz [this message]
2010-03-25 20:05 ` [RFA] Java DWARF fixes Tom Tromey
2010-03-25 22:14 ` Keith Seitz
2010-03-26 16:48 ` Ulrich Weigand
2010-03-26 16:54 ` Keith Seitz
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=4BABABE5.8020201@redhat.com \
--to=keiths@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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