This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/8] Refactor gdb.base/disp-step-syscall.exp for general step over test
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 19 Feb 2016 14:36:28 +0000
- Subject: [PATCH 2/8] Refactor gdb.base/disp-step-syscall.exp for general step over test
- Authentication-results: sourceware.org; auth=none
- References: <1455892594-2294-1-git-send-email-yao dot qi at linaro dot org>
This patch moves some code out of disp_step_cross_syscall to a new proc
check_pc_after_cross_syscall, and delete the breakpoint later.
gdb/testsuite:
2016-02-19 Yao Qi <yao.qi@linaro.org>
* gdb.base/disp-step-syscall.exp (check_pc_after_cross_syscall): New
proc.
(disp_step_cross_syscall): Move code to check_pc_after_cross_syscall
and delete breakpoint later.
---
gdb/testsuite/gdb.base/disp-step-syscall.exp | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp
index 80cdc3b..aba5db8 100644
--- a/gdb/testsuite/gdb.base/disp-step-syscall.exp
+++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp
@@ -32,6 +32,18 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
return -1
}
+proc check_pc_after_cross_syscall { syscall syscall_insn_next_addr } {
+ set syscall_insn_next_addr_found [get_hexadecimal_valueof "\$pc" "0"]
+
+ set test "single step over $syscall final pc"
+ if {$syscall_insn_next_addr != 0
+ && $syscall_insn_next_addr == $syscall_insn_next_addr_found} {
+ pass $test
+ } else {
+ fail $test
+ }
+}
+
proc disp_step_cross_syscall { syscall } {
with_test_prefix "$syscall" {
global syscall_insn
@@ -120,7 +132,6 @@ proc disp_step_cross_syscall { syscall } {
pass "break on syscall insns"
}
}
- gdb_test_no_output "delete $syscall_bp" "delete break $syscall"
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, .*" \
"continue to syscall insn $syscall"
@@ -132,19 +143,13 @@ proc disp_step_cross_syscall { syscall } {
return -1
}
- set syscall_insn_next_addr_found [get_hexadecimal_valueof "\$pc" "0"]
-
- set test "single step over $syscall final pc"
- if {$syscall_insn_next_addr != 0
- && $syscall_insn_next_addr == $syscall_insn_next_addr_found} {
- pass $test
- } else {
- fail $test
- }
+ check_pc_after_cross_syscall $syscall $syscall_insn_next_addr
# Delete breakpoint syscall insns to avoid interference to other syscalls.
gdb_test_no_output "delete $syscall_insn_bp" "delete break $syscall insn"
+ gdb_test_no_output "delete $syscall_bp" "delete break $syscall"
+
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker \\(\\) at.*" \
"continue to marker ($syscall)"
}
--
1.9.1