Rewrite find_active_thread() and find_tcb() to use ptid_t, instead of
[deliverable/binutils-gdb.git] / gdb / solib.c
index 370f814e435c62baeea27b460345383d56ef6bf4..c43858e8b55e282a0f74b9d4f4878e06a2ecd225 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;
@@ -732,6 +730,8 @@ clear_solib (void)
     {
       struct so_list *so = so_list_head;
       so_list_head = so->next;
+      if (so->abfd)
+       remove_target_sections (so->abfd);
       free_so (so);
     }
 
This page took 0.042811 seconds and 4 git commands to generate.