From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7338 invoked by alias); 18 Nov 2008 22:56:02 -0000 Received: (qmail 7249 invoked by uid 22791); 18 Nov 2008 22:56:01 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 18 Nov 2008 22:55:26 +0000 Received: from zps18.corp.google.com (zps18.corp.google.com [172.25.146.18]) by smtp-out.google.com with ESMTP id mAIMtOpH007856 for ; Tue, 18 Nov 2008 14:55:24 -0800 Received: from localhost (elbrus.corp.google.com [172.18.116.17]) by zps18.corp.google.com with ESMTP id mAIMtLWZ000702; Tue, 18 Nov 2008 14:55:22 -0800 Received: by localhost (Postfix, from userid 74925) id C65783A6B19; Tue, 18 Nov 2008 14:55:21 -0800 (PST) To: gdb-patches@sourceware.org Cc: ppluzhnikov@google.com Subject: [patch] Fix a buglet in maintenance_translate_address() Message-Id: <20081118225521.C65783A6B19@localhost> Date: Wed, 19 Nov 2008 14:06:00 -0000 From: ppluzhnikov@google.com (Paul Pluzhnikov) X-IsSubscribed: yes 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: 2008-11/txt/msg00491.txt.bz2 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 , line 1. (gdb) run Breakpoint 1, main () at :1 1 : No such file or directory. in (gdb) p &main $1 = (int (*)()) 0x400468
(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 * 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); }