* xcoffread.c (scan_xcoff_symtab): Update.
[deliverable/binutils-gdb.git] / gdb / solib-osf.c
index a00e488ee041926a8db0317346b03f9aa6a4827f..c295335bae56afd2f017261efda92de17dc40e3c 100644 (file)
@@ -1,13 +1,13 @@
 /* Handle OSF/1, Digital UNIX, and Tru64 shared libraries
    for GDB, the GNU Debugger.
 /* Handle OSF/1, Digital UNIX, and Tru64 shared libraries
    for GDB, the GNU Debugger.
-   Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2007, 2008,
+   2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
    This file is part of GDB.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -16,9 +16,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* When handling shared libraries, GDB has to find out the pathnames
    of all shared libraries that are currently loaded (to read in their
 
 /* When handling shared libraries, GDB has to find out the pathnames
    of all shared libraries that are currently loaded (to read in their
@@ -55,7 +53,9 @@
 #include "objfiles.h"
 #include "target.h"
 #include "inferior.h"
 #include "objfiles.h"
 #include "target.h"
 #include "inferior.h"
+#include "gdbthread.h"
 #include "solist.h"
 #include "solist.h"
+#include "solib.h"
 
 #ifdef USE_LDR_ROUTINES
 # include <loader.h>
 
 #ifdef USE_LDR_ROUTINES
 # include <loader.h>
@@ -220,7 +220,7 @@ fetch_sec_names (struct lm_info *lmi)
       target_read_string (lms->nameaddr, &name, PATH_MAX, &errcode);
       if (errcode != 0)
        {
       target_read_string (lms->nameaddr, &name, PATH_MAX, &errcode);
       if (errcode != 0)
        {
-         warning ("unable to read shared sec name at 0x%lx", lms->nameaddr);
+         warning (_("unable to read shared sec name at 0x%lx"), lms->nameaddr);
          name = xstrdup ("");
        }
       lms->name = name;
          name = xstrdup ("");
        }
       lms->name = name;
@@ -234,7 +234,7 @@ fetch_sec_names (struct lm_info *lmi)
 
 static void
 osf_relocate_section_addresses (struct so_list *so,
 
 static void
 osf_relocate_section_addresses (struct so_list *so,
-                               struct section_table *sec)
+                               struct target_section *sec)
 {
   struct lm_info *lmi;
   struct lm_sec lms_key, *lms;
 {
   struct lm_info *lmi;
   struct lm_sec lms_key, *lms;
@@ -308,6 +308,16 @@ osf_clear_solib (void)
 static void
 osf_solib_create_inferior_hook (void)
 {
 static void
 osf_solib_create_inferior_hook (void)
 {
+  struct inferior *inf;
+  struct thread_info *tp;
+
+  inf = current_inferior ();
+
+  /* If we are attaching to the inferior, the shared libraries
+     have already been mapped, so nothing more to do.  */
+  if (inf->attach_flag)
+    return;
+
   /* Nothing to do for statically bound executables.  */
 
   if (symfile_objfile == NULL
   /* Nothing to do for statically bound executables.  */
 
   if (symfile_objfile == NULL
@@ -318,29 +328,34 @@ osf_solib_create_inferior_hook (void)
   /* Now run the target.  It will eventually get a SIGTRAP, at
      which point all of the libraries will have been mapped in and we
      can go groveling around in the rld structures to find
   /* Now run the target.  It will eventually get a SIGTRAP, at
      which point all of the libraries will have been mapped in and we
      can go groveling around in the rld structures to find
-     out what we need to know about them. */
+     out what we need to know about them.
+     
+     If debugging from a core file, we cannot resume the execution
+     of the inferior.  But this is actually not an issue, because
+     shared libraries have already been mapped anyways, which means
+     we have nothing more to do.  */
+  if (!target_can_run (&current_target))
+    return;
 
 
+  tp = inferior_thread ();
   clear_proceed_status ();
   clear_proceed_status ();
-  stop_soon_quietly = 1;
-  stop_signal = TARGET_SIGNAL_0;
+  inf->stop_soon = STOP_QUIETLY;
+  tp->stop_signal = TARGET_SIGNAL_0;
   do
     {
   do
     {
-      target_resume (minus_one_ptid, 0, stop_signal);
-      wait_for_inferior ();
+      target_resume (minus_one_ptid, 0, tp->stop_signal);
+      wait_for_inferior (0);
     }
     }
-  while (stop_signal != TARGET_SIGNAL_TRAP);
+  while (tp->stop_signal != TARGET_SIGNAL_TRAP);
 
   /*  solib_add will call reinit_frame_cache.
      But we are stopped in the runtime loader and we do not have symbols
      for the runtime loader. So heuristic_proc_start will be called
      and will put out an annoying warning.
 
   /*  solib_add will call reinit_frame_cache.
      But we are stopped in the runtime loader and we do not have symbols
      for the runtime loader. So heuristic_proc_start will be called
      and will put out an annoying warning.
-     Delaying the resetting of stop_soon_quietly until after symbol loading
+     Delaying the resetting of stop_soon until after symbol loading
      suppresses the warning.  */
   solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
      suppresses the warning.  */
   solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
-  stop_soon_quietly = 0;
-
-  /* Enable breakpoints disabled (unnecessarily) by clear_solib().  */
-  re_enable_breakpoints_in_shlibs ();
+  inf->stop_soon = NO_STOP_QUIETLY;
 }
 
 /* target_so_ops callback.  Do additional symbol handling, lookup, etc. after
 }
 
 /* target_so_ops callback.  Do additional symbol handling, lookup, etc. after
@@ -359,7 +374,14 @@ static int
 open_map (struct read_map_ctxt *ctxt)
 {
 #ifdef USE_LDR_ROUTINES
 open_map (struct read_map_ctxt *ctxt)
 {
 #ifdef USE_LDR_ROUTINES
-  ctxt->proc = ldr_my_process ();
+  /* Note: As originally written, ldr_my_process() was used to obtain
+     the value for ctxt->proc.  This is incorrect, however, since
+     ldr_my_process() retrieves the "unique identifier" associated
+     with the current process (i.e. GDB) and not the one being
+     debugged.  Presumably, the pid of the process being debugged is
+     compatible with the "unique identifier" used by the ldr_
+     routines, so we use that.  */
+  ctxt->proc = ptid_get_pid (inferior_ptid);
   if (ldr_xattach (ctxt->proc) != 0)
     return 0;
   ctxt->next = LDR_NULL_MODULE;
   if (ldr_xattach (ctxt->proc) != 0)
     return 0;
   ctxt->next = LDR_NULL_MODULE;
@@ -402,8 +424,8 @@ init_so (struct so_list *so, char *name, int isloader, int nsecs)
   memcpy (so->so_name, so->so_original_name, namelen + 1);
 
   /* Allocate section space.  */
   memcpy (so->so_name, so->so_original_name, namelen + 1);
 
   /* Allocate section space.  */
-  so->lm_info = xmalloc ((unsigned) &(((struct lm_info *)0)->secs) +
-                        nsecs * sizeof *so->lm_info);
+  so->lm_info = xmalloc (sizeof (struct lm_info)
+                         + (nsecs - 1) * sizeof (struct lm_sec));
   so->lm_info->isloader = isloader;
   so->lm_info->nsecs = nsecs;
   for (i = 0; i < nsecs; i++)
   so->lm_info->isloader = isloader;
   so->lm_info->nsecs = nsecs;
   for (i = 0; i < nsecs; i++)
@@ -547,7 +569,6 @@ osf_current_sos (void)
       tail->next = NULL;
     }
 
       tail->next = NULL;
     }
 
- done:
   close_map (&ctxt);
   return head;
 }
   close_map (&ctxt);
   return head;
 }
@@ -563,7 +584,7 @@ osf_open_symbol_file_object (void *from_ttyp)
   int found;
 
   if (symfile_objfile)
   int found;
 
   if (symfile_objfile)
-    if (!query ("Attempt to reload symbols from process? "))
+    if (!query (_("Attempt to reload symbols from process? ")))
       return 0;
 
   /* The first module after /sbin/loader is the main program.  */
       return 0;
 
   /* The first module after /sbin/loader is the main program.  */
@@ -593,7 +614,7 @@ osf_in_dynsym_resolve_code (CORE_ADDR pc)
      for the user: When stepping inside a subprogram located in a shared
      library, gdb might stop inside the dynamic loader code instead of
      inside the subprogram itself. See the explanations in infrun.c about
      for the user: When stepping inside a subprogram located in a shared
      library, gdb might stop inside the dynamic loader code instead of
      inside the subprogram itself. See the explanations in infrun.c about
-     the IN_SOLIB_DYNSYM_RESOLVE_CODE macro for more details. */
+     the in_solib_dynsym_resolve_code() function for more details. */
   return 0;
 }
 
   return 0;
 }
 
@@ -610,6 +631,7 @@ _initialize_osf_solib (void)
   osf_so_ops.current_sos = osf_current_sos;
   osf_so_ops.open_symbol_file_object = osf_open_symbol_file_object;
   osf_so_ops.in_dynsym_resolve_code = osf_in_dynsym_resolve_code;
   osf_so_ops.current_sos = osf_current_sos;
   osf_so_ops.open_symbol_file_object = osf_open_symbol_file_object;
   osf_so_ops.in_dynsym_resolve_code = osf_in_dynsym_resolve_code;
+  osf_so_ops.bfd_open = solib_bfd_open;
 
   /* FIXME: Don't do this here.  *_gdbarch_init() should set so_ops. */
   current_target_so_ops = &osf_so_ops;
 
   /* FIXME: Don't do this here.  *_gdbarch_init() should set so_ops. */
   current_target_so_ops = &osf_so_ops;
This page took 0.031355 seconds and 4 git commands to generate.