diff options
author | Tristan Gingold <gingold@adacore.com> | 2011-09-22 10:22:28 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2011-09-22 10:22:28 +0000 |
commit | e69860f1b6d6e38cc5de31a9dc1138015182c7d5 (patch) | |
tree | 0440500af65431119a8f792b2967d84b63e5064f /gdb/fork-child.c | |
parent | 7cf3bbff3627f9650721a2f8c07581e75208d30d (diff) | |
download | fsf-binutils-gdb-e69860f1b6d6e38cc5de31a9dc1138015182c7d5.zip fsf-binutils-gdb-e69860f1b6d6e38cc5de31a9dc1138015182c7d5.tar.gz fsf-binutils-gdb-e69860f1b6d6e38cc5de31a9dc1138015182c7d5.tar.bz2 |
2011-09-22 Tristan Gingold <gingold@adacore.com>
* fork-child.c (fork_inferior): Add exec_fun parameter.
Call exec_fun or execvp.
* inferior.h: Adjust prototype.
* gnu-nat.c (gnu_create_inferior): Adjust fork_inferior call.
* inf-ttrace.c (inf_ttrace_create_inferior): Ditto.
* inf-ptrace.c (inf_ptrace_create_inferior): Ditto.
* procfs.c (procfs_create_inferior): Ditto.
* darwin-nat.c (darwin_execvp): New function.
(darwin_create_inferior): Use it.
Diffstat (limited to 'gdb/fork-child.c')
-rw-r--r-- | gdb/fork-child.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/fork-child.c b/gdb/fork-child.c index 5dbf1f7..e6408f4 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -115,6 +115,7 @@ escape_bang_in_quoted_argument (const char *shell_file) pid. EXEC_FILE is the file to run. ALLARGS is a string containing the arguments to the program. ENV is the environment vector to pass. SHELL_FILE is the shell file, or NULL if we should pick + one. EXEC_FUN is the exec(2) function to use, or NULL for the default one. */ /* This function is NOT reentrant. Some of the variables have been @@ -123,7 +124,9 @@ escape_bang_in_quoted_argument (const char *shell_file) int fork_inferior (char *exec_file_arg, char *allargs, char **env, void (*traceme_fun) (void), void (*init_trace_fun) (int), - void (*pre_trace_fun) (void), char *shell_file_arg) + void (*pre_trace_fun) (void), char *shell_file_arg, + void (*exec_fun)(const char *file, char * const *argv, + char * const *env)) { int pid; static char default_shell_file[] = SHELL_FILE; @@ -359,7 +362,10 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env, path to find $SHELL. Rich Pixley says so, and I agree. */ environ = env; - execvp (argv[0], argv); + if (exec_fun != NULL) + (*exec_fun) (argv[0], argv, env); + else + execvp (argv[0], argv); /* If we get here, it's an error. */ save_errno = errno; |