VSCode GDB调试c++程序需要root权限

lig*_*use 8 debugging sudo gdb cmake root

我需要在Linux上使用VSCode和GDB调试c++程序,该程序需要root权限才能正常运行。这与硬件访问有关,因此几乎不相信存在任何解决方法。

\n

在这种情况下,我如何在 VSCode 和 GDB 中调试程序,该程序是由 CMake 构建的,因此 CMake Tools 调试是更好的选择,但不是必需的。

\n

我已经厌倦了下面指定的解决方案;
\n Vscode/Cmake 工具 - 如何将调试器附加到需要 root 权限的程序?

\n

具有以下输出(问题)。

\n
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===\nAuthentication is needed to run `/usr/bin/gdb\xe2\x80\x99 as the super user\nMultiple identities can be used for authentication:\n 1.  Ubuntu (ubuntu)\n 2.  myuser,,, (myuser)\nChoose identity to authenticate as (1-2): [1] + Stopped (tty input)        \xe2\x80\x9c/home/myuser/gdb\xe2\x80\x9d --interpreter=mi --tty=${DbgTerm} 0<\xe2\x80\x9c/tmp/Microsoft-MIEngine-In-or3v3iwk.blv\xe2\x80\x9d 1>\xe2\x80\x9c/tmp/Microsoft-MIEngine-Out-o2vrpakv.czu\xe2\x80\x9d\nYou have stopped jobs.\n
Run Code Online (Sandbox Code Playgroud)\n

它不会等待身份选择,而是立即退出。

\n

调试C++程序需要sudo权限才能在VSCode中正常工作应该怎么做?

\n