aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2012-09-17 08:42:14 +0000
committerYao Qi <yao@codesourcery.com>2012-09-17 08:42:14 +0000
commit6fc1c7733ea454110cfcb02be7d9b4b0f12eca91 (patch)
tree21dc5418ed29e2209c93817d94465640b82d124f /gdb/cli
parent6acef6cd7bfefe89401de1eca7e12e737eb94da6 (diff)
downloadgdb-6fc1c7733ea454110cfcb02be7d9b4b0f12eca91.zip
gdb-6fc1c7733ea454110cfcb02be7d9b4b0f12eca91.tar.gz
gdb-6fc1c7733ea454110cfcb02be7d9b4b0f12eca91.tar.bz2
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.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c9
-rw-r--r--gdb/cli/cli-decode.c22
-rw-r--r--gdb/cli/cli-setshow.c30
3 files changed, 55 insertions, 6 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d3473d5..2e98804 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1826,14 +1826,15 @@ is displayed."),
show_remote_debug,
&setdebuglist, &showdebuglist);
- add_setshow_integer_cmd ("remotetimeout", no_class, &remote_timeout, _("\
+ add_setshow_zuinteger_unlimited_cmd ("remotetimeout", no_class,
+ &remote_timeout, _("\
Set timeout limit to wait for target to respond."), _("\
Show timeout limit to wait for target to respond."), _("\
This value is used to set the time limit for gdb to wait for a response\n\
from the target."),
- NULL,
- show_remote_timeout,
- &setlist, &showlist);
+ NULL,
+ show_remote_timeout,
+ &setlist, &showlist);
add_prefix_cmd ("debug", no_class, set_debug,
_("Generic command for setting gdb debugging flags"),
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4752a82..6e0f0de 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -632,7 +632,8 @@ add_setshow_optional_filename_cmd (char *name, enum command_class class,
/* Add element named NAME to both the set and show command LISTs (the
list for set/show or some sublist thereof). CLASS is as in
add_cmd. VAR is address of the variable which will contain the
- value. SET_DOC and SHOW_DOC are the documentation strings. */
+ value. SET_DOC and SHOW_DOC are the documentation strings. This
+ function is only used in Python API. Please don't use it elsewhere. */
void
add_setshow_integer_cmd (char *name, enum command_class class,
int *var,
@@ -692,6 +693,25 @@ add_setshow_zinteger_cmd (char *name, enum command_class class,
NULL, NULL);
}
+void
+add_setshow_zuinteger_unlimited_cmd (char *name,
+ enum command_class class,
+ unsigned int *var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list)
+{
+ add_setshow_cmd_full (name, class, var_zuinteger_unlimited, var,
+ set_doc, show_doc, help_doc,
+ set_func, show_func,
+ set_list, show_list,
+ NULL, NULL);
+}
+
/* Add element named NAME to both the set and show command LISTs (the
list for set/show or some sublist thereof). CLASS is as in
add_cmd. VAR is address of the variable which will contain the
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"));
}