From 6fc1c7733ea454110cfcb02be7d9b4b0f12eca91 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Mon, 17 Sep 2012 08:42:14 +0000 Subject: gdb/ * cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New. Update comment to add_setshow_integer_cmd. * cli/cli-setshow.c (do_set_command): Handle case 'var_zuinteger_unlimited'. (do_show_command): Likewise. * cli/cli-cmds.c (init_cmds): Call add_setshow_zuinteger_unlimited_cmd for command 'remotetimeout'. * command.h (enum var_types): New zuinteger_unlimited. Update comment to var_integer. * source.c (_initialize_source): Call add_setshow_zuinteger_unlimited_cmd for command 'set listsize'. gdb/doc/ * gdb.texinfo (List): Describe the meaning of 0 and -1 in 'set listsize'. gdb/testsuite/ * gdb.base/list.exp (set_listsize): Don't set arg to "unlimited" when it is less than 0. --- gdb/cli/cli-setshow.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'gdb/cli/cli-setshow.c') diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 89e095a..9d8cb2e 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -379,6 +379,26 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c) } } break; + case var_zuinteger_unlimited: + { + LONGEST val; + + if (arg == NULL) + error_no_arg (_("integer to set it to.")); + val = parse_and_eval_long (arg); + + if (val >= INT_MAX) + error (_("integer %s out of range"), plongest (val)); + else if (val < -1) + error (_("only -1 is allowed to set as unlimited")); + + if (*(int *) c->var != val) + { + *(int *) c->var = val; + option_changed = 1; + } + } + break; default: error (_("gdb internal error: bad var_type in do_setshow_command")); } @@ -478,6 +498,7 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c) break; case var_integer: case var_zinteger: + case var_zuinteger_unlimited: { char s[64]; @@ -562,7 +583,14 @@ do_show_command (char *arg, int from_tty, struct cmd_list_element *c) else fprintf_filtered (stb, "%d", *(int *) c->var); break; - + case var_zuinteger_unlimited: + { + if (*(int *) c->var == -1) + fputs_filtered ("unlimited", stb); + else + fprintf_filtered (stb, "%u", *(int *) c->var); + } + break; default: error (_("gdb internal error: bad var_type in do_show_command")); } -- cgit v1.1