解决vscode非root用户登录启动gdb调试问题

ubuntu一般默认非root用户的登录,当用非root用户登录的时候,并进行vscode的远程登录调试时,会报权限不足,无法调试.
这里提供一个方法规避:
新建1个文件比如xgdb,在路径/home/test/xgdb,写入以下代码

#!/bin/bash
#gdb路径为/usr/local/bin/gdb
sudo -i /usr/local/bin/gdb "$@"

然后编辑vscode的调试配置文件luanch.json
其中:
"miDebuggerPath": "/home/test/xgdb",

  	"preLaunchTask": "echo",
        "miDebuggerPath": "/home/test/xgdb",
        "miDebuggerArgs": "-ex",

这样配置后, 非root的账号也能启动gdb进行调试.

# vscode   ubuntu  gdb  启动 

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×