我在 Mac 上設定了一個 C 環境來為我的 phd 實作一些數字代碼。我使用的是 Intel C/C Classic 編譯器,而不是默認的 clang。
到目前為止,我設法生成了一些除錯資訊,以喚起類似的命令icc -std=c17 -o code -g code.c
當我在 VSCode 中呼叫 Run and Debug 選項時,它會向我顯示 2 個選項:C (GDB/LLDB)和C (Windows). 當我單擊第一個時,它會顯示另外 2 個選項:C/C : clang build and debug active file或C/C : gcc build and debug active file. 它沒有顯示與英特爾經典編譯器相關的任何內容。如何使用此編譯器在 VSCode 環境中使用英特爾 C/C Classic 編譯器進行除錯?
提前致謝!
uj5u.com熱心網友回復:
根據檔案,我認為您正在混合編譯和除錯,C/C : gcc build and debug active file從系統上檢測到的編譯器串列中進行選擇只是幫助您生成一些這樣的配置:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C : g build active file",
"command": "/usr/bin/g ",
"args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
"options": {
"cwd": "/usr/bin"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
]
}
如果您想在 VSCode 中進行除錯,您只需將此配置添加到您的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}/code",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/484011.html
上一篇:Perl除錯:設定為`1`的變數意外設定為`undef`
下一篇:套接字連接失敗時如何不崩潰
