diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1b4d87f9ef0..5484618aa63 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2014-06-06 Yao Qi + + * gdb.base/async.c (foo): Add one statement. + * gdb.base/async.exp: Get the next instruction address and + match the output of "nexti" by instruction address. Match + the hex address in the output of "finish". + 2014-06-06 Gary Benson * gdb.base/call-signals.c: Remove preprocessor conditionals diff --git a/gdb/testsuite/gdb.base/async.c b/gdb/testsuite/gdb.base/async.c index 76ce8be57a6..649e9e65a91 100644 --- a/gdb/testsuite/gdb.base/async.c +++ b/gdb/testsuite/gdb.base/async.c @@ -11,7 +11,7 @@ foo () int y; volatile int x; - x = 5; x = 5; + x = 5; x = 5; x = 5; y = 3; return x + y; diff --git a/gdb/testsuite/gdb.base/async.exp b/gdb/testsuite/gdb.base/async.exp index 0f99b011931..cce8b5b1c99 100644 --- a/gdb/testsuite/gdb.base/async.exp +++ b/gdb/testsuite/gdb.base/async.exp @@ -75,10 +75,22 @@ test_background "step&" "" " foo \\(\\) at .*async.c.*x = 5.*" "step& #2" test_background "stepi&" "" ".*$hex.*x = 5.*" -test_background "nexti&" "" ".*y = 3.*" +# Get the next instruction address. +set next_insn_addr "" +set test "get next insn" +gdb_test_multiple {x/2i $pc} "$test" { + -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" { + set next_insn_addr $expect_out(1,string) + pass "$test" + } +} +# We nexti into the same source line. The current PC is printed out. +test_background "nexti&" "" ".* 0x0*$next_insn_addr.* x = 5; .*" + +# PC is in the middle of a source line, so the PC address is displayed. test_background "finish&" \ - "Run till exit from #0 foo \\(\\) at.*async.c.*\r\n" \ + "Run till exit from #0 $hex in foo \\(\\) at.*async.c.*\r\n" \ ".*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*" set jump_here [gdb_get_line_number "jump here"]