home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / gdb-4.9 / gdb / solib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-12  |  35.9 KB  |  1,348 lines

  1. /* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
  2.    Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
  3.    
  4. This file is part of GDB.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. #include "defs.h"
  22.  
  23. #include <sys/types.h>
  24. #include <signal.h>
  25. #include <string.h>
  26. #include <link.h>
  27. #include <sys/param.h>
  28. #include <fcntl.h>
  29.  
  30. #ifndef SVR4_SHARED_LIBS
  31.  /* SunOS shared libs need the nlist structure.  */
  32. #include <a.out.h> 
  33. #endif
  34.  
  35. #include "symtab.h"
  36. #include "bfd.h"
  37. #include "symfile.h"
  38. #include "objfiles.h"
  39. #include "gdbcore.h"
  40. #include "command.h"
  41. #include "target.h"
  42. #include "frame.h"
  43. #include "regex.h"
  44. #include "inferior.h"
  45.  
  46. #define MAX_PATH_SIZE 256        /* FIXME: Should be dynamic */
  47.  
  48. /* On SVR4 systems, for the initial implementation, use some runtime startup
  49.    symbol as the "startup mapping complete" breakpoint address.  The models
  50.    for SunOS and SVR4 dynamic linking debugger support are different in that
  51.    SunOS hits one breakpoint when all mapping is complete while using the SVR4
  52.    debugger support takes two breakpoint hits for each file mapped, and
  53.    there is no way to know when the "last" one is hit.  Both these
  54.    mechanisms should be tied to a "breakpoint service routine" that
  55.    gets automatically executed whenever one of the breakpoints indicating
  56.    a change in mapping is hit.  This is a future enhancement.  (FIXME) */
  57.  
  58. #define BKPT_AT_SYMBOL 1
  59.  
  60. static char *bkpt_names[] = {
  61. #ifdef SOLIB_BKPT_NAME
  62.   SOLIB_BKPT_NAME,        /* Prefer configured name if it exists. */
  63. #endif
  64.   "_start",
  65.   "main",
  66.   NULL
  67. };
  68.  
  69. /* local data declarations */
  70.  
  71. #ifndef SVR4_SHARED_LIBS
  72.  
  73. #define DEBUG_BASE "_DYNAMIC"
  74. #define LM_ADDR(so) ((so) -> lm.lm_addr)
  75. #define LM_NEXT(so) ((so) -> lm.lm_next)
  76. #define LM_NAME(so) ((so) -> lm.lm_name)
  77. static struct link_dynamic dynamic_copy;
  78. static struct link_dynamic_2 ld_2_copy;
  79. static struct ld_debug debug_copy;
  80. static CORE_ADDR debug_addr;
  81. static CORE_ADDR flag_addr;
  82.  
  83. #else    /* SVR4_SHARED_LIBS */
  84.  
  85. #define DEBUG_BASE "_r_debug"
  86. #define LM_ADDR(so) ((so) -> lm.l_addr)
  87. #define LM_NEXT(so) ((so) -> lm.l_next)
  88. #define LM_NAME(so) ((so) -> lm.l_name)
  89. static struct r_debug debug_copy;
  90. char shadow_contents[BREAKPOINT_MAX];    /* Stash old bkpt addr contents */
  91.  
  92. #endif    /* !SVR4_SHARED_LIBS */
  93.  
  94. struct so_list {
  95.   struct so_list *next;            /* next structure in linked list */
  96.   struct link_map lm;            /* copy of link map from inferior */
  97.   struct link_map *lmaddr;        /* addr in inferior lm was read from */
  98.   CORE_ADDR lmend;            /* upper addr bound of mapped object */
  99.   char so_name[MAX_PATH_SIZE];        /* shared object lib name (FIXME) */
  100.   char symbols_loaded;            /* flag: symbols read in yet? */
  101.   char from_tty;            /* flag: print msgs? */
  102.   struct objfile *objfile;        /* objfile for loaded lib */
  103.   struct section_table *sections;
  104.   struct section_table *sections_end;
  105.   struct section_table *textsection;
  106.   bfd *bfd;
  107. };
  108.  
  109. static struct so_list *so_list_head;    /* List of known shared objects */
  110. static CORE_ADDR debug_base;        /* Base of dynamic linker structures */
  111. static CORE_ADDR breakpoint_addr;    /* Address where end bkpt is set */
  112.  
  113. extern int
  114. fdmatch PARAMS ((int, int));        /* In libiberty */
  115.  
  116. /* Local function prototypes */
  117.  
  118. static void
  119. special_symbol_handling PARAMS ((struct so_list *));
  120.  
  121. static void
  122. sharedlibrary_command PARAMS ((char *, int));
  123.  
  124. static int
  125. enable_break PARAMS ((void));
  126.  
  127. static int
  128. disable_break PARAMS ((void));
  129.  
  130. static void
  131. info_sharedlibrary_command PARAMS ((char *, int));
  132.  
  133. static int
  134. symbol_add_stub PARAMS ((char *));
  135.  
  136. static struct so_list *
  137. find_solib PARAMS ((struct so_list *));
  138.  
  139. static struct link_map *
  140. first_link_map_member PARAMS ((void));
  141.  
  142. static CORE_ADDR
  143. locate_base PARAMS ((void));
  144.  
  145. static void
  146. solib_map_sections PARAMS ((struct so_list *));
  147.  
  148. #ifdef SVR4_SHARED_LIBS
  149.  
  150. static int
  151. look_for_base PARAMS ((int, CORE_ADDR));
  152.  
  153. static CORE_ADDR
  154. bfd_lookup_symbol PARAMS ((bfd *, char *));
  155.  
  156. #else
  157.  
  158. static void
  159. solib_add_common_symbols PARAMS ((struct rtc_symb *, struct objfile *));
  160.  
  161. #endif
  162.  
  163. /*
  164.  
  165. LOCAL FUNCTION
  166.  
  167.     solib_map_sections -- open bfd and build sections for shared lib
  168.  
  169. SYNOPSIS
  170.  
  171.     static void solib_map_sections (struct so_list *so)
  172.  
  173. DESCRIPTION
  174.  
  175.     Given a pointer to one of the shared objects in our list
  176.     of mapped objects, use the recorded name to open a bfd
  177.     descriptor for the object, build a section table, and then
  178.     relocate all the section addresses by the base address at
  179.     which the shared object was mapped.
  180.  
  181. FIXMES
  182.  
  183.     In most (all?) cases the shared object file name recorded in the
  184.     dynamic linkage tables will be a fully qualified pathname.  For
  185.     cases where it isn't, do we really mimic the systems search
  186.     mechanism correctly in the below code (particularly the tilde
  187.     expansion stuff?).
  188.  */
  189.  
  190. static void
  191. solib_map_sections (so)
  192.      struct so_list *so;
  193. {
  194.   char *filename;
  195.   char *scratch_pathname;
  196.   int scratch_chan;
  197.   struct section_table *p;
  198.   struct cleanup *old_chain;
  199.   bfd *abfd;
  200.   
  201.   filename = tilde_expand (so -> so_name);
  202.   old_chain = make_cleanup (free, filename);
  203.   
  204.   scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
  205.             &scratch_pathname);
  206.   if (scratch_chan < 0)
  207.     {
  208.       scratch_chan = openp (getenv ("LD_LIBRARY_PATH"), 1, filename,
  209.                 O_RDONLY, 0, &scratch_pathname);
  210.     }
  211.   if (scratch_chan < 0)
  212.     {
  213.       perror_with_name (filename);
  214.     }
  215.   /* Leave scratch_pathname allocated.  bfd->name will point to it.  */
  216.  
  217.   abfd = bfd_fdopenr (scratch_pathname, NULL, scratch_chan);
  218.   if (!abfd)
  219.     {
  220.       close (scratch_chan);
  221.       error ("Could not open `%s' as an executable file: %s",
  222.          scratch_pathname, bfd_errmsg (bfd_error));
  223.     }
  224.   /* Leave bfd open, core_xfer_memory and "info files" need it.  */
  225.   so -> bfd = abfd;
  226.   abfd -> cacheable = true;
  227.  
  228.   if (!bfd_check_format (abfd, bfd_object))
  229.     {
  230.       error ("\"%s\": not in executable format: %s.",
  231.          scratch_pathname, bfd_errmsg (bfd_error));
  232.     }
  233.   if (build_section_table (abfd, &so -> sections, &so -> sections_end))
  234.     {
  235.       error ("Can't find the file sections in `%s': %s", 
  236.          bfd_get_filename (exec_bfd), bfd_errmsg (bfd_error));
  237.     }
  238.  
  239.   for (p = so -> sections; p < so -> sections_end; p++)
  240.     {
  241.       /* Relocate the section binding addresses as recorded in the shared
  242.      object's file by the base address to which the object was actually
  243.      mapped. */
  244.       p -> addr += (CORE_ADDR) LM_ADDR (so);
  245.       p -> endaddr += (CORE_ADDR) LM_ADDR (so);
  246.       so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
  247.       if (STREQ (p -> sec_ptr -> name, ".text"))
  248.     {
  249.       so -> textsection = p;
  250.     }
  251.     }
  252.  
  253.   /* Free the file names, close the file now.  */
  254.   do_cleanups (old_chain);
  255. }
  256.  
  257. /* Read all dynamically loaded common symbol definitions from the inferior
  258.    and add them to the minimal symbol table for the shared library objfile.  */
  259.  
  260. #ifndef SVR4_SHARED_LIBS
  261.  
  262. static void
  263. solib_add_common_symbols (rtc_symp, objfile)
  264.     struct rtc_symb *rtc_symp;
  265.     struct objfile *objfile;
  266. {
  267.   struct rtc_symb inferior_rtc_symb;
  268.   struct nlist inferior_rtc_nlist;
  269.   int len;
  270.   char *name;
  271.   char *origname;
  272.  
  273.   init_minimal_symbol_collection ();
  274.   make_cleanup (discard_minimal_symbols, 0);
  275.  
  276.   while (rtc_symp)
  277.     {
  278.       read_memory ((CORE_ADDR) rtc_symp,
  279.            (char *) &inferior_rtc_symb,
  280.            sizeof (inferior_rtc_symb));
  281.       read_memory ((CORE_ADDR) inferior_rtc_symb.rtc_sp,
  282.            (char *) &inferior_rtc_nlist,
  283.            sizeof(inferior_rtc_nlist));
  284.       if (inferior_rtc_nlist.n_type == N_COMM)
  285.     {
  286.       /* FIXME: The length of the symbol name is not available, but in the
  287.          current implementation the common symbol is allocated immediately
  288.          behind the name of the symbol. */
  289.       len = inferior_rtc_nlist.n_value - inferior_rtc_nlist.n_un.n_strx;
  290.  
  291.       origname = name = xmalloc (len);
  292.       read_memory ((CORE_ADDR) inferior_rtc_nlist.n_un.n_name, name, len);
  293.  
  294.       /* Don't enter the symbol twice if the target is re-run. */
  295.  
  296.       if (name[0] == bfd_get_symbol_leading_char (objfile->obfd))
  297.         {
  298.           name++;
  299.         }
  300.  
  301.       /* FIXME:  Do we really want to exclude symbols which happen
  302.          to match symbols for other locations in the inferior's
  303.          address space, even when they are in different linkage units? */
  304.       if (lookup_minimal_symbol (name, (struct objfile *) NULL) == NULL)
  305.         {
  306.           name = obsavestring (name, strlen (name),
  307.                    &objfile -> symbol_obstack);
  308.           prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
  309.                       mst_bss);
  310.         }
  311.       free (origname);
  312.     }
  313.       rtc_symp = inferior_rtc_symb.rtc_next;
  314.     }
  315.  
  316.   /* Install any minimal symbols that have been collected as the current
  317.      minimal symbols for this objfile. */
  318.  
  319.   install_minimal_symbols (objfile);
  320. }
  321.  
  322. #endif    /* SVR4_SHARED_LIBS */
  323.  
  324. #ifdef SVR4_SHARED_LIBS
  325.  
  326. /*
  327.  
  328. LOCAL FUNCTION
  329.  
  330.     bfd_lookup_symbol -- lookup the value for a specific symbol
  331.  
  332. SYNOPSIS
  333.  
  334.     CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
  335.  
  336. DESCRIPTION
  337.  
  338.     An expensive way to lookup the value of a single symbol for
  339.     bfd's that are only temporary anyway.  This is used by the
  340.     shared library support to find the address of the debugger
  341.     interface structures in the shared library.
  342.  
  343.     Note that 0 is specifically allowed as an error return (no
  344.     such symbol).
  345.  
  346.     FIXME:  See if there is a less "expensive" way of doing this.
  347.     Also see if there is already another bfd or gdb function
  348.     that specifically does this, and if so, use it.
  349. */
  350.  
  351. static CORE_ADDR
  352. bfd_lookup_symbol (abfd, symname)
  353.      bfd *abfd;
  354.      char *symname;
  355. {
  356.   unsigned int storage_needed;
  357.   asymbol *sym;
  358.   asymbol **symbol_table;
  359.   unsigned int number_of_symbols;
  360.   unsigned int i;
  361.   struct cleanup *back_to;
  362.   CORE_ADDR symaddr = 0;
  363.   
  364.   storage_needed = get_symtab_upper_bound (abfd);
  365.  
  366.   if (storage_needed > 0)
  367.     {
  368.       symbol_table = (asymbol **) xmalloc (storage_needed);
  369.       back_to = make_cleanup (free, (PTR)symbol_table);
  370.       number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table); 
  371.   
  372.       for (i = 0; i < number_of_symbols; i++)
  373.     {
  374.       sym = *symbol_table++;
  375.       if (STREQ (sym -> name, symname))
  376.         {
  377.           symaddr = sym -> value;
  378.           break;
  379.         }
  380.     }
  381.       do_cleanups (back_to);
  382.     }
  383.   return (symaddr);
  384. }
  385.  
  386. /*
  387.  
  388. LOCAL FUNCTION
  389.  
  390.     look_for_base -- examine file for each mapped address segment
  391.  
  392. SYNOPSYS
  393.  
  394.     static int look_for_base (int fd, CORE_ADDR baseaddr)
  395.  
  396. DESCRIPTION
  397.  
  398.     This function is passed to proc_iterate_over_mappings, which
  399.     causes it to get called once for each mapped address space, with
  400.     an open file descriptor for the file mapped to that space, and the
  401.     base address of that mapped space.
  402.  
  403.     Our job is to find the symbol DEBUG_BASE in the file that this
  404.     fd is open on, if it exists, and if so, initialize the dynamic
  405.     linker structure base address debug_base.
  406.  
  407.     Note that this is a computationally expensive proposition, since
  408.     we basically have to open a bfd on every call, so we specifically
  409.     avoid opening the exec file.
  410.  */
  411.  
  412. static int
  413. look_for_base (fd, baseaddr)
  414.      int fd;
  415.      CORE_ADDR baseaddr;
  416. {
  417.   bfd *interp_bfd;
  418.   CORE_ADDR address;
  419.  
  420.   /* If the fd is -1, then there is no file that corresponds to this
  421.      mapped memory segment, so skip it.  Also, if the fd corresponds
  422.      to the exec file, skip it as well. */
  423.  
  424.   if ((fd == -1) || fdmatch (fileno ((FILE *)(exec_bfd -> iostream)), fd))
  425.     {
  426.       return (0);
  427.     }
  428.  
  429.   /* Try to open whatever random file this fd corresponds to.  Note that
  430.      we have no way currently to find the filename.  Don't gripe about
  431.      any problems we might have, just fail. */
  432.  
  433.   if ((interp_bfd = bfd_fdopenr ("unnamed", NULL, fd)) == NULL)
  434.     {
  435.       return (0);
  436.     }
  437.   if (!bfd_check_format (interp_bfd, bfd_object))
  438.     {
  439.       bfd_close (interp_bfd);
  440.       return (0);
  441.     }
  442.  
  443.   /* Now try to find our DEBUG_BASE symbol in this file, which we at
  444.      least know to be a valid ELF executable or shared library. */
  445.  
  446.   if ((address = bfd_lookup_symbol (interp_bfd, DEBUG_BASE)) == 0)
  447.     {
  448.       bfd_close (interp_bfd);
  449.       return (0);
  450.     }
  451.  
  452.   /* Eureka!  We found the symbol.  But now we may need to relocate it
  453.      by the base address.  If the symbol's value is less than the base
  454.      address of the shared library, then it hasn't yet been relocated
  455.      by the dynamic linker, and we have to do it ourself.  FIXME: Note
  456.      that we make the assumption that the first segment that corresponds
  457.      to the shared library has the base address to which the library
  458.      was relocated. */
  459.  
  460.   if (address < baseaddr)
  461.     {
  462.       address += baseaddr;
  463.     }
  464.   debug_base = address;
  465.   bfd_close (interp_bfd);
  466.   return (1);
  467. }
  468.  
  469. #endif
  470.  
  471. /*
  472.  
  473. LOCAL FUNCTION
  474.  
  475.     locate_base -- locate the base address of dynamic linker structs
  476.  
  477. SYNOPSIS
  478.  
  479.     CORE_ADDR locate_base (void)
  480.  
  481. DESCRIPTION
  482.  
  483.     For both the SunOS and SVR4 shared library implementations, if the
  484.     inferior executable has been linked dynamically, there is a single
  485.     address somewhere in the inferior's data space which is the key to
  486.     locating all of the dynamic linker's runtime structures.  This
  487.     address is the value of the symbol defined by the macro DEBUG_BASE.
  488.     The job of this function is to find and return that address, or to
  489.     return 0 if there is no such address (the executable is statically
  490.     linked for example).
  491.  
  492.     For SunOS, the job is almost trivial, since the dynamic linker and
  493.     all of it's structures are statically linked to the executable at
  494.     link time.  Thus the symbol for the address we are looking for has
  495.     already been added to the minimal symbol table for the executable's
  496.     objfile at the time the symbol file's symbols were read, and all we
  497.     have to do is look it up there.  Note that we explicitly do NOT want
  498.     to find the copies in the shared library.
  499.  
  500.     The SVR4 version is much more complicated because the dynamic linker
  501.     and it's structures are located in the shared C library, which gets
  502.     run as the executable's "interpreter" by the kernel.  We have to go
  503.     to a lot more work to discover the address of DEBUG_BASE.  Because
  504.     of this complexity, we cache the value we find and return that value
  505.     on subsequent invocations.  Note there is no copy in the executable
  506.     symbol tables.
  507.  
  508.     Note that we can assume nothing about the process state at the time
  509.     we need to find this address.  We may be stopped on the first instruc-
  510.     tion of the interpreter (C shared library), the first instruction of
  511.     the executable itself, or somewhere else entirely (if we attached
  512.     to the process for example).
  513.  
  514.  */
  515.  
  516. static CORE_ADDR
  517. locate_base ()
  518. {
  519.  
  520. #ifndef SVR4_SHARED_LIBS
  521.  
  522.   struct minimal_symbol *msymbol;
  523.   CORE_ADDR address = 0;
  524.  
  525.   /* For SunOS, we want to limit the search for DEBUG_BASE to the executable
  526.      being debugged, since there is a duplicate named symbol in the shared
  527.      library.  We don't want the shared library versions. */
  528.  
  529.   msymbol = lookup_minimal_symbol (DEBUG_BASE, symfile_objfile);
  530.   if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
  531.     {
  532.       address = SYMBOL_VALUE_ADDRESS (msymbol);
  533.     }
  534.   return (address);
  535.  
  536. #else    /* SVR4_SHARED_LIBS */
  537.  
  538.   /* Check to see if we have a currently valid address, and if so, avoid
  539.      doing all this work again and just return the cached address.  If
  540.      we have no cached address, ask the /proc support interface to iterate
  541.      over the list of mapped address segments, calling look_for_base() for
  542.      each segment.  When we are done, we will have either found the base
  543.      address or not. */
  544.  
  545.   if (debug_base == 0)
  546.     {
  547.       proc_iterate_over_mappings (look_for_base);
  548.     }
  549.   return (debug_base);
  550.  
  551. #endif    /* !SVR4_SHARED_LIBS */
  552.  
  553. }
  554.  
  555. /*
  556.  
  557. LOCAL FUNCTION
  558.  
  559.     first_link_map_member -- locate first member in dynamic linker's map
  560.  
  561. SYNOPSIS
  562.  
  563.     static struct link_map *first_link_map_member (void)
  564.  
  565. DESCRIPTION
  566.  
  567.     Read in a copy of the first member in the inferior's dynamic
  568.     link map from the inferior's dynamic linker structures, and return
  569.     a pointer to the copy in our address space.
  570. */
  571.  
  572. static struct link_map *
  573. first_link_map_member ()
  574. {
  575.   struct link_map *lm = NULL;
  576.  
  577. #ifndef SVR4_SHARED_LIBS
  578.  
  579.   read_memory (debug_base, (char *) &dynamic_copy, sizeof (dynamic_copy));
  580.   if (dynamic_copy.ld_version >= 2)
  581.     {
  582.       /* It is a version that we can deal with, so read in the secondary
  583.      structure and find the address of the link map list from it. */
  584.       read_memory ((CORE_ADDR) dynamic_copy.ld_un.ld_2, (char *) &ld_2_copy,
  585.            sizeof (struct link_dynamic_2));
  586.       lm = ld_2_copy.ld_loaded;
  587.     }
  588.  
  589. #else    /* SVR4_SHARED_LIBS */
  590.  
  591.   read_memory (debug_base, (char *) &debug_copy, sizeof (struct r_debug));
  592.   /* FIXME:  Perhaps we should validate the info somehow, perhaps by
  593.      checking r_version for a known version number, or r_state for
  594.      RT_CONSISTENT. */
  595.   lm = debug_copy.r_map;
  596.  
  597. #endif    /* !SVR4_SHARED_LIBS */
  598.  
  599.   return (lm);
  600. }
  601.  
  602. /*
  603.  
  604. LOCAL FUNCTION
  605.  
  606.     find_solib -- step through list of shared objects
  607.  
  608. SYNOPSIS
  609.  
  610.     struct so_list *find_solib (struct so_list *so_list_ptr)
  611.  
  612. DESCRIPTION
  613.  
  614.     This module contains the routine which finds the names of any
  615.     loaded "images" in the current process. The argument in must be
  616.     NULL on the first call, and then the returned value must be passed
  617.     in on subsequent calls. This provides the capability to "step" down
  618.     the list of loaded objects. On the last object, a NULL value is
  619.     returned.
  620.  
  621.     The arg and return value are "struct link_map" pointers, as defined
  622.     in <link.h>.
  623.  */
  624.  
  625. static struct so_list *
  626. find_solib (so_list_ptr)
  627.      struct so_list *so_list_ptr;    /* Last lm or NULL for first one */
  628. {
  629.   struct so_list *so_list_next = NULL;
  630.   struct link_map *lm = NULL;
  631.   struct so_list *new;
  632.   
  633.   if (so_list_ptr == NULL)
  634.     {
  635.       /* We are setting up for a new scan through the loaded images. */
  636.       if ((so_list_next = so_list_head) == NULL)
  637.     {
  638.       /* We have not already read in the dynamic linking structures
  639.          from the inferior, lookup the address of the base structure. */
  640.       debug_base = locate_base ();
  641.       if (debug_base != 0)
  642.         {
  643.           /* Read the base structure in and find the address of the first
  644.          link map list member. */
  645.           lm = first_link_map_member ();
  646.         }
  647.     }
  648.     }
  649.   else
  650.     {
  651.       /* We have been called before, and are in the process of walking
  652.      the shared library list.  Advance to the next shared object. */
  653.       if ((lm = LM_NEXT (so_list_ptr)) == NULL)
  654.     {
  655.       /* We have hit the end of the list, so check to see if any were
  656.          added, but be quiet if we can't read from the target any more. */
  657.       int status = target_read_memory ((CORE_ADDR) so_list_ptr -> lmaddr,
  658.                        (char *) &(so_list_ptr -> lm),
  659.                        sizeof (struct link_map));
  660.       if (status == 0)
  661.         {
  662.           lm = LM_NEXT (so_list_ptr);
  663.         }
  664.       else
  665.         {
  666.           lm = NULL;
  667.         }
  668.     }
  669.       so_list_next = so_list_ptr -> next;
  670.     }
  671.   if ((so_list_next == NULL) && (lm != NULL))
  672.     {
  673.       /* Get next link map structure from inferior image and build a local
  674.      abbreviated load_map structure */
  675.       new = (struct so_list *) xmalloc (sizeof (struct so_list));
  676.       memset ((char *) new, 0, sizeof (struct so_list));
  677.       new -> lmaddr = lm;
  678.       /* Add the new node as the next node in the list, or as the root
  679.      node if this is the first one. */
  680.       if (so_list_ptr != NULL)
  681.     {
  682.       so_list_ptr -> next = new;
  683.     }
  684.       else
  685.     {
  686.       so_list_head = new;
  687.     }      
  688.       so_list_next = new;
  689.       read_memory ((CORE_ADDR) lm, (char *) &(new -> lm),
  690.            sizeof (struct link_map));
  691.       /* For the SVR4 version, there is one entry that has no name
  692.      (for the inferior executable) since it is not a shared object. */
  693.       if (LM_NAME (new) != 0)
  694.     {
  695.       if (!target_read_string((CORE_ADDR) LM_NAME (new), new -> so_name,
  696.               MAX_PATH_SIZE - 1))
  697.           error ("find_solib: Can't read pathname for load map\n");
  698.       new -> so_name[MAX_PATH_SIZE - 1] = 0;
  699.       solib_map_sections (new);
  700.     }      
  701.     }
  702.   return (so_list_next);
  703. }
  704.  
  705. /* A small stub to get us past the arg-passing pinhole of catch_errors.  */
  706.  
  707. static int
  708. symbol_add_stub (arg)
  709.      char *arg;
  710. {
  711.   register struct so_list *so = (struct so_list *) arg;    /* catch_errs bogon */
  712.   
  713.   so -> objfile = symbol_file_add (so -> so_name, so -> from_tty,
  714.                    (unsigned int) so -> textsection -> addr,
  715.                    0, 0, 0);
  716.   return (1);
  717. }
  718.  
  719. /*
  720.  
  721. GLOBAL FUNCTION
  722.  
  723.     solib_add -- add a shared library file to the symtab and section list
  724.  
  725. SYNOPSIS
  726.  
  727.     void solib_add (char *arg_string, int from_tty,
  728.             struct target_ops *target)
  729.  
  730. DESCRIPTION
  731.  
  732. */
  733.  
  734. void
  735. solib_add (arg_string, from_tty, target)
  736.      char *arg_string;
  737.      int from_tty;
  738.      struct target_ops *target;
  739. {    
  740.   register struct so_list *so = NULL;       /* link map state variable */
  741.   char *re_err;
  742.   int count;
  743.   int old;
  744.   
  745.   if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
  746.     {
  747.       error ("Invalid regexp: %s", re_err);
  748.     }
  749.   
  750.   /* Getting new symbols may change our opinion about what is
  751.      frameless.  */
  752.   reinit_frame_cache ();
  753.   
  754.   while ((so = find_solib (so)) != NULL)
  755.     {
  756.       if (so -> so_name[0] && re_exec (so -> so_name))
  757.     {
  758.       so -> from_tty = from_tty;
  759.       if (so -> symbols_loaded)
  760.         {
  761.           if (from_tty)
  762.         {
  763.           printf ("Symbols already loaded for %s\n", so -> so_name);
  764.         }
  765.         }
  766.       else if (catch_errors
  767.            (symbol_add_stub, (char *) so,
  768.             "Error while reading shared library symbols:\n"))
  769.         {
  770.           special_symbol_handling (so);
  771.           so -> symbols_loaded = 1;
  772.         }
  773.     }
  774.     }
  775.   
  776.   /* Now add the shared library sections to the section table of the
  777.      specified target, if any.  */
  778.   if (target)
  779.     {
  780.       /* Count how many new section_table entries there are.  */
  781.       so = NULL;
  782.       count = 0;
  783.       while ((so = find_solib (so)) != NULL)
  784.     {
  785.       if (so -> so_name[0])
  786.         {
  787.           count += so -> sections_end - so -> sections;
  788.         }
  789.     }
  790.       
  791.       if (count)
  792.     {
  793.       /* Reallocate the target's section table including the new size.  */
  794.       if (target -> to_sections)
  795.         {
  796.           old = target -> to_sections_end - target -> to_sections;
  797.           target -> to_sections = (struct section_table *)
  798.         realloc ((char *)target -> to_sections,
  799.              (sizeof (struct section_table)) * (count + old));
  800.         }
  801.       else
  802.         {
  803.           old = 0;
  804.           target -> to_sections = (struct section_table *)
  805.         malloc ((sizeof (struct section_table)) * count);
  806.         }
  807.       target -> to_sections_end = target -> to_sections + (count + old);
  808.       
  809.       /* Add these section table entries to the target's table.  */
  810.       while ((so = find_solib (so)) != NULL)
  811.         {
  812.           if (so -> so_name[0])
  813.         {
  814.           count = so -> sections_end - so -> sections;
  815.           memcpy ((char *) (target -> to_sections + old),
  816.               so -> sections, 
  817.               (sizeof (struct section_table)) * count);
  818.           old += count;
  819.         }
  820.         }
  821.     }
  822.     }
  823. }
  824.  
  825. /*
  826.  
  827. LOCAL FUNCTION
  828.  
  829.     info_sharedlibrary_command -- code for "info sharedlibrary"
  830.  
  831. SYNOPSIS
  832.  
  833.     static void info_sharedlibrary_command ()
  834.  
  835. DESCRIPTION
  836.  
  837.     Walk through the shared library list and print information
  838.     about each attached library.
  839. */
  840.  
  841. static void
  842. info_sharedlibrary_command (ignore, from_tty)
  843.      char *ignore;
  844.      int from_tty;
  845. {
  846.   register struct so_list *so = NULL;      /* link map state variable */
  847.   int header_done = 0;
  848.   
  849.   if (exec_bfd == NULL)
  850.     {
  851.       printf ("No exec file.\n");
  852.       return;
  853.     }
  854.   while ((so = find_solib (so)) != NULL)
  855.     {
  856.       if (so -> so_name[0])
  857.     {
  858.       if (!header_done)
  859.         {
  860.           printf("%-12s%-12s%-12s%s\n", "From", "To", "Syms Read",
  861.              "Shared Object Library");
  862.           header_done++;
  863.         }
  864.       printf ("%-12s", local_hex_string_custom ((int) LM_ADDR (so), "08"));
  865.       printf ("%-12s", local_hex_string_custom (so -> lmend, "08"));
  866.       printf ("%-12s", so -> symbols_loaded ? "Yes" : "No");
  867.       printf ("%s\n",  so -> so_name);
  868.     }
  869.     }
  870.   if (so_list_head == NULL)
  871.     {
  872.       printf ("No shared libraries loaded at this time.\n");    
  873.     }
  874. }
  875.  
  876. /*
  877.  
  878. GLOBAL FUNCTION
  879.  
  880.     solib_address -- check to see if an address is in a shared lib
  881.  
  882. SYNOPSIS
  883.  
  884.     int solib_address (CORE_ADDR address)
  885.  
  886. DESCRIPTION
  887.  
  888.     Provides a hook for other gdb routines to discover whether or
  889.     not a particular address is within the mapped address space of
  890.     a shared library.  Any address between the base mapping address
  891.     and the first address beyond the end of the last mapping, is
  892.     considered to be within the shared library address space, for
  893.     our purposes.
  894.  
  895.     For example, this routine is called at one point to disable
  896.     breakpoints which are in shared libraries that are not currently
  897.     mapped in.
  898.  */
  899.  
  900. int
  901. solib_address (address)
  902.      CORE_ADDR address;
  903. {
  904.   register struct so_list *so = 0;       /* link map state variable */
  905.   
  906.   while ((so = find_solib (so)) != NULL)
  907.     {
  908.       if (so -> so_name[0])
  909.     {
  910.       if ((address >= (CORE_ADDR) LM_ADDR (so)) &&
  911.           (address < (CORE_ADDR) so -> lmend))
  912.         {
  913.           return (1);
  914.         }
  915.     }
  916.     }
  917.   return (0);
  918. }
  919.  
  920. /* Called by free_all_symtabs */
  921.  
  922. void 
  923. clear_solib()
  924. {
  925.   struct so_list *next;
  926.   char *bfd_filename;
  927.   
  928.   while (so_list_head)
  929.     {
  930.       if (so_list_head -> sections)
  931.     {
  932.       free ((PTR)so_list_head -> sections);
  933.     }
  934.       if (so_list_head -> bfd)
  935.     {
  936.       bfd_filename = bfd_get_filename (so_list_head -> bfd);
  937.       bfd_close (so_list_head -> bfd);
  938.     }
  939.       else
  940.     /* This happens for the executable on SVR4.  */
  941.     bfd_filename = NULL;
  942.       
  943.       next = so_list_head -> next;
  944.       if (bfd_filename)
  945.     free ((PTR)bfd_filename);
  946.       free ((PTR)so_list_head);
  947.       so_list_head = next;
  948.     }
  949.   debug_base = 0;
  950. }
  951.  
  952. /*
  953.  
  954. LOCAL FUNCTION
  955.  
  956.     disable_break -- remove the "mapping changed" breakpoint
  957.  
  958. SYNOPSIS
  959.  
  960.     static int disable_break ()
  961.  
  962. DESCRIPTION
  963.  
  964.     Removes the breakpoint that gets hit when the dynamic linker
  965.     completes a mapping change.
  966.  
  967. */
  968.  
  969. static int
  970. disable_break ()
  971. {
  972.   int status = 1;
  973.  
  974. #ifndef SVR4_SHARED_LIBS
  975.  
  976.   int in_debugger = 0;
  977.   
  978.   /* Read the debugger structure from the inferior to retrieve the
  979.      address of the breakpoint and the original contents of the
  980.      breakpoint address.  Remove the breakpoint by writing the original
  981.      contents back. */
  982.  
  983.   read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
  984.  
  985.   /* Set `in_debugger' to zero now. */
  986.  
  987.   write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
  988.  
  989.   breakpoint_addr = (CORE_ADDR) debug_copy.ldd_bp_addr;
  990.   write_memory (breakpoint_addr, (char *) &debug_copy.ldd_bp_inst,
  991.         sizeof (debug_copy.ldd_bp_inst));
  992.  
  993. #else    /* SVR4_SHARED_LIBS */
  994.  
  995.   /* Note that breakpoint address and original contents are in our address
  996.      space, so we just need to write the original contents back. */
  997.  
  998.   if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0)
  999.     {
  1000.       status = 0;
  1001.     }
  1002.  
  1003. #endif    /* !SVR4_SHARED_LIBS */
  1004.  
  1005.   /* For the SVR4 version, we always know the breakpoint address.  For the
  1006.      SunOS version we don't know it until the above code is executed.
  1007.      Grumble if we are stopped anywhere besides the breakpoint address. */
  1008.  
  1009.   if (stop_pc != breakpoint_addr)
  1010.     {
  1011.       warning ("stopped at unknown breakpoint while handling shared libraries");
  1012.     }
  1013.  
  1014.   return (status);
  1015. }
  1016.  
  1017. /*
  1018.  
  1019. LOCAL FUNCTION
  1020.  
  1021.     enable_break -- arrange for dynamic linker to hit breakpoint
  1022.  
  1023. SYNOPSIS
  1024.  
  1025.     int enable_break (void)
  1026.  
  1027. DESCRIPTION
  1028.  
  1029.     Both the SunOS and the SVR4 dynamic linkers have, as part of their
  1030.     debugger interface, support for arranging for the inferior to hit
  1031.     a breakpoint after mapping in the shared libraries.  This function
  1032.     enables that breakpoint.
  1033.  
  1034.     For SunOS, there is a special flag location (in_debugger) which we
  1035.     set to 1.  When the dynamic linker sees this flag set, it will set
  1036.     a breakpoint at a location known only to itself, after saving the
  1037.     original contents of that place and the breakpoint address itself,
  1038.     in it's own internal structures.  When we resume the inferior, it
  1039.     will eventually take a SIGTRAP when it runs into the breakpoint.
  1040.     We handle this (in a different place) by restoring the contents of
  1041.     the breakpointed location (which is only known after it stops),
  1042.     chasing around to locate the shared libraries that have been
  1043.     loaded, then resuming.
  1044.  
  1045.     For SVR4, the debugger interface structure contains a member (r_brk)
  1046.     which is statically initialized at the time the shared library is
  1047.     built, to the offset of a function (_r_debug_state) which is guaran-
  1048.     teed to be called once before mapping in a library, and again when
  1049.     the mapping is complete.  At the time we are examining this member,
  1050.     it contains only the unrelocated offset of the function, so we have
  1051.     to do our own relocation.  Later, when the dynamic linker actually
  1052.     runs, it relocates r_brk to be the actual address of _r_debug_state().
  1053.  
  1054.     The debugger interface structure also contains an enumeration which
  1055.     is set to either RT_ADD or RT_DELETE prior to changing the mapping,
  1056.     depending upon whether or not the library is being mapped or unmapped,
  1057.     and then set to RT_CONSISTENT after the library is mapped/unmapped.
  1058. */
  1059.  
  1060. static int
  1061. enable_break ()
  1062. {
  1063.   int success = 0;
  1064.  
  1065. #ifndef SVR4_SHARED_LIBS
  1066.  
  1067.   int j;
  1068.   int in_debugger;
  1069.  
  1070.   /* Get link_dynamic structure */
  1071.  
  1072.   j = target_read_memory (debug_base, (char *) &dynamic_copy,
  1073.               sizeof (dynamic_copy));
  1074.   if (j)
  1075.     {
  1076.       /* unreadable */
  1077.       return (0);
  1078.     }
  1079.  
  1080.   /* Calc address of debugger interface structure */
  1081.  
  1082.   debug_addr = (CORE_ADDR) dynamic_copy.ldd;
  1083.  
  1084.   /* Calc address of `in_debugger' member of debugger interface structure */
  1085.  
  1086.   flag_addr = debug_addr + (CORE_ADDR) ((char *) &debug_copy.ldd_in_debugger -
  1087.                     (char *) &debug_copy);
  1088.  
  1089.   /* Write a value of 1 to this member.  */
  1090.  
  1091.   in_debugger = 1;
  1092.   write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
  1093.   success = 1;
  1094.  
  1095. #else    /* SVR4_SHARED_LIBS */
  1096.  
  1097. #ifdef BKPT_AT_SYMBOL
  1098.  
  1099.   struct minimal_symbol *msymbol;
  1100.   char **bkpt_namep;
  1101.   CORE_ADDR bkpt_addr;
  1102.  
  1103.   /* Scan through the list of symbols, trying to look up the symbol and
  1104.      set a breakpoint there.  Terminate loop when we/if we succeed. */
  1105.  
  1106.   breakpoint_addr = 0;
  1107.   for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
  1108.     {
  1109.       msymbol = lookup_minimal_symbol (*bkpt_namep, symfile_objfile);
  1110.       if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
  1111.     {
  1112.       bkpt_addr = SYMBOL_VALUE_ADDRESS (msymbol);
  1113.       if (target_insert_breakpoint (bkpt_addr, shadow_contents) == 0)
  1114.         {
  1115.           breakpoint_addr = bkpt_addr;
  1116.           success = 1;
  1117.           break;
  1118.         }
  1119.     }
  1120.     }
  1121.  
  1122. #else    /* !BKPT_AT_SYMBOL */
  1123.  
  1124.   struct symtab_and_line sal;
  1125.  
  1126.   /* Read the debugger interface structure directly. */
  1127.  
  1128.   read_memory (debug_base, (char *) &debug_copy, sizeof (debug_copy));
  1129.  
  1130.   /* Set breakpoint at the debugger interface stub routine that will
  1131.      be called just prior to each mapping change and again after the
  1132.      mapping change is complete.  Set up the (nonexistent) handler to
  1133.      deal with hitting these breakpoints.  (FIXME). */
  1134.  
  1135.   warning ("'%s': line %d: missing SVR4 support code", __FILE__, __LINE__);
  1136.   success = 1;
  1137.  
  1138. #endif    /* BKPT_AT_SYMBOL */
  1139.  
  1140. #endif    /* !SVR4_SHARED_LIBS */
  1141.  
  1142.   return (success);
  1143. }
  1144.   
  1145. /*
  1146.   
  1147. GLOBAL FUNCTION
  1148.   
  1149.     solib_create_inferior_hook -- shared library startup support
  1150.   
  1151. SYNOPSIS
  1152.   
  1153.     void solib_create_inferior_hook()
  1154.   
  1155. DESCRIPTION
  1156.   
  1157.     When gdb starts up the inferior, it nurses it along (through the
  1158.     shell) until it is ready to execute it's first instruction.  At this
  1159.     point, this function gets called via expansion of the macro
  1160.     SOLIB_CREATE_INFERIOR_HOOK.
  1161.  
  1162.     For SunOS executables, this first instruction is typically the
  1163.     one at "_start", or a similar text label, regardless of whether
  1164.     the executable is statically or dynamically linked.  The runtime
  1165.     startup code takes care of dynamically linking in any shared
  1166.     libraries, once gdb allows the inferior to continue.
  1167.  
  1168.     For SVR4 executables, this first instruction is either the first
  1169.     instruction in the dynamic linker (for dynamically linked
  1170.     executables) or the instruction at "start" for statically linked
  1171.     executables.  For dynamically linked executables, the system
  1172.     first exec's /lib/libc.so.N, which contains the dynamic linker,
  1173.     and starts it running.  The dynamic linker maps in any needed
  1174.     shared libraries, maps in the actual user executable, and then
  1175.     jumps to "start" in the user executable.
  1176.  
  1177.     For both SunOS shared libraries, and SVR4 shared libraries, we
  1178.     can arrange to cooperate with the dynamic linker to discover the
  1179.     names of shared libraries that are dynamically linked, and the
  1180.     base addresses to which they are linked.
  1181.  
  1182.     This function is responsible for discovering those names and
  1183.     addresses, and saving sufficient information about them to allow
  1184.     their symbols to be read at a later time.
  1185.  
  1186. FIXME
  1187.  
  1188.     Between enable_break() and disable_break(), this code does not
  1189.     properly handle hitting breakpoints which the user might have
  1190.     set in the startup code or in the dynamic linker itself.  Proper
  1191.     handling will probably have to wait until the implementation is
  1192.     changed to use the "breakpoint handler function" method.
  1193.  
  1194.     Also, what if child has exit()ed?  Must exit loop somehow.
  1195.   */
  1196.  
  1197. void 
  1198. solib_create_inferior_hook()
  1199. {
  1200.   
  1201.   if ((debug_base = locate_base ()) == 0)
  1202.     {
  1203.       /* Can't find the symbol or the executable is statically linked. */
  1204.       return;
  1205.     }
  1206.  
  1207.   if (!enable_break ())
  1208.     {
  1209.       warning ("shared library handler failed to enable breakpoint");
  1210.       return;
  1211.     }
  1212.  
  1213.   /* Now run the target.  It will eventually hit the breakpoint, at
  1214.      which point all of the libraries will have been mapped in and we
  1215.      can go groveling around in the dynamic linker structures to find
  1216.      out what we need to know about them. */
  1217.  
  1218.   clear_proceed_status ();
  1219.   stop_soon_quietly = 1;
  1220.   stop_signal = 0;
  1221.   do
  1222.     {
  1223.       target_resume (0, stop_signal);
  1224.       wait_for_inferior ();
  1225.     }
  1226.   while (stop_signal != SIGTRAP);
  1227.   stop_soon_quietly = 0;
  1228.   
  1229.   /* We are now either at the "mapping complete" breakpoint (or somewhere
  1230.      else, a condition we aren't prepared to deal with anyway), so adjust
  1231.      the PC as necessary after a breakpoint, disable the breakpoint, and
  1232.      add any shared libraries that were mapped in. */
  1233.  
  1234.   if (DECR_PC_AFTER_BREAK)
  1235.     {
  1236.       stop_pc -= DECR_PC_AFTER_BREAK;
  1237.       write_register (PC_REGNUM, stop_pc);
  1238.     }
  1239.  
  1240.   if (!disable_break ())
  1241.     {
  1242.       warning ("shared library handler failed to disable breakpoint");
  1243.     }
  1244.  
  1245.   solib_add ((char *) 0, 0, (struct target_ops *) 0);
  1246. }
  1247.  
  1248. /*
  1249.  
  1250. LOCAL FUNCTION
  1251.  
  1252.     special_symbol_handling -- additional shared library symbol handling
  1253.  
  1254. SYNOPSIS
  1255.  
  1256.     void special_symbol_handling (struct so_list *so)
  1257.  
  1258. DESCRIPTION
  1259.  
  1260.     Once the symbols from a shared object have been loaded in the usual
  1261.     way, we are called to do any system specific symbol handling that 
  1262.     is needed.
  1263.  
  1264.     For Suns, this consists of grunging around in the dynamic linkers
  1265.     structures to find symbol definitions for "common" symbols and 
  1266.     adding them to the minimal symbol table for the corresponding
  1267.     objfile.
  1268.  
  1269. */
  1270.  
  1271. static void
  1272. special_symbol_handling (so)
  1273. struct so_list *so;
  1274. {
  1275. #ifndef SVR4_SHARED_LIBS
  1276.   int j;
  1277.  
  1278.   if (debug_addr == 0)
  1279.     {
  1280.       /* Get link_dynamic structure */
  1281.  
  1282.       j = target_read_memory (debug_base, (char *) &dynamic_copy,
  1283.                   sizeof (dynamic_copy));
  1284.       if (j)
  1285.     {
  1286.       /* unreadable */
  1287.       return;
  1288.     }
  1289.  
  1290.       /* Calc address of debugger interface structure */
  1291.       /* FIXME, this needs work for cross-debugging of core files
  1292.      (byteorder, size, alignment, etc).  */
  1293.  
  1294.       debug_addr = (CORE_ADDR) dynamic_copy.ldd;
  1295.     }
  1296.  
  1297.   /* Read the debugger structure from the inferior, just to make sure
  1298.      we have a current copy. */
  1299.  
  1300.   j = target_read_memory (debug_addr, (char *) &debug_copy,
  1301.               sizeof (debug_copy));
  1302.   if (j)
  1303.     return;        /* unreadable */
  1304.  
  1305.   /* Get common symbol definitions for the loaded object. */
  1306.  
  1307.   if (debug_copy.ldd_cp)
  1308.     {
  1309.       solib_add_common_symbols (debug_copy.ldd_cp, so -> objfile);
  1310.     }
  1311.  
  1312. #endif    /* !SVR4_SHARED_LIBS */
  1313. }
  1314.  
  1315.  
  1316. /*
  1317.  
  1318. LOCAL FUNCTION
  1319.  
  1320.     sharedlibrary_command -- handle command to explicitly add library
  1321.  
  1322. SYNOPSIS
  1323.  
  1324.     static void sharedlibrary_command (char *args, int from_tty)
  1325.  
  1326. DESCRIPTION
  1327.  
  1328. */
  1329.  
  1330. static void
  1331. sharedlibrary_command (args, from_tty)
  1332. char *args;
  1333. int from_tty;
  1334. {
  1335.   dont_repeat ();
  1336.   solib_add (args, from_tty, (struct target_ops *) 0);
  1337. }
  1338.  
  1339. void
  1340. _initialize_solib()
  1341. {
  1342.   
  1343.   add_com ("sharedlibrary", class_files, sharedlibrary_command,
  1344.        "Load shared object library symbols for files matching REGEXP.");
  1345.   add_info ("sharedlibrary", info_sharedlibrary_command, 
  1346.         "Status of loaded shared object libraries.");
  1347. }
  1348.