Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Verify that address is provided in add-symbol-file command
Date: Thu, 02 Feb 2006 19:15:00 -0000	[thread overview]
Message-ID: <20060202191549.GK31770@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

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  <brobecker@adacore.com>

        * 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

[-- Attachment #2: symfile.c.diff --]
[-- Type: text/plain, Size: 882 bytes --]

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

             reply	other threads:[~2006-02-02 19:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02 19:15 Joel Brobecker [this message]
2006-02-03  1:44 ` Jim Blandy
2006-02-03  3:36   ` Joel Brobecker
2006-02-03 17:07 ` Jim Blandy
2006-02-07 19:03   ` Jim Blandy
2006-02-07 19:40     ` Joel Brobecker

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=20060202191549.GK31770@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sources.redhat.com \
    /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