]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix failed exec error message
authorPedro Alves <palves@redhat.com>
Fri, 24 Jul 2015 16:27:58 +0000 (17:27 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 24 Jul 2015 16:27:58 +0000 (17:27 +0100)
Ref: https://sourceware.org/ml/gdb-patches/2015-07/msg00629.html

This fixes the bogus command line in the error message shown when the
SHELL environment variable points somewhere that's not something that
resembles a shell:

  $ SHELL=/nonexisting gdb /home/pedro/a.out
  (gdb) r
  Starting program: /home/pedro/a.out
 - Cannot exec /home/pedro/a.out -c exec /home/pedro/a.out .
 + Cannot exec /nonexisting -c exec /home/pedro/a.out .
  Error: No such file or directory
  During startup program exited with code 127.
  (gdb)

gdb/ChangeLog:
2015-07-24  Pedro Alves  <palves@redhat.com>

* fork-child.c (fork_inferior): Print argv[0] instead of exec_file.

gdb/ChangeLog
gdb/fork-child.c

index f6898fc0be73dcb1ee20a865ba1ee64035217823..a3fa56f873017eb22519add3d13eb43c4394dcb0 100644 (file)
@@ -1,3 +1,7 @@
+2015-07-24  Pedro Alves  <palves@redhat.com>
+
+       * fork-child.c (fork_inferior): Print argv[0] instead of exec_file.
+
 2015-07-24  Pedro Alves  <palves@redhat.com>
 
        * aarch64-linux-nat.c: Include nat/gdb_ptrace.h instead of
index 66c07fbf3921731c4823169b34330bdb38b369e9..4ba62b09ac9123a25946d30d7febf3465c0695aa 100644 (file)
@@ -365,7 +365,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
 
       /* If we get here, it's an error.  */
       save_errno = errno;
-      fprintf_unfiltered (gdb_stderr, "Cannot exec %s", exec_file);
+      fprintf_unfiltered (gdb_stderr, "Cannot exec %s", argv[0]);
       for (i = 1; argv[i] != NULL; i++)
        fprintf_unfiltered (gdb_stderr, " %s", argv[i]);
       fprintf_unfiltered (gdb_stderr, ".\n");