[patch] realloc bug in add_symbol_file_command

Jean-Marc Saffroy
2006-10-06T14:18:19Z

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 *)