本文介紹了如何使用“sudo"調試程序在 VSCODE 中的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我正在嘗試在 VSCODE 中調試程序.該程序需要以 root 身份或在 Ubuntu 上使用sudo"啟動.實現這一目標的最佳方法是什么?示例啟動配置會有所幫助.謝謝.
I am trying to debug a program in VSCODE. The program needs to be launched as root or with "sudo" on Ubuntu. What's the best way to achieve this? An example launch configuration would be helpful. Thanks.
推薦答案
我做了以下事情:
- 在例如創建一個名為gdb"的腳本我的主目錄,包含:
pkexec/usr/bin/gdb "$@"
- 使其可執行
- 修改 VSCode 中的 launch.json 以通過添加miDebuggerPath"來調用腳本(顯然相應地更改用戶名):
...
"externalConsole": false,
"miDebuggerPath": "/home/<username>/gdb",
"MIMode": "gdb",
...
- 在調試時,使用
top
等來驗證進程是否以 root 身份運行.
- whilst debugging, use
top
or such like to verify the process is running as root.
應該夠了.
這篇關于如何使用“sudo"調試程序在 VSCODE 中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!