winzik/docs/ide/debugger.md

41 lines
1.8 KiB
Markdown

# Debugger
Step debugging of PHP with **Xdebug** or **PHP Debugger** (desktop).
## Breakpoints
Click in the gutter left of a line (right click: a condition; `Ctrl+F8` at the caret). They are kept per project and follow their
lines as you edit. **Stop at Exceptions…** (the ⚠ of the Debug window): `*` or class names, it stops where one is thrown.
## Debug
**Debug** (`Shift+F9`, the bug beside Run) runs the selected configuration under the debugger. Where it stops: the line is marked
and the **Debug** window shows the stack (click a frame), the variables as a tree, watches, an expression evaluated there, and a
variable can get a new value (double click or `F2`).
| Action | Shortcut |
|---|---|
| Resume | `F9` |
| Step Over / Into / Out | `F8` / `F7` / `Shift+F8` |
| Run to Cursor | `Alt+F9` |
| Stop | `Ctrl+F2` |
Hovering a variable in the editor while stopped shows its value.
The trees (Variables, Watches, the hover card) read only the children of the row you open and keep every other row, the scroll and
what you opened (also after a step in the same frame). A value that cannot be read shows `error: ...` inside its own row. The hover
card stays open while the pointer is on it or a read is pending, grows to a maximum height then scrolls, and closes on Escape, a
click outside, or when the pointer has been away for more than 300 ms.
## Engines
Xdebug by default; [PHP Debugger](https://php-debugger.dev) is much faster: **Debug with…** (right click on the Debug button)
chooses one for a run and can make it the default.
## Web sites
Debug on **Serve the site** turns Xdebug on in the site's container: breakpoints stop the requests.
## Tips
Headless runs (`shot`, `test`) are best: a game stopped in a window freezes until you resume. Claude can drive the same debugger
([Claude](claude.md)). More: [docs/ide-debugger.md](../ide-debugger.md).