* infrun.c (normal_stop): Don't call
[deliverable/binutils-gdb.git] / gdb / solib-pa64.c
index 599f3f305f685b207aef250c28c5ce4af8679722..98ee07038a1574684938b48bb11f9ac17486155b 100644 (file)
@@ -1,6 +1,6 @@
 /* Handle PA64 shared libraries for GDB, the GNU Debugger.
 
-   Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
 #include "hppa-tdep.h"
 #include "solist.h"
+#include "solib.h"
 #include "solib-pa64.h"
 
 #undef SOLIB_PA64_DBG
 
-/* If we are building for a SOM-only target, then we don't need this.  */
-#ifndef PA_SOM_ONLY
+/* We can build this file only when running natively on 64-bit HP/UX.
+   We check for that by checking for the elf_hp.h header file.  */
+#if defined(HAVE_ELF_HP_H) && defined(__LP64__)
 
 /* FIXME: kettenis/20041213: These includes should be eliminated.  */
 #include <dlfcn.h>
@@ -123,8 +125,8 @@ pa64_target_read_memory (void *buffer, CORE_ADDR ptr, size_t bufsiz, int ident)
 
    This must happen after dld starts running, so we can't do it in
    read_dynamic_info.  Record the fact that we have loaded the
-   descriptor.  If the library is archive bound, then return zero, else
-   return nonzero.  */
+   descriptor.  If the library is archive bound or the load map
+   hasn't been setup, then return zero; else return nonzero.  */
 
 static int
 read_dld_descriptor (void)
@@ -159,6 +161,9 @@ read_dld_descriptor (void)
       error (_("Error while reading in load map pointer."));
     }
 
+  if (!dld_cache.load_map)
+    return 0;
+
   /* Read in the dld load module descriptor */
   if (dlgetmodinfo (-1, 
                    &dld_cache.dld_desc,
@@ -317,13 +322,12 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
    to tell the dynamic linker that a private copy of the library is
    needed (so GDB can set breakpoints in the library).
 
-   We need to set two flag bits in this routine.
-
-     DT_HP_DEBUG_PRIVATE to indicate that shared libraries should be
-     mapped private.
-
-     DT_HP_DEBUG_CALLBACK to indicate that we want the dynamic linker to
-     call the breakpoint routine for significant events.  */
+   We need to set DT_HP_DEBUG_CALLBACK to indicate that we want the
+   dynamic linker to call the breakpoint routine for significant events.
+   We used to set DT_HP_DEBUG_PRIVATE to indicate that shared libraries
+   should be mapped private.  However, this flag can be set using
+   "chatr +dbg enable".  Not setting DT_HP_DEBUG_PRIVATE allows debugging
+   with shared libraries mapped shareable.  */
 
 static void
 pa64_solib_create_inferior_hook (void)
@@ -355,8 +359,15 @@ pa64_solib_create_inferior_hook (void)
   if (! read_dynamic_info (shlib_info, &dld_cache))
     error (_("Unable to read the .dynamic section."));
 
+  /* If the libraries were not mapped private, warn the user.  */
+  if ((dld_cache.dld_flags & DT_HP_DEBUG_PRIVATE) == 0)
+    warning
+      (_("Private mapping of shared library text was not specified\n"
+        "by the executable; setting a breakpoint in a shared library which\n"
+        "is not privately mapped will not work.  See the HP-UX 11i v3 chatr\n"
+        "manpage for methods to privately map shared library text."));
+
   /* Turn on the flags we care about.  */
-  dld_cache.dld_flags |= DT_HP_DEBUG_PRIVATE;
   dld_cache.dld_flags |= DT_HP_DEBUG_CALLBACK;
   status = target_write_memory (dld_cache.dld_flags_addr,
                                (char *) &dld_cache.dld_flags,
@@ -449,12 +460,6 @@ pa64_current_sos (void)
     if (! read_dld_descriptor ())
       return NULL;
 
-  /* If the libraries were not mapped private, warn the user.  */
-  if ((dld_cache.dld_flags & DT_HP_DEBUG_PRIVATE) == 0)
-    warning (_("The shared libraries were not privately mapped; setting a\n"
-            "breakpoint in a shared library will not work until you rerun "
-            "the program.\n"));
-
   for (dll_index = -1; ; dll_index++)
     {
       struct load_module_desc dll_desc;
@@ -657,9 +662,10 @@ _initialize_pa64_solib (void)
   memset (&dld_cache, 0, sizeof (dld_cache));
 }
 
-void pa64_solib_select (struct gdbarch_tdep *tdep)
+void pa64_solib_select (struct gdbarch *gdbarch)
 {
-  current_target_so_ops = &pa64_so_ops;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  set_solib_ops (gdbarch, &pa64_so_ops);
 
   tdep->solib_thread_start_addr = pa64_solib_thread_start_addr;
   tdep->solib_get_got_by_pc = pa64_solib_get_got_by_pc;
@@ -667,7 +673,7 @@ void pa64_solib_select (struct gdbarch_tdep *tdep)
   tdep->solib_get_text_base = pa64_solib_get_text_base;
 }
 
-#else /* PA_SOM_ONLY */
+#else /* HAVE_ELF_HP_H */
 
 extern initialize_file_ftype _initialize_pa64_solib; /* -Wmissing-prototypes */
 
@@ -676,7 +682,7 @@ _initialize_pa64_solib (void)
 {
 }
 
-void pa64_solib_select (struct gdbarch_tdep *tdep)
+void pa64_solib_select (struct gdbarch *gdbarch)
 {
   /* For a SOM-only target, there is no pa64 solib support.  This is needed
      for hppa-hpux-tdep.c to build.  */
This page took 0.027591 seconds and 4 git commands to generate.