cdt-gdb-adapter icon indicating copy to clipboard operation
cdt-gdb-adapter copied to clipboard

Cannot execute CLI commands like `> interrupt` from Debug Console while CPU is running

Open jreineckearm opened this issue 6 months ago • 0 comments

Problem

One cannot use the Debug Console to execute GDB commands while a CPU/thread is running. You get an error message about no frameId being available.

This includes CLI commands which are not dependent on a stopped CPU or a frame/thread ID. Examples are

  • > help
  • > interrupt

Proposal

We should consider to NOT suppress Debug Console input when the CPU is running as we currently do in the evaluateRequest handler:

  • I would expect GDB can gracefully handle commands that it cannot execute while CPU is running. This may even depend on the debugged architecture which may be even more so a reason to let GDB and/or the GDB server handle it.
  • More generic commands that don't even need to access the target system shouldn't be affected by the CPU state.
  • -interpreter-exec doesn't always require --frame and --thread.

Allowing non-GDB-command expressions from the console while the CPU is running is probably more debatable. It highly depends on the variable type (global vs local C/C++ variables) and target architecture. Variables at a fixed memory location (for example global C variables) could be for example read from an Arm Cortex-M based system while the CPU is running. If GDB itself doesn't just handle this gracefully, then we should consider treating this part separately from enabling GDB commands while CPU is running.

Note: success of GDB commands presumably depends on non-stop mode support. Again I'd expect GDB to reject gracefully.

jreineckearm avatar Apr 25 '25 11:04 jreineckearm