[testsuite] Unbuffer the output in gdb.base/multi-forks.c
[deliverable/binutils-gdb.git] / gdb / exec.c
index 872b86c69802a0b6721f6a580736baf6fcfea557..23c89c252154feba1c9293beeb140bd83850393e 100644 (file)
@@ -1,6 +1,6 @@
 /* Work with executable files, for GDB. 
 
-   Copyright (C) 1988-2015 Free Software Foundation, Inc.
+   Copyright (C) 1988-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -154,15 +154,8 @@ exec_file_locate_attach (int pid, int from_tty)
 
   /* If gdb_sysroot is not empty and the discovered filename
      is absolute then prefix the filename with gdb_sysroot.  */
-  if (gdb_sysroot != NULL && *gdb_sysroot != '\0'
-      && IS_ABSOLUTE_PATH (exec_file))
-    {
-      int fd = -1;
-
-      full_exec_path = exec_file_find (exec_file, &fd);
-      if (fd >= 0)
-       close (fd);
-    }
+  if (*gdb_sysroot != '\0' && IS_ABSOLUTE_PATH (exec_file))
+    full_exec_path = exec_file_find (exec_file, NULL);
 
   if (full_exec_path == NULL)
     {
@@ -261,7 +254,7 @@ exec_file_attach (const char *filename, int from_tty)
 #if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
          if (scratch_chan < 0)
            {
-             char *exename = alloca (strlen (filename) + 5);
+             char *exename = (char *) alloca (strlen (filename) + 5);
 
              strcat (strcpy (exename, filename), ".exe");
              scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST,
@@ -290,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 ()));
        }
 
@@ -460,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
@@ -482,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.024603 seconds and 4 git commands to generate.