diff options
author | Pedro Alves <palves@redhat.com> | 2015-03-18 19:28:08 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-03-18 19:28:08 +0000 |
commit | 32d2e5d6404d8ebbff89408767084d7064178a4c (patch) | |
tree | cd8f33da570def0512222654e98f361bdb0cc413 /gdb | |
parent | 0b0732e13a9a40c9e894cc6aed1e899cff81251e (diff) | |
download | gdb-32d2e5d6404d8ebbff89408767084d7064178a4c.zip gdb-32d2e5d6404d8ebbff89408767084d7064178a4c.tar.gz gdb-32d2e5d6404d8ebbff89408767084d7064178a4c.tar.bz2 |
Tighten gdb.base/disp-step-syscall.exp
This fixes several problems with this test.
E.g,. with --target_board=native-extended-gdbserver on x86_64 Fedora
20, I get:
Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/disp-step-syscall.exp ...
FAIL: gdb.base/disp-step-syscall.exp: vfork: get hexadecimal valueof "$pc" (timeout)
FAIL: gdb.base/disp-step-syscall.exp: vfork: single step over vfork final pc
FAIL: gdb.base/disp-step-syscall.exp: vfork: delete break vfork insn
FAIL: gdb.base/disp-step-syscall.exp: vfork: continue to marker (vfork) (the program is no longer running)
And with --target=native-gdbserver, I get:
Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/disp-step-syscall.exp ...
KPASS: gdb.base/disp-step-syscall.exp: vfork: single step over vfork (PRMS server/13796)
FAIL: gdb.base/disp-step-syscall.exp: vfork: get hexadecimal valueof "$pc" (timeout)
FAIL: gdb.base/disp-step-syscall.exp: vfork: single step over vfork final pc
FAIL: gdb.base/disp-step-syscall.exp: vfork: delete break vfork insn
FAIL: gdb.base/disp-step-syscall.exp: vfork: continue to marker (vfork) (the program is no longer running)
First, the lack of fork support on remote targets is supposed to be
kfailed, so the KPASS is obviously bogus. The extended-remote board
should have KFAILed too.
The problem is that the test is using "is_remote" instead of
gdb_is_target_remote.
And then, I get:
(gdb) PASS: gdb.base/disp-step-syscall.exp: vfork: set displaced-stepping on
stepi
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) PASS: gdb.base/disp-step-syscall.exp: vfork: single step over vfork
Obviously, that should be a FAIL. The problem is that the test only
expects SIGILL, not SIGSEGV. It also doesn't bail correctly if an
internal error or some other pattern caught by gdb_test_multiple
matches. The test doesn't really need to match specific exits/crashes
patterns, if the PASS regex is improved, like in ...
... this and the other "stepi" tests are a bit too lax, passing on
".*". This tightens those up to expect "x/i" and the "=>" current PC
indicator, like in:
1: x/i $pc
=> 0x3b36abc9e2 <vfork+34>: syscall
On x86_64 Fedora 20, I now get a quick KFAIL instead of timeouts with
both the native-extended-gdbserver and native-gdbserver boards:
PASS: gdb.base/disp-step-syscall.exp: vfork: delete break vfork
PASS: gdb.base/disp-step-syscall.exp: vfork: continue to syscall insn vfork
PASS: gdb.base/disp-step-syscall.exp: vfork: set displaced-stepping on
KFAIL: gdb.base/disp-step-syscall.exp: vfork: single step over vfork (PRMS: server/13796)
and a full pass with native testing.
gdb/testsuite/
2015-03-18 Pedro Alves <palves@redhat.com>
* gdb.base/disp-step-syscall.exp (disp_step_cross_syscall):
Use gdb_is_target_remote instead of is_remote. Use
gdb_test_multiple instead of gdb_expect. Exit early if
gdb_test_multiple hits its internal matches. Tighten stepi tests
expected output. Fail on exit with any signal, instead of just
SIGILL.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/disp-step-syscall.exp | 53 |
2 files changed, 35 insertions, 27 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a2cf7ef..d9f4ecf 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2015-03-18 Pedro Alves <palves@redhat.com> + + * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): + Use gdb_is_target_remote instead of is_remote. Use + gdb_test_multiple instead of gdb_expect. Exit early if + gdb_test_multiple hits its internal matches. Tighten stepi tests + expected output. Fail on exit with any signal, instead of just + SIGILL. + 2015-03-18 Yao Qi <yao.qi@linaro.org> PR tdep/18107 diff --git a/gdb/testsuite/gdb.base/disp-step-syscall.exp b/gdb/testsuite/gdb.base/disp-step-syscall.exp index ff66f83..b13dce4 100644 --- a/gdb/testsuite/gdb.base/disp-step-syscall.exp +++ b/gdb/testsuite/gdb.base/disp-step-syscall.exp @@ -49,6 +49,8 @@ proc disp_step_cross_syscall { syscall } { return } + set is_target_remote [gdb_is_target_remote] + # Delete the breakpoint on main. gdb_test_no_output "delete break 1" @@ -77,27 +79,34 @@ proc disp_step_cross_syscall { syscall } { gdb_test "display/i \$pc" ".*" - # Single step until we see sysall insn or we reach the upper bound of loop - # iterations. - set see_syscall_insn 0 - - for {set i 0} {$i < 1000 && $see_syscall_insn == 0} {incr i} { - send_gdb "stepi\n" - gdb_expect { - -re ".*$syscall_insn.*$gdb_prompt $" { - set see_syscall_insn 1 + # Single step until we see a syscall insn or we reach the + # upper bound of loop iterations. + set msg "find syscall insn in $syscall" + set steps 0 + set max_steps 1000 + gdb_test_multiple "stepi" $msg { + -re ".*$syscall_insn.*$gdb_prompt $" { + pass $msg + } + -re "x/i .*=>.*\r\n$gdb_prompt $" { + incr steps + if {$steps == $max_steps} { + fail $msg + } else { + send_gdb "stepi\n" + exp_continue } - -re ".*$gdb_prompt $" {} } } - if {$see_syscall_insn == 0} then { - fail "find syscall insn in $syscall" + if {$steps == $max_steps} { return -1 } set syscall_insn_addr [get_hexadecimal_valueof "\$pc" "0"] - gdb_test "stepi" ".*" "stepi $syscall insn" + if {[gdb_test "stepi" "x/i .*=>.*" "stepi $syscall insn"] != 0} { + return -1 + } set syscall_insn_next_addr [get_hexadecimal_valueof "\$pc" "0"] gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \ @@ -121,22 +130,12 @@ proc disp_step_cross_syscall { syscall } { gdb_test_no_output "set displaced-stepping on" # Check the address of next instruction of syscall. - if {$syscall == "vfork" && [is_remote target]} { + if {$syscall == "vfork" && $is_target_remote} { setup_kfail server/13796 "*-*-*" } - set test "single step over $syscall" - gdb_test_multiple "stepi" $test { - -re "Program terminated with signal SIGILL,.*\r\n$gdb_prompt $" { - fail $test - return - } - -re "\\\[Inferior .* exited normally\\\].*\r\n$gdb_prompt $" { - fail $test - return - } - -re "\r\n$gdb_prompt $" { - pass $test - } + + if {[gdb_test "stepi" "x/i .*=>.*" "single step over $syscall"] != 0} { + return -1 } set syscall_insn_next_addr_found [get_hexadecimal_valueof "\$pc" "0"] |