From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25523 invoked by alias); 25 Mar 2010 18:31:18 -0000 Received: (qmail 25510 invoked by uid 22791); 25 Mar 2010 18:31:17 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Mar 2010 18:31:09 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2PIV6ON023955 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 Mar 2010 14:31:06 -0400 Received: from [IPv6:::1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2PIV1Dw018104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Mar 2010 14:31:04 -0400 Message-ID: <4BABABE5.8020201@redhat.com> Date: Thu, 25 Mar 2010 18:31:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc11 Lightning/1.0b1 Thunderbird/3.0.3 MIME-Version: 1.0 To: Ulrich Weigand CC: gdb-patches@sourceware.org Subject: [RFA] Java DWARF fixes (was Re: [RFA] dwarf2_physname FINAL) References: <201003251020.o2PAKxUe014290@d12av02.megacenter.de.ibm.com> In-Reply-To: <201003251020.o2PAKxUe014290@d12av02.megacenter.de.ibm.com> Content-Type: multipart/mixed; boundary="------------070200080807010806050305" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00854.txt.bz2 This is a multi-part message in MIME format. --------------070200080807010806050305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1259 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 * 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 * gdb.java/jprint.exp: XFAIL printing of static class members because of GCC debuginfo problem. --------------070200080807010806050305 Content-Type: text/plain; name="java-dwarf.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="java-dwarf.patch" Content-length: 2913 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 "", so return + the class name when we see this special case. */ + if (cu->language == language_java + && DW_STRING (attr) != NULL + && strcmp (DW_STRING (attr), "") == 0) + { + struct dwarf2_cu *spec_cu = cu; + struct die_info *spec_die; + + /* GCJ will output '' 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" } --------------070200080807010806050305--