From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6519 invoked by alias); 2 Feb 2006 19:15:56 -0000 Received: (qmail 6509 invoked by uid 22791); 2 Feb 2006 19:15:55 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 02 Feb 2006 19:15:53 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id 5D25848CE8D for ; Thu, 2 Feb 2006 14:15:50 -0500 (EST) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 27189-01-5 for ; Thu, 2 Feb 2006 14:15:50 -0500 (EST) Received: from takamaka.act-europe.fr (s142-179-108-108.bc.hsia.telus.net [142.179.108.108]) by nile.gnat.com (Postfix) with ESMTP id 04DBA48CE00 for ; Thu, 2 Feb 2006 14:15:50 -0500 (EST) Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 53E3547E7E; Thu, 2 Feb 2006 11:15:49 -0800 (PST) Date: Thu, 02 Feb 2006 19:15:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: [RFA] Verify that address is provided in add-symbol-file command Message-ID: <20060202191549.GK31770@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tsOsTdHNUZQcU9Ye" Content-Disposition: inline User-Agent: Mutt/1.4i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00041.txt.bz2 --tsOsTdHNUZQcU9Ye Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 818 Hello, We have a mysterious crash of our debugger (6.3-based) debugger on hppa-hpux when we did something like this: % gdb (gdb) set confirm off (gdb) add-symbol-file a.o As you see, we forgot to provide the text address where a.o was loaded. The current code verifies that the filename is provided, but doesn't verify that the address is there. This is what the attached does. Otherwise, we ended creating a section_addr_info struct with zero section, and bad things happened. 2005-02-02 Joel Brobecker * symfile.c (add_symbol_file_command): Abort if the user forgot to provide the address when the file has been loaded. For F130-030. Tested on hppa-hpux and x86-linux. No regression. OK to apply? Want a new testcase for it? -- Joel --tsOsTdHNUZQcU9Ye Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="symfile.c.diff" Content-length: 882 Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.166 diff -u -p -r1.166 symfile.c --- symfile.c 1 Feb 2006 23:14:10 -0000 1.166 +++ symfile.c 2 Feb 2006 18:21:11 -0000 @@ -1876,6 +1876,13 @@ add_symbol_file_command (char *args, int argcnt++; } + /* This command takes at least two arguments. The first one is a + filename, and the second is the address where this file has been + loaded. Abort now if this address hasn't been provided by the + user. */ + if (section_index < 1) + error (_("The address where %s has been loaded is missing"), filename); + /* Print the prompt for the query below. And save the arguments into a sect_addr_info structure to be passed around to other functions. We have to split this up into separate print --tsOsTdHNUZQcU9Ye--