diff options
author | Pedro Alves <palves@redhat.com> | 2013-04-10 15:11:12 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2013-04-10 15:11:12 +0000 |
commit | f81d112039fa5c836e446d8f79331fdaa35d76ab (patch) | |
tree | 7f629e7ff028ac4c5eadfd3ba5777203615d0d1f | |
parent | 2f9d54cfcef6c6085ff4bfcbf42c963527606d89 (diff) | |
download | gdb-f81d112039fa5c836e446d8f79331fdaa35d76ab.zip gdb-f81d112039fa5c836e446d8f79331fdaa35d76ab.tar.gz gdb-f81d112039fa5c836e446d8f79331fdaa35d76ab.tar.bz2 |
Accept "set foo unlimited" in integer/uinteger/zuinteger_unlimited commands.
Currently, several commands take "0" or "-1" to mean "unlimited".
"show" knows when to print "unlimited":
(gdb) show height
Number of lines gdb thinks are in a page is 45.
(gdb) set height 0
(gdb) show height
Number of lines gdb thinks are in a page is unlimited.
However, the user can't herself specify "unlimited" directly:
(gdb) set height unlimited
No symbol table is loaded. Use the "file" command.
(gdb)
This patch addresses that, by adjusting the set handler for all
integer/uinteger/zuinteger_unlimited commands to accept literal
"unlimited". It also installs a completer. Presently, we complete on
symbols by default, and at
<http://sourceware.org/ml/gdb-patches/2013-03/msg00864.html> I've
shown a WIP prototype that tried to keep that half working in these
commands. In the end, it turned out to be more complicated than
justifiable, IMO. It's super rare to want to pass the value of a
variable/symbol in the program to a GDB set/show knob. That'll still
work, it's just that we won't assist with completion anymore. This
patch just sticks with the simple, and completes on "unlimited", and
nothing else. This simplification means that
"set he<tab><tab>"
is all it takes to get to:
"set height unlimited"
The patch then goes through all integer/uinteger/zuinteger_unlimited
commands in the tree, and updates both the online help and the manual
to mention that "unlimited" is accepted in addition to 0/-1. In the
cases where the command had no online help text at all, this adds it.
I've tried to make the texts read in a way that "unlimited" is
suggested before "0" or "-1" is.
Tested on x86_64 Fedora 17.
gdb/
2013-04-10 Pedro Alves <palves@redhat.com>
* cli/cli-decode.c (integer_unlimited_completer): New function.
(add_setshow_integer_cmd, add_setshow_uinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd): Install the "unlimited"
completer.
* cli/cli-setshow.c: Include "cli/cli-utils.h".
(is_unlimited_literal): New function.
(do_set_command): Handle literal "unlimited" arguments.
* frame.c (_initialize_frame) <set backtrace limit>: Document
"unlimited".
* printcmd.c (_initialize_printcmd) <set print
max-symbolic-offset>: Add help text.
* record-full.c (_initialize_record_full) <set record full
insn-number-max>: Likewise.
* record.c (_initialize_record) <set record
instruction-history-size, set record function-call-history-size>:
Add help text.
* ser-tcp.c (_initialize_ser_tcp) <set tcp connect-timeout>: Add
help text.
* tracepoint.c (_initialize_tracepoint) <set trace-buffer-size>:
Likewise.
* source.c (_initialize_source) <set listsize>: Add help text.
* utils.c (initialize_utils) <set height, set width>: Likewise.
<set pagination>: Mention "set height unlimited".
* valprint.c (_initialize_valprint) <set print elements, set print
repeats>: Document "unlimited".
gdb/doc/
2013-04-10 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Process Record and Replay): Document that "set
record full insn-number-max", "set record
instruction-history-size" and "set record
function-call-history-size" accept "unlimited".
(Backtrace): Document that "set backtrace limit" accepts
"unlimited".
(List): Document that "set listsize" accepts "unlimited".
(Print Settings)" Document that "set print max-symbolic-offset",
"set print elements" and "set print repeats" accept "unlimited".
(Starting and Stopping Trace Experiments): Document that "set
trace-buffer-size" accepts "unlimited".
(Remote Configuration): Document that "set tcp connect-timeout"
accepts "unlimited".
(Command History): Document that "set history size" accepts
"unlimited".
(Screen Size): Document that "set height" and "set width" accepts
"unlimited". Adjust "set pagination"'s description to suggest
"set height unlimited" instead of "set height 0".
gdb/testsuite/
2013-04-10 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp: Test "set height", "set listsize" and
"set trace-buffer-size" completion.
* gdb.base/setshow.exp: Test "set height unlimited".
* gdb.trace/trace-buffer-size.exp: Test "set trace-buffer-size
unlimited".
-rw-r--r-- | gdb/ChangeLog | 28 | ||||
-rw-r--r-- | gdb/cli/cli-decode.c | 34 | ||||
-rw-r--r-- | gdb/cli/cli-setshow.c | 49 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 71 | ||||
-rw-r--r-- | gdb/frame.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 7 | ||||
-rw-r--r-- | gdb/record-full.c | 3 | ||||
-rw-r--r-- | gdb/record.c | 8 | ||||
-rw-r--r-- | gdb/ser-tcp.c | 11 | ||||
-rw-r--r-- | gdb/source.c | 5 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/completion.exp | 16 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/setshow.exp | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/trace-buffer-size.exp | 4 | ||||
-rw-r--r-- | gdb/top.c | 5 | ||||
-rw-r--r-- | gdb/tracepoint.c | 4 | ||||
-rw-r--r-- | gdb/utils.c | 6 | ||||
-rw-r--r-- | gdb/valprint.c | 4 |
19 files changed, 236 insertions, 55 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bd222cc..89b787b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,33 @@ 2013-04-10 Pedro Alves <palves@redhat.com> + * cli/cli-decode.c (integer_unlimited_completer): New function. + (add_setshow_integer_cmd, add_setshow_uinteger_cmd) + (add_setshow_zuinteger_unlimited_cmd): Install the "unlimited" + completer. + * cli/cli-setshow.c: Include "cli/cli-utils.h". + (is_unlimited_literal): New function. + (do_set_command): Handle literal "unlimited" arguments. + * frame.c (_initialize_frame) <set backtrace limit>: Document + "unlimited". + * printcmd.c (_initialize_printcmd) <set print + max-symbolic-offset>: Add help text. + * record-full.c (_initialize_record_full) <set record full + insn-number-max>: Likewise. + * record.c (_initialize_record) <set record + instruction-history-size, set record function-call-history-size>: + Add help text. + * ser-tcp.c (_initialize_ser_tcp) <set tcp connect-timeout>: Add + help text. + * tracepoint.c (_initialize_tracepoint) <set trace-buffer-size>: + Likewise. + * source.c (_initialize_source) <set listsize>: Add help text. + * utils.c (initialize_utils) <set height, set width>: Likewise. + <set pagination>: Mention "set height unlimited". + * valprint.c (_initialize_valprint) <set print elements, set print + repeats>: Document "unlimited". + +2013-04-10 Pedro Alves <palves@redhat.com> + * cli/cli-cmds.c (quit_command): Call query_if_trace_running instead of disconnect_tracing. * infcmd.c (detach_command, disconnect_command): Call diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 61a7b5a..9bc14b5 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -638,6 +638,22 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class class, } +/* Completes on literal "unlimited". Used by integer commands that + support a special "unlimited" value. */ + +static VEC (char_ptr) * +integer_unlimited_completer (struct cmd_list_element *ignore, + const char *text, const char *word) +{ + static const char * const keywords[] = + { + "unlimited", + NULL, + }; + + return complete_on_enum (keywords, text, word); +} + /* 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 @@ -653,11 +669,15 @@ add_setshow_integer_cmd (const char *name, enum command_class class, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { + struct cmd_list_element *set; + add_setshow_cmd_full (name, class, var_integer, var, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list, - NULL, NULL); + &set, NULL); + + set_cmd_completer (set, integer_unlimited_completer); } /* Add element named NAME to both the set and show command LISTs (the @@ -674,11 +694,15 @@ add_setshow_uinteger_cmd (const char *name, enum command_class class, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { + struct cmd_list_element *set; + add_setshow_cmd_full (name, class, var_uinteger, var, set_doc, show_doc, help_doc, set_func, show_func, set_list, show_list, - NULL, NULL); + &set, NULL); + + set_cmd_completer (set, integer_unlimited_completer); } /* Add element named NAME to both the set and show command LISTs (the @@ -714,11 +738,15 @@ add_setshow_zuinteger_unlimited_cmd (const char *name, struct cmd_list_element **set_list, struct cmd_list_element **show_list) { + struct cmd_list_element *set; + 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); + &set, NULL); + + set_cmd_completer (set, integer_unlimited_completer); } /* Add element named NAME to both the set and show command LISTs (the diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index f612369..3e41fd4 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -28,6 +28,7 @@ #include "cli/cli-decode.h" #include "cli/cli-cmds.h" #include "cli/cli-setshow.h" +#include "cli/cli-utils.h" /* Return true if the change of command parameter should be notified. */ @@ -127,6 +128,20 @@ deprecated_show_value_hack (struct ui_file *ignore_file, } } +/* Returns true if ARG is "unlimited". */ + +static int +is_unlimited_literal (const char *arg) +{ + size_t len = sizeof ("unlimited") - 1; + + arg = skip_spaces_const (arg); + + return (strncmp (arg, "unlimited", len) == 0 + && (isspace (arg[len]) || arg[len] == '\0')); +} + + /* Do a "set" command. ARG is NULL if no argument, or the text of the argument, and FROM_TTY is nonzero if this command is being entered directly by the user (i.e. these are just like any @@ -273,8 +288,17 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c) LONGEST val; if (arg == NULL) - error_no_arg (_("integer to set it to.")); - val = parse_and_eval_long (arg); + { + if (c->var_type == var_uinteger) + error_no_arg (_("integer to set it to, or \"unlimited\".")); + else + error_no_arg (_("integer to set it to.")); + } + + if (c->var_type == var_uinteger && is_unlimited_literal (arg)) + val = 0; + else + val = parse_and_eval_long (arg); if (c->var_type == var_uinteger && val == 0) val = UINT_MAX; @@ -300,8 +324,17 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c) LONGEST val; if (arg == NULL) - error_no_arg (_("integer to set it to.")); - val = parse_and_eval_long (arg); + { + if (c->var_type == var_integer) + error_no_arg (_("integer to set it to, or \"unlimited\".")); + else + error_no_arg (_("integer to set it to.")); + } + + if (c->var_type == var_integer && is_unlimited_literal (arg)) + val = 0; + else + val = parse_and_eval_long (arg); if (val == 0 && c->var_type == var_integer) val = INT_MAX; @@ -396,8 +429,12 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c) LONGEST val; if (arg == NULL) - error_no_arg (_("integer to set it to.")); - val = parse_and_eval_long (arg); + error_no_arg (_("integer to set it to, or \"unlimited\".")); + + if (is_unlimited_literal (arg)) + val = -1; + else + val = parse_and_eval_long (arg); if (val > INT_MAX) error (_("integer %s out of range"), plongest (val)); diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 9e3a956..e55b219 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,24 @@ +2013-04-10 Pedro Alves <palves@redhat.com> + + * gdb.texinfo (Process Record and Replay): Document that "set + record full insn-number-max", "set record + instruction-history-size" and "set record + function-call-history-size" accept "unlimited". + (Backtrace): Document that "set backtrace limit" accepts + "unlimited". + (List): Document that "set listsize" accepts "unlimited". + (Print Settings)" Document that "set print max-symbolic-offset", + "set print elements" and "set print repeats" accept "unlimited". + (Starting and Stopping Trace Experiments): Document that "set + trace-buffer-size" accepts "unlimited". + (Remote Configuration): Document that "set tcp connect-timeout" + accepts "unlimited". + (Command History): Document that "set history size" accepts + "unlimited". + (Screen Size): Document that "set height" and "set width" accepts + "unlimited". Adjust "set pagination"'s description to suggest + "set height unlimited" instead of "set height 0". + 2013-04-10 Yao Qi <yao@codesourcery.com> * gdb.texinfo (Trace Files): Add "target ctf". diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 6974b5c..15a8894 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -6207,6 +6207,7 @@ File must have been created with @code{record save}. @kindex set record full @item set record full insn-number-max @var{limit} +@itemx set record full insn-number-max unlimited Set the limit of instructions to be recorded for the @code{full} recording method. Default value is 200000. @@ -6219,9 +6220,9 @@ instruction to keep the number of recorded instructions at the limit. lets you control what happens when the limit is reached, by means of the @code{stop-at-limit} option, described below.) -If @var{limit} is zero, @value{GDBN} will never delete recorded -instructions from the execution log. The number of recorded -instructions is unlimited in this case. +If @var{limit} is @code{unlimited} or zero, @value{GDBN} will never +delete recorded instructions from the execution log. The number of +recorded instructions is limited only by the available memory. @kindex show record full @item show record full insn-number-max @@ -6333,9 +6334,11 @@ number @var{end} is not included. This command may not be available for all recording methods. @kindex set record -@item set record instruction-history-size +@item set record instruction-history-size @var{size} +@itemx set record instruction-history-size unlimited Define how many instructions to disassemble in the @code{record instruction-history} command. The default value is 10. +A @var{size} of @code{unlimited} means unlimited instructions. @kindex show record @item show record instruction-history-size @@ -6399,9 +6402,11 @@ included. This command may not be available for all recording methods. -@item set record function-call-history-size +@item set record function-call-history-size @var{size} +@itemx set record function-call-history-size unlimited Define how many lines to print in the @code{record function-call-history} command. The default value is 10. +A size of @code{unlimited} means unlimited lines. @item show record function-call-history-size Show how many lines to print in the @@ -6678,9 +6683,10 @@ Display the current internal entry point backtrace policy. @item set backtrace limit @var{n} @itemx set backtrace limit 0 +@itemx set backtrace limit unlimited @cindex backtrace limit -Limit the backtrace to @var{n} levels. A value of zero means -unlimited. +Limit the backtrace to @var{n} levels. A value of @code{unlimited} +or zero means unlimited levels. @item show backtrace limit Display the current limit on backtrace levels. @@ -6919,9 +6925,10 @@ the @code{list} command. You can change this using @code{set listsize}: @table @code @kindex set listsize @item set listsize @var{count} +@itemx set listsize unlimited Make the @code{list} command display @var{count} source lines (unless the @code{list} argument explicitly specifies some other number). -Setting @var{count} to 0 means there's no limit. +Setting @var{count} to @code{unlimited} or 0 means there's no limit. @kindex show listsize @item show listsize @@ -8652,11 +8659,13 @@ printed is reasonably close to the closest earlier symbol: @table @code @item set print max-symbolic-offset @var{max-offset} +@itemx set print max-symbolic-offset unlimited @cindex maximum value for offset of closest symbol Tell @value{GDBN} to only display the symbolic form of an address if the offset between the closest earlier symbol and the address is less than -@var{max-offset}. The default is 0, which tells @value{GDBN} -to always print the symbolic form of an address if any symbol precedes it. +@var{max-offset}. The default is @code{unlimited}, which tells @value{GDBN} +to always print the symbolic form of an address if any symbol precedes +it. Zero is equivalent to @code{unlimited}. @item show print max-symbolic-offset Ask how large the maximum offset is that @value{GDBN} prints in a @@ -8733,6 +8742,7 @@ Show whether the index of each element is printed when displaying arrays. @item set print elements @var{number-of-elements} +@itemx set print elements unlimited @cindex number of array elements to print @cindex limit on number of printed array elements Set a limit on how many elements of an array @value{GDBN} will print. @@ -8740,7 +8750,8 @@ If @value{GDBN} is printing a large array, it stops printing after it has printed the number of elements set by the @code{set print elements} command. This limit also applies to the display of strings. When @value{GDBN} starts, this limit is set to 200. -Setting @var{number-of-elements} to zero means that the printing is unlimited. +Setting @var{number-of-elements} to @code{unlimited} or zero means +that the number of elements to print is unlimited. @item show print elements Display the number of elements of a large array that @value{GDBN} will print. @@ -8910,15 +8921,17 @@ entry resolution see @ref{set debug entry-values}. Show the method being used for printing of frame argument values at function entry. -@item set print repeats +@item set print repeats @var{number-of-repeats} +@itemx set print repeats unlimited @cindex repeated array elements Set the threshold for suppressing display of repeated array elements. When the number of consecutive identical elements of an array exceeds the threshold, @value{GDBN} prints the string @code{"<repeats @var{n} times>"}, where @var{n} is the number of identical repetitions, instead of displaying the identical elements -themselves. Setting the threshold to zero will cause all elements to -be individually printed. The default threshold is 10. +themselves. Setting the threshold to @code{unlimited} or zero will +cause all elements to be individually printed. The default threshold +is 10. @item show print repeats Display the current threshold for printing repeated identical @@ -11880,12 +11893,13 @@ for instance if you are looking at frames from a trace file. @table @code @item set trace-buffer-size @var{n} +@itemx set trace-buffer-size unlimited @kindex set trace-buffer-size Request that the target use a trace buffer of @var{n} bytes. Not all targets will honor the request; they may have a compiled-in size for the trace buffer, or some other limitation. Set to a value of -@code{-1} to let the target use whatever size it likes. This is also -the default. +@code{unlimited} or @code{-1} to let the target use whatever size it +likes. This is also the default. @item show trace-buffer-size @kindex show trace-buffer-size @@ -18286,13 +18300,16 @@ Do not auto-retry failed TCP connections. Show the current auto-retry setting. @item set tcp connect-timeout @var{seconds} +@itemx set tcp connect-timeout unlimited @cindex connection timeout, for remote TCP target @cindex timeout, for remote target connection Set the timeout for establishing a TCP connection to the remote target to @var{seconds}. The timeout affects both polling to retry failed connections (enabled by @code{set tcp auto-retry on}) and waiting for connections that are merely slow to complete, and represents an approximate cumulative -value. +value. If @var{seconds} is @code{unlimited}, there is no timeout and +@value{GDBN} will keep attempting to establish a connection forever, +unless interrupted with @kbd{Ctrl-c}. The default is 15 seconds. @item show tcp connect-timeout Show the current connection timeout setting. @@ -21256,9 +21273,12 @@ Stop recording command history in a file. @kindex set history size @cindex @env{HISTSIZE}, environment variable @item set history size @var{size} +@itemx set history size unlimited Set the number of commands which @value{GDBN} keeps in its history list. This defaults to the value of the environment variable -@code{HISTSIZE}, or to 256 if this variable is not set. +@code{HISTSIZE}, or to 256 if this variable is not set. If @var{size} +is @code{unlimited}, the number of commands @value{GDBN} keeps in the +history list is unlimited. @end table History expansion assigns special meaning to the character @kbd{!}. @@ -21343,25 +21363,28 @@ width} commands: @kindex show width @kindex show height @item set height @var{lpp} +@itemx set height unlimited @itemx show height @itemx set width @var{cpl} +@itemx set width unlimited @itemx show width These @code{set} commands specify a screen height of @var{lpp} lines and a screen width of @var{cpl} characters. The associated @code{show} commands display the current settings. -If you specify a height of zero lines, @value{GDBN} does not pause during -output no matter how long the output is. This is useful if output is to a -file or to an editor buffer. +If you specify a height of either @code{unlimited} or zero lines, +@value{GDBN} does not pause during output no matter how long the +output is. This is useful if output is to a file or to an editor +buffer. -Likewise, you can specify @samp{set width 0} to prevent @value{GDBN} -from wrapping its output. +Likewise, you can specify @samp{set width unlimited} or @samp{set +width 0} to prevent @value{GDBN} from wrapping its output. @item set pagination on @itemx set pagination off @kindex set pagination Turn the output pagination on or off; the default is on. Turning -pagination off is the alternative to @code{set height 0}. Note that +pagination off is the alternative to @code{set height unlimited}. Note that running @value{GDBN} with the @option{--batch} option (@pxref{Mode Options, -batch}) also automatically disables pagination. diff --git a/gdb/frame.c b/gdb/frame.c index a4d18bb..8d4e2c8 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2495,7 +2495,7 @@ the rest of the stack trace."), Set an upper bound on the number of backtrace levels."), _("\ Show the upper bound on the number of backtrace levels."), _("\ No more than the specified number of frames can be displayed or examined.\n\ -Zero is unlimited."), +Literal \"unlimited\" or zero means no limit."), NULL, show_backtrace_limit, &set_backtrace_cmdlist, diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 4f8c9d4..2cc33d0 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2615,7 +2615,12 @@ but no count or size letter (see \"x\" command).")); add_setshow_uinteger_cmd ("max-symbolic-offset", no_class, &max_symbolic_offset, _("\ Set the largest offset that will be printed in <symbol+1234> form."), _("\ -Show the largest offset that will be printed in <symbol+1234> form."), NULL, +Show the largest offset that will be printed in <symbol+1234> form."), _("\ +Tell GDB to only display the symbolic form of an address if the\n\ +offset between the closest earlier symbol and the address is less than\n\ +the specified maximum offset. The default is \"unlimited\", which tells GDB\n\ +to always print the symbolic form of an address if any symbol precedes\n\ +it. Zero is equivalent to \"unlimited\"."), NULL, show_max_symbolic_offset, &setprintlist, &showprintlist); diff --git a/gdb/record-full.c b/gdb/record-full.c index 2ff7dec..03d287d 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -2971,7 +2971,8 @@ delete the oldest recorded instruction to make room for each new one."), _("Set record/replay buffer limit."), _("Show record/replay buffer limit."), _("\ Set the maximum number of instructions to be stored in the\n\ -record/replay buffer. Zero means unlimited. Default is 200000."), +record/replay buffer. A value of either \"unlimited\" or zero means no\n\ +limit. Default is 200000."), set_record_full_insn_max_num, NULL, &set_record_full_cmdlist, &show_record_full_cmdlist); diff --git a/gdb/record.c b/gdb/record.c index 2736a1e..0a7f0a1 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -701,16 +701,16 @@ _initialize_record (void) add_setshow_uinteger_cmd ("instruction-history-size", no_class, &record_insn_history_size_setshow_var, _("\ Set number of instructions to print in \"record instruction-history\"."), _("\ -Show number of instructions to print in \"record instruction-history\"."), - NULL, +Show number of instructions to print in \"record instruction-history\"."), _("\ +A size of \"unlimited\" means unlimited instructions. The default is 10."), set_record_insn_history_size, NULL, &set_record_cmdlist, &show_record_cmdlist); add_setshow_uinteger_cmd ("function-call-history-size", no_class, &record_call_history_size_setshow_var, _("\ Set number of function to print in \"record function-call-history\"."), _("\ -Show number of functions to print in \"record function-call-history\"."), - NULL, +Show number of functions to print in \"record function-call-history\"."), _("\ +A size of \"unlimited\" means unlimited lines. The default is 10."), set_record_call_history_size, NULL, &set_record_cmdlist, &show_record_cmdlist); diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index a818c65..e4fbf26 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -424,8 +424,11 @@ Show auto-retry on socket connect"), add_setshow_uinteger_cmd ("connect-timeout", class_obscure, &tcp_retry_limit, _("\ -Set timeout limit for socket connection"), _("\ -Show timeout limit for socket connection"), - NULL, NULL, NULL, - &tcp_set_cmdlist, &tcp_show_cmdlist); +Set timeout limit in seconds for socket connection"), _("\ +Show timeout limit in seconds for socket connection"), _("\ +If set to \"unlimited\", GDB will keep attempting to establish a\n\ +connection forever, unless interrupted with Ctrl-c.\n\ +The default is 15 seconds."), + NULL, NULL, + &tcp_set_cmdlist, &tcp_show_cmdlist); } diff --git a/gdb/source.c b/gdb/source.c index 03c5253..55970ba 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -2046,7 +2046,10 @@ The matching line number is also stored as the value of \"$_\".")); add_setshow_integer_cmd ("listsize", class_support, &lines_to_list, _("\ Set number of source lines gdb will list by default."), _("\ -Show number of source lines gdb will list by default."), NULL, +Show number of source lines gdb will list by default."), _("\ +Use this to choose how many source lines the \"list\" displays (unless\n\ +the \"list\" argument explicitly specifies some other number).\n\ +A value of \"unlimited\", or zero, means there's no limit."), NULL, show_lines_to_list, &setlist, &showlist); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 92d8ff3..90a83b0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-04-10 Pedro Alves <palves@redhat.com> + + * gdb.base/completion.exp: Test "set height", "set listsize" and + "set trace-buffer-size" completion. + * gdb.base/setshow.exp: Test "set height unlimited". + * gdb.trace/trace-buffer-size.exp: Test "set trace-buffer-size + unlimited". + 2013-04-10 Yao Qi <yao@codesourcery.com> * gdb.trace/actions.exp: Save trace data to CTF. diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 7b664bf..008cb0a 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -720,6 +720,22 @@ foreach target_name { "core" "tfile" "exec" } { "target ${target_name} ./gdb.base/completion\\.exp.*" } +# +# "set foo unlimited" completion. +# + +# A var_uinteger command. +gdb_test "complete set height " "set height unlimited" +gdb_test "complete set height u" "set height unlimited" + +# A var_integer command. +gdb_test "complete set listsize " "set listsize unlimited" +gdb_test "complete set listsize unl" "set listsize unlimited" + +# A var_zuinteger_unlimited command. +gdb_test "complete set trace-buffer-size " "set trace-buffer-size unlimited" +gdb_test "complete set trace-buffer-size unl" "set trace-buffer-size unlimited" + # Restore globals modified in this test... set timeout $oldtimeout1 diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index eadd1f5..d33d6c7 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -162,8 +162,9 @@ gdb_test "show environment FOOBARBAZ" "FOOBARBAZ = grbxgrbxgrbx.*" "show enviro gdb_test_no_output "set height 100" "set height 100" #test show height 100 gdb_test "show height" "Number of lines gdb thinks are in a page is 100..*" "show height" -# back to infinite height to avoid pagers -gdb_test_no_output "set height 0" "" +# Back to infinite height to avoid pagers. While at it, check that +# literal "unlimited" works just as well as 0. +gdb_test_no_output "set height unlimited" #test set history expansion on gdb_test_no_output "set history expansion on" "set history expansion on" #test show history expansion on diff --git a/gdb/testsuite/gdb.trace/trace-buffer-size.exp b/gdb/testsuite/gdb.trace/trace-buffer-size.exp index e8c6a95..0916df7 100644 --- a/gdb/testsuite/gdb.trace/trace-buffer-size.exp +++ b/gdb/testsuite/gdb.trace/trace-buffer-size.exp @@ -64,10 +64,14 @@ gdb_test "show trace-buffer-size $BUFFER_SIZE" \ "Requested size of trace buffer is $BUFFER_SIZE.*" \ "show trace buffer size" +# -1 means "no limit on GDB's end. Let the target choose." gdb_test_no_output \ "set trace-buffer-size -1" \ "set trace buffer size 2" +# "unlimited" means the same. +gdb_test_no_output "set trace-buffer-size unlimited" + # Test that tstatus gives us default buffer size now. gdb_test "tstatus" \ ".*Trace buffer has $decimal bytes of $default_size bytes free.*" \ @@ -1670,7 +1670,10 @@ Without an argument, saving is enabled."), add_setshow_uinteger_cmd ("size", no_class, &history_size_setshow_var, _("\ Set the size of the command history,"), _("\ Show the size of the command history,"), _("\ -ie. the number of previous commands to keep a record of."), +ie. the number of previous commands to keep a record of.\n\ +If set to \"unlimited\", the number of commands kept in the history\n\ +list is unlimited. This defaults to the value of the environment\n\ +variable \"HISTSIZE\", or to 256 if this variable is not set."), set_history_size_command, show_history_size, &sethistlist, &showhistlist); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 7b4cfb2..b1686b7 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -5884,8 +5884,8 @@ up and stopping the trace run."), Set requested size of trace buffer."), _("\ Show requested size of trace buffer."), _("\ Use this to choose a size for the trace buffer. Some targets\n\ -may have fixed or limited buffer sizes. A value of -1 disables\n\ -any attempt to set the buffer size and lets the target choose."), +may have fixed or limited buffer sizes. Specifying \"unlimited\" or -1\n\ +disables any attempt to set the buffer size and lets the target choose."), set_trace_buffer_size, NULL, &setlist, &showlist); diff --git a/gdb/utils.c b/gdb/utils.c index a222c59..37deb02 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2651,7 +2651,7 @@ initialize_utils (void) Set number of characters where GDB should wrap lines of its output."), _("\ Show number of characters where GDB should wrap lines of its output."), _("\ This affects where GDB wraps its output to fit the screen width.\n\ -Setting this to zero prevents GDB from wrapping its output."), +Setting this to \"unlimited\" or zero prevents GDB from wrapping its output."), set_width_command, show_chars_per_line, &setlist, &showlist); @@ -2661,7 +2661,7 @@ Set number of lines in a page for GDB output pagination."), _("\ Show number of lines in a page for GDB output pagination."), _("\ This affects the number of lines after which GDB will pause\n\ its output and ask you whether to continue.\n\ -Setting this to zero causes GDB never pause during output."), +Setting this to \"unlimited\" or zero causes GDB never pause during output."), set_height_command, show_lines_per_page, &setlist, &showlist); @@ -2674,7 +2674,7 @@ Set state of GDB output pagination."), _("\ Show state of GDB output pagination."), _("\ When pagination is ON, GDB pauses at end of each screenful of\n\ its output and asks you whether to continue.\n\ -Turning pagination off is an alternative to \"set height 0\"."), +Turning pagination off is an alternative to \"set height unlimited\"."), NULL, show_pagination_enabled, &setlist, &showlist); diff --git a/gdb/valprint.c b/gdb/valprint.c index 18cff49..bc21f4f 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -2707,7 +2707,7 @@ _initialize_valprint (void) &user_print_options.print_max, _("\ Set limit on string chars or array elements to print."), _("\ Show limit on string chars or array elements to print."), _("\ -\"set print elements 0\" causes there to be no limit."), +\"set print elements unlimited\" causes there to be no limit."), NULL, show_print_max, &setprintlist, &showprintlist); @@ -2724,7 +2724,7 @@ Show printing of char arrays to stop at first null char."), NULL, &user_print_options.repeat_count_threshold, _("\ Set threshold for repeated print elements."), _("\ Show threshold for repeated print elements."), _("\ -\"set print repeats 0\" causes all elements to be individually printed."), +\"set print repeats unlimited\" causes all elements to be individually printed."), NULL, show_repeat_count_threshold, &setprintlist, &showprintlist); |