This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 3/4] Add testcases to list.exp and dfp-test.exp
- From: Fei Jie <feij dot fnst at cn dot fujitsu dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Mon, 9 Nov 2015 16:20:14 +0800
- Subject: [PATCH v2 3/4] Add testcases to list.exp and dfp-test.exp
- Authentication-results: sourceware.org; auth=none
- References: <1447057215-7574-1-git-send-email-feij dot fnst at cn dot fujitsu dot com>
add testcases which test list with more paraments to list.exp, and
backtrace with parament '-1' to dfp-test.exp
gdb/testsuite/ChangeLog:
*gdb.base/list.exp: Add new testcases.
*gdb.base/dfp-test.exp: Likewise.
---
gdb/testsuite/gdb.base/dfp-test.exp | 1 +
gdb/testsuite/gdb.base/list.exp | 49 +++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/gdb/testsuite/gdb.base/dfp-test.exp b/gdb/testsuite/gdb.base/dfp-test.exp
index e648a6b..4caa50e 100644
--- a/gdb/testsuite/gdb.base/dfp-test.exp
+++ b/gdb/testsuite/gdb.base/dfp-test.exp
@@ -220,6 +220,7 @@ gdb_test "backtrace" ".*arg0_64 \\(arg0=0.1, arg1=1.0, arg2=2.0, arg3=3.0, arg4=
gdb_breakpoint arg0_128
gdb_continue_to_breakpoint "entry to arg0_128"
gdb_test "backtrace" ".*arg0_128 \\(arg0=0.1, arg1=1.0, arg2=2.0, arg3=3.0, arg4=4.0, arg5=5.0\\).*" "backtrace at arg0_128"
+gdb_test "backtrace -1" ".*0x\[0-9\]\{1,16\}.*at\ .*${srcfile}.*"
# Test calling inferior function with DFP arguments or return value.
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index 2aea9a3..c61f88f 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -624,4 +624,53 @@ test_list "list -" 10 2 "7-8" "5-6"
# the current line.
test_list "list -" 10 1 "7" "6"
+# Get main address.
+set main_addr ""
+gdb_test_multiple "print/x &main" "getting main's address" {
+ -re "$decimal = \($hex\)\r\n$gdb_prompt $" {
+ set main_addr $expect_out(1,string)
+ }
+}
+# Test set listsize to -1.
+set_listsize -1
+
+set_listsize 10
+# Test list with line number.
+gdb_test "list 12" \
+ "7\\s+x = 0.*16\\s+foo \\(x\\+\\+\\);"
+
+# Test list with +.
+gdb_test "list +" \
+ "17\\s+foo \\(x\\+\\+\\).*26\\s+foo \\(x\\+\\+\\);"
+
+# Test list with '+' number.
+gdb_test "list +1" \
+ "23\\s+foo \\(x\\+\\+\\).*32\\s+foo \\(x\\+\\+\\);"
+
+# Test list with starting line number and ','.
+gdb_test "list 20," \
+ "20\\s+foo \\(x\\+\\+\\).*29\\s+foo \\(x\\+\\+\\);"
+
+# Test list with ',' and ending line number.
+gdb_test "list ,25" \
+ "16\\s+foo \\(x\\+\\+\\).*25\\s+foo \\(x\\+\\+\\);"
+
+# Test list with address.
+gdb_test "list *${main_addr}" \
+ "${main_addr} is in main.*${srcfile}.*"
+
+# Test list with '-' last line number.
+gdb_test "list -${last_line}" \
+ "1\\s+#include \"list0.h\".*10\\s+foo \\(x\\+\\+\\);"
+
+# Test list with ',NUM' (NUM is out of range but NUM-listsize is not).
+set little_past_end [expr ${last_line} + 5 ]
+gdb_test "list ,${little_past_end}" \
+ ".*43\\s+\\} \\/\\* last line \\*\\/"
+
+# Test list with ',NUM' (both NUM and NUM-listsize are out of range).
+set much_past_end [expr ${last_line} + 10 ]
+gdb_test "list ,${much_past_end}" \
+ "Line number 44 out of range.*"
+
remote_exec build "rm -f list0.h"
--
1.8.3.1