Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Verify that address is provided in add-symbol-file command
@ 2006-02-02 19:15 Joel Brobecker
  2006-02-03  1:44 ` Jim Blandy
  2006-02-03 17:07 ` Jim Blandy
  0 siblings, 2 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-02-02 19:15 UTC (permalink / raw)
  To: gdb-patches

[-- 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Verify that address is provided in add-symbol-file command
  2006-02-02 19:15 [RFA] Verify that address is provided in add-symbol-file command Joel Brobecker
@ 2006-02-03  1:44 ` Jim Blandy
  2006-02-03  3:36   ` Joel Brobecker
  2006-02-03 17:07 ` Jim Blandy
  1 sibling, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2006-02-03  1:44 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 2/2/06, Joel Brobecker <brobecker@adacore.com> wrote:
> 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.

What's the F130-030?

Assume it's a bug report identifier: I could be persuaded, but I'm not
too keen on including values indexing proprietory bug databases in the
public ChangeLog.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Verify that address is provided in add-symbol-file command
  2006-02-03  1:44 ` Jim Blandy
@ 2006-02-03  3:36   ` Joel Brobecker
  0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-02-03  3:36 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

> > 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.
> 
> What's the F130-030?
> 
> Assume it's a bug report identifier: I could be persuaded, but I'm not
> too keen on including values indexing proprietory bug databases in the
> public ChangeLog.

I'm sorry, it's a copy/paste error. It shouldn't be in the public
ChangeLog, of course! It wouldn't make any sense.

Thanks for spotting this.
-- 
Joel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Verify that address is provided in add-symbol-file command
  2006-02-02 19:15 [RFA] Verify that address is provided in add-symbol-file command Joel Brobecker
  2006-02-03  1:44 ` Jim Blandy
@ 2006-02-03 17:07 ` Jim Blandy
  2006-02-07 19:03   ` Jim Blandy
  1 sibling, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2006-02-03 17:07 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 2/2/06, Joel Brobecker <brobecker@adacore.com> wrote:
> 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.

Seems obvious to me.  The documentation says an address is required.

> Want a new testcase for it?

I don't think it's too important.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Verify that address is provided in add-symbol-file command
  2006-02-03 17:07 ` Jim Blandy
@ 2006-02-07 19:03   ` Jim Blandy
  2006-02-07 19:40     ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Blandy @ 2006-02-07 19:03 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 2/3/06, Jim Blandy <jimb@red-bean.com> wrote:
> On 2/2/06, Joel Brobecker <brobecker@adacore.com> wrote:
> > 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.

I approve of this change; please commit.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFA] Verify that address is provided in add-symbol-file command
  2006-02-07 19:03   ` Jim Blandy
@ 2006-02-07 19:40     ` Joel Brobecker
  0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2006-02-07 19:40 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

> > > 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.
> 
> I approve of this change; please commit.

Thanks Jim. Checked in.

-- 
Joel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-07 19:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-02 19:15 [RFA] Verify that address is provided in add-symbol-file command Joel Brobecker
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox