From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25081 invoked by alias); 6 May 2002 19:33:57 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 25074 invoked from network); 6 May 2002 19:33:56 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sources.redhat.com with SMTP; 6 May 2002 19:33:56 -0000 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 174oFA-0006lm-00 for ; Mon, 06 May 2002 15:33:56 -0400 Date: Mon, 06 May 2002 12:33:00 -0000 From: Daniel Jacobowitz To: Gdb List Subject: Re: question about method naming Message-ID: <20020506193356.GA25574@nevyn.them.org> Mail-Followup-To: Gdb List References: <87u1pl6u33.fsf@creche.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87u1pl6u33.fsf@creche.redhat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-05/txt/msg00045.txt.bz2 On Mon, May 06, 2002 at 11:53:52AM -0600, Tom Tromey wrote: > I compiled the appended code with `gcj -g'. I'm using the trunk cvs > gcj. Then I ran gdb on the program. > > If I type: > > b x.main > > gdb tells me that there is no such method. Are you working on a very current gcj? I.E. one that defaults to DWARF-2 output? I observe the same thing in 3.0.4 with -gdwarf-2, but not with -gstabs+. In this version, the stabs debug info claims that 'class x' has a member function 'main'. In DWARF-2 it claims that 'class x' has a member function 'x.main(java.lang.String[])'. If this is still the case in your compiler (check readelf -w output, search for a DW_TAG_subprogram whose name contains main) then I believe it is a gcj bug. <2><16d>: Abbrev Number: 4 (DW_TAG_subprogram) DW_AT_sibling : <1c4> DW_AT_external : 1 DW_AT_name : x.main(java.lang.String[]) DW_AT_decl_file : 1 DW_AT_decl_line : 458756 DW_AT_MIPS_linkage_name: _ZN1x4mainEP6JArrayIPN4java4lang6StringEE DW_AT_declaration : 1 Also amusing: <2><1c4>: Abbrev Number: 6 (DW_TAG_subprogram) DW_AT_external : 1 DW_AT_name : () DW_AT_MIPS_linkage_name: _ZN1xC1Ev DW_AT_artificial : 1 DW_AT_declaration : 1 The constructor's name is obviously wrong... > > I tracked the problem down to linespec.c:find_methods(). > > Here we end up in the loop, and method_name for the 0th method is: > > (gdb) p method_name > $27 = 0x83e9a52 "x.main(java.lang.String[])" > > So of course we fail to match this against "main". > > Is this a gdb bug or a gcj bug? Or just a disagreement? > > I'm guessing that method_name should not be fully qualified. > Is that correct? I believe so. > > Tom > > public class x > { > public static void main (String[] args) > { > char c = args[0].charAt(0); > System.out.println(c); > } > } > -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer