-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Describe the bug
When using the debug control buttons (e.g., clicking "Next" or "Step" twice in a row), the second click is completely ignored by the terminal and backend.
Root Cause
In TerminalComp.jsx, the useEffect that triggers commands relies on toggling commandPress to run:
useEffect(() => {
if (terminalOutput) {
defaultHandler(terminalOutput);
}
}, [commandPress]); However, since commandPress is a boolean toggle, if you click the SAME button multiple times, the state toggles back and forth. But because the terminalOutput is kept the same, and React batches the state update or fails to fire the effect appropriately, duplicate button clicks are dropped.
Expected behaviour
Clicking "Next" three times should execute the next GDB command three times.
To Reproduce
- Start a debugging session.
- Click the "Next" (arrow right) button in the
DebugHeader. - The terminal executes
next. - Click the same "Next" button again.
- Bug: Nothing happens. The command is ignored.
Suggested Fix
Refactor the global state to replace the boolean toggle commandPress with an incrementing counter (e.g., setCommandCount(prev => prev + 1)) so the dependency array always sees a new, unique value on every click.