gdb/cuda: add SASS listing breakpoints - #28
Draft
Tyxiaoyou wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This patch adds a CUDA-GDB workflow for setting breakpoints on numbered SASS
listings without manually computing runtime device addresses.
New user-facing commands:
sass KERNELprints a numbered SASS listing for a loaded CUDAkernel/function.
break -sassstores a symbolic SASS breakpoint selectorand resolves it to ordinary CUDA device breakpoint locations when matching CUDA
modules are loaded.
Motivation
CUDA-GDB can already set source-level CUDA breakpoints and raw address
breakpoints. The missing workflow is a convenient way to break at a visible SASS
instruction. Today users must wait for the kernel/module to load, inspect SASS,
compute a runtime PC or offset manually, and set a raw address breakpoint.
This change keeps the internal breakpoint mechanism address-based while adding
a source-breakpoint-like CLI for SASS listings.
Implementation Notes
instruction number, SASS offset, runtime PC, and display text.
sass KERNELingdb/cuda/cuda-commands.c.ordinary_breakpointsubclass for symbolic SASSbreakpoints in
gdb/breakpoint.c.breakpoint_re_set()afterCUDA module load.
specific or mangled function name.
Validation
Tested on the official
nvidia-gdb-16.3branch withexamples/vector_add_debug.cu.The branch was built with CUDA 13.3 Debugger headers extracted from the
NVIDIA
cuda-gdb-13-3package. Runtime smoke tests used CUDA 13.3cuobjdumpand
nvdisasmextracted from the matching NVIDIA packages.Build:
CLI registration was checked with:
Runtime instruction-number test:
The breakpoint hit:
The offset form
break -sass vector_add_kernel+0x1e0hit the same SASSinstruction.
Listing test:
(cuda-gdb) set cuda break_on_launch application (cuda-gdb) run (cuda-gdb) sass vector_add_kernelsass vector_add_kernelprinted a numbered SASS listing and instruction31 corresponded to offset
0x1e0.Additional checks:
git diff --checkpasses.break -sass vector_add_kernel+0x1e0can be set before launch, remainspending, resolves after CUDA module load, and hits the same instruction as
vector_add_kernel:31.break -sass vector_add_kernel:63can be set after stopping at kernel entrywith
set cuda break_on_launch application, resolves immediately, and hits:break -sass vector_add_kernel:31survivesruna second time andresolves again to the current launch's runtime device PC.
Follow-Up Work