diff --git a/docs/step-debugger-guide.md b/docs/step-debugger-guide.md index 99556c2..b95972e 100644 --- a/docs/step-debugger-guide.md +++ b/docs/step-debugger-guide.md @@ -78,12 +78,6 @@ command-line arguments), a status line, a **Breakpoints** pane on the left, and **Locals**, a watch row, **Stack** and **Target output (stdout/stderr)** on the right. -> **First-run quirk:** the breakpoint pane opens squeezed narrow — the -> location entry is only ~50 px wide and the list shows just the -> `Ignore`/`Message` columns. Drag the divider between the panes to the -> right and everything appears. See -> [Troubleshooting](#troubleshooting). - ## 2. (Optional) Turn on "Break on main" 1. In the debugger, click **Settings** (or **Debug ▸ Debugger Settings…**). @@ -438,7 +432,7 @@ debugger today. The other two are at different stages: | Button | Key | What it does | | ------ | --- | ------------ | -| **Run** | — | Start the target under gdb. From Idle it reads the **Target:** entry; from Stopped/Exited it re-runs the *currently loaded* executable (see the target-switching note below). | +| **Run** | — | Start the target under gdb. Reads the **Target:** entry (and **Args:**) every time: from Idle it starts it; from Stopped/Exited it re-runs the loaded executable when the entry is unchanged, or loads and runs the new target when the entry or args changed. | | **Continue** | `F5` | Continue execution until the next breakpoint, or exit. | | **Step Over** | `F10` | Step over the current line — run a function call as one step. | | **Step Into** | `F11` | Step into the called function. | @@ -478,15 +472,21 @@ still there when you reopen it. ## Troubleshooting **The breakpoint pane is too narrow.** -At the default divider position the location entry is squeezed to ~50 px -and the list shows only the `Ignore`/`Message` columns, with no visible -horizontal scrollbar: +FIXED Dec 2, 2026 (commit a3df7cd): the default divider moved from +380 px to 560 px, the breakpoint pane keeps a minimum width of 480 px +with a horizontal scrollbar, the Location column has a 140 px minimum +and expands, and all columns are resizable. The deeper cause was the +hint line under the list ("Breakpoints (toggle Enabled to +enable/disable; …)"): as one unwrapped line it was ~700 px wide, which +forced the whole pane's minimum width to ~734 px — wider than the +paned's 560 px slot — so GTK right-aligned the overflowing pane and the +`#` and Location columns ended up off-screen left. The hint now wraps +to two lines, the pane fits its 560 px slot exactly, and the list opens +with `#` and Location fully visible (the remaining columns scroll). +Before the fix the location entry was squeezed to ~50 px and the list +showed only the `Ignore`/`Message` columns: -![Squeezed breakpoint pane at the default divider](../screenshots/debugger/20_narrow_pane.png) - -Drag the divider between the breakpoint pane and the Locals pane to the -right. The full entry and all eight columns (`#`, `Location`, `Enabled`, -`Hits`, `Type`, `Condition`, `Ignore`, `Message`) appear. +![Squeezed breakpoint pane at the default divider (before the fix)](../screenshots/debugger/20_narrow_pane.png) **The status says "Running…" but the program already stopped.** The status is polled every 150 ms, so it can show `Running…` for a beat @@ -494,73 +494,94 @@ after the stop event. Wait a moment; the status line, locals and code window catch up together. **The debugger stops responding to clicks.** -Look for a modal error dialog centred on the debugger window — for -example `"finish" not meaningful in the outermost frame.` if you press -**Step Out** while stopped in `main()` (there is no caller to return -to). Modal dialogs block all input to the debugger until you dismiss -them with **OK**, and nothing else on screen hints they are there. If -the debugger seems dead, list the windows — an untitled dialog is the -usual culprit. +Look for a modal error dialog centred on the debugger window — modal +dialogs block all input to the debugger until you dismiss them with +**OK**, and nothing else on screen hints they are there. If the debugger +seems dead, list the windows — an untitled dialog is the usual culprit. +(Step Out in `main()` used to produce such a dialog — +`"finish" not meaningful in the outermost frame.` — but that case is +FIXED Dec 2, 2026, commit e6678e1: pressing **Step Out** in +`main()` now writes `Step Out: already in the outermost frame (main) — +nothing to return to. Use Continue.` in the status line instead.) **Stop doesn't interrupt a GUI app.** -Pressing **Stop** while a generated app sits in `gtk_main` can fail with -`"timed out waiting for gdb reply"` (5 s timeout) and the app keeps -running. Use **Restart** instead — it SIGKILLs the target and re-runs it. +FIXED Dec 2, 2026 (commit e6678e1): the root cause was gdb +running in synchronous mode — while the target ran, gdb never read +`-exec-interrupt` from its stdin, so **Stop** timed out after 5 s with +`"timed out waiting for gdb reply"` and the app kept running. The +debugger now enables gdb's async mode at startup, and **Stop** falls +back to SIGINT and then SIGSTOP delivered straight to the target pid. +Stop now interrupts a GUI app sitting in `gtk_main` (or a busy loop) in +~0.1 s; press **Stop** again to kill it. **Run re-runs the old program after I changed the Target field.** -**Run** from Stopped or Exited re-runs the executable that is already -loaded; only a fresh (Idle) session reads the **Target:** entry. Closing -the debugger window doesn't reset this — the session stays alive. To -debug a different target, quit LightGUI and start it again for a fresh -session. +FIXED Dec 2, 2026 (commit e6678e1): **Run** from Stopped or +Exited now compares the **Target:** and **Args:** entries with the +loaded target — unchanged means restart the loaded program, changed +means the old target is killed (through gdb, so it is reaped at once) +and the new one is loaded and run. Closing the debugger window doesn't +reset this — the session stays alive — but you no longer need to quit +LightGUI to switch targets. -**Edit… / Remove do nothing.** -The list is rebuilt every 150 ms, which wipes the row selection almost -as fast as you click it, so usually no row is selected when **Edit…** or -**Remove** runs and they silently return. Create conditional/logpoint -breakpoints with **Add…** instead, and toggle breakpoints with the -**Enabled** checkbox (press-hold-release works more reliably than a -quick click for the checkbox). +**Edit… / Remove do nothing, or the Enabled checkbox ignores a quick +click.** +FIXED Dec 2, 2026 (commit a3df7cd): the lists are now rebuilt only +when their contents actually change (before, the 150 ms poll cleared +and rebuilt every list on every tick, wiping the row selection almost +as fast as you clicked it), and the selection is preserved across a +rebuild that does happen — so the row you clicked stays selected when +**Edit…** or **Remove** runs. The **Enabled** checkbox also flips in +the list immediately on click (optimistic update) instead of waiting +for the gdb round-trip. **Two identical "main" breakpoints.** -The break-on-main temporary breakpoint is written into -`debugger_bps.conf` and re-applied on the next start, so a fresh session -can show two `main` rows (one with hits, one without). Harmless — disable -or remove the spare one. +FIXED Dec 2, 2026 (commit e6678e1): the break-on-main +breakpoint is now marked temporary — it lives only for the run and is +never written to `debugger_bps.conf`, and a second one is never added +when a `main` breakpoint already exists. Files that already contain two +`main` lines load deduplicated (the first is kept). **Breakpoints from an old target fail on the new one.** -Stale breakpoints are dropped best-effort when a session starts (gdb -reports `No source file named console.cpp.` for locations the new target -doesn't have). They are not kept pending — re-add the ones you need. +Breakpoints for locations the new target doesn't have are kept staged +(shown in the list with no gdb id) instead of being dropped, and are +re-applied automatically when you switch back to a target that has +them (gdb reports `No source file named console.cpp.` for locations +the current target doesn't have). **My watch text goes into a search popup, not the watch entry.** -Clicks in the watch row can focus the watch *list* instead of the entry; -typing then opens GTK's interactive-search popup. Click directly inside -the entry field and retype. +FIXED Dec 2, 2026 (commit a3df7cd): interactive search is disabled +on all debugger lists, so typing while a list has focus can no longer +open GTK's search popup instead of reaching the entry above the list. **Breakpoints don't resolve / locals are empty.** The target wasn't built with `-g`. Rebuild with `-g -O0` (for a generated project, `make CXXFLAGS="-g -O0 -Wall -std=c++17"` — the generated `Makefile`/`CMakeLists.txt` don't add `-g` themselves) and run again. -## Known bugs found while writing this guide +## Known bugs found while writing this guide — all fixed Dec 2, 2026 -Found during the screenshot sessions; reported here, not fixed (this -guide is documentation only). Checked Dec 2, 2026: no debugger fixes -have landed since Nov 29, so all eight are still there. +Found during the screenshot sessions. All eight were fixed Dec 2, 2026 +and are covered by `tests/debugger_tests.sh` (backend) and the GUI +checks in that script: -1. Breakpoint pane too narrow by default (see above). +1. Breakpoint pane too narrow by default — fixed, commit a3df7cd. 2. Breakpoint list selection doesn't stick — **Edit…** / **Remove** - usually do nothing (150 ms list rebuild clears the selection). + usually do nothing (150 ms list rebuild clears the selection) — + fixed, commit a3df7cd. 3. **Step Out** in `main()` shows `"finish" not meaningful in the - outermost frame.` as a modal error. + outermost frame.` as a modal error — fixed, commit e6678e1: + a status-line note instead, no modal. 4. **Stop** times out (`"timed out waiting for gdb reply"`) on a GUI app - sitting in `gtk_main`; **Restart** works. + sitting in `gtk_main` — fixed, commit e6678e1: gdb async + mode + SIGINT/SIGSTOP fallbacks. 5. **Run** from Stopped/Exited ignores the **Target:** entry and re-runs - the loaded executable; no UI path to switch targets without - restarting LightGUI. + the loaded executable — fixed, commit e6678e1: Run now + loads the new target when the entry changed. 6. Break-on-main's temporary breakpoint is persisted, so a fresh session - can show two identical `main` breakpoints. + can show two identical `main` breakpoints — fixed, commit + e6678e1: the temp breakpoint is never saved. 7. Watch-entry clicks can land on the watch list and open GTK's - interactive-search popup instead of focusing the entry. -8. Enabled-checkbox toggles sometimes ignore a quick click. + interactive-search popup instead of focusing the entry — fixed, + commit a3df7cd: interactive search disabled on all lists. +8. Enabled-checkbox toggles sometimes ignore a quick click — fixed, + commit a3df7cd: optimistic toggle + no rebuild while idle.