* A few more improvements to gx jit prototype.
[deliverable/binutils-gdb.git] / gdb / solib.c
index 6cf44d2473e7a33b33e2f2c6d025d6553d2d315c..3f6e73002358c6f410de960e056c7eeb866dd791 100644 (file)
@@ -186,8 +186,8 @@ first_link_map_member PARAMS ((void));
 static CORE_ADDR
 locate_base PARAMS ((void));
 
-static void
-solib_map_sections PARAMS ((struct so_list *));
+static int
+solib_map_sections PARAMS ((char *));
 
 #ifdef SVR4_SHARED_LIBS
 
@@ -224,7 +224,7 @@ LOCAL FUNCTION
 
 SYNOPSIS
 
-       static void solib_map_sections (struct so_list *so)
+       static int solib_map_sections (struct so_list *so)
 
 DESCRIPTION
 
@@ -243,10 +243,11 @@ FIXMES
        expansion stuff?).
  */
 
-static void
-solib_map_sections (so)
-     struct so_list *so;
+static int
+solib_map_sections (arg)
+     char *arg;
 {
+  struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
   char *filename;
   char *scratch_pathname;
   int scratch_chan;
@@ -343,6 +344,8 @@ solib_map_sections (so)
 
   /* Free the file names, close the file now.  */
   do_cleanups (old_chain);
+
+  return (1);
 }
 
 #ifndef SVR4_SHARED_LIBS
@@ -986,12 +989,17 @@ find_solib (so_list_ptr)
          target_read_string ((CORE_ADDR) LM_NAME (new), &buffer,
                              MAX_PATH_SIZE - 1, &errcode);
          if (errcode != 0)
-           error ("find_solib: Can't read pathname for load map: %s\n",
-                  safe_strerror (errcode));
+           {
+             warning ("find_solib: Can't read pathname for load map: %s\n",
+                      safe_strerror (errcode));
+             return (so_list_next);
+           }
          strncpy (new -> so_name, buffer, MAX_PATH_SIZE - 1);
          new -> so_name[MAX_PATH_SIZE - 1] = '\0';
          free (buffer);
-         solib_map_sections (new);
+         catch_errors (solib_map_sections, (char *) new,
+                       "Error while mapping shared library sections:\n",
+                       RETURN_MASK_ALL);
        }      
     }
   return (so_list_next);
@@ -1008,7 +1016,7 @@ symbol_add_stub (arg)
 
   if (so -> textsection)
     text_addr = so -> textsection -> addr;
-  else
+  else if (so -> abfd != NULL)
     {
       asection *lowest_sect;
 
@@ -1544,7 +1552,7 @@ enable_break ()
 
         This address is stored on the stack.  However, I've been unable
         to find any magic formula to find it for Solaris (appears to
-        be trivial on Linux).  Therefore, we have to try an alternate
+        be trivial on GNU/Linux).  Therefore, we have to try an alternate
         mechanism to find the dynamic linker's base address.  */
       tmp_bfd = bfd_openr (buf, gnutarget);
       if (tmp_bfd == NULL)
@@ -1602,9 +1610,7 @@ enable_break ()
       /* For whatever reason we couldn't set a breakpoint in the dynamic
         linker.  Warn and drop into the old code.  */
 bkpt_at_symbol:
-      warning ("Unable to find dynamic linker breakpoint function.");
-      warning ("GDB will be unable to debug shared library initializers");
-      warning ("and track explicitly loaded dynamic code.");
+      warning ("Unable to find dynamic linker breakpoint function.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code.");
     }
 #endif
 
@@ -1684,11 +1690,9 @@ FIXME
        Also, what if child has exit()ed?  Must exit loop somehow.
   */
 
-void
+void 
 solib_create_inferior_hook()
 {
-  static int dyn_relocated;
-
   /* If we are using the BKPT_AT_SYMBOL code, then we don't need the base
      yet.  In fact, in the case of a SunOS4 executable being run on
      Solaris, we can't get it yet.  find_solib will get it when it needs
@@ -1707,34 +1711,8 @@ solib_create_inferior_hook()
       return;
     }
 
-  if (!dyn_relocated && exec_bfd->start_address != stop_pc)
-    {
-      /* We have to relocate the debug information.  */
-      CORE_ADDR displacement = stop_pc - exec_bfd->start_address;
-      struct section_offsets *new_offsets;
-      int i;
-
-      new_offsets = alloca (symfile_objfile->num_sections
-                           * sizeof (*new_offsets));
-
-      for (i = 0; i < symfile_objfile->num_sections; ++i)
-       ANOFFSET (new_offsets, i) =
-         ANOFFSET (symfile_objfile->section_offsets, i);
-
-      ANOFFSET (new_offsets, SECT_OFF_TEXT) += displacement;
-      ANOFFSET (new_offsets, SECT_OFF_DATA) += displacement;
-      ANOFFSET (new_offsets, SECT_OFF_BSS) += displacement;
-      ANOFFSET (new_offsets, SECT_OFF_RODATA) += displacement;
-
-      objfile_relocate (symfile_objfile, new_offsets);
-      breakpoint_re_set ();
-
-      /* Make sure this relocation is done only once.  */
-      dyn_relocated = 1;
-    }
-
-#ifndef SVR4_SHARED_LIBS
-  /* Only SunOS needs the loop below, other systems should be using the
+#if !defined(SVR4_SHARED_LIBS) || defined(_SCO_DS)
+  /* SCO and SunOS need the loop below, other systems should be using the
      special shared library breakpoints and the shared library breakpoint
      service routine.
 
@@ -1753,7 +1731,8 @@ solib_create_inferior_hook()
     }
   while (stop_signal != TARGET_SIGNAL_TRAP);
   stop_soon_quietly = 0;
-  
+
+#if !defined(_SCO_DS)
   /* We are now either at the "mapping complete" breakpoint (or somewhere
      else, a condition we aren't prepared to deal with anyway), so adjust
      the PC as necessary after a breakpoint, disable the breakpoint, and
@@ -1772,6 +1751,7 @@ solib_create_inferior_hook()
 
   if (auto_solib_add)
     solib_add ((char *) 0, 0, (struct target_ops *) 0);
+#endif /* ! _SCO_DS */
 #endif
 }
 
This page took 0.025332 seconds and 4 git commands to generate.