# Copyright (C) 2022-2024 Advanced Micro Devices, Inc. All rights reserved. # 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 . # When in non-stop mode, ensure that dbgapi can allocate a displaced stepping # buffer for a wave while another wave from the same dispatch is running. load_lib rocm.exp require allow_hip_tests # The debug behavior this test checks (inspecting device locals # and/or single-stepping) is not reliable on optimized device # code, so skip it for optimized builds. require no_optimized_code standard_testfile .cpp if {[build_executable "failed to prepare ${testfile}" \ $testfile $srcfile {debug hip}]} { return -1 } save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set non-stop on\"" clean_restart ${binfile} } with_rocm_gpu_lock { if ![runto_main] { fail "can't run to main" return -1 } gdb_breakpoint "foo" allow-pending set threadnum -1 gdb_test_multiple "continue" "" { -wrap -re "Thread (\[0-9\]+) \"\[^\"\]*\" hit Breakpoint.*" { set threadnum [expr $expect_out(1,string)] pass $gdb_test_name } } gdb_test "thread $threadnum" \ "\\\[Switching to thread $threadnum.*\\\].*" \ "thread \$threadnum" gdb_test "next" ".*__hip_atomic_store.*" gdb_continue_to_end "" continue 1 }