aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-script.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-03-30 16:51:20 +0000
committerDaniel Jacobowitz <drow@false.org>2006-03-30 16:51:20 +0000
commit61d9b92fc1a084d43c328afbd9f9177013b226c6 (patch)
tree38193caba832176b2badf1b76be1ef75e29c313f /gdb/cli/cli-script.c
parentf7060f859d2b845bf842397baeeafbb4fca2075e (diff)
downloadgdb-61d9b92fc1a084d43c328afbd9f9177013b226c6.zip
gdb-61d9b92fc1a084d43c328afbd9f9177013b226c6.tar.gz
gdb-61d9b92fc1a084d43c328afbd9f9177013b226c6.tar.bz2
gdb/
* cli/cli-script.c (insert_args): Handle NULL user_args. gdb/testsuite/ * gdb.base/commands.exp (stray_arg0_test): New test.
Diffstat (limited to 'gdb/cli/cli-script.c')
-rw-r--r--gdb/cli/cli-script.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index b8e9d4f..b447b44 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -593,6 +593,11 @@ insert_args (char *line)
char *p, *save_line, *new_line;
unsigned len, i;
+ /* If we are not in a user-defined function, treat $argc, $arg0, et
+ cetera as normal convenience variables. */
+ if (user_args == NULL)
+ return xstrdup (line);
+
/* First we need to know how much memory to allocate for the new line. */
save_line = line;
len = 0;