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
121 lines
4.1 KiB
Plaintext
121 lines
4.1 KiB
Plaintext
# Copyright 2021-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/>.
|
|
|
|
# Test running into vfork while "detach-on-fork" is off and "follow-fork-mode"
|
|
# is parent. This shows a "Can not resume the parent process..." message. If
|
|
# the user wants to resume execution, they have to use either "set
|
|
# schedule-multiple on" or "set detach-on-fork on". Test these two resolution
|
|
# methods.
|
|
|
|
require allow_fork_tests
|
|
|
|
standard_testfile .c vforked-prog.c
|
|
|
|
set binfile ${testfile}-exit
|
|
set binfile2 ${testfile}-exec
|
|
set binfile3 vforked-prog
|
|
|
|
if { [build_executable "compile $binfile3" $binfile3 $srcfile2] } {
|
|
untested "failed to compile third test binary"
|
|
return -1
|
|
}
|
|
|
|
if { [is_remote target] } {
|
|
gdb_remote_download target [standard_output_file $binfile3]
|
|
}
|
|
|
|
set opts [list debug additional_flags=-DTEST_EXIT]
|
|
if { [build_executable "compile ${binfile}" ${binfile} ${srcfile} ${opts}] } {
|
|
untested "failed to compile first test binary"
|
|
return
|
|
}
|
|
|
|
set opts [list debug additional_flags=-DTEST_EXEC]
|
|
if { [build_executable "compile ${binfile2}" ${binfile2} ${srcfile} ${opts}] } {
|
|
untested "failed to compile second test binary"
|
|
return
|
|
}
|
|
|
|
# Test running to the "Can not resume the parent..." message. Then, resolve
|
|
# the situation using the method in RESOLUTION_METHOD, either "detach-on-fork"
|
|
# or "schedule-multiple" (the two alternatives the message suggests to the
|
|
# user).
|
|
|
|
proc do_test { exec_file resolution_method target_non_stop non_stop } {
|
|
save_vars { ::GDBFLAGS } {
|
|
append ::GDBFLAGS " -ex \"maint set target-non-stop ${target_non_stop}\""
|
|
append ::GDBFLAGS " -ex \"set non-stop ${non_stop}\""
|
|
clean_restart $exec_file
|
|
}
|
|
|
|
gdb_test_no_output "set detach-on-fork off"
|
|
|
|
if { ![runto_main] } {
|
|
return
|
|
}
|
|
|
|
# Delete the breakpoint on main so we don't bit the breakpoint in
|
|
# the case that the vfork child performs an exec.
|
|
delete_breakpoints
|
|
|
|
gdb_test "break break_parent"
|
|
|
|
gdb_test "continue" \
|
|
"Can not resume the parent process over vfork .*" \
|
|
"continue to vfork"
|
|
|
|
# Try to continue again from there, expecting the same message. It
|
|
# exercises a different code path in GDB.
|
|
gdb_test "continue" \
|
|
"Can not resume the parent process over vfork .*" \
|
|
"try to continue from vfork"
|
|
|
|
# Unblock the execution using the specified resolution method.
|
|
if { $resolution_method == "detach-on-fork" } {
|
|
# Make GDB detach the child.
|
|
gdb_test "set detach-on-fork on"
|
|
gdb_test "print unblock_parent = 1" " = 1"
|
|
} elseif { $resolution_method == "schedule-multiple" } {
|
|
# Make GDB resume both inferiors. The parent is blocked while the
|
|
# children executes, so the continue will make the child reach the
|
|
# end.
|
|
gdb_test "set schedule-multiple on"
|
|
gdb_test "continue" "$::inferior_exited_re normally.*" \
|
|
"continue to end of inferior 2"
|
|
gdb_test -no-prompt-anchor "inferior 1" ".*Switching to inferior 1.*"
|
|
gdb_test "print unblock_parent = 1" " = 1"
|
|
} else {
|
|
error "invalid resolution method: $resolution_method"
|
|
}
|
|
|
|
# Continue from the vfork call to the breakpoint.
|
|
gdb_test "continue" "Breakpoint $::decimal, break_parent .*" \
|
|
"continue to break_parent"
|
|
}
|
|
|
|
foreach_with_prefix exec_file [list $binfile $binfile2] {
|
|
foreach_with_prefix target-non-stop {on off} {
|
|
# This test was written assuming non-stop mode is off.
|
|
foreach_with_prefix non-stop {off} {
|
|
if {!${target-non-stop} && ${non-stop}} {
|
|
continue
|
|
}
|
|
foreach_with_prefix resolution_method {detach-on-fork schedule-multiple} {
|
|
do_test $exec_file $resolution_method ${target-non-stop} ${non-stop}
|
|
}
|
|
}
|
|
}
|
|
}
|