diff options
Diffstat (limited to 'gdb/testsuite/gdb.rocm')
23 files changed, 180 insertions, 22 deletions
diff --git a/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.cpp b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.cpp new file mode 100644 index 0000000..d75bc76 --- /dev/null +++ b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.cpp @@ -0,0 +1,86 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 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 + 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/>. */ + +#ifdef DEVICE + +#include <hip/hip_runtime.h> + +constexpr unsigned int NUM_BREAKPOINT_HITS = 5; + +static __device__ void +break_here () +{ +} + +extern "C" __global__ void +kernel () +{ + for (int n = 0; n < NUM_BREAKPOINT_HITS; ++n) + break_here (); +} + +#else + +#include <hip/hip_runtime.h> +#include <unistd.h> + +constexpr unsigned int NUM_ITEMS_PER_BLOCK = 256; +constexpr unsigned int NUM_BLOCKS = 128; +constexpr unsigned int NUM_ITEMS = NUM_ITEMS_PER_BLOCK * NUM_BLOCKS; +constexpr unsigned int NUM_LOAD_UNLOADS = 5; + +#define CHECK(cmd) \ + { \ + hipError_t error = cmd; \ + if (error != hipSuccess) \ + { \ + fprintf (stderr, "error: '%s'(%d) at %s:%d\n", \ + hipGetErrorString (error), error, __FILE__, __LINE__); \ + exit (EXIT_FAILURE); \ + } \ + } + +int +main (int argc, const char **argv) +{ + if (argc != 2) + { + fprintf (stderr, "Usage: %s <hip_module_path>\n", argv[0]); + return 1; + } + + const auto module_path = argv[1]; + hipModule_t module; + CHECK (hipModuleLoad (&module, module_path)); + + /* Launch the kernel. */ + hipFunction_t function; + CHECK (hipModuleGetFunction (&function, module, "kernel")); + CHECK (hipModuleLaunchKernel (function, NUM_BLOCKS, 1, 1, + NUM_ITEMS_PER_BLOCK, 1, 1, 0, nullptr, nullptr, + nullptr)); + + /* Load and unload the module many times. */ + for (int i = 0; i < NUM_LOAD_UNLOADS; ++i) + { + hipModule_t dummy_module; + CHECK (hipModuleLoad (&dummy_module, module_path)); + CHECK (hipModuleUnload (dummy_module)); + } +} + +#endif diff --git a/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp new file mode 100644 index 0000000..3fe6a95 --- /dev/null +++ b/gdb/testsuite/gdb.rocm/code-object-load-while-breakpoint-hit.exp @@ -0,0 +1,68 @@ +# Copyright 2025 Free Software Foundation, Inc. + +# This file is part of GDB. + +# 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 verifies what happens when a code object list update happens at the +# same time as some wave stop events are reported. It was added following a +# performance bug fix, where forward progress requirement disabled when +# pulling events from amd-dbgapi in amd_dbgapi_target_breakpoint::check_status. +# +# The test launches a kernel that hits a breakpoint with an always false +# condition a certain number of times. Meanwhile, the host loads and unloads +# a code object in a loop, causing check_status to be called. The hope is that +# check_status, when calling process_event_queue, will pull many WAVE_STOP +# events from the kernel hitting the breakpoint. +# +# Without the appropriate fix (of disabling forward progress requirement in +# check_status), GDB would hit the newly-added assert in process_event_queue, +# which verifies that forward progress requirement is disabled. Even without +# this assert, the test would likely time out (depending on the actual timeout +# value). + +load_lib rocm.exp +standard_testfile .cpp +require allow_hipcc_tests + +# Build the host executable. +if { [build_executable "failed to prepare" \ + $testfile $srcfile {debug hip}] == -1 } { + return -1 +} + +set hipmodule_path [standard_output_file ${testfile}.co] + +# Build the kernel object file. +if { [gdb_compile $srcdir/$subdir/$srcfile \ + $hipmodule_path object \ + { debug hip additional_flags=--genco additional_flags=-DDEVICE } ] != "" } { + return -1 +} + +proc do_test { } { + with_rocm_gpu_lock { + clean_restart $::binfile + gdb_test_no_output "set args $::hipmodule_path" "set args" + + if { ![runto_main] } { + return + } + + gdb_test "with breakpoint pending on -- break break_here if 0" + gdb_continue_to_end "continue to end" "continue" 1 + } +} + +do_test diff --git a/gdb/testsuite/gdb.rocm/displaced-stepping.cpp b/gdb/testsuite/gdb.rocm/displaced-stepping.cpp index b94e8ab..7adb646 100644 --- a/gdb/testsuite/gdb.rocm/displaced-stepping.cpp +++ b/gdb/testsuite/gdb.rocm/displaced-stepping.cpp @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2022-2024 Free Software Foundation, Inc. + Copyright 2022-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 diff --git a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp index 06a7589..6fbf55f 100644 --- a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp +++ b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execee.cpp @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2021-2024 Free Software Foundation, Inc. + Copyright 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 diff --git a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp index 09a4983..48267e3 100644 --- a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp +++ b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu-execer.cpp @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2021-2024 Free Software Foundation, Inc. + Copyright 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 diff --git a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp index 3e122f5..22d4b75 100644 --- a/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp +++ b/gdb/testsuite/gdb.rocm/fork-exec-gpu-to-non-gpu.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 Free Software Foundation, Inc. # This file is part of GDB. @@ -21,6 +21,7 @@ load_lib rocm.exp require allow_hipcc_tests +require allow_fork_tests standard_testfile -execer.cpp -execee.cpp diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp index fb1df66..116c3c9 100644 --- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp +++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execee.cpp @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2021-2024 Free Software Foundation, Inc. + Copyright 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 diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp index f0e273b..2c8e743 100644 --- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp +++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu-execer.cpp @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2021-2024 Free Software Foundation, Inc. + Copyright 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 diff --git a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp index 50efb4f..1386099 100644 --- a/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp +++ b/gdb/testsuite/gdb.rocm/fork-exec-non-gpu-to-gpu.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 Free Software Foundation, Inc. # This file is part of GDB. @@ -20,6 +20,7 @@ load_lib rocm.exp require allow_hipcc_tests +require allow_fork_tests standard_testfile -execer.cpp -execee.cpp diff --git a/gdb/testsuite/gdb.rocm/mi-attach.exp b/gdb/testsuite/gdb.rocm/mi-attach.exp index 2ca610c..37ce92a 100644 --- a/gdb/testsuite/gdb.rocm/mi-attach.exp +++ b/gdb/testsuite/gdb.rocm/mi-attach.exp @@ -13,10 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +load_lib rocm.exp load_lib mi-support.exp set MIFLAGS "-i=mi" -require can_spawn_for_attach +require can_spawn_for_attach allow_hipcc_tests standard_testfile .cpp diff --git a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp index e6be857..8952308 100644 --- a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp +++ b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.cpp @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2023-2024 Free Software Foundation, Inc. + Copyright 2023-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 diff --git a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp index 4c5e459..4f55432 100644 --- a/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp +++ b/gdb/testsuite/gdb.rocm/multi-inferior-gpu.exp @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Free Software Foundation, Inc. +# Copyright 2023-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 diff --git a/gdb/testsuite/gdb.rocm/precise-memory-exec.c b/gdb/testsuite/gdb.rocm/precise-memory-exec.c index fb41846..a208f13 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-exec.c +++ b/gdb/testsuite/gdb.rocm/precise-memory-exec.c @@ -1,4 +1,4 @@ -/* Copyright 2021-2024 Free Software Foundation, Inc. +/* Copyright 2021-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp index 3a0301b..506488c 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-exec.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory-exec.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 Free Software Foundation, Inc. # This file is part of GDB. diff --git a/gdb/testsuite/gdb.rocm/precise-memory-fork.c b/gdb/testsuite/gdb.rocm/precise-memory-fork.c index 3db6c2f..2c3ca61 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-fork.c +++ b/gdb/testsuite/gdb.rocm/precise-memory-fork.c @@ -1,4 +1,4 @@ -/* Copyright 2021-2024 Free Software Foundation, Inc. +/* Copyright 2021-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp index f6a658a..23c1ebe 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-fork.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory-fork.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 Free Software Foundation, Inc. # This file is part of GDB. @@ -21,6 +21,7 @@ load_lib rocm.exp require allow_hipcc_tests +require allow_fork_tests standard_testfile .c diff --git a/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp b/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp index de86eb2..c7a78b8 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory-multi-inferiors.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 Free Software Foundation, Inc. # This file is part of GDB. diff --git a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp index ccb1e52..54ce6a3 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp +++ b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.cpp @@ -1,4 +1,4 @@ -/* Copyright 2021-2024 Free Software Foundation, Inc. +/* Copyright 2021-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp index d9b016e..f855719 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory-warning-sigsegv.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 Free Software Foundation, Inc. # This file is part of GDB. diff --git a/gdb/testsuite/gdb.rocm/precise-memory.cpp b/gdb/testsuite/gdb.rocm/precise-memory.cpp index 7a8c37e..a42c0ba 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory.cpp +++ b/gdb/testsuite/gdb.rocm/precise-memory.cpp @@ -1,4 +1,4 @@ -/* Copyright 2021-2024 Free Software Foundation, Inc. +/* Copyright 2021-2025 Free Software Foundation, Inc. This file is part of GDB. diff --git a/gdb/testsuite/gdb.rocm/precise-memory.exp b/gdb/testsuite/gdb.rocm/precise-memory.exp index 8c39f80..6711d80 100644 --- a/gdb/testsuite/gdb.rocm/precise-memory.exp +++ b/gdb/testsuite/gdb.rocm/precise-memory.exp @@ -1,4 +1,4 @@ -# Copyright 2022-2024 Free Software Foundation, Inc. +# Copyright 2022-2025 Free Software Foundation, Inc. # This file is part of GDB. @@ -59,7 +59,7 @@ proc do_test { } { return } - # Get to the begining of the GPU kernel without precise memory enabled. + # Get to the beginning of the GPU kernel without precise memory enabled. with_test_prefix "goto gpu code" { gdb_test_no_output "set amdgpu precise-memory off" gdb_breakpoint "kernel" allow-pending diff --git a/gdb/testsuite/gdb.rocm/simple.cpp b/gdb/testsuite/gdb.rocm/simple.cpp index b94e8ab..7adb646 100644 --- a/gdb/testsuite/gdb.rocm/simple.cpp +++ b/gdb/testsuite/gdb.rocm/simple.cpp @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2022-2024 Free Software Foundation, Inc. + Copyright 2022-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 diff --git a/gdb/testsuite/gdb.rocm/simple.exp b/gdb/testsuite/gdb.rocm/simple.exp index 11ba2a3..bc90a0a 100644 --- a/gdb/testsuite/gdb.rocm/simple.exp +++ b/gdb/testsuite/gdb.rocm/simple.exp @@ -1,4 +1,4 @@ -# Copyright 2022-2024 Free Software Foundation, Inc. +# Copyright 2022-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 |