Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] Fix maint translate command
Date: Wed, 01 Sep 2010 08:54:00 -0000	[thread overview]
Message-ID: <002101cb49b3$50d60cd0$f2822670$@muller@ics-cnrs.unistra.fr> (raw)

  '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=src&r1=text&tr1=1.66&r2=text&tr2=1.67&f=u

  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 
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
 
2010-09-01  Pierre Muller  <muller@ics.u-strasbg.fr>

	* maint.c (maintenance_translate_address): Fix search of named section.


Index: src/gdb/maint.c
===================================================================
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 */
 
-      ALL_OBJSECTIONS (objfile, sect)
-      {
-	if (strcmp (sect->the_bfd_section->name, arg) == 0)
-	  break;
-      }
+	fsect = NULL;
 
-      if (!objfile)
-	error (_("Unknown section %s."), arg);
+	ALL_OBJFILES (objfile)
+	  {
+	    ALL_OBJFILE_OSECTIONS (objfile, sect)
+	      {
+		if (strcmp (sect->the_bfd_section->name, arg) == 0)
+		  {
+		    fsect = sect;
+		    break;
+		  }
+	      }
+	    if (fsect)
+	      break;
+	  }
+  
+	if (!fsect)
+	  error (_("Unknown section %s."), arg);
+	else
+	  sect = fsect;
     }
 
   address = parse_and_eval_address (p);


             reply	other threads:[~2010-09-01  8:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01  8:54 Pierre Muller [this message]
2010-09-01 13:39 ` Pedro Alves
2010-09-01 13:49   ` Pierre Muller
2010-09-01 15:25     ` Pedro Alves
2010-09-01 16:07       ` Pedro Alves
2010-09-14 15:14         ` [PING]RE: " Pierre Muller
2010-09-22 18:59           ` Joel Brobecker
2010-09-22 19:23             ` Pedro Alves
2010-09-24 15:55               ` Pedro Alves

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='002101cb49b3$50d60cd0$f2822670$@muller@ics-cnrs.unistra.fr' \
    --to=pierre.muller@ics-cnrs.unistra.fr \
    --cc=gdb-patches@sourceware.org \
    /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