code-debug icon indicating copy to clipboard operation
code-debug copied to clipboard

How to send Ctrl+C (SIGINT) to gdbserver?

Open DeadRabbits307 opened this issue 6 years ago • 3 comments

Is it possible to send a Ctrl+C (SIGINT) to the gdbserver?

As far as I know using Native Debug simultaneously conntecting to the gdbserver for example in the TERMINAL using

(gdb) target extended-remote xx.xx.xx.xx:2345

to send a signal SIGINT is not possible, is it?

See https://stackoverflow.com/questions/55045070/pass-sigint-while-pressing-ctrlc-on-using-debugger-in-vscode

DeadRabbits307 avatar Jul 19 '19 08:07 DeadRabbits307

https://sourceware.org/gdb/onlinedocs/gdb/Signaling.html#Signaling

try signal SIGINT in the debugging console

WebFreak001 avatar Jul 20 '19 11:07 WebFreak001

I have a similar issue. I tried your suggestion and typed "signal SIGTRAP" in the console, and I got the following error:

Cannot execute this command while the selected thread is running. (from interpreter-exec console "signal SIGTRAP") Cannot execute this command while the selected thread is running.

edit: Follow-up

after more messing around, here's what I've found that doesn't work:

  • The play button (sometimes?)
  • The pause button
  • The step back button
  • The restart button?
  • The reverse button

Here's what works:

  • The play button
  • The step over button
  • The step into button
  • The step out button
  • breakpoints
  • Watches window
  • Variables window

The play button seems to work, except when I get in a weird state where the "play" button appears instead of the pause button even though the program is currently running. The reason I can enter this weird state is because the pause button doesn't pause my program.

As a side note, I believe the reason the "restart" button doesn't work is because of my gdb server, and not due to a problem with the vscode extension.

I have found that typing "interrupt" in the vscode debug console performs the equivalent of pressing ctrl+c in gdb.

Is there a way to remap what the gui buttons do? If I could remap the "pause" button to do the equivalent of typing "interrupt" in the debug console, it would streamline my debugging experience a lot.

4a-42 avatar Sep 30 '19 02:09 4a-42

This issue is possibly related https://github.com/microsoft/MIEngine/issues/844

bustij avatar Oct 07 '19 18:10 bustij