Skip to content

gdb: resolve inline call-site line breakpoints before next-line fallback - #29

Open
elibol wants to merge 2 commits into
NVIDIA:nvidia-gdb-16.3from
elibol:fix/inline-callsite-line-breakpoints
Open

elibol wants to merge 2 commits into
NVIDIA:nvidia-gdb-16.3from
elibol:fix/inline-callsite-line-breakpoints

Conversation

@elibol

@elibol elibol commented Oct 10, 2026

Copy link
Copy Markdown

A source breakpoint on an inlined call can slide past the entire helper when the call line has no line-table row. In the cuTile reproduction in NVIDIA/cuda-rust#1476, break 132 stops at line 133 after validation has already run, even though the cubin records DW_AT_call_line: 132 and the helper's executable entry.

Before using the next-line fallback, resolve a missing source line through inline symbols whose call-site file and line match. Use the block's entry PC (including explicit entry-PC and range-list semantics), and prevent prologue skipping from moving that address. Existing exact line-table matches keep their current behavior; eliminated calls with no executable range retain the existing fallback. Helper instruction locations and inline scopes remain intact.

Validation:

  • Built CUDA-GDB from the current nvidia-gdb-16.3 branch with CUDA 13.4 debugger headers.
  • Reproduced the slide with released CUDA-GDB 13.3 and 13.4 on an RTX PRO 2000 Blackwell laptop GPU, driver 610.43.02.
  • With this change, the exact pending command break 132 resolves when the JIT module loads and stops at the first validation comparison (FSETP.GE.AND), with the complete stack: assert_in_range:18 -> validate_scale_factor:14 -> checked_scale:132 -> checked_scale_entry:10. Continuing completes normally.
  • Synthetic-DWARF regressions cover missing call-line rows, nested and cross-file calls, multiple inline instances, noncontiguous ranges, explicit entry PCs, eliminated calls, and ordinary source-line breakpoints. The new regression fails on released CUDA-GDB. The focused suites pass all 30 checks.
  • Related inline, entry-PC, ordinary breakpoint, and until suites pass. Two existing tests now expect successful inline call-site resolution instead of the previous slide or single-location result. Documentation describes the new behavior and remaining metadata/elimination limitations.

Fixes NVIDIA/cuda-rust#1476. The separate assertion SIGTRAP/coredump attribution issue NVIDIA/cuda-rust#1379 and frontend generated-constant span work are outside this change.

@elibol

elibol commented Oct 21, 2026

Copy link
Copy Markdown
Author

Reviewing this against NVIDIA/cuda-rust#1476. The validation already described is the right acceptance test: the exact pending break 132, set before JIT module loading, stops at the first validation comparison rather than the next caller statement, with the complete helper stack. The synthetic-DWARF cases cover nested/cross-file calls, repeated instances, range/entry-PC handling, eliminated calls, and the unchanged ordinary-line behavior.

Please retain those focused tests and the live cuTile reproduction on the final rebased revision, recording the debugger/toolkit/driver versions and before/after transcript. Re-resolving the same source breakpoint on a later JIT specialization is also worth a focused regression if it is not already exercised by the loaded-module tests: one source call can acquire multiple compiled instances over the application's lifetime.

No compiler-side rewriting of helper instruction locations is needed for this scope. NVIDIA/cuda-rust#1476 should remain open until the debugger fix lands, with the first containing CUDA-GDB release identified so cuTile users know when the behavior is available. Assertion SIGTRAP/coredump attribution (NVIDIA/cuda-rust#1379) remains separate; an inside-helper breakpoint is evidence of intact metadata, not a substitute for the call-line regression.

@elibol

elibol commented Oct 26, 2026

Copy link
Copy Markdown
Author

Pushed d6d9b2b60a9b4397dedea6265a1f386fc3feddc6 with the requested successive-module regression: a pending caller-line breakpoint resolves in the first DSO and gains two more inline locations when a second DSO loads while the first remains loaded. Both modules hit both inline entries with nested backtraces; all four breakpoint locations remain present.

Built CUDA-GDB 13.4 with its matching headers. The call-site, inline-header and inline-break suites pass all 109 checks, including the new loader test.

Fresh live comparison on RTX 5090, driver 610.43.02, tileiras 13.3.36, using the combined cuTile release candidate: break cutile/tests/debug_info.rs:26, set before JIT module loading, stops on the next statement at line 27 with released CUDA-GDB 13.3. This branch stops inside offset at helper line 9 with offset -> nested -> source_kernel:26 -> source_kernel_entry:25; execution completes successfully. This supplements the original exact pending break 132 reproduction; the automated DSO test explicitly covers pending resolution and later loads.

NVIDIA/cuda-rust#1476 still needs debugger-maintainer review/merge and the first containing CUDA-GDB release identified. Assertion SIGTRAP/coredump attribution (#1379) remains separate.

elibol added a commit to NVIDIA/cuda-rust that referenced this pull request Oct 30, 2026
…1480)

Current review head: **`9f19c0c84e32e0b686154695b0f9bd96451b5d1f`**,
incorporating main through `0d62b682b` after #1528 and #1600 merged. The
diff against main remains four files and one source-policy change:
generated entry setup uses the user signature span.

Refresh validation: **36 tests passed** on CUDA 13.3 with serial
execution: 20 debug-info, three constant-origin, six generated-origin,
and seven JIT-override tests. This includes ignored assembler, GPU, and
live CUDA-GDB cases. Formatting and diff checks pass. Fresh CI is
running; independent review is still needed. The older validation
details below are historical evidence, not a claim that every suite was
rerun at this head.

Generated entry setup currently inherits `Span::call_site()`, so
CUDA-GDB attributes the wrapper and its generated assumptions to the
module header. Use the original user function's signature span for the
synthesized wrapper, including its call into the user kernel. The
original kernel body and nested helper locations remain unchanged.

The regression checks wrapper operations and assumptions, the outer
caller in inline chains, and the serialized entry subprogram's
declaration line. Constants compiled from synthesized types are outside
this change; #1385 has now merged their separate frontend-origin fix.
Backend assertion-trap/coredump attribution remains under #1379.

Validation:

- The new regression fails with the original wrapper span and passes
with this change.
- All nine `debug_info` tests pass, including real `tileiras`/`nvdisasm`
checks, execution in all debug modes, and the live cuda-gdb cross-file
helper test.
- Live CUDA-GDB confirms the wrapper frame and the entry instruction now
point to the user function signature.
- Scoped formatting and `cargo clippy --locked -p cutile-compiler --lib
-- -D warnings` pass.
- Ran the required `scripts/run_all.sh`: CPU/assembler tests, 26
supported examples, and all eight benchmark smoke tests passed. One
example was skipped because it requires Tile IR 13.4 and the installed
assembler is 13.3. All GPU targets passed except one existing test-order
dependency in `warmup_suite`; the whole 16-test cache suite passes
serially on this branch. The script therefore returned nonzero for that
unrelated cache test.

The unrelated cache failure is reproducible on unchanged base
`bafffe45662a5cdc064a1c6674c6c02d466a58e0`:
`retain_predicate_may_reenter_the_cache_without_deadlock` leaves the
same specialization cached, while
`composed_builder_compile_terminal_warms_the_dispatched_specialization`
expects its compile count to increase by one. Running the baseline test
binary with `RUSTC_BOOTSTRAP=1 <warmup_suite-binary> warmup_composed::
-Z unstable-options --shuffle-seed 3 --test-threads 1` reproduces that
assertion. This setting only enables the test harness's shuffle option;
it does not rebuild or change the pinned toolchain.

For benchmark validation, the existing runner drops its bare
`smoke-test` argument. For this run, its invocation was temporarily
corrected to `--features smoke-test` so all eight benchmarks used the
intended smoke configuration. The runner was restored afterward; that
correction is not part of the PR.

Part of #1475. The inline call-line breakpoint resolver is addressed
separately by
[NVIDIA/cuda-gdb#29](NVIDIA/cuda-gdb#29). The
generated assertion trap's backend source attribution remains under
#1379.

Signed-off-by: Melih Elibol <[email protected]>
Signed-off-by: Melih Elibol <[email protected]>
Co-authored-by: Melih Elibol <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cuTile: breakpoint on an inlined helper call slides to the next statement

1 participant