import gdb-1999-06-28 snapshot
[deliverable/binutils-gdb.git] / gdb / solib.c
index aa2dd46ab13462a913397991f5c0ddc222b59804..2bd8a2ec79412e844162f94b2908f0b463497397 100644 (file)
@@ -1306,11 +1306,35 @@ solib_address (address)
 /* Called by free_all_symtabs */
 
 void 
-clear_solib()
+clear_solib ()
 {
   struct so_list *next;
   char *bfd_filename;
 
+  /* This function is expected to handle ELF shared libraries.  It is
+     also used on Solaris, which can run either ELF or a.out binaries
+     (for compatibility with SunOS 4), both of which can use shared
+     libraries.  So we don't know whether we have an ELF executable or
+     an a.out executable until the user chooses an executable file.
+
+     ELF shared libraries don't get mapped into the address space
+     until after the program starts, so we'd better not try to insert
+     breakpoints in them immediately.  We have to wait until the
+     dynamic linker has loaded them; we'll hit a bp_shlib_event
+     breakpoint (look for calls to create_solib_event_breakpoint) when
+     it's ready.
+
+     SunOS shared libraries seem to be different --- they're present
+     as soon as the process begins execution, so there's no need to
+     put off inserting breakpoints.  There's also nowhere to put a
+     bp_shlib_event breakpoint, so if we put it off, we'll never get
+     around to it.
+
+     So: disable breakpoints only if we're using ELF shared libs.  */
+  if (exec_bfd != NULL
+      && bfd_get_flavour (exec_bfd) != bfd_target_aout_flavour)
+    disable_breakpoints_in_shlibs (1);
+
   while (so_list_head)
     {
       if (so_list_head -> sections)
This page took 0.02326 seconds and 4 git commands to generate.