]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.base/async.exp
Fix some duplicate test names
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / async.exp
index f688423b80f9095ec08d0b9f8a8c7f4233374c0e..32711d04bab64954e8bd1e0d867ea5f7df2b18bb 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1999-2016 Free Software Foundation, Inc.
+#   Copyright 1999-2020 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -20,8 +20,7 @@
 
 standard_testfile
 
-if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
-    untested $testfile.exp
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
     return -1
 }
 
@@ -63,7 +62,7 @@ proc test_background {command before_prompt after_prompt {message ""}} {
            fail "$message"
        }
        -re ".*Asynchronous execution not supported on this target\..*" {
-           unsupported "Asynchronous execution not supported: $message"
+           unsupported "asynchronous execution not supported: $message"
        }
        timeout  {
            fail "$message (timeout)"
@@ -80,7 +79,7 @@ test_background "step&" "" ".*y = foo \\(\\).*" "step& #1"
 
 test_background "step&" "" " foo \\(\\) at .*async.c.*x = 5.*" "step& #2"
 
-test_background "stepi&" "" ".*$hex.*x = 5.*"
+set is_stmt [is_stmt_addresses $srcfile]
 
 # Get the next instruction address.
 set next_insn_addr ""
@@ -88,16 +87,48 @@ 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"
+       pass $gdb_test_name
     }
 }
+set next_insn_is_stmt [hex_in_list $next_insn_addr $is_stmt]
 
-# We nexti into the same source line.  The current PC is printed out.
-test_background "nexti&" "" ".* 0x0*$next_insn_addr.* x = 5; .*"
+if { $next_insn_is_stmt } {
+    set prefix ""
+} else {
+    # The current PC is printed out.
+    set prefix "0x0*$next_insn_addr.*"
+}
+test_background "stepi&" "" ".*$prefix x = 5; .*"
 
-# PC is in the middle of a source line, so the PC address is displayed.
+# Get the next instruction address.
+set next_insn_addr ""
+set test "get next insn, 2nd"
+gdb_test_multiple {x/2i $pc} "$test" {
+    -re "=> $hex .* 0x(\[0-9a-f\]*) .*$gdb_prompt $" {
+       set next_insn_addr $expect_out(1,string)
+       pass $gdb_test_name
+    }
+}
+set next_insn_is_stmt \
+    [expr [lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1]
+
+if { $next_insn_is_stmt } {
+    set prefix ""
+} else {
+    # The current PC is printed out.
+    set prefix "0x0*$next_insn_addr.*"
+}
+# We nexti into the same source line.
+test_background "nexti&" "" ".*$prefix x = 5; .*"
+
+if { $next_insn_is_stmt } {
+    set prefix ""
+} else {
+    # PC is in the middle of a source line, so the PC address is displayed.
+    set prefix "0x0*$next_insn_addr in "
+}
 test_background "finish&" \
-    "Run till exit from #0  $hex in foo \\(\\) at.*async.c.*\r\n" \
+    "Run till exit from #0  ${prefix}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"]