Skip to content

[libcudacxx] Add GDB/LLDB pretty-printers for cuda::std::complex and cuda::complex - #10563

Merged
Jacobfaib merged 1 commit into
NVIDIA:mainfrom
HenrikGharagyozyan:feature/cccl-complex-pretty-printers
Jul 31, 2026
Merged

Jacobfaib merged 1 commit into
NVIDIA:mainfrom
HenrikGharagyozyan:feature/cccl-complex-pretty-printers

Conversation

@HenrikGharagyozyan

@HenrikGharagyozyan HenrikGharagyozyan commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

closes #10090

Adds debugger pretty-printers for cuda::std::complex and cuda::complex, following the pattern established for cuda::std::array in #10528:

  • libcudacxx/share/libcudacxx/gdb/complex.py — GDB printer displaying both class templates as <type> = {real = <re>, imag = <im>}. Both types store _Tp __re_; _Tp __im_;, so a single matcher handles them; ABI inline namespaces (e.g. cuda::std::__4::) are stripped from displayed type names via the existing helper.
  • libcudacxx/share/libcudacxx/lldb/complex.py — LLDB synthetic-children provider exposing real/imag children, mirroring the GDB logic.
  • libcudacxx/test/debugging/complex/ — harness test with 7 cases: default-constructed complex<float>, complex<double> with nonzero parts, cuda::complex<float>, a typedef alias, complex nested inside cuda::std::array (verifies printer composition), and a before/after mutation pair.

Testing notes: The GDB printer was validated end-to-end locally (gdb 15.1, host-compiled scenario) using run_pretty_printer_test.py; gdb.expected was generated by the harness (--update-expected) and verified to pass on a clean re-run. I don't have lldb available locally, so the LLDB printer follows the established structural pattern from the array/buffer formatters but was not executed — lldb.expected is written by analogy with the array golden and relies on CI for verification. To reduce golden-file risk, test values are dyadic fractionals so float rendering is unambiguous across debuggers. Happy to fix up the lldb golden from the CI diff if it differs.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-project-automation github-project-automation Bot moved this to Todo in CCCL Jul 30, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Jul 30, 2026
@HenrikGharagyozyan
HenrikGharagyozyan force-pushed the feature/cccl-complex-pretty-printers branch from b2b3117 to 352f051 Compare July 30, 2026 20:36
@coderabbitai

coderabbitai Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b247b018-d0ee-40b1-b8ce-563a6114c58c

📥 Commits

Reviewing files that changed from the base of the PR and between b2b3117 and 352f051.

📒 Files selected for processing (9)
  • libcudacxx/share/libcudacxx/gdb/__init__.py
  • libcudacxx/share/libcudacxx/gdb/complex.py
  • libcudacxx/share/libcudacxx/lldb/__init__.py
  • libcudacxx/share/libcudacxx/lldb/complex.py
  • libcudacxx/test/debugging/CMakeLists.txt
  • libcudacxx/test/debugging/complex/CMakeLists.txt
  • libcudacxx/test/debugging/complex/gdb.expected
  • libcudacxx/test/debugging/complex/lldb.expected
  • libcudacxx/test/debugging/complex/source.cu

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added debugger pretty-printing for CUDA complex numbers in both GDB and LLDB.
    • Complex values now show real and imag components for supported cuda::complex / cuda::std::complex types, including aliases and nested values.
    • Debugger output also covers “before” and “after” states when complex values change.
  • Tests

    • Added new GDB and LLDB golden-output fixtures plus a dedicated CUDA test case for complex-number scenarios (including nested arrays).

Walkthrough

Changes

CUDA complex debugger printers

Layer / File(s) Summary
GDB complex printer
libcudacxx/share/libcudacxx/gdb/complex.py, libcudacxx/share/libcudacxx/gdb/__init__.py
Recognizes cuda::complex and cuda::std::complex, exposes real and imag, and registers the printer.
LLDB complex synthetic provider
libcudacxx/share/libcudacxx/lldb/complex.py, libcudacxx/share/libcudacxx/lldb/__init__.py
Recognizes CUDA complex types, exposes synthetic real and imag children, and registers the provider.
Debugger test scenarios
libcudacxx/test/debugging/CMakeLists.txt, libcudacxx/test/debugging/complex/CMakeLists.txt, libcudacxx/test/debugging/complex/source.cu
Adds complex debugger tests covering scalar, CUDA, alias, nested, and updated values.
Expected debugger output
libcudacxx/test/debugging/complex/gdb.expected, libcudacxx/test/debugging/complex/lldb.expected
Adds golden output for the supported GDB and LLDB scenarios.

Assessment against linked issues

Objective Addressed Explanation
Create GDB and LLDB pretty printers for cuda::std::complex and cuda::complex under the specified directories [#10090] ✅
Add exhaustive debugger tests under libcudacxx/test/debugging/complex [#10090] ✅

Possibly related PRs

  • NVIDIA/cccl#10528: Extends the same GDB and LLDB pretty-printer registration entry points with another formatter module.

Suggested reviewers: wmaxey, jacobfaib, pciolkosz


Comment @coderabbitai help to get the list of available commands.

@Jacobfaib Jacobfaib left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@Jacobfaib

Copy link
Copy Markdown
Contributor

/ok to test 352f051

@Jacobfaib
Jacobfaib enabled auto-merge (squash) July 30, 2026 22:17
@github-actions

Copy link
Copy Markdown
Contributor

🥳 CI Workflow Results

🟩 Finished in 2h 02m: Pass: 100%/68 | Total: 1d 16h | Max: 1h 16m | Hits: 99%/318670

See results here.

@Jacobfaib
Jacobfaib merged commit 6e0de67 into NVIDIA:main Jul 31, 2026
93 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Jul 31, 2026
davebayer pushed a commit to davebayer/cccl that referenced this pull request Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[FEA]: Debugger pretty-printers: cuda::std::complex/cuda::complex

2 participants