c - 如何在已编译的可执行文件中调试 vscode?
问题描述
尝试在 vscode 中调试时,vscode 会生成launch.json
配置文件。当我尝试调试时,它首先尝试编译源代码,然后调试 exe。我只想调试已经编译的可执行文件(使用gcc -g
选项编译)。
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": "gcc-10 - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [
"-pthread",
"common.c"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: gcc-10 build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
我能否以某种方式使 vsode不编译,而只是使用已编译的源代码进行调试"program":"${fileDirname}/${fileBasenameNoExtension}"
,我已经编译为相同的名称 - 当前目录中没有扩展名,正如属性所建议的那样。那么如何让vscode把这个可执行文件作为它的调试文件呢?
解决方案
推荐阅读
- c++ - 如何将 User32.lib 连接到 QT 项目?
- android - 从 Spinner 获取选定的保存项目位置
- javascript - JavaScript:从对象数组的对象数组中,将属性的值提取为数组
- java - 使用 Frame.pack() 添加 ScrollBar
- javascript - 使用 mysql 数据库时使用 open() javascript 函数的最佳方法是什么?
- delphi - 单击标题时无法对网格中的数据进行排序
- mysql - 为非常大的基于时间的数据集选择正确的 MySQL 结构
- mysql - 创建一个表,其中包含值列表中的一列作为存储过程的输入
- c# - .NET Standard 库是否可以访问 .NET Core 方法?
- regex - 我使用什么正则表达式将某些模块列入白名单?