Files
TheRock/debug-tools/rocgdb/source/gdb/testsuite/gdb.base/run-control-while-bg-execution.exp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

119 lines
4.0 KiB
Plaintext

# Copyright 2022-2024 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This test aims at testing various operations after getting rid of an inferior
# that was running in background, or while we have an inferior running in
# background. The original intent was to expose cases where the commit-resumed
# state of the process stratum target was not reset properly after killing an
# inferior running in background, which would be a problem when trying to run
# again. The test was expanded to test various combinations of
# run-control-related actions done with an inferior running in background.
require !use_gdb_stub
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile]} {
return
}
# Run one variation of the test:
#
# 1. Start an inferior in the background with "run &"
# 2. Do action 1
# 3. Do action 2
#
# Action 1 indicates what to do with the inferior running in background:
#
# - kill: kill it
# - detach: detach it
# - add: add a new inferior and switch to it, leave the inferior running in
# background alone
# - none: do nothing, leave the inferior running in background alone
#
# Action 2 indicates what to do after that:
#
# - start: use the start command
# - run: use the run command
# - attach: start a process outside of GDB and attach it
proc do_test { action1 action2 } {
save_vars { ::GDBFLAGS } {
append ::GDBFLAGS " -ex \"maintenance set target-non-stop on\""
clean_restart $::binfile
}
# Ensure we are at least after the getpid call, should we need it.
if { ![runto "after_getpid"] } {
return
}
# Some commands below ask for confirmation. Turn that off for simplicity.
gdb_test "set confirm off"
gdb_test -no-prompt-anchor "continue &"
if { $action1 == "kill" } {
gdb_test "kill" "Inferior 1 .* killed.*"
} elseif { $action1 == "detach" } {
set child_pid [get_integer_valueof "mypid" -1]
if { $child_pid == -1 } {
fail "failed to extract child pid"
return
}
gdb_test "detach" "Inferior 1 .* detached.*" "detach from first instance"
# Kill the detached process, to avoid hanging when exiting GDBserver,
# when testing with the native-extended-gdbserver board.
remote_exec target "kill $child_pid"
} elseif { $action1 == "add" } {
gdb_test "add-inferior -exec $::binfile" \
"Added inferior 2 on connection 1.*" "add-inferior"
gdb_test "inferior 2" "Switching to inferior 2 .*"
} elseif { $action1 == "none" } {
} else {
error "invalid action 1"
}
if { $action2 == "start" } {
gdb_test "start" "Temporary breakpoint $::decimal\(?:\.$::decimal\)?, main .*"
} elseif { $action2 == "run" } {
gdb_test "break main" "Breakpoint $::decimal at $::hex.*"
gdb_test "run" "Breakpoint $::decimal\(?:\.$::decimal\)?, main .*"
} elseif { $action2 == "attach" } {
set test_spawn_id [spawn_wait_for_attach $::binfile]
set test_pid [spawn_id_get_pid $test_spawn_id]
if { [gdb_attach $test_pid] } {
gdb_test "detach" "Inferior $::decimal .* detached.*" \
"detach from second instance"
}
# Detach and kill this inferior so we don't leave it around.
kill_wait_spawned_process $test_spawn_id
} else {
error "invalid action 2"
}
}
foreach_with_prefix action1 { kill detach add none } {
foreach_with_prefix action2 { start run attach } {
if { $action2 == "attach" && ![can_spawn_for_attach] } {
continue
}
do_test $action1 $action2
}
}