Skip to content

feat: show the process which a DAP session debugs, with its PID, in the console - #2152

Merged
lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/dap-process-event
Nov 23, 2026
Merged

lagergren merged 1 commit into
redhat-developer:mainfrom
lagergren:feat/dap-process-event

Conversation

@lagergren

Copy link
Copy Markdown
Collaborator

Fixes #2114

What

A debug adapter's process event names the process it debugs, with its PID and how it started it. DAPClient.process called LSP4J's empty default, and in launch mode the IntelliJ process handler is the debug adapter's, so the program's PID showed nowhere.

Change

  • DAPClient.process prints one line in the console (SYSTEM_OUTPUT, DAPBundle messages), such as Debugging process '/path/app' (PID 1234, launched). Whatever the event leaves out is left out of the line. isLocalProcess: false adds remote, and startMethod adds launched, attached or launched suspended, then attached. pointerSize is kept but not printed.
  • The line of a child session (startDebugging) ends with in the session '<name>'. The name is the name of the child's configuration, which is also what VS Code calls the child session (debugpy's Subprocess <pid>, vscode-js-debug's target name). Without one, the run configuration's name is used. The issue suggested getConfigName(), but that returns the run configuration's name. Every session of a tree shares it, because a child client is created on the same DAPDebugProcess.
  • DAPClient keeps the last event in a volatile field. getProcessEvent() returns it, for the later uses the issue lists (the Threads tooltip, the address width of DAP: view and edit memory (readMemory, writeMemory and the memory event) #2112).
  • DAP defines no client capability for this event, so there is nothing new to advertise in initialize.
  • Docs: Process is now ✅ in DAPSupport.md. The user guide has a new "Debugged process" section with a screenshot:

Debugged process

Behaviour change

Before After
The process event was ignored The console shows one line per process event: the process, its PID and how it was started, plus the session name for a child session

Backward compatibility

Nothing changes with adapters that don't send the event (CodeLLDB, rdbg, java-debug). Adapters that send it (debugpy, lldb-dap, Delve, netcoredbg, GDB, MIEngine) get one more console line per event. Delve sends one for each process it spawns. The only API change is the new DAPClient.getProcessEvent(); nothing is removed or changed.

Test

  • DAPClientProcessMessageTest (light): the line with PID and start method, a PID that isn't grouped (1234567), leaving out a missing PID, start method or both, a local process, a remote one, each startMethod, an empty name, and the line of a child session.
  • DAPProcessEventSessionTest (heavy, scripted DAP server over a socket). The console shows the line. The line leaves out what the event leaves out, and says remote. The client keeps the last of two events. A child session's line names the session after its configuration's name, or after the run configuration when there is none.
  • Without the change, all 5 session tests fail: the console has only Attaching .... The light test doesn't compile without getProcessMessage.
  • dap package: 369 tests, 0 failures, 0 skipped on IC 2024.2, IC 2025.3 and IU 2026.3. Full suite on 2024.2: 2077 tests, 0 failures, 7 skipped (Windows-only and inline-completion tests, skipped on main too).

…he console

A debug adapter's 'process' event names the process it debugs, with its
PID and how it was started. In launch mode the process of an IntelliJ
debug session is the debug adapter's, so the IDE didn't show the
program's PID anywhere. The console now prints a line for each 'process'
event, such as

    Debugging process '/path/app' (PID 1234, launched)

leaving out what the event leaves out, and saying 'remote' for a process
which isn't local. The line of a child session started with
'startDebugging' names that session: the name of its configuration, or
else the run configuration's. DAPClient keeps the last event, for
getProcessEvent().

The user guide describes it, with a screenshot, and DAPSupport.md marks it as
supported.

Fixes redhat-developer#2114
@lagergren lagergren added this to the 0.30.2 milestone Nov 23, 2026
@lagergren lagergren added enhancement New feature or request dap Debugging Adapter Protocol labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features

    • The Console now displays process details reported by a DAP server, including the process name, available PID, remote status, and whether the session was launched or attached.
    • Child-session entries include the session name when available.
  • Documentation

    • Updated the DAP support documentation and user guide with details about process events and the information shown in the Console.

DAPClient now stores the latest DAP process event and prints process details in the console. Documentation describes the reported information, and unit and session tests cover message formatting, event retention, and child-session names.

Changes: Process Event Handling

Layer / File(s) Summary
Process event reporting
src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPClient.java, src/main/resources/messages/DAPBundle.properties, src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientProcessMessageTest.java, docs/dap/DAPSupport.md, docs/dap/UserGuide.md
DAPClient stores the latest process event and prints its available details, including process name, PID, remote status, start method, and child-session name. Localized messages, documentation, and formatting tests cover the output.
Session-level process event verification
src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPProcessEventSessionTest.java
Session tests check console output, retention of the latest process event, and child-session naming with a local DAP server.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant DAPServer
  participant DAPClient
  participant SystemConsole
  DAPServer->>DAPClient: Send process event
  DAPClient->>DAPClient: Store event and format process details
  DAPClient->>SystemConsole: Print process message
Loading

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to 66bde · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: the DAP process event is now shown in the console with the debugged process and its PID. The raw summary and objectives confirm DAPClient prints a console line per pr…
Description check Passed The description is detailed and directly relevant. It covers the DAP process event handling, the console line format, the child-session naming, the new getProcessEvent() accessor, documentation update…
Linked Issues check Passed [#2114] Objectives and evidence:
1. Print a console line for the process event. DAPClient.process no longer delegates to the LSP4J default. The change prints one SYSTEM_OUTPUT line using DAPBundle mes…
Out of Scope Changes check Passed All changed areas trace to #2114: DAPClient.java (process handler, getProcessEvent, message builder), DAPBundle.properties (new message keys for the line), DAPClientProcessMessageTest and DAPProcessEv…
Full details: Title check

Explanation

The title states the main change: the DAP process event is now shown in the console with the debugged process and its PID. The raw summary and objectives confirm DAPClient prints a console line per process event, and the title matches that core change. The 'feat:' prefix is a conventional-commit style, which is acceptable and does not reduce clarity.

Full details: Description check

Explanation

The description is detailed and directly relevant. It covers the DAP process event handling, the console line format, the child-session naming, the new getProcessEvent() accessor, documentation updates, backward compatibility, and the test plan. It matches the changed files in the raw summary.

Full details: Linked Issues check

Explanation

[#2114] Objectives and evidence:

  1. Print a console line for the process event. DAPClient.process no longer delegates to the LSP4J default. The change prints one SYSTEM_OUTPUT line using DAPBundle messages, for example "Debugging process '/path/app' (PID 1234, launched)". Covered by DAPClientProcessMessageTest (light) and DAPProcessEventSessionTest (heavy, scripted DAP server).
  2. Show name, PID, locality and start method. The line includes PID and startMethod (launched, attached, launched suspended then attached). isLocalProcess false adds 'remote'. Missing fields are omitted. Covered by the light tests for each case.
  3. Child-session naming. The issue suggests getConfigName(). The PR uses the child configuration's name and falls back to the run configuration name. The PR explains that getConfigName() returns the shared run-configuration name. This is a documented deviation that still meets the intent of naming the child session. It is not a failing gap.
  4. Keep the latest event in a volatile field. DAPClient stores the last ProcessEventArguments and exposes it via getProcessEvent(). Covered by the session test that checks the last of two events.
  5. No capability flag. The PR advertises nothing new in initialize, which matches the issue.
  6. Docs. DAPSupport.md marks Process as supported. UserGuide.md adds a 'Debugged process' section. These are non-coding but are in the issue's How-it-could-be-done list and are consistent with it.
  7. Open question on Delve. The PR prints one line per event, including one per spawned process. The issue leaves this open, so the choice is acceptable.
    No unmet coding requirement was found in the summary evidence. Evidence is the whole-PR summary and PR description; no focused source inspection was performed.
Full details: Out of Scope Changes check

Explanation

All changed areas trace to #2114: DAPClient.java (process handler, getProcessEvent, message builder), DAPBundle.properties (new message keys for the line), DAPClientProcessMessageTest and DAPProcessEventSessionTest (tests for the new behaviour), DAPSupport.md (Process marked supported), and UserGuide.md (documents the new console output). The image file docs/dap/images/DAP_process_event.png is referenced by the user guide and is excluded from review by the !**/*.png rule; its absence is not treated as evidence of a problem, and this does not affect the verdict because the image is documentation only. No unrelated functional change was identified in the summary.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 635f6773-7087-45aa-acd5-a49c3bb59145
Commits

Reviewing files that changed from the base of the PR and between 11be81a and 66bde84.

Files ignored due to path filters: 1

  • docs/dap/images/DAP_process_event.png is excluded by !**/*.png
Files selected for processing: 6

  • docs/dap/DAPSupport.md
  • docs/dap/UserGuide.md
  • src/main/java/com/redhat/devtools/lsp4ij/dap/client/DAPClient.java
  • src/main/resources/messages/DAPBundle.properties
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPClientProcessMessageTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/dap/client/DAPProcessEventSessionTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.27%. Comparing base (11be81a) to head (66bde84).

Files with missing lines Patch % Lines
...m/redhat/devtools/lsp4ij/dap/client/DAPClient.java 91.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2152      +/-   ##
==========================================
+ Coverage   53.22%   53.27%   +0.05%     
==========================================
  Files         826      826              
  Lines       34717    34738      +21     
  Branches     7143     7152       +9     
==========================================
+ Hits        18477    18506      +29     
+ Misses      13468    13460       -8     
  Partials     2772     2772              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit 862d0a7 into redhat-developer:main Nov 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dap Debugging Adapter Protocol enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAP: handle the process event

1 participant