[commit] Don't try to open bad solib paths

Daniel Jacobowitz drow@false.org
Mon Oct 9 20:06:00 GMT 2006


I was reviewing one of Jan's older patches, which showed up as a
segfault based on solib-absolute-prefix settings.  I was curious:
if there was a bad prefix, we thought, then why did anything go so wrong?

  http://sourceware.org/ml/gdb-patches/2006-06/msg00322.html

The answer was that we loaded the shared library ignoring the specified
prefix, and in my case that meant we got the right file after all.  But
we didn't know where it was loaded in memory, so we called the function
at its unrelocated address.

If the first open failed we'd better not try the second one.  I've
committed the attached.

-- 
Daniel Jacobowitz
CodeSourcery

2006-10-09  Daniel Jacobowitz  <dan@codesourcery.com>

	* solib.c (solib_read_symbols): Stop if the file was not found.

Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.84
diff -u -p -r1.84 solib.c
--- solib.c	25 Feb 2006 04:36:39 -0000	1.84
+++ solib.c	9 Oct 2006 19:57:23 -0000
@@ -418,6 +418,11 @@ solib_read_symbols (struct so_list *so, 
       if (from_tty)
 	printf_unfiltered (_("Symbols already loaded for %s\n"), so->so_name);
     }
+  else if (so->abfd == NULL)
+    {
+      if (from_tty)
+	printf_unfiltered (_("Symbol file not found for %s\n"), so->so_name);
+    }
   else
     {
       if (catch_errors (symbol_add_stub, so,



More information about the Gdb-patches mailing list