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
249 lines
8.6 KiB
Plaintext
249 lines
8.6 KiB
Plaintext
# Copyright (C) 2021-2024 Free Software Foundation, Inc.
|
|
# Copyright (C) 2021-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 <http://www.gnu.org/licenses/>.
|
|
#
|
|
# Test watchpoints in default and private_lane address space.
|
|
#
|
|
# Watchpoints in the private_lane address space are only supported
|
|
# if they have an alias address in the default address space
|
|
# (global memory).
|
|
|
|
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 {[prepare_for_testing "failed to prepare ${testfile}" $testfile $srcfile {debug hip}]} {
|
|
return -1
|
|
}
|
|
|
|
with_rocm_gpu_lock {
|
|
|
|
with_test_prefix "private lane watchpoints" {
|
|
if ![runto_main] {
|
|
fail "can't run to main"
|
|
return -1
|
|
}
|
|
|
|
# Set breakpoint in device code.
|
|
gdb_breakpoint "kernel" "allow-pending" "qualified"
|
|
gdb_continue_to_breakpoint "kernel" ".*char array.*"
|
|
|
|
delete_breakpoints
|
|
|
|
# Step over array initialization.
|
|
gdb_test "next" ".*array\\\[3\\\] = \\\'b\\\'.*"
|
|
|
|
# Set watchpoint on the whole array.
|
|
gdb_test "watch array" "Hardware watchpoint.*: array"
|
|
|
|
# Set watchpoint on an array element.
|
|
gdb_test "watch array\[3\]" "Hardware watchpoint.*: array\\\[3\\\]"
|
|
|
|
set elem_3_addr ""
|
|
gdb_test_multiple "p &array\[3\]" "" {
|
|
-re -wrap ".*private_lane#($::hex).*" {
|
|
set elem_3_addr $expect_out(1,string)
|
|
pass $gdb_test_name
|
|
}
|
|
}
|
|
|
|
# Set watchpoint on an array element address expression.
|
|
gdb_test "watch *((char *) private_lane#$elem_3_addr)" \
|
|
"Hardware watchpoint.*: \\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\)" \
|
|
"watchpoint on an array element expression"
|
|
|
|
# Set watchpoint on an array element address directly.
|
|
gdb_test "watch -l *((char *) private_lane#$elem_3_addr)" \
|
|
"Hardware watchpoint.*: -location \\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\)" \
|
|
"watchpoint on an array element address"
|
|
|
|
# Continue until the watchpoint is triggered by the first change.
|
|
set pattern ""
|
|
gdb_test "continue" \
|
|
[append pattern \
|
|
"Continuing." \
|
|
".*Hardware watchpoint.*array.*Old value = \\\"aaaa\\\".*New value = \\\"aaab\\\"" \
|
|
".*Hardware watchpoint.*array\\\[3\\\].*Old value = 97.*New value = 98" \
|
|
".*Hardware watchpoint.*\\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\).*Old value = 97.*New value = 98" \
|
|
".*Hardware watchpoint.*-location \\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\).*Old value = 97.*New value = 98.*"] \
|
|
"change an array element value from letter a to letter b"
|
|
|
|
set pattern ""
|
|
gdb_test "continue" \
|
|
[append pattern \
|
|
"Continuing." \
|
|
".*Hardware watchpoint.*array.*Old value = \\\"aaab\\\".*New value = \\\"baab\\\".*"] \
|
|
"change array content from aaab string to baab string"
|
|
|
|
# Backtrace outputs may appear with or without the PC address.
|
|
set bt_pattern "#\[0-9\] (0x\[0-9a-fA-F\]+ in )?"
|
|
gdb_test "bt" "${bt_pattern}kernel.*" "inside kernel"
|
|
|
|
|
|
gdb_breakpoint "change_memory" "allow-pending" "qualified"
|
|
gdb_test "continue" "Breakpoint \[0-9a-fA-F\]+, with lane 0, change_memory.*" \
|
|
"continue to change_memory function breakpoint"
|
|
|
|
# Continue until the watchpoint is triggered by the second change.
|
|
set pattern ""
|
|
gdb_test "continue" \
|
|
[append pattern \
|
|
"Continuing." \
|
|
".*Hardware watchpoint.*array.*Old value = \\\"baab\\\".*New value = \\\"baac\\\"" \
|
|
".*Hardware watchpoint.*array\\\[3\\\].*Old value = 98.*New value = 99" \
|
|
".*Hardware watchpoint.*\\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\).*Old value = 98.*New value = 99" \
|
|
".*Hardware watchpoint.*-location \\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\).*Old value = 98.*New value = 99.*"] \
|
|
"change an array element value from letter b to letter c"
|
|
|
|
set pattern ""
|
|
gdb_test "continue" \
|
|
[append pattern \
|
|
"Continuing." \
|
|
".*Hardware watchpoint.*array.*Old value = \\\"baac\\\".*New value = \\\"caac\\\".*"] \
|
|
"change array content from baac string to caac string"
|
|
|
|
gdb_test "bt" \
|
|
[multi_line \
|
|
"${bt_pattern}change_memory.*" \
|
|
"${bt_pattern}kernel.*"] \
|
|
"inside change_memory"
|
|
|
|
delete_breakpoints
|
|
|
|
# Check if watchpoint is still hit in a caller frame.
|
|
gdb_test "watch -l *((char *) private_lane#$elem_3_addr)" \
|
|
"Hardware watchpoint.*: -location \\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\)" \
|
|
"check if lane context is preserved correctly"
|
|
|
|
set pattern ""
|
|
gdb_test "continue" \
|
|
[append pattern \
|
|
"Continuing." \
|
|
".*Hardware watchpoint.*-location \\\*\\\(\\\(char \\\*\\\) private_lane#$elem_3_addr\\\).*Old value = 99.*New value = 100.*"] \
|
|
"change an array element value from letter c to letter d"
|
|
|
|
gdb_test "bt" "${bt_pattern}kernel.*" "inside kernel again"
|
|
}
|
|
|
|
clean_restart ${testfile}
|
|
|
|
with_test_prefix "global memory watchpoint" {
|
|
if ![runto_main] {
|
|
fail "can't run to main"
|
|
return -1
|
|
}
|
|
|
|
# Set breakpoint in device code.
|
|
gdb_breakpoint "kernel" "allow-pending" "qualified"
|
|
gdb_continue_to_breakpoint "kernel" ".*char array.*"
|
|
|
|
delete_breakpoints
|
|
|
|
# Set watchpoint on the pointer to global memory value.
|
|
gdb_test "watch *global_ptr" "Hardware watchpoint.*: \\\*global_ptr"
|
|
|
|
# Set watchpoint on the pointer to global memory value as location.
|
|
gdb_test "watch -l *global_ptr" "Hardware watchpoint.*: -location \\\*global_ptr"
|
|
|
|
# Set watchpoint on the address directly.
|
|
set pattern ""
|
|
gdb_test "continue" \
|
|
[append pattern \
|
|
"Continuing." \
|
|
".*Hardware watchpoint.* \\\*global_ptr.*Old value = 0.*New value = 1" \
|
|
".*Hardware watchpoint.*-location \\\*global_ptr.*Old value = 0.*New value = 1.*"] \
|
|
"change global_ptr content from 0 to 1"
|
|
|
|
gdb_test "bt" "${bt_pattern}kernel.*" "inside kernel"
|
|
|
|
# Check if watchpoint is also hit in a callee frame.
|
|
set pattern ""
|
|
gdb_test "continue" \
|
|
[append pattern \
|
|
"Continuing." \
|
|
".*Hardware watchpoint.* \\\*global_ptr.*Old value = 1.*New value = 2" \
|
|
".*Hardware watchpoint.*-location \\\*global_ptr.*Old value = 1.*New value = 2.*"] \
|
|
"change global_ptr content from 1 to 2"
|
|
|
|
gdb_test "bt" \
|
|
[multi_line \
|
|
"${bt_pattern}change_memory.*" \
|
|
"${bt_pattern}kernel.*"] \
|
|
"inside change_memory"
|
|
}
|
|
|
|
with_test_prefix "Watchpoint and thread scope change " {
|
|
if ![runto_main] {
|
|
fail "can't run to main"
|
|
return -1
|
|
}
|
|
|
|
# Set breakpoint in device code.
|
|
gdb_breakpoint "kernel" "allow-pending" "qualified"
|
|
gdb_continue_to_breakpoint "kernel" ".*char array.*"
|
|
|
|
delete_breakpoints
|
|
|
|
# Create convenience variable while focused on the first wave.
|
|
gdb_test_no_output "set var \$addr = &array"
|
|
|
|
set original_wave_id [get_integer_valueof "\$_thread" -1]
|
|
set wave_id_list [info_thread_get_wave_list]
|
|
|
|
# Find thread ID of some other wave.
|
|
set new_wave_id $original_wave_id
|
|
|
|
foreach iter [lrange $wave_id_list 1 end] {
|
|
if {$new_wave_id != $iter} {
|
|
set new_wave_id $iter
|
|
break
|
|
}
|
|
}
|
|
|
|
# There has to be more than one wave.
|
|
if {$new_wave_id == $original_wave_id} {
|
|
fail "only one wave found"
|
|
return -1
|
|
}
|
|
|
|
# Switch to a new wave before inserting a watchpoint.
|
|
gdb_test "thread $new_wave_id" "Switching to thread $new_wave_id.*"
|
|
|
|
# Step over array initialization.
|
|
gdb_test "next" ".*array\\\[3\\\] = \\\'b\\\'.*"
|
|
|
|
# Set watchpoint on the whole array.
|
|
gdb_test "watch *\$addr" "Hardware watchpoint.*: \\\*\\\$addr"
|
|
|
|
# Continue until the watchpoint is triggered by the first change.
|
|
gdb_test "continue" \
|
|
".*Hardware watchpoint.*\\\*\\\$addr.*Old value = \\\"aaaa\\\".*New value = \\\"aaab\\\".*" \
|
|
"change an array element value from letter a to letter b"
|
|
|
|
# Check if the watchpoint is triggered in a correct thread scope
|
|
# of the new wave id.
|
|
gdb_assert { $new_wave_id == [get_integer_valueof "\$_thread" -1 "focused thread after stop"] } "watchpoint triggered by the expected wave"
|
|
}
|
|
|
|
}
|