This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/3] Use get_var_address in test cases
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 14 Oct 2016 11:53:05 +0100
- Subject: [PATCH 1/3] Use get_var_address in test cases
- Authentication-results: sourceware.org; auth=none
- References: <1476442387-17291-1-git-send-email-yao.qi@linaro.org>
This patch uses get_var_address more.
gdb/testsuite:
2016-10-13 Yao Qi <yao.qi@linaro.org>
* gdb.python/py-events.exp: Call get_var_address.
* gdb.trace/tracecmd.exp: Call get_var_address and match possible
leading zeros.
---
gdb/testsuite/gdb.python/py-events.exp | 7 +------
gdb/testsuite/gdb.trace/tracecmd.exp | 9 ++++-----
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index de8de07..602fbae 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -88,12 +88,7 @@ gdb_test_multiple "info threads" "get current thread" {
}
}
-gdb_test_multiple "print do_nothing" "get address of do_nothing" {
- -re "\[^\n\r\]*(0x\[0-9a-f\]+) \<do_nothing\>.*$gdb_prompt $" {
- set addr $expect_out(1,string)
- pass "get address of do_nothing"
- }
-}
+set addr [get_var_address "do_nothing"]
set expected [list "event type: pre-call"]
lappend expected "ptid: \\($process_id, $process_id, 0\\)" "address: $addr"
diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp
index 11ef691..7e1dc4b 100644
--- a/gdb/testsuite/gdb.trace/tracecmd.exp
+++ b/gdb/testsuite/gdb.trace/tracecmd.exp
@@ -114,11 +114,10 @@ gdb_test "info trace" "$asm_test_addr.*gdb_asm_test.*" \
# 1.7 trace at function's exact address
# Collect the address of the function for comparison
-gdb_test_multiple "print gdb_recursion_test" "" {
- -re "\[$\]\[0-9\].*0x(\[0-9a-fA-F\]+).*$gdb_prompt $" {
- set c_test_addr $expect_out(1,string)
- }
-}
+set c_test_addr [get_var_address "gdb_recursion_test"]
+# Match leading zeros in address.
+set c_test_addr [string range $c_test_addr 2 [expr {[string length $c_test_addr] -1}]]
+set c_test_addr "0x(0)*$c_test_addr"
gdb_delete_tracepoints
gdb_test "trace \*gdb_recursion_test" \
--
1.9.1