This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] solib-{svr4,aix5}.c: make bfd_lookup_symbol() notice bfd errors


I've just committed the changes below.  The use of unsigned int to
hold the ``storage_needed'' value was causing GDB to attempt to
allocate a very large amount of memory ((unsigned int) -1) when the
BFD layer was actually signalling an error.

This fixes the out-of-memory problem that I was seeing on Unixware 7
and also cleans up a hack that I had added to solib-aix5.c which I
had previously added to solve the same problem.

	* solib-svr4.c (bfd_lookup_symbol):  Change type of
	``storage_needed'' from unsigned int to long in order to
	match return type of bfd_get_symtab_upper_bound() and
	bfd_get_dynamic_symtab_upper_bound().
	* solib-aix5.c (bfd_lookup_symbol): Likewise.  Also, eliminate
	REASONABLE_LIMIT hack which had been added to work around this
	problem.

Index: solib-aix5.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-aix5.c,v
retrieving revision 1.6
diff -u -p -r1.6 solib-aix5.c
--- solib-aix5.c	2001/03/16 03:52:12	1.6
+++ solib-aix5.c	2001/03/16 18:04:46
@@ -105,7 +105,7 @@ static void aix5_relocate_main_executabl
 static CORE_ADDR
 bfd_lookup_symbol (bfd *abfd, char *symname)
 {
-  unsigned int storage_needed;
+  long storage_needed;
   asymbol *sym;
   asymbol **symbol_table;
   unsigned int number_of_symbols;
@@ -140,10 +140,6 @@ bfd_lookup_symbol (bfd *abfd, char *symn
   /* Look for the symbol in the dynamic string table too.  */
 
   storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
-/* FIXME: This problem should be addressed in BFD.  */
-#define REASONABLE_LIMIT 0x400000
-  if (storage_needed > REASONABLE_LIMIT)
-    storage_needed = REASONABLE_LIMIT;
 
   if (storage_needed > 0)
     {
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.13
diff -u -p -r1.13 solib-svr4.c
--- solib-svr4.c	2001/03/10 06:17:20	1.13
+++ solib-svr4.c	2001/03/16 18:04:48
@@ -364,7 +364,7 @@ static CORE_ADDR bfd_lookup_symbol (bfd 
 static CORE_ADDR
 bfd_lookup_symbol (bfd *abfd, char *symname)
 {
-  unsigned int storage_needed;
+  long storage_needed;
   asymbol *sym;
   asymbol **symbol_table;
   unsigned int number_of_symbols;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]