在 vscode 中使用调试器时按 ctrl+c 传递 SIGINT

Por*_*fum 8 gdb visual-studio-code vscode-settings

我知道我们可以在 gdb 中使用 handle 信号命令让它将 SIGINT 信号传递给程序。在 vs 代码中使用调试器时有没有办法做同样的事情?

ash*_*shk 5

打开另一个终端。

ps -eaf |grep <Proc-Name>   //  find the PID

kill -s SIGINT PID_OF_PROCESS
Run Code Online (Sandbox Code Playgroud)

返回 VS Code 现在您可以查看并使用堆栈跟踪等。

  • 这与调试控制台中的 -exec handle SIGINT nostop pass 结合起来效果很好。如果我按 CTRL+C,即使设置了 -exec handle SIGINT nostop pass,它也不会在我的断点处停止。 (2认同)

小智 3

在vs code的调试控制台中写入:

-exec 处理 SIGINT pass
-exec 处理 SIGINT nostop