mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-26 11:22:28 +08:00
[gdb/testsuite] Set completions to unlimited in get_set_option_choices
In some test-case I tried to use get_set_option_choices "set architecture" and ran into max-completions: ... set architecture simple^M set architecture tomcat^M set architecture xscale^M set architecture *** List may be truncated, max-completions reached. ***^M (gdb) PASS: gdb.base/foo.exp: complete set architecture ... There's only one test-case using this currently: gdb.base/parse_number.exp, and it locally sets max-completions to unlimited. Fix this by: - factoring out a new proc with_set out of proc with_complaints, and - using it to temporarily set max-completions to unlimited in get_set_option_choice. Tested on x86_64-linux, by running test-cases that excercise get_set_option_choice and with_complaints.
This commit is contained in:
gdb/testsuite
@ -346,18 +346,16 @@ proc test_parse_numbers {arch} {
|
|||||||
|
|
||||||
clean_restart
|
clean_restart
|
||||||
|
|
||||||
gdb_test_no_output "set language unknown"
|
|
||||||
gdb_test "p/x 0" \
|
|
||||||
"expression parsing not implemented for language \"Unknown\""
|
|
||||||
|
|
||||||
gdb_test_no_output "set max-completions unlimited"
|
|
||||||
|
|
||||||
set supported_archs [get_set_option_choices "set architecture"]
|
set supported_archs [get_set_option_choices "set architecture"]
|
||||||
# There should be at least one more than "auto".
|
# There should be at least one more than "auto".
|
||||||
gdb_assert {[llength $supported_archs] > 1} "at least one architecture"
|
gdb_assert {[llength $supported_archs] > 1} "at least one architecture"
|
||||||
|
|
||||||
set all_languages [get_set_option_choices "set language"]
|
set all_languages [get_set_option_choices "set language"]
|
||||||
|
|
||||||
|
gdb_test_no_output "set language unknown"
|
||||||
|
gdb_test "p/x 0" \
|
||||||
|
"expression parsing not implemented for language \"Unknown\""
|
||||||
|
|
||||||
# If 1, test each arch. If 0, test one arch for each sizeof
|
# If 1, test each arch. If 0, test one arch for each sizeof
|
||||||
# short/int/long/longlong configuration.
|
# short/int/long/longlong configuration.
|
||||||
# For a build with --enable-targets=all, full_arch_testing == 0 takes 15s,
|
# For a build with --enable-targets=all, full_arch_testing == 0 takes 15s,
|
||||||
|
@ -5911,34 +5911,31 @@ proc gdb_load { arg } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# with_complaints -- Execute BODY and set complaints temporary to N for the
|
# with_set -- Execute BODY and set VAR temporary to VAL for the
|
||||||
# duration.
|
# duration.
|
||||||
#
|
#
|
||||||
proc with_complaints { n body } {
|
proc with_set { var val body } {
|
||||||
global decimal
|
|
||||||
|
|
||||||
# Save current setting of complaints.
|
|
||||||
set save ""
|
set save ""
|
||||||
set show_complaints_re \
|
set show_re \
|
||||||
"Max number of complaints about incorrect symbols is ($decimal)\\."
|
"is (\[^\r\n\]+)\\."
|
||||||
gdb_test_multiple "show complaints" "" {
|
gdb_test_multiple "show $var" "" {
|
||||||
-re -wrap $show_complaints_re {
|
-re -wrap $show_re {
|
||||||
set save $expect_out(1,string)
|
set save $expect_out(1,string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if { $save == "" } {
|
if { $save == "" } {
|
||||||
perror "Did not manage to set complaints"
|
perror "Did not manage to set $var"
|
||||||
} else {
|
} else {
|
||||||
# Set complaints.
|
# Set var.
|
||||||
gdb_test_no_output -nopass "set complaints $n"
|
gdb_test_no_output -nopass "set $var $val"
|
||||||
}
|
}
|
||||||
|
|
||||||
set code [catch {uplevel 1 $body} result]
|
set code [catch {uplevel 1 $body} result]
|
||||||
|
|
||||||
# Restore saved setting of complaints.
|
# Restore saved setting.
|
||||||
if { $save != "" } {
|
if { $save != "" } {
|
||||||
gdb_test_no_output -nopass "set complaints $save"
|
gdb_test_no_output -nopass "set $var $save"
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$code == 1} {
|
if {$code == 1} {
|
||||||
@ -5949,6 +5946,14 @@ proc with_complaints { n body } {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# with_complaints -- Execute BODY and set complaints temporary to N for the
|
||||||
|
# duration.
|
||||||
|
#
|
||||||
|
proc with_complaints { n body } {
|
||||||
|
return [uplevel [list with_set complaints $n $body]]
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# gdb_load_no_complaints -- As gdb_load, but in addition verifies that
|
# gdb_load_no_complaints -- As gdb_load, but in addition verifies that
|
||||||
# loading caused no symbol reading complaints.
|
# loading caused no symbol reading complaints.
|
||||||
@ -9108,20 +9113,23 @@ gdb_caching_proc has_hw_wp_support {
|
|||||||
# Return a list of all the accepted values of the set command SET_CMD.
|
# Return a list of all the accepted values of the set command SET_CMD.
|
||||||
|
|
||||||
proc get_set_option_choices {set_cmd} {
|
proc get_set_option_choices {set_cmd} {
|
||||||
global gdb_prompt
|
|
||||||
|
|
||||||
set values {}
|
set values {}
|
||||||
|
|
||||||
|
set cmd "complete $set_cmd "
|
||||||
set test "complete $set_cmd"
|
set test "complete $set_cmd"
|
||||||
gdb_test_multiple "complete $set_cmd " "$test" {
|
|
||||||
-re "$set_cmd (\[^\r\n\]+)\r\n" {
|
with_set max-completions unlimited {
|
||||||
lappend values $expect_out(1,string)
|
gdb_test_multiple $cmd $test {
|
||||||
exp_continue
|
-re "\r\n$set_cmd (\[^\r\n\]+)" {
|
||||||
}
|
lappend values $expect_out(1,string)
|
||||||
-re "$gdb_prompt " {
|
exp_continue
|
||||||
pass $test
|
}
|
||||||
|
-re -wrap "" {
|
||||||
|
pass $gdb_test_name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $values
|
return $values
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user