diff options
author | Yao Qi <yao@codesourcery.com> | 2012-07-19 12:48:17 +0000 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2012-07-19 12:48:17 +0000 |
commit | 6ace3df1ec836a2c7aaabbd32877229757fae412 (patch) | |
tree | c9a18d6b62815ab120b435221b3b0c0413634527 /gdb/cli/cli-setshow.c | |
parent | f1415016b687b6b9d1f5c53c91036f8a565b2c52 (diff) | |
download | gdb-6ace3df1ec836a2c7aaabbd32877229757fae412.zip gdb-6ace3df1ec836a2c7aaabbd32877229757fae412.tar.gz gdb-6ace3df1ec836a2c7aaabbd32877229757fae412.tar.bz2 |
* cli/cli-setshow.c (do_setshow_command): Handle case 'var_filename'
and case 'var_optional_filename' together.
* infcmd.c (_initialize_infcmd): Call add_setshow_string_noescape_cmd
instead of add_setshow_optional_filename_cmd for setshow command
'args'. Set completer for 'set args'.
gdb/testsuite:
* gdb.base/setshow.exp: Test 'set args ~'.
Diffstat (limited to 'gdb/cli/cli-setshow.c')
-rw-r--r-- | gdb/cli/cli-setshow.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 521ac0e..dccf425 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -182,27 +182,27 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) xfree (*(char **) c->var); *(char **) c->var = xstrdup (arg); break; - case var_optional_filename: - if (arg == NULL) - arg = ""; - if (*(char **) c->var != NULL) - xfree (*(char **) c->var); - *(char **) c->var = xstrdup (arg); - break; case var_filename: if (arg == NULL) error_no_arg (_("filename to set it to.")); + /* FALLTHROUGH */ + case var_optional_filename: if (*(char **) c->var != NULL) xfree (*(char **) c->var); - { - /* Clear trailing whitespace of filename. */ - char *ptr = arg + strlen (arg) - 1; - while (ptr >= arg && (*ptr == ' ' || *ptr == '\t')) - ptr--; - *(ptr + 1) = '\0'; - } - *(char **) c->var = tilde_expand (arg); + if (arg != NULL) + { + /* Clear trailing whitespace of filename. */ + char *ptr = arg + strlen (arg) - 1; + + while (ptr >= arg && (*ptr == ' ' || *ptr == '\t')) + ptr--; + *(ptr + 1) = '\0'; + + *(char **) c->var = tilde_expand (arg); + } + else + *(char **) c->var = xstrdup (""); break; case var_boolean: *(int *) c->var = parse_binary_operation (arg); |