From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24126 invoked by alias); 1 Sep 2010 08:54:57 -0000 Received: (qmail 24118 invoked by uid 22791); 1 Sep 2010 08:54:56 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT,TW_BJ X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Sep 2010 08:54:49 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o818sfBa023858 for ; Wed, 1 Sep 2010 10:54:41 +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 md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id o818seuU044796 for ; Wed, 1 Sep 2010 10:54:40 +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 o818sdko027275 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Wed, 1 Sep 2010 10:54:40 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFA] Fix maint translate command Date: Wed, 01 Sep 2010 08:54:00 -0000 Message-ID: <002101cb49b3$50d60cd0$f2822670$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" 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-09/txt/msg00008.txt.bz2 'maint translate .text 0xXXXX' failed saying that Unknown section .text. This problem is due to the introduction of the macro ALL_OBJSECTIONS (objfile, sect) in revision 1.67 of maint.c: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/maint.c.diff?cvsroot=3Dsrc= &r1=3Dtext&tr1=3D1.66&r2=3Dtext&tr2=3D1.67&f=3Du ALL_OBJSECTIONS is a double for loop, thus the 'break' statement was only exiting the first loop, but the second loop was still continuing, leading to=20 a false error. Another option would be to simply revert that commit, as the former code probably was working correctly and is as nice as what I propose here. Checked on x86_64-unknown-linux-gnu (Compile Farm), no regression found. Pierre Muller Pascal language support maintainer for GDB projecttype:gdb revision:HEAD email:muller@ics.u-strasbg.fr =20 2010-09-01 Pierre Muller * maint.c (maintenance_translate_address): Fix search of named section. Index: src/gdb/maint.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/maint.c,v retrieving revision 1.79 diff -u -p -r1.79 maint.c --- src/gdb/maint.c 1 Jul 2010 15:36:16 -0000 1.79 +++ src/gdb/maint.c 1 Sep 2010 07:43:56 -0000 @@ -452,7 +452,7 @@ static void maintenance_translate_address (char *arg, int from_tty) { CORE_ADDR address; - struct obj_section *sect; + struct obj_section *sect, *fsect; char *p; struct minimal_symbol *sym; struct objfile *objfile; @@ -473,14 +473,26 @@ maintenance_translate_address (char *arg while (isspace (*p)) p++; /* Skip whitespace */ =20 - ALL_OBJSECTIONS (objfile, sect) - { - if (strcmp (sect->the_bfd_section->name, arg) =3D=3D 0) - break; - } + fsect =3D NULL; =20 - if (!objfile) - error (_("Unknown section %s."), arg); + ALL_OBJFILES (objfile) + { + ALL_OBJFILE_OSECTIONS (objfile, sect) + { + if (strcmp (sect->the_bfd_section->name, arg) =3D=3D 0) + { + fsect =3D sect; + break; + } + } + if (fsect) + break; + } +=20=20 + if (!fsect) + error (_("Unknown section %s."), arg); + else + sect =3D fsect; } =20 address =3D parse_and_eval_address (p);