This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

[commit] Fix crash when setting solib-search-path


I have checked in the attached patch. It was originally posted
over a year ago:

	http://sourceware.org/ml/gdb-patches/2008-02/msg00465.html

and approved in:

	http://sourceware.org/ml/gdb-patches/2008-03/msg00297.html

It still applies, and causes no change in test results.

- Volodya

? commit_1.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.10232
diff -u -p -r1.10232 ChangeLog
--- ChangeLog	9 Mar 2009 05:35:56 -0000	1.10232
+++ ChangeLog	9 Mar 2009 13:16:08 -0000
@@ -1,3 +1,9 @@
+2008-03-09  Vladimir Prus  <vladimir@codesourcery.com>
+
+       * solib.c (reload_shared_libraries): Give
+       inferior a chance to reset solib breakpoint.
+       Reinit frame cache.
+
 2009-03-08  Christopher Faylor  <me+cygwin@cgf.cx>
 
 	* windows-nat.c (dr): Redefine to use largest possible integer which
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.113
diff -u -p -r1.113 solib.c
--- solib.c	6 Mar 2009 18:51:05 -0000	1.113
+++ solib.c	9 Mar 2009 13:16:08 -0000
@@ -1015,6 +1015,28 @@ reload_shared_libraries (char *ignored, 
 {
   no_shared_libraries (NULL, from_tty);
   solib_add (NULL, from_tty, NULL, auto_solib_add);
+  /* Creating inferior hooks here has two purposes. First, if we reload 
+     shared libraries then the address of solib breakpoint we've computed
+     previously might be no longer valid.  For example, if we forgot to set
+     solib-absolute-prefix and are setting it right now, then the previous
+     breakpoint address is plain wrong.  Second, installing solib hooks
+     also implicitly figures were ld.so is and loads symbols for it.
+     Absent this call, if we've just connected to a target and set 
+     solib-absolute-prefix or solib-search-path, we'll lose all information
+     about ld.so.  */
+  if (target_has_execution)
+    {
+#ifdef SOLIB_CREATE_INFERIOR_HOOK
+      SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
+#else
+      solib_create_inferior_hook ();
+#endif
+    }
+  /* We have unloaded and then reloaded debug info for all shared libraries.
+     However, frames may still reference them, for example a frame's 
+     unwinder might still point of DWARF FDE structures that are now freed.
+     Reinit frame cache to avoid crashing.  */
+  reinit_frame_cache ();
 }
 
 static void

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