diff options
author | Andrew Stubbs <andrew.stubbs@st.com> | 2006-04-07 13:31:15 +0000 |
---|---|---|
committer | Andrew Stubbs <andrew.stubbs@st.com> | 2006-04-07 13:31:15 +0000 |
commit | e28493f22671b9acb23366572cfba9dd5ed13a8d (patch) | |
tree | 5cf23b92d541855717b39dc9e1c8819371e31f13 /gdb/cli/cli-script.c | |
parent | f2e349f91a7063d6a09630bce740696a7bd38fea (diff) | |
download | gdb-e28493f22671b9acb23366572cfba9dd5ed13a8d.zip gdb-e28493f22671b9acb23366572cfba9dd5ed13a8d.tar.gz gdb-e28493f22671b9acb23366572cfba9dd5ed13a8d.tar.bz2 |
2006-04-07 Andrew Stubbs <andrew.stubbs@st.com>
gdb/
* cli/cli-script.c (struct user_args): Add command field.
(arg_cleanup): Free command string.
(setup_user_args): Copy the command line before relying on it.
gdb/testsuite/
* gdb.base/commands.exp (recursive_source_test): New test.
Diffstat (limited to 'gdb/cli/cli-script.c')
-rw-r--r-- | gdb/cli/cli-script.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index b447b44..4f44477 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -54,6 +54,9 @@ static int control_level; struct user_args { struct user_args *next; + /* It is necessary to store a malloced copy of the command line to + ensure that the arguments are not overwritten before they are used. */ + char *command; struct { char *arg; @@ -483,6 +486,7 @@ arg_cleanup (void *ignore) _("arg_cleanup called with no user args.\n")); user_args = user_args->next; + xfree (oargs->command); xfree (oargs); } @@ -507,6 +511,8 @@ setup_user_args (char *p) if (p == NULL) return old_chain; + user_args->command = p = xstrdup (p); + while (*p) { char *start_arg; |