* d10v-dis.c: Fix formatting.
[deliverable/binutils-gdb.git] / gdb / solib.c
index dc831095e6f9713a4ed36010720ee275de7849ff..dfcca0cc47b6df7c3da393314b7408df6d11748c 100644 (file)
@@ -39,6 +39,7 @@
 #include "language.h"
 #include "gdbcmd.h"
 #include "completer.h"
+#include "filenames.h"         /* for DOSish file names */
 
 #include "solist.h"
 
@@ -101,10 +102,14 @@ solib_open (char *in_pathname, char **found_pathname)
 {
   int found_file = -1;
   char *temp_pathname = NULL;
+  char *p = in_pathname;
 
-  if (strchr (in_pathname, SLASH_CHAR))
+  while (*p && !IS_DIR_SEPARATOR (*p))
+    p++;
+
+  if (*p)
     {
-      if (! ROOTED_P (in_pathname) || solib_absolute_prefix == NULL)
+      if (! IS_ABSOLUTE_PATH (in_pathname) || solib_absolute_prefix == NULL)
         temp_pathname = in_pathname;
       else
        {
@@ -112,7 +117,7 @@ solib_open (char *in_pathname, char **found_pathname)
 
          /* Remove trailing slashes from absolute prefix.  */
          while (prefix_len > 0
-                && SLASH_P (solib_absolute_prefix[prefix_len - 1]))
+                && IS_DIR_SEPARATOR (solib_absolute_prefix[prefix_len - 1]))
            prefix_len--;
 
          /* Cat the prefixed pathname together.  */
@@ -461,30 +466,20 @@ update_solib_list (int from_tty, struct target_ops *target)
          catch_errors (solib_map_sections, i,
                        "Error while mapping shared library sections:\n",
                        RETURN_MASK_ALL);
-       }
-
-      /* If requested, add the shared objects' sections to the the
-        TARGET's section table.  */
-      if (target)
-       {
-         int new_sections;
 
-         /* Figure out how many sections we'll need to add in total.  */
-         new_sections = 0;
-         for (i = inferior; i; i = i->next)
-           new_sections += (i->sections_end - i->sections);
-
-         if (new_sections > 0)
+         /* If requested, add the shared object's sections to the TARGET's
+            section table.  Do this immediately after mapping the object so
+            that later nodes in the list can query this object, as is needed
+            in solib-osf.c.  */
+         if (target)
            {
-             int space = target_resize_to_sections (target, new_sections);
-
-             for (i = inferior; i; i = i->next)
+             int count = (i->sections_end - i->sections);
+             if (count > 0)
                {
-                 int count = (i->sections_end - i->sections);
+                 int space = target_resize_to_sections (target, count);
                  memcpy (target->to_sections + space,
                          i->sections,
                          count * sizeof (i->sections[0]));
-                 space += count;
                }
            }
        }
@@ -605,7 +600,10 @@ info_sharedlibrary_command (char *ignore, int from_tty)
     }
 
   arch_size = bfd_get_arch_size (exec_bfd);
-  /* Default to 32-bit in case of failure (non-elf). */
+  if (arch_size == -1)
+    arch_size = bfd_arch_bits_per_address(exec_bfd);
+
+  /* Default to 32-bit in case of failure.  */
   if (arch_size == 32 || arch_size == -1)
     {
       addr_width = 8 + 4;
@@ -809,6 +807,18 @@ sharedlibrary_command (char *args, int from_tty)
   solib_add (args, from_tty, (struct target_ops *) 0);
 }
 
+/* LOCAL FUNCTION
+
+   no_shared_libraries -- handle command to explicitly discard symbols
+   from shared libraries.
+
+   DESCRIPTION
+
+   Implements the command "nosharedlibrary", which discards symbols
+   that have been auto-loaded from shared libraries.  Symbols from
+   shared libraries that were added by explicit request of the user
+   are not discarded.  Also called from remote.c.  */
+
 void
 no_shared_libraries (char *ignored, int from_tty)
 {
@@ -826,7 +836,7 @@ _initialize_solib (void)
   add_info ("sharedlibrary", info_sharedlibrary_command,
            "Status of loaded shared object libraries.");
   add_com ("nosharedlibrary", class_files, no_shared_libraries,
-          "Unload all shared object library symbols except .");
+          "Unload all shared object library symbols.");
 
   add_show_from_set
     (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
This page took 0.02584 seconds and 4 git commands to generate.