* [pushed] Fix failed exec error message
@ 2015-07-24 16:43 Pedro Alves
0 siblings, 0 replies; only message in thread
From: Pedro Alves @ 2015-07-24 16:43 UTC (permalink / raw)
To: gdb-patches
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 | 4 ++++
gdb/fork-child.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f6898fc..a3fa56f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
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
sys/ptrace.h.
* alpha-linux-nat.c: Likewise.
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 66c07fb..4ba62b0 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -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");
--
1.9.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-24 16:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 16:43 [pushed] Fix failed exec error message Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).