gdb_breakpoint [gdb_get_line_number "set foo break here"]
gdb_continue_to_breakpoint "first breakpoint" ".* set foo break here .*"
-gdb_breakpoint [gdb_get_line_number "set bar break here"]
+# Get the address of the next instruction and set a breakpoint there.
+set next_insn_addr ""
+set test "disassemble main"
+gdb_test_multiple $test $test {
+ -re ".*=> $hex <\\+$decimal>:\[^\r\n\]+\r\n ($hex) .*$gdb_prompt $" {
+ set next_insn_addr $expect_out(1,string)
+ pass $test
+ }
+}
+
+if { $next_insn_addr == "" } {
+ return -1
+}
+
+gdb_test "b *$next_insn_addr" "Breakpoint .*"
# So that GDB doesn't try to remove the regular breakpoint when the
# step finishes.
# remove it. But, a regular breakpoint is planted there already, and
# with always-inserted on, should remain planted when the step
# finishes.
-gdb_test "si" "Breakpoint .* bar break .*"
+gdb_test "si" "Breakpoint .*"
# If the breakpoint is still correctly inserted, then this jump should
# re-trigger it. Otherwise, GDB will lose control and the program
# will exit. See PR breakpoints/17000.
-gdb_test "jump *\$pc" "Breakpoint .* bar break .*"
+gdb_test "jump *\$pc" "Breakpoint .*"