Skip to content

[lldb][test] Add mock GPU DAP test for startDebugging reverse request#84

Open
thechenli wants to merge 1 commit into
clayborg:llvm-server-pluginsfrom
thechenli:mock-gpu-dap-test
Open

[lldb][test] Add mock GPU DAP test for startDebugging reverse request#84
thechenli wants to merge 1 commit into
clayborg:llvm-server-pluginsfrom
thechenli:mock-gpu-dap-test

Conversation

@thechenli

Copy link
Copy Markdown
Collaborator

Summary

Add a DAP test for the mock GPU plugin that verifies the startDebugging reverse request is sent with the correct structure when a mock GPU target is created. This mirrors the AMD GPU DAP test from #72 but uses the mock GPU plugin, allowing the test to run in CI on any machine without real GPU hardware.

The test validates:

  • The reverse request command is startDebugging with request type attach
  • The session name is "Mock GPU Session"
  • The configuration includes valid debuggerId and targetId fields
  • The test correctly handles multiple GPU plugins being active simultaneously by filtering for the mock GPU session name

Files added

  • lldb/test/API/tools/lldb-dap/gpu/mock/TestDAP_mock_gpu_reverse_request.py — test
  • lldb/test/API/tools/lldb-dap/gpu/mock/hello_world.cpp — test program with mock GPU lifecycle functions
  • lldb/test/API/tools/lldb-dap/gpu/mock/Makefile — build rules
  • lldb/test/API/tools/lldb-dap/gpu/mock/lit.local.cfg — requires lldb-mock-gpu plugin

Test plan

  • Built with -DLLDB_ENABLE_MOCK_GPU_PLUGIN=ON -DLLDB_ENABLE_AMDGPU_PLUGIN=ON
  • Ran llvm-lit lldb/test/API/tools/lldb-dap/gpu/mock/ — all tests pass

@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@thechenli thechenli marked this pull request as ready for review March 5, 2026 19:31
@qxy11

qxy11 commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

Can this mock more than just the startDebugging request? We should try to send DAP requests to the CPU and mock GPU targets.

@qxy11 qxy11 requested review from qxy11 March 5, 2026 21:02
@thechenli thechenli force-pushed the mock-gpu-dap-test branch from a366e9d to edbb2de Compare March 5, 2026 23:28
@thechenli

thechenli commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator Author

Can this mock more than just the startDebugging request? We should try to send DAP requests to the CPU and mock GPU targets.

yeah, added another test test_dap_requests_to_cpu_and_gpu_targets which hopefully have the e2e testing flow.

)

# Stack trace on the GPU thread
gpu_thread_id = gpu_threads[0]["id"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we test more than simple commands like stack trace - maybe try continuing to the next mock GPU breakpoint, and CPU breakpoints?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fyi - the current PR have two CPU breakpoints and only one GPU breakpoint, I am trying to figure out a deadlock issue with multiple GPU breakpoints.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

updated with setting instruction breakpoints for GPU and continue to the breakpoint.

@thechenli thechenli force-pushed the mock-gpu-dap-test branch 5 times, most recently from 398e910 to 78471db Compare March 9, 2026 02:21
@thechenli thechenli force-pushed the mock-gpu-dap-test branch from 78471db to d979f98 Compare March 9, 2026 02:28
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.

2 participants