Skip to content

πŸ› Bug: GDB session silently restarts (losing all state) if requested filename mismatches backendΒ #112

@Jayant-kernel

Description

@Jayant-kernel

πŸ› 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

  1. Upload and compile a file named my_test.c.
  2. The backend registers program_name as my_test (or similar).
  3. The frontend Breakpoint.jsx component sends a /set_breakpoint POST request hardcoded with name: "program".
  4. The backend sees name != program_name and silently triggers start_gdb(), wiping all existing GDB state.

Suggested Fix

  1. Frontend: Remove the hardcoded name: "program" strings inside the React components. Instead, store the currently active executable name in DataContext.jsx and pass it to API calls.
  2. Backend: Refactor the start_gdb conditions to be more explicit, or return a 400 error rather than silently resetting the debugging environment if there's a file name conflict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions