-
Notifications
You must be signed in to change notification settings - Fork 30
Description
π Bug: GDB session silently restarts, wiping state on filename mismatch
Description
In gdbui_server/main.py, several endpoints (such as /set_breakpoint, /gdb_command, etc.) check if the incoming name matches the internal program_name. If it does not match, the server automatically restarts the entire GDB session without warning.
However, the frontend currently hardcodes name: "program" in almost all of its API requests. If a user tries to debug an actual file with a different name, or if state gets out of sync, the backend will continually and silently restart the GDB instance. This causes the user to instantly lose all breakpoints, memory map history, stack traces, and execution position.
Expected behaviour
The frontend should dynamically send the correct, current program_name to the backend.
Alternatively, the backend should not aggressively restart the GDB session simply because of a name mismatch, or at least return an explicit warning/error indicating the mismatch rather than silently wiping debug state.
To Reproduce
- Upload and compile a file named
my_test.c. - The backend registers
program_nameasmy_test(or similar). - The frontend
Breakpoint.jsxcomponent sends a/set_breakpointPOST request hardcoded withname: "program". - The backend sees
name != program_nameand silently triggersstart_gdb(), wiping all existing GDB state.
Suggested Fix
- Frontend: Remove the hardcoded
name: "program"strings inside the React components. Instead, store the currently active executable name inDataContext.jsxand pass it to API calls. - Backend: Refactor the
start_gdbconditions to be more explicit, or return a 400 error rather than silently resetting the debugging environment if there's a file name conflict.