f81d112039
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".
118 lines
3.5 KiB
Text
118 lines
3.5 KiB
Text
# Copyright 1998-2013 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
load_lib "trace-support.exp"
|
|
|
|
standard_testfile
|
|
|
|
if [prepare_for_testing ${testfile}.exp $testfile $srcfile \
|
|
{debug nowarnings}] {
|
|
untested "failed to prepare for trace tests"
|
|
return -1
|
|
}
|
|
|
|
if ![runto_main] {
|
|
fail "can't run to main to check for trace support"
|
|
return -1
|
|
}
|
|
|
|
if ![gdb_target_supports_trace] {
|
|
unsupported "target does not support trace"
|
|
return -1
|
|
}
|
|
|
|
set BUFFER_SIZE 4
|
|
set default_size -1
|
|
set test "get default buffer size"
|
|
|
|
# Save default trace buffer size in 'default_size'.
|
|
gdb_test_multiple "tstatus" $test {
|
|
-re ".*Trace buffer has ($decimal) bytes of ($decimal) bytes free.*$gdb_prompt $" {
|
|
set default_size $expect_out(2,string)
|
|
pass $test
|
|
}
|
|
}
|
|
|
|
# If we did not get the default size then there is no point in running the
|
|
# tests below.
|
|
if { $default_size < 0 } {
|
|
return -1
|
|
}
|
|
|
|
# Change buffer size to 'BUFFER_SIZE'.
|
|
gdb_test_no_output \
|
|
"set trace-buffer-size $BUFFER_SIZE" \
|
|
"set trace buffer size 1"
|
|
|
|
gdb_test "tstatus" \
|
|
".*Trace buffer has $decimal bytes of $BUFFER_SIZE bytes free.*" \
|
|
"tstatus check 2"
|
|
|
|
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.*" \
|
|
"tstatus check 3"
|
|
|
|
gdb_test_no_output \
|
|
"set trace-buffer-size $BUFFER_SIZE" \
|
|
"set trace buffer size 3"
|
|
|
|
# We set trace buffer to very small size. Then after running trace,
|
|
# we check if it is full. This will show if setting trace buffer
|
|
# size really worked.
|
|
gdb_breakpoint ${srcfile}:[gdb_get_line_number "breakpoint1"]
|
|
gdb_test "trace test_function" \
|
|
"Tracepoint \[0-9\]+ at .*" \
|
|
"set tracepoint at test_function"
|
|
gdb_trace_setactions "Set action for trace point 1" "" \
|
|
"collect var" "^$"
|
|
gdb_test_no_output "tstart"
|
|
gdb_test "continue" \
|
|
"Continuing.*Breakpoint $decimal.*" \
|
|
"run trace experiment 1"
|
|
gdb_test "tstatus" \
|
|
".*Trace stopped because the buffer was full.*" \
|
|
"buffer full check 1"
|
|
|
|
# Use the default size -- the trace buffer should not end up
|
|
# full this time
|
|
clean_restart ${testfile}
|
|
runto_main
|
|
gdb_breakpoint ${srcfile}:[gdb_get_line_number "breakpoint1"]
|
|
gdb_test "trace test_function" \
|
|
"Tracepoint \[0-9\]+ at .*" \
|
|
"set tracepoint at test_function"
|
|
gdb_trace_setactions "Set action for trace point 2" "" \
|
|
"collect var" "^$"
|
|
gdb_test_no_output "tstart"
|
|
gdb_test "continue" \
|
|
"Continuing.*Breakpoint $decimal.*" \
|
|
"run trace experiment 2"
|
|
gdb_test "tstatus" \
|
|
".*Trace is running on the target.*" \
|
|
"buffer full check 2"
|
|
gdb_test_no_output "tstop"
|