Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] realloc bug in add_symbol_file_command
@ 2006-10-06 14:18 Jean-Marc Saffroy
  2006-10-06 21:27 ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Marc Saffroy @ 2006-10-06 14:18 UTC (permalink / raw)
  To: gdb-patches

Hello,

In gdb 6.5 I had systematic crashes with add-symbol-file: my kernel 
modules have many sections... :) The patch below lets me load many modules 
now.


Cheers,

-- 
saffroy@gmail.com

Index: gdb-6.5/gdb/symfile.c
===================================================================
--- gdb-6.5.orig/gdb/symfile.c	2006-10-06 15:56:41.000000000 +0200
+++ gdb-6.5/gdb/symfile.c	2006-10-06 15:57:52.000000000 +0200
@@ -1852,7 +1852,7 @@
                 to load the program. */
  	    sect_opts[section_index].name = ".text";
  	    sect_opts[section_index].value = arg;
-	    if (++section_index > num_sect_opts)
+	    if (++section_index == num_sect_opts)
  	      {
  		num_sect_opts *= 2;
  		sect_opts = ((struct sect_opt *)
@@ -1888,7 +1888,7 @@
  		    {
  		      sect_opts[section_index].value = arg;
  		      expecting_sec_addr = 0;
-		      if (++section_index > num_sect_opts)
+		      if (++section_index == num_sect_opts)
  			{
  			  num_sect_opts *= 2;
  			  sect_opts = ((struct sect_opt *)


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

* Re: [patch] realloc bug in add_symbol_file_command
  2006-10-06 14:18 [patch] realloc bug in add_symbol_file_command Jean-Marc Saffroy
@ 2006-10-06 21:27 ` Michael Snyder
  2006-10-06 21:59   ` Jean-Marc Saffroy
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2006-10-06 21:27 UTC (permalink / raw)
  To: Jean-Marc Saffroy; +Cc: gdb-patches

On Fri, 2006-10-06 at 16:16 +0200, Jean-Marc Saffroy wrote:
> Hello,
> 
> In gdb 6.5 I had systematic crashes with add-symbol-file: my kernel 
> modules have many sections... :) The patch below lets me load many modules 
> now.

Just to be safe, might you want to use >=?


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

* Re: [patch] realloc bug in add_symbol_file_command
  2006-10-06 21:27 ` Michael Snyder
@ 2006-10-06 21:59   ` Jean-Marc Saffroy
  2006-10-06 23:39     ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Marc Saffroy @ 2006-10-06 21:59 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

On Fri, 6 Oct 2006, Michael Snyder wrote:

> On Fri, 2006-10-06 at 16:16 +0200, Jean-Marc Saffroy wrote:
>> Hello,
>>
>> In gdb 6.5 I had systematic crashes with add-symbol-file: my kernel
>> modules have many sections... :) The patch below lets me load many modules
>> now.
>
> Just to be safe, might you want to use >=?

Do you fear the processor would skip a number when incrementing the 
variable indexing the section array? ;-)

Given the current code, it should not be necessary in any way, but feel 
free to change the patch as you please.


Cheers,

-- 
saffroy@gmail.com


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

* Re: [patch] realloc bug in add_symbol_file_command
  2006-10-06 21:59   ` Jean-Marc Saffroy
@ 2006-10-06 23:39     ` Michael Snyder
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2006-10-06 23:39 UTC (permalink / raw)
  To: Jean-Marc Saffroy; +Cc: gdb-patches

On Fri, 2006-10-06 at 23:57 +0200, Jean-Marc Saffroy wrote:
> On Fri, 6 Oct 2006, Michael Snyder wrote:
> 
> > On Fri, 2006-10-06 at 16:16 +0200, Jean-Marc Saffroy wrote:
> >> Hello,
> >>
> >> In gdb 6.5 I had systematic crashes with add-symbol-file: my kernel
> >> modules have many sections... :) The patch below lets me load many modules
> >> now.
> >
> > Just to be safe, might you want to use >=?
> 
> Do you fear the processor would skip a number when incrementing the 
> variable indexing the section array? ;-)

Yes.  I'm just paranoid that way.   ;-)

> Given the current code, it should not be necessary in any way, but feel 
> free to change the patch as you please.

It was just a suggestion, not a demand.

Anyway, I was going to approve your change, but I see that it's
already in.  Andreas Schwab anticipated you on August 24.   
Great minds think alike.  ;-)



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

end of thread, other threads:[~2006-10-06 23:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-06 14:18 [patch] realloc bug in add_symbol_file_command Jean-Marc Saffroy
2006-10-06 21:27 ` Michael Snyder
2006-10-06 21:59   ` Jean-Marc Saffroy
2006-10-06 23:39     ` Michael Snyder

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