linux-mips-low.c: Change "private" variable name
[deliverable/binutils-gdb.git] / gdb / exec.c
index 9d4ad90c3f90f6b0e3e035c7528dd1324f7bbb52..3089bb4f42a8bcdf5dd695d522e8f2e42a2a4796 100644 (file)
@@ -42,6 +42,7 @@
 
 #include <ctype.h>
 #include <sys/stat.h>
+#include "solist.h"
 
 void (*deprecated_file_changed_hook) (char *);
 
@@ -151,15 +152,23 @@ exec_file_locate_attach (int pid, int from_tty)
   if (exec_file == NULL)
     return;
 
-  /* It's possible we don't have a full path, but rather just a
-     filename.  Some targets, such as HP-UX, don't provide the
-     full path, sigh.
+  /* If gdb_sysroot is not empty and the discovered filename
+     is absolute then prefix the filename with gdb_sysroot.  */
+  if (*gdb_sysroot != '\0' && IS_ABSOLUTE_PATH (exec_file))
+    full_exec_path = exec_file_find (exec_file, NULL);
 
-     Attempt to qualify the filename against the source path.
-     (If that fails, we'll just fall back on the original
-     filename.  Not much more we can do...)  */
-  if (!source_full_path_of (exec_file, &full_exec_path))
-    full_exec_path = xstrdup (exec_file);
+  if (full_exec_path == NULL)
+    {
+      /* It's possible we don't have a full path, but rather just a
+        filename.  Some targets, such as HP-UX, don't provide the
+        full path, sigh.
+
+        Attempt to qualify the filename against the source path.
+        (If that fails, we'll just fall back on the original
+        filename.  Not much more we can do...)  */
+      if (!source_full_path_of (exec_file, &full_exec_path))
+       full_exec_path = xstrdup (exec_file);
+    }
 
   exec_file_attach (full_exec_path, from_tty);
   symbol_file_add_main (full_exec_path, from_tty);
@@ -274,7 +283,7 @@ exec_file_attach (const char *filename, int from_tty)
 
       if (!exec_bfd)
        {
-         error (_("\"%s\": could not open as an executable file: %s"),
+         error (_("\"%s\": could not open as an executable file: %s."),
                 scratch_pathname, bfd_errmsg (bfd_get_error ()));
        }
 
@@ -444,8 +453,8 @@ resize_section_table (struct target_section_table *table, int adjustment)
 
   if (new_count)
     {
-      table->sections = xrealloc (table->sections,
-                                 sizeof (struct target_section) * new_count);
+      table->sections = XRESIZEVEC (struct target_section, table->sections,
+                                   new_count);
       table->sections_end = table->sections + new_count;
     }
   else
@@ -466,7 +475,7 @@ build_section_table (struct bfd *some_bfd, struct target_section **start,
   count = bfd_count_sections (some_bfd);
   if (*start)
     xfree (* start);
-  *start = (struct target_section *) xmalloc (count * sizeof (**start));
+  *start = XNEWVEC (struct target_section, count);
   *end = *start;
   bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
   if (*end > *start + count)
This page took 0.025195 seconds and 4 git commands to generate.