Wait for an ABAP Debuggee
sap_debug_waitBlock until a watched user's code traps on a breakpoint, then attach to the frozen session and get the stop position and call stack for inspection.
Instructions
Register the debug listener and block until the watched user's code traps on a breakpoint — then attach to it and return the stop position and call stack.
BEHAVIOUR CHANGED: this is now a real server-side long-poll (POST /sap/bc/adt/debugger/listeners), not a state-polling loop, and it performs the attach itself. Registration is a side effect of this call: once made, the listener stays armed on SAP across timeouts until sap_debug_detach deletes it.
Args:
session_id (string): from sap_debug_attach.
timeout_ms (int): client-side cap (default 60000, max 300000).
poll_interval_ms (int): ignored, kept for compatibility.
response_format.
Returns (json): { sessionId, state, program?, include?, line?, stack, debuggee?, reachedBreakpoints?, message }.
state='STOPPED': a debuggee is attached and FROZEN. Inspect with sap_debug_variables, move with sap_debug_step, and release promptly — this is a real user session halted mid-execution, and SAP kills an abandoned debuggee after its own timeout.
state='TIMEOUT': nothing trapped in time; the listener is still armed, so call again (after making sure the code actually runs as that user).
state='CANCELLED': the listener was deleted elsewhere — call sap_debug_attach again.
Error Handling:
Conflict: another IDE took the scope over mid-wait; the message carries SAP's conflictText.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session ID returned by sap_debug_attach. | |
| timeout_ms | No | How long to block waiting for a trap (default 60s, max 300s). On timeout the listener stays armed — just call again. | |
| response_format | No | Output format: 'markdown' (human-readable, default) or 'json' (structured). | markdown |
| poll_interval_ms | No | Accepted for compatibility and ignored: this is a single server-side long-poll, not a polling loop. |