Debug This Hang
debug_this_hangDiagnose stuck, deadlocked, or spinning processes by pausing the target, collecting bounded stacks from every thread, and applying wait-state and cross-thread pointer-provenance analysis.
Instructions
High-level native hang workflow for all-thread triage. Use it when a live process appears stuck, deadlocked, waiting forever, or spinning and you need bounded stacks from every thread, wait-state/deadlock heuristics, and cross-thread Pointer-Provenance v2. In current mode it inspects an existing configured session and pauses a running live target when necessary; codelldb, lldb-dap, gdb, and live modes can launch or attach to an authorized local target, observe it for a bounded interval, then pause it for evidence. Do not use executable/attach modes when target execution or debugger control is not authorized, and do not treat a deadlock-candidate as a proven lock cycle because generic DAP does not expose portable lock ownership.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory for adapter-owned launches and a project-root hint for hang triage. | |
| env | No | Environment variables supplied to adapter-owned launched programs. | |
| pid | No | Required for codelldb/lldb-dap/gdb attach modes; ignored for launch and generic live configuration. | |
| args | No | Command-line arguments for codelldb/lldb-dap/gdb launch modes. | |
| mode | No | current triages the configured session; live uses an already initialized generic DAP adapter; codelldb/lldb-dap/gdb discover and start that adapter before launch/attach. | current |
| program | No | Required for codelldb/lldb-dap/gdb launch; optional executable image hint for adapter-specific attach. | |
| request | No | For live or adapter-owned modes, launch starts a program and attach connects to an existing authorized process. | launch |
| analysis | No | Optional project roots/modules used to recognize project-controlled frames across all threads. | |
| observeMs | No | Bounded interval after launch/attach during which a normal stop or process exit prevents automatic hang-timeout classification. | |
| sessionId | No | Optional DAP session ID. Omit to use the backward-compatible default session. | |
| maxThreads | No | Maximum threads to collect for bounded all-thread triage. | |
| adapterPath | No | Optional explicit CodeLLDB, lldb-dap, or GDB executable path; omit to use adapter discovery. | |
| stackLevels | No | Maximum stack frames collected per thread. | |
| configuration | No | Required only for mode=live: adapter-specific DAP launch/attach configuration. | |
| pauseBudgetMs | No | Aggregate wall-clock budget across thread enumeration and all pause requests. This prevents per-thread pause timeouts from multiplying across large thread sets. | |
| pauseTimeoutMs | No | Maximum time to wait for any single pause request used to freeze a suspected live hang. | |
| captureTimeoutMs | No | Global deadline for all-thread stack/scope/variable evidence collection after the pause phase. When it expires, remaining threads are retained as partial/unclassified evidence instead of extending the workflow per thread. | |
| requestTimeoutMs | No | Per-request timeout for starting and configuring an adapter-owned DAP session. | |
| framesWithVariables | No | Maximum frames per thread whose locals/arguments are collected, prioritizing the top frame and first project-controlled frame. | |
| maxVariablesPerFrame | No | Maximum local/argument variables collected per selected frame scope for Pointer-Provenance v2. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| status | Yes | ||
| evidence | No | ||
| diagnosis | No | ||
| observation | Yes |