From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10468 invoked by alias); 25 Jun 2010 08:33:22 -0000 Received: (qmail 10454 invoked by uid 22791); 25 Jun 2010 08:33:21 -0000 X-SWARE-Spam-Status: No, hits=0.3 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,RCVD_IN_JMF_BL X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Jun 2010 08:33:16 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o5P8WqiG054117 ; Fri, 25 Jun 2010 10:32:52 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms8.u-strasbg.fr [IPv6:2001:660:2402:d::17]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o5P8WpCM007889 ; Fri, 25 Jun 2010 10:32:51 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id o5P8WnXi008579 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Fri, 25 Jun 2010 10:32:51 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Joel Brobecker'" , Cc: References: <1276813536-31761-1-git-send-email-brobecker@adacore.com> In-Reply-To: <1276813536-31761-1-git-send-email-brobecker@adacore.com> Subject: RE: [RFA/commit/Win64] Remove new extra leading underscore in symbol name Date: Fri, 25 Jun 2010 08:33:00 -0000 Message-ID: <001801cb1441$078b23a0$16a16ae0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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-06/txt/msg00572.txt.bz2 Why don't you simply use bfd_get_symbol_leading_char function=20 or use EXTERNAL_NAME macro defined line 65 in coffread.C to remove the extra underscore? Pierre Muller > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Joel Brobecker > Envoy=E9=A0: Friday, June 18, 2010 12:26 AM > =C0=A0: gdb-patches@sourceware.org > Cc=A0: ktietz70@googlemail.com; Joel Brobecker > Objet=A0: [RFA/commit/Win64] Remove new extra leading underscore in > symbol name >=20 > For any Ada program, the debugger no longer finds the right routine as > the main subprogram when using the "start" command. For instance: >=20 > % gdb simple_main > (gdb) start > [...] > Temporary breakpoint 1, main (argc=3D1, argv=3D(system.address) > 0x232470, [...] > ^^^^ >=20 > The expected behavior is to stop in the Ada main program: >=20 > (gdb) start > [...] > Temporary breakpoint 1, simple_main () at simple_main.adb:4 > 4 simple.test_simple; >=20 > The problem was introduced, I believe, by a patch in bfd causing > the names in the symbol table to now have a leading underscore: >=20 > Adjust calling convention of x64 windows to non-leading underscore > http://www.sourceware.org/ml/binutils/2010-04/msg00354.html >=20 > In the case of the "start" command, the search for the name of the > main subprogram requires GDB to find the __gnat_ada_main_program_name > symbol. But since the patch above got applied, GDB now sees that > (minimal) symbol as ___gnat_ada_main_program_name (extra leading > underscore). >=20 > Other consequences of that change of behavior: >=20 > - Ada tasking support is broken, since it relies on other known > symbol names; >=20 > - minimal symbol and symbols from debug info has non-matching names; > I would think that some parts of GDB's code make the assumption > that these names match, at least for C, but I might be > unnecessarily > pessimistic. >=20 > This patch changes the COFF reader such that, for COFF/PE64, we discard > the leading underscore. >=20 > 2010-06-17 Joel Brobecker >=20 > gdb/ > * coffread.c (getsymname): Skip the leading underscore on pe64. >=20 > Tested on x64-windows with AdaCore's testsuite (we do a MinGW build). > I'd like to commit a fix before 7.2. >=20 > Kai's input would be greatly appreciated, as he probably knows Windows > a thousand times better than I do. >=20 > --- > gdb/coffread.c | 14 ++++++++++++++ > 1 files changed, 14 insertions(+), 0 deletions(-) >=20 > diff --git a/gdb/coffread.c b/gdb/coffread.c > index 52417b2..4ab0640 100644 > --- a/gdb/coffread.c > +++ b/gdb/coffread.c > @@ -1256,6 +1256,9 @@ getsymname (struct internal_syment *symbol_entry) > { > static char buffer[SYMNMLEN + 1]; > char *result; > + const char *target =3D bfd_get_target (symfile_bfd); > + const int is_pe64 =3D (strcmp (target, "pe-x86-64") =3D=3D 0 > + || strcmp (target, "pei-x86-64") =3D=3D 0); >=20 > if (symbol_entry->_n._n_n._n_zeroes =3D=3D 0) > { > @@ -1269,6 +1272,17 @@ getsymname (struct internal_syment > *symbol_entry) > buffer[SYMNMLEN] =3D '\0'; > result =3D buffer; > } > + > + /* On x64-windows, an extra leading underscore is usually added to > + the symbol name. However, the name provided in the associated > + debug information does not include that underscore. So remove it > + now, to make the two names match. > + > + This is also useful for code that searches the minimal symbols > + for a specific symbol whose name should be target-independent. > */ > + if (is_pe64 && result[0] =3D=3D '_') > + result++; > + > return result; > } >=20 > -- > 1.7.1