gdb_test "next" ".*marker \\\(\\\);" "next to finish marker"
gdb_test "step" ".*set breakpoint 2 here.*" "step into finish marker"
-gdb_test "finish" "func1 \\\(\\\);" "finish from marker to func1"
+
+# Some architectures will have one or more instructions after
+# the call instruction which still are part of the call sequence,
+# so it should be expected to return to the caller line after issue
+# a 'finish' command.
+gdb_test_multiple "finish" "finish from marker" {
+ -re "func1 \\\(\\\);.*\r\n$gdb_prompt $" {
+ pass "finish from marker to func1"
+ }
+ -re "marker \\\(\\\);.*\r\n$gdb_prompt $" {
+ pass "finish from marker"
+ gdb_test "step" "func1 \\\(\\\);.*" "step after marker to reach func1"
+ }
+}
gdb_test "step" "bar \\\(\\\);" "step into func1 for finish"
gdb_test "finish" "func3 \\\(\\\);" "finish from func1 to func3"
gdb_breakpoint $line6
gdb_continue_to_breakpoint "before the outer_inline call"
gdb_test "step" "marker \\\(\\\) at .*" "reach 1 the outer_inline call"
-gdb_test "finish" "main \\\(\\\) at .*outer_inline2 \\\(\\\);" "reach outer_inline2"
+gdb_test_multiple "finish" "finish from marker" {
+ -re "main \\\(\\\) at .*outer_inline2 \\\(\\\);.*\r\n$gdb_prompt $" {
+ pass "reach outer_inline2"
+ }
+ -re "main \\\(\\\) at .*marker \\\(\\\);.*\r\n$gdb_prompt $" {
+ pass "finish from marker"
+ gdb_test "step" "outer_inline2 \\\(\\\);.*" "step after marker to reach outer_inline2"
+ }
+}
gdb_test "bt" "#0 main.*" "backtrace at main of outer_inline"
gdb_test "step" "outer_inline2 \\\(\\\) at .*" "enter outer_inline2"
gdb_test "bt" "#0 outer_inline2.*#1 main.*" "backtrace at outer_inline2"