diff options
Diffstat (limited to 'gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp')
-rw-r--r-- | gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp | 91 |
1 files changed, 48 insertions, 43 deletions
diff --git a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp index 42222c0..fec31c3 100644 --- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp +++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2021-2024 Free Software Foundation, Inc. +# Copyright (C) 2021-2025 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 @@ -74,42 +74,45 @@ proc test { non_stop } { delete_breakpoints # Start the second inferior. - with_test_prefix "second inferior" { - # With stub targets that do reload on run, if we let the new - # inferior share inferior 1's connection, runto would - # fail because GDB is already connected to something, like - # e.g. with --target_board=native-gdbserver: - # - # (gdb) kill - # ... - # (gdb) target remote localhost:2348 - # Already connected to a remote target. Disconnect? (y or n) - # - # Instead, start the inferior with no connection, and let - # gdb_load/runto spawn a new remote connection/gdbserver. - # - # OTOH, with extended-remote, we must let the new inferior - # reuse the current connection, so that runto below can - # issue the "run" command, and have the inferior run on the - # remote target. If we forced no connection, then "run" would - # either fail if "set auto-connect-native-target" is on, like - # the native-extended-gdbserver board enforces, or it would - # run the inferior on the native target, which isn't what is - # being tested. - # - # Since it's reload_on_run targets that need special care, we - # default to reusing the connection on most targets. - if [target_info exists gdb,do_reload_on_run] { - gdb_test "add-inferior -no-connection" "New inferior 2.*" - } else { - gdb_test "add-inferior" "New inferior 2.*" - } - gdb_test "inferior 2" "Switching to inferior 2 .*" - - gdb_load $binfile - - if ![runto setup_done] { - return -1 + if {[allow_multi_inferior_tests]} { + with_test_prefix "second inferior" { + # With stub targets that do reload on run, if we let the + # new inferior share inferior 1's connection, runto would + # fail because GDB is already connected to something, like + # e.g. with --target_board=native-gdbserver: + # + # (gdb) kill + # ... + # (gdb) target remote localhost:2348 + # Already connected to a remote target. Disconnect? (y or n) + # + # Instead, start the inferior with no connection, and let + # gdb_load/runto spawn a new remote connection/gdbserver. + # + # OTOH, with extended-remote, we must let the new inferior + # reuse the current connection, so that runto below can + # issue the "run" command, and have the inferior run on + # the remote target. If we forced no connection, then + # "run" would either fail if "set + # auto-connect-native-target" is on, like the + # native-extended-gdbserver board enforces, or it would + # run the inferior on the native target, which isn't what + # is being tested. + # + # Since it's reload_on_run targets that need special care, + # we default to reusing the connection on most targets. + if [target_info exists gdb,do_reload_on_run] { + gdb_test "add-inferior -no-connection" "New inferior 2.*" + } else { + gdb_test "add-inferior" "New inferior 2.*" + } + gdb_test "inferior 2" "Switching to inferior 2 .*" + + gdb_load $binfile + + if ![runto setup_done] { + return -1 + } } } @@ -158,13 +161,15 @@ proc test { non_stop } { verbose -log "xxxxx: iteration $iter" gdb_test -nopass "info threads" - if {$inf == 1} { - set inf 2 - } else { - set inf 1 - } + if {[allow_multi_inferior_tests]} { + if {$inf == 1} { + set inf 2 + } else { + set inf 1 + } - my_gdb_test "inferior $inf" ".*" "inferior $inf" + my_gdb_test "inferior $inf" ".*" "inferior $inf" + } my_gdb_test "print global_var = 555" " = 555" \ "write to global_var" |