簡體   English   中英

無法在Windows子系統Linux上使用gdb在VS代碼上調試C

[英]Unable to debug C on VS Code using gdb on Windows Subsystem for Linux

我正在使用VS Code來使用適用於Linux的Windows子系統來調試“C”代碼。 我基本上想要使用基於Linux的編譯器為操作系統的課程編譯'C'代碼。 我在Visual Studio Code上將默認終端設置為“WSL”。 單擊調試按鈕時,我收到以下錯誤'無法啟動調試。 miDebuggerPath的值無效'我驗證了'gdb'安裝在Windows的Solaris子系統中,其可執行文件(ELF文件)存在於'/ usr / bin / gdb'位置

這是m launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/temp",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            //"preLaunchTask": "Compile C Ubuntu"
        }
    ]
}

任何方向都會有所幫助:)

您遇到的問題是使用bash.exe丟失遠程調用,該調用是在WSL站點上調用調試器所必需的。 您需要添加一個名為"pipeTransport":的部分"pipeTransport":並對其進行配置。 有關詳細信息,請參閱此處的操作方法文檔。

您可以在https://github.com/microsoft/vscode-cpptools上找到有關我們擴展程序的GitHub站點的更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM