* 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 ~'.
This commit is contained in:
parent
f1415016b6
commit
6ace3df1ec
@ -1,3 +1,12 @@
|
||||
2012-07-19 Yao Qi <yao@codesourcery.com>
|
||||
Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* 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'.
|
||||
|
||||
2012-07-18 Doug Evans <dje@google.com>
|
||||
|
||||
* common/gdb_vecs.h: Moved here from ./gdb_vecs.h.
|
||||
|
@ -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);
|
||||
|
15
gdb/infcmd.c
15
gdb/infcmd.c
@ -2918,6 +2918,7 @@ _initialize_infcmd (void)
|
||||
{
|
||||
static struct cmd_list_element *info_proc_cmdlist;
|
||||
struct cmd_list_element *c = NULL;
|
||||
char *cmd_name;
|
||||
|
||||
/* Add the filename of the terminal connected to inferior I/O. */
|
||||
add_setshow_filename_cmd ("inferior-tty", class_run,
|
||||
@ -2930,14 +2931,18 @@ Usage: set inferior-tty /dev/pts/1"),
|
||||
&setlist, &showlist);
|
||||
add_com_alias ("tty", "set inferior-tty", class_alias, 0);
|
||||
|
||||
add_setshow_optional_filename_cmd ("args", class_run,
|
||||
&inferior_args_scratch, _("\
|
||||
cmd_name = "args";
|
||||
add_setshow_string_noescape_cmd (cmd_name, class_run,
|
||||
&inferior_args_scratch, _("\
|
||||
Set argument list to give program being debugged when it is started."), _("\
|
||||
Show argument list to give program being debugged when it is started."), _("\
|
||||
Follow this command with any number of args, to be passed to the program."),
|
||||
set_args_command,
|
||||
show_args_command,
|
||||
&setlist, &showlist);
|
||||
set_args_command,
|
||||
show_args_command,
|
||||
&setlist, &showlist);
|
||||
c = lookup_cmd (&cmd_name, setlist, "", -1, 1);
|
||||
gdb_assert (c != NULL);
|
||||
set_cmd_completer (c, filename_completer);
|
||||
|
||||
c = add_cmd ("environment", no_class, environment_info, _("\
|
||||
The environment to give the program, or one variable's value.\n\
|
||||
|
@ -1,3 +1,7 @@
|
||||
2012-07-19 Yao Qi <yao@codesourcery.com>
|
||||
|
||||
* gdb.base/setshow.exp: Test 'set args ~'.
|
||||
|
||||
2012-07-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
* gdb.base/store.exp (check_set): Import gdb_prompt.
|
||||
|
@ -87,6 +87,10 @@ gdb_test_no_output "set annotate 0" "set annotate 0"
|
||||
gdb_test "show annotate" "Annotation_level is 0..*" "show annotate (0)"
|
||||
#test annotation_level 0
|
||||
gdb_test "info line 1" "Line 1 of .* is at address .* but contains no code.*" "annotation_level 0"
|
||||
|
||||
gdb_test_no_output "set args ~"
|
||||
gdb_test "show args" "Argument list to give program being debugged when it is started is \"~\"..*" \
|
||||
"show args ~"
|
||||
#test set args
|
||||
gdb_test_no_output "set args foo bar blup baz bubble" "set args"
|
||||
#test show args
|
||||
|
Loading…
Reference in New Issue
Block a user