Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: ppluzhnikov@google.com (Paul Pluzhnikov)
To: gdb-patches@sourceware.org
Cc: ppluzhnikov@google.com
Subject: [patch] Fix a buglet in maintenance_translate_address()
Date: Wed, 19 Nov 2008 14:06:00 -0000	[thread overview]
Message-ID: <20081118225521.C65783A6B19@localhost> (raw)

Greetings,

Attached patch fixes a buglet I noticed in maintenance_translate_address().

To observe the buglet:

echo "int main() { return 0; }" | gcc -g -xc -
gdb -ex 'set prompt (top) ' --args gdb ./a.out

(top) run
(gdb) break main
Breakpoint 1 at 0x40046c: file <stdin>, line 1.
(gdb) run

Breakpoint 1, main () at <stdin>:1
1       <stdin>: No such file or directory.
        in <stdin>
(gdb) p &main
$1 = (int (*)()) 0x400468 <main>
(gdb) maint translate-address no-such-section 0x400468

Program received signal SIGSEGV, Segmentation fault.
0x00000000004c879a in matching_obj_sections (obj_first=0xa57688, obj_second=0x3256290) at ../../src/gdb/symtab.c:726
726       if (first->owner == NULL || second->owner == NULL)
(top) p first
$1 = (asection *) 0xa58740
(top) p first.owner
$2 = (bfd *) 0xa44e30
(top) p second.owner
Cannot access memory at address 0x2aaaadf090d8

Committed as obvious.

--
Paul Pluzhnikov

2008-11-18  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* maint.c (maintenance_translate_address): Fix a buglet.
	
Index: maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.69
diff -u -p -u -r1.69 maint.c
--- maint.c	18 Nov 2008 21:31:26 -0000	1.69
+++ maint.c	18 Nov 2008 22:45:23 -0000
@@ -473,7 +473,7 @@ maintenance_translate_address (char *arg
 	  break;
       }
 
-      if (!sect)
+      if (!objfile)
 	error (_("Unknown section %s."), arg);
     }
 


                 reply	other threads:[~2008-11-18 22:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20081118225521.C65783A6B19@localhost \
    --to=ppluzhnikov@google.com \
    --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