aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/list.exp
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-11-16 09:33:32 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-12-11 23:05:35 +0000
commita0def019aaf79adf3add2a0559ab75bb84d72085 (patch)
tree3254e8bb79f32d62a52bbe2a18828ca727b5807c /gdb/testsuite/gdb.base/list.exp
parent5c000dff26b7c5159ca1a6d562e7ab50656f4b73 (diff)
downloadgdb-a0def019aaf79adf3add2a0559ab75bb84d72085.zip
gdb-a0def019aaf79adf3add2a0559ab75bb84d72085.tar.gz
gdb-a0def019aaf79adf3add2a0559ab75bb84d72085.tar.bz2
gdb: 'list' command, tweak handling of +/- arguments.
There is an inconsistency with the handling of the special +/- arguments to the list command. For the very first time that list is used (after the inferior has changed locations) then only the first character of the argument string is checked, so 'list +BLAH' will operate as 'list +' and 'list -----FOO' will operate as 'list -'. This compares to each subsequent use of list, where the whole argument string is checked, so 'list +BLAH' will try to list lines of code around the function '+BLAH'. This commit unifies the behaviour so that the whole argument string is checked, in order to list the next 10, or previous 10 lines from a file only 'list +' and 'list -' are now valid. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Check that the argument string is a single character, either '+' or '-'. gdb/testsuite/ChangeLog: * gdb.base/list.exp (test_list_invalid_args): New function, defined, and called.
Diffstat (limited to 'gdb/testsuite/gdb.base/list.exp')
-rw-r--r--gdb/testsuite/gdb.base/list.exp19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index 84ae251..cac3a62 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -505,6 +505,24 @@ proc test_only_end {} {
gdb_test "list ,5" "list ,5\r\n4\[ \t\]\[^\r\n\]*\r\n5\[ \t\]\[^\r\n\]*"
}
+proc test_list_invalid_args {} {
+ global binfile
+
+ clean_restart ${binfile}
+ gdb_test "list -INVALID" \
+ "invalid explicit location argument, \"-INVALID\"" \
+ "first use of \"list -INVALID\""
+ gdb_test "list -INVALID" \
+ "invalid explicit location argument, \"-INVALID\"" \
+ "second use of \"list -INVALID\""
+
+ clean_restart ${binfile}
+ gdb_test "list +INVALID" "Function \"\\+INVALID\" not defined." \
+ "first use of \"list +INVALID\""
+ gdb_test "list +INVALID" "Function \"\\+INVALID\" not defined." \
+ "second use of \"list +INVALID\""
+}
+
# Start with a fresh gdb.
gdb_exit
@@ -527,6 +545,7 @@ if [ set_listsize 10 ] then {
test_list_filename_and_function
test_forward_search
test_only_end
+ test_list_invalid_args
}
# Follows tests that require execution.