Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion gdb/testsuite/lib/rocm.exp
Original file line number Diff line number Diff line change
Expand Up @@ -421,19 +421,45 @@ proc gdb_compile_ocl {source dest type options} {
}

# Run "info threads INF_NUM", return the number of "AMDGPU Wave" threads found.
# Print only the first and last 20 wave lines if there are more than 40 waves,
# replacing the omitted middle with a single summary line "... N lines omitted ...".

proc info_threads_get_wave_count { inf_num } {
set wave_count 0
set wave_lines {}
set test_name "unknown"
Comment thread
akondrat-amd marked this conversation as resolved.

log_user 0
gdb_test_multiple "info threads ${inf_num}.*" "" {
-re "AMDGPU Wave\[^\r\n\]+\r\n" {
incr wave_count
lappend wave_lines [string trimright $expect_out(buffer) "\r\n"]
exp_continue
}

-re "\[^\r\n\]+\r\n" {
lappend wave_lines [string trimright $expect_out(buffer) "\r\n"]
exp_continue
}

-re "$::gdb_prompt " {
pass $gdb_test_name
set test_name $gdb_test_name
}
}
log_user 1

set n [llength $wave_lines]
if {$n <= 40} {
foreach line $wave_lines { verbose -log $line }
} else {
foreach line [lrange $wave_lines 0 19] { verbose -log $line }
verbose -log "... [expr {$n - 40}] lines omitted ..."
foreach line [lrange $wave_lines [expr {$n - 20}] end] { verbose -log $line }
}

if {$test_name ne "unknown"} {
pass $test_name
}

return $wave_count
}
Expand Down
Loading