move some static thread state into remote_state
[deliverable/binutils-gdb.git] / gdb / solib-sunos.c
index 9936038d4e5e86683d5a110cc844bed9f1e99e82..3259f8b79055bd49eb3ed4604d846baa6745b32e 100644 (file)
@@ -1,7 +1,6 @@
 /* Handle SunOS shared libraries for GDB, the GNU Debugger.
 
-   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
-   2001, 2004, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1990-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,7 +22,6 @@
 #include <sys/types.h>
 #include <signal.h>
 #include "gdb_string.h"
-#include <sys/param.h>
 #include <fcntl.h>
 
 /* SunOS shared libs need the nlist structure.  */
@@ -121,7 +119,7 @@ static char *main_name_list[] =
 
 #define SOLIB_EXTRACT_ADDRESS(MEMBER) \
        extract_unsigned_integer (&(MEMBER), sizeof (MEMBER), \
-                                 gdbarch_byte_order (target_gdbarch))
+                                 gdbarch_byte_order (target_gdbarch ()))
 
 /* local data declarations */
 
@@ -141,7 +139,7 @@ static CORE_ADDR flag_addr;
 static CORE_ADDR
 lm_addr (struct so_list *so)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
   int lm_addr_offset = offsetof (struct link_map, lm_addr);
   int lm_addr_size = fieldsize (struct link_map, lm_addr);
 
@@ -152,7 +150,7 @@ lm_addr (struct so_list *so)
 static CORE_ADDR
 lm_next (struct so_list *so)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
   int lm_next_offset = offsetof (struct link_map, lm_next);
   int lm_next_size = fieldsize (struct link_map, lm_next);
 
@@ -164,7 +162,7 @@ lm_next (struct so_list *so)
 static CORE_ADDR
 lm_name (struct so_list *so)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
+  enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
   int lm_name_offset = offsetof (struct link_map, lm_name);
   int lm_name_size = fieldsize (struct link_map, lm_name);
 
@@ -189,9 +187,9 @@ allocate_rt_common_objfile (void)
 
   objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
   memset (objfile, 0, sizeof (struct objfile));
-  objfile->psymbol_cache = bcache_xmalloc ();
-  objfile->macro_cache = bcache_xmalloc ();
-  objfile->filename_cache = bcache_xmalloc ();
+  objfile->psymbol_cache = psymbol_bcache_init ();
+  objfile->macro_cache = bcache_xmalloc (NULL, NULL);
+  objfile->filename_cache = bcache_xmalloc (NULL, NULL);
   obstack_init (&objfile->objfile_obstack);
   objfile->name = xstrdup ("rt_common");
 
@@ -274,17 +272,7 @@ solib_add_common_symbols (CORE_ADDR rtc_symp)
 }
 
 
-/*
-
-   LOCAL FUNCTION
-
-   locate_base -- locate the base address of dynamic linker structs
-
-   SYNOPSIS
-
-   CORE_ADDR locate_base (void)
-
-   DESCRIPTION
+/* Locate the base address of dynamic linker structs.
 
    For both the SunOS and SVR4 shared library implementations, if the
    inferior executable has been linked dynamically, there is a single
@@ -307,9 +295,7 @@ solib_add_common_symbols (CORE_ADDR rtc_symp)
    to a lot more work to discover the address of the debug base symbol.
    Because of this complexity, we cache the value we find and return that
    value on subsequent invocations.  Note there is no copy in the
-   executable symbol tables.
-
- */
+   executable symbol tables.  */
 
 static CORE_ADDR
 locate_base (void)
@@ -334,17 +320,7 @@ locate_base (void)
   return (0);
 }
 
-/*
-
-   LOCAL FUNCTION
-
-   first_link_map_member -- locate first member in dynamic linker's map
-
-   SYNOPSIS
-
-   static CORE_ADDR first_link_map_member (void)
-
-   DESCRIPTION
+/* Locate first member in dynamic linker's map.
 
    Find the first element in the inferior's dynamic link map, and
    return its address in the inferior.  This function doesn't copy the
@@ -375,24 +351,7 @@ open_symbol_file_object (void *from_ttyp)
 }
 
 
-/* LOCAL FUNCTION
-
-   current_sos -- build a list of currently loaded shared objects
-
-   SYNOPSIS
-
-   struct so_list *current_sos ()
-
-   DESCRIPTION
-
-   Build a list of `struct so_list' objects describing the shared
-   objects currently loaded in the inferior.  This list does not
-   include an entry for the main executable file.
-
-   Note that we only gather information directly available from the
-   inferior --- we don't examine any of the shared library files
-   themselves.  The declaration of `struct so_list' says which fields
-   we provide values for.  */
+/* Implement the "current_sos" target_so_ops method.  */
 
 static struct so_list *
 sunos_current_sos (void)
@@ -495,22 +454,10 @@ sunos_in_dynsym_resolve_code (CORE_ADDR pc)
   return 0;
 }
 
-/*
-
-   LOCAL FUNCTION
-
-   disable_break -- remove the "mapping changed" breakpoint
-
-   SYNOPSIS
-
-   static int disable_break ()
-
-   DESCRIPTION
+/* Remove the "mapping changed" breakpoint.
 
    Removes the breakpoint that gets hit when the dynamic linker
-   completes a mapping change.
-
- */
+   completes a mapping change.  */
 
 static int
 disable_break (void)
@@ -547,18 +494,7 @@ disable_break (void)
   return 1;
 }
 
-
-/*
-
-   LOCAL FUNCTION
-
-   enable_break -- arrange for dynamic linker to hit breakpoint
-
-   SYNOPSIS
-
-   int enable_break (void)
-
-   DESCRIPTION
+/* Arrange for dynamic linker to hit breakpoint.
 
    Both the SunOS and the SVR4 dynamic linkers have, as part of their
    debugger interface, support for arranging for the inferior to hit
@@ -587,9 +523,9 @@ disable_break (void)
 
    The debugger interface structure also contains an enumeration which
    is set to either RT_ADD or RT_DELETE prior to changing the mapping,
-   depending upon whether or not the library is being mapped or unmapped,
-   and then set to RT_CONSISTENT after the library is mapped/unmapped.
- */
+   depending upon whether or not the library is being mapped or
+   unmapped, and then set to RT_CONSISTENT after the library is
  mapped/unmapped.  */
 
 static int
 enable_break (void)
@@ -626,28 +562,12 @@ enable_break (void)
   return (success);
 }
 
-/*
-
-   LOCAL FUNCTION
-
-   special_symbol_handling -- additional shared library symbol handling
-
-   SYNOPSIS
-
-   void special_symbol_handling ()
-
-   DESCRIPTION
-
-   Once the symbols from a shared object have been loaded in the usual
-   way, we are called to do any system specific symbol handling that 
-   is needed.
+/* Implement the "special_symbol_handling" target_so_ops method.
 
    For SunOS4, this consists of grunging around in the dynamic
    linkers structures to find symbol definitions for "common" symbols
    and adding them to the minimal symbol table for the runtime common
-   objfile.
-
- */
+   objfile.  */
 
 static void
 sunos_special_symbol_handling (void)
@@ -689,22 +609,7 @@ sunos_special_symbol_handling (void)
     }
 }
 
-/*
-
-   GLOBAL FUNCTION
-
-   sunos_solib_create_inferior_hook -- shared library startup support
-
-   SYNOPSIS
-
-   void sunos_solib_create_inferior_hook ()
-
-   DESCRIPTION
-
-   When gdb starts up the inferior, it nurses it along (through the
-   shell) until it is ready to execute it's first instruction.  At this
-   point, this function gets called via expansion of the macro
-   SOLIB_CREATE_INFERIOR_HOOK.
+/* Implement the "create_inferior_hook" target_solib_ops method.
 
    For SunOS executables, this first instruction is typically the
    one at "_start", or a similar text label, regardless of whether
@@ -712,19 +617,9 @@ sunos_special_symbol_handling (void)
    startup code takes care of dynamically linking in any shared
    libraries, once gdb allows the inferior to continue.
 
-   For SVR4 executables, this first instruction is either the first
-   instruction in the dynamic linker (for dynamically linked
-   executables) or the instruction at "start" for statically linked
-   executables.  For dynamically linked executables, the system
-   first exec's /lib/libc.so.N, which contains the dynamic linker,
-   and starts it running.  The dynamic linker maps in any needed
-   shared libraries, maps in the actual user executable, and then
-   jumps to "start" in the user executable.
-
-   For both SunOS shared libraries, and SVR4 shared libraries, we
-   can arrange to cooperate with the dynamic linker to discover the
-   names of shared libraries that are dynamically linked, and the
-   base addresses to which they are linked.
+   We can arrange to cooperate with the dynamic linker to discover the
+   names of shared libraries that are dynamically linked, and the base
+   addresses to which they are linked.
 
    This function is responsible for discovering those names and
    addresses, and saving sufficient information about them to allow
@@ -738,8 +633,7 @@ sunos_special_symbol_handling (void)
    handling will probably have to wait until the implementation is
    changed to use the "breakpoint handler function" method.
 
-   Also, what if child has exit()ed?  Must exit loop somehow.
- */
+   Also, what if child has exit()ed?  Must exit loop somehow.  */
 
 static void
 sunos_solib_create_inferior_hook (int from_tty)
@@ -774,13 +668,13 @@ sunos_solib_create_inferior_hook (int from_tty)
   clear_proceed_status ();
 
   inf->control.stop_soon = STOP_QUIETLY;
-  tp->suspend.stop_signal = TARGET_SIGNAL_0;
+  tp->suspend.stop_signal = GDB_SIGNAL_0;
   do
     {
       target_resume (pid_to_ptid (-1), 0, tp->suspend.stop_signal);
       wait_for_inferior ();
     }
-  while (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP);
+  while (tp->suspend.stop_signal != GDB_SIGNAL_TRAP);
   inf->control.stop_soon = NO_STOP_QUIETLY;
 
   /* We are now either at the "mapping complete" breakpoint (or somewhere
@@ -794,9 +688,9 @@ sunos_solib_create_inferior_hook (int from_tty)
      the GDB software break point list.  Thus we have to adjust the
      PC here.  */
 
-  if (gdbarch_decr_pc_after_break (target_gdbarch))
+  if (gdbarch_decr_pc_after_break (target_gdbarch ()))
     {
-      stop_pc -= gdbarch_decr_pc_after_break (target_gdbarch);
+      stop_pc -= gdbarch_decr_pc_after_break (target_gdbarch ());
       regcache_write_pc (get_current_regcache (), stop_pc);
     }
 
This page took 0.03219 seconds and 4 git commands to generate.