attach_to_process
Attach a debugger to a running process for live debugging. Verifies target by polling for threads; fails if none appear within timeout.
Instructions
Attach to a running process for debugging. After the handshake the target is verified by polling for threads; if none are reported within verifyTimeout (~20s default) the attach fails and the proxy is torn down. When a requested post-attach pause is accepted but no stopped event arrives within its bounded wait, returns state "running" with pending:true; the late event alone changes the session to "paused"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | Host to attach to (default: localhost) | |
| port | No | Debug port to attach to | |
| timeout | No | Connection timeout in milliseconds (default: 30000) | |
| processId | No | Process ID (for local attach, language-specific) | |
| sessionId | Yes | Debug session ID | |
| justMyCode | No | Only debug user code (skip library code) | |
| sourcePaths | No | Source paths for code mapping | |
| stopOnEntry | No | Pause the target after attaching. Default true when omitted (thread verification, then a pause request; if the stop lands after the response you get pending:true and the target still freezes on its next dispatch). Pass false to attach without stopping — required when attaching to a live service | |
| adapterConfig | No | Adapter-specific attach configuration merged into the attach config before the adapter transforms it (e.g. C/C++/LLDB: program — the binary path for symbol resolution when /proc/<pid>/maps paths are not openable, as in a kubectl-debug ephemeral container — or initCommands like "settings set target.exec-search-paths /proc/<pid>/root"). Reserved keys request/__attachMode are ignored; set stopOnEntry via the top-level parameter. Keys the adapter does not recognize are still forwarded to the debugger and named in the response warning — a near-miss of a supported key gets a did-you-mean suggestion. js-debug pins its attach orchestration keys (address/port/continueOnAttach/attachExistingChildren) over caller values; its autoAttachChildProcesses defaults to false on attach — child processes the target forks run undebugged (set it true to auto-attach children; only one child can be adopted at a time, further children are resumed undebugged) | |
| verifyTimeout | No | How long to wait (ms) for the debugger to report at least one thread after attaching before failing the attach (default: 20000, max: 600000). Decrease for fast failure-by-design probes; increase for targets that are exceptionally slow to become debuggable | |
| breakOnExceptions | No | Break when exceptions are thrown: "uncaught" pauses at uncaught exceptions at the crash site; "all" also pauses on caught/raised exceptions (language-dependent). Default "none" — attach sessions never apply a language default (unlike launch) |