* target.c: Include "solib.h".
authorUlrich Weigand <uweigand@de.ibm.com>
Sat, 9 Aug 2008 12:15:10 +0000 (12:15 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Sat, 9 Aug 2008 12:15:10 +0000 (12:15 +0000)
(target_pre_inferior): Call no_shared_libraries.
* infcmd.c (run_command_1): Do not call objfile_purge_solibs
or clear_solib.
(attach_command): Do not call clear_solib.

gdb/ChangeLog
gdb/infcmd.c
gdb/target.c

index d6169fa..3dcf5ce 100644 (file)
@@ -1,3 +1,11 @@
+2008-08-09  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * target.c: Include "solib.h".
+       (target_pre_inferior): Call no_shared_libraries.
+       * infcmd.c (run_command_1): Do not call objfile_purge_solibs
+       or clear_solib.
+       (attach_command): Do not call clear_solib.
+
 2008-08-09  Mark Kettenis  <kettenis@gnu.org>
 
        * i386obsd-nat.c (i386obsd_supply_pcb): Supply the right bytes for
index e4198b5..572555c 100644 (file)
@@ -487,11 +487,6 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
      this function should probably be moved into target_pre_inferior.  */
   target_pre_inferior (from_tty);
 
-  /* Purge old solib objfiles. */
-  objfile_purge_solibs ();
-
-  clear_solib ();
-
   /* The comment here used to read, "The exec file is re-read every
      time we do a generic_mourn_inferior, so we just have to worry
      about the symbol file."  The `generic_mourn_inferior' function
@@ -2023,24 +2018,6 @@ attach_command (char *args, int from_tty)
      this function should probably be moved into target_pre_inferior.  */
   target_pre_inferior (from_tty);
 
-  /* Clear out solib state. Otherwise the solib state of the previous
-     inferior might have survived and is entirely wrong for the new
-     target.  This has been observed on GNU/Linux using glibc 2.3. How
-     to reproduce:
-
-     bash$ ./foo&
-     [1] 4711
-     bash$ ./foo&
-     [1] 4712
-     bash$ gdb ./foo
-     [...]
-     (gdb) attach 4711
-     (gdb) detach
-     (gdb) attach 4712
-     Cannot access memory at address 0xdeadbeef
-  */
-  clear_solib ();
-
   if (args)
     {
       async_exec = strip_bg_char (&args);
index 461cfe3..6cda095 100644 (file)
@@ -40,6 +40,7 @@
 #include "exceptions.h"
 #include "target-descriptions.h"
 #include "gdbthread.h"
+#include "solib.h"
 
 static void target_info (char *, int);
 
@@ -1717,6 +1718,24 @@ target_info (char *args, int from_tty)
 void
 target_pre_inferior (int from_tty)
 {
+  /* Clear out solib state. Otherwise the solib state of the previous
+     inferior might have survived and is entirely wrong for the new
+     target.  This has been observed on GNU/Linux using glibc 2.3. How
+     to reproduce:
+
+     bash$ ./foo&
+     [1] 4711
+     bash$ ./foo&
+     [1] 4712
+     bash$ gdb ./foo
+     [...]
+     (gdb) attach 4711
+     (gdb) detach
+     (gdb) attach 4712
+     Cannot access memory at address 0xdeadbeef
+  */
+  no_shared_libraries (NULL, from_tty);
+
   invalidate_target_mem_regions ();
 
   target_clear_description ();