diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-11-12 10:38:44 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-11-12 10:38:44 -0500 |
commit | 53a89d6e5861d23b2b9ad0c82247daddc117701a (patch) | |
tree | 2fb5a0d022e771bf15e05b0a9c007bc57349a55d /gdb/testsuite/gdb.base | |
parent | 8a758655b3ee39bed245a6ba2fc9f81f77813443 (diff) | |
download | binutils-gdb-53a89d6e5861d23b2b9ad0c82247daddc117701a.tar.gz |
Add completer for skip numbers
Add completer to various commands that accept skip numbers:
- skip enable
- skip disable
- skip delete
- info skip
These commands also accept ranges, the completer works for that but is
not very smart. It will suggest invalid ranges, for example when doing
"2-<TAB>" it will suggest "1", which would not result in a valid range.
Also, it will keep suggesting when doing "1-2-<TAB>", even though it's
an invalid syntax.
A future idea would be to make a re-usable and well-tested completer for
numbers and ranges. I think it could at least be re-used for breakpoint
and thread numbers (for example with the "enable breakpoints" command).
gdb/ChangeLog:
* skip.c (complete_skip_number): New function.
(_initialize_step_skip): Add completers to some skip commands.
gdb/testsuite/ChangeLog:
* gdb.base/skip.exp: Add standard_testfile. Add "skip delete"
completer tests.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/skip.exp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/skip.exp b/gdb/testsuite/gdb.base/skip.exp index 223c93d0d9b..a7ea0b52c47 100644 --- a/gdb/testsuite/gdb.base/skip.exp +++ b/gdb/testsuite/gdb.base/skip.exp @@ -16,6 +16,10 @@ # This file was written by Justin Lebar. (justin.lebar@gmail.com) # And further hacked on by Doug Evans. (dje@google.com) +load_lib completion-support.exp + +standard_testfile + if { [prepare_for_testing "failed to prepare" "skip" \ {skip.c skip1.c } \ {debug nowarnings}] } { @@ -297,3 +301,35 @@ with_test_prefix "step using -fi + -fu" { gdb_test "step" ".*" "step 4"; # Skip over test_skip() gdb_test "step" "test_skip_file_and_function \\(\\) at.*" "step 5"; # Return from skip1_test_skip_file_and_function() } + +with_test_prefix "skip delete completion" { + global binfile + clean_restart "${binfile}" + if ![runto_main] { + fail "can't run to main" + return + } + + # Create a bunch of skips, don't care what they are. + for {set i 0} {$i < 12} {incr i} { + gdb_test "skip" ".*" "add skip $i" + } + + set all_numbers { "1" "10" "11" "12" "2" "3" "4" "5" "6" "7" "8" "9" } + + # Test completing single numbers. + test_gdb_complete_multiple "skip delete " "" "" $all_numbers + test_gdb_complete_multiple "skip delete " "1" "" { "1" "10" "11" "12" } + test_gdb_complete_multiple "skip delete 2 " "" "" $all_numbers + test_gdb_complete_unique "skip delete 11" "skip delete 11" + + # Test completing ranges. + test_gdb_complete_multiple "skip delete 2-" "" "" $all_numbers + test_gdb_complete_unique "skip delete 2-5" "skip delete 2-5" + + # Test cases with no completion. + test_gdb_complete_none "skip delete 123" + test_gdb_complete_none "skip delete a1" + test_gdb_complete_none "skip delete 2-33" +} + |