{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "G:\\MySoftware\\scoop\\apps\\nuwen-mingw-without-git\\current\\bin\\gcc.exe",
"intelliSenseMode": "windows-gcc-x64",
"cStandard": "c17",
"cppStandard": "c++23"
}
],
"version": 4
}
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
// ${workspaceRoot} 当前打开的文件夹的绝对路径+文件夹的名字
// ${workspaceRootFolderName} 当前打开的文件夹的名字
// ${file} 当前打开正在编辑的文件名,包括绝对路径,文件名,文件后缀名
// ${relativeFile} 从当前打开的文件夹到当前打开的文件的路径
// ${fileBasename} 当前打开的文件名+后缀名,不包括路径
// ${fileBasenameNoExtension} 当前打开的文件的文件名,不包括路径和后缀名
// ${fileDirname} 当前打开的文件所在的绝对路径,不包括文件名
// ${fileExtname} 当前打开的文件的后缀名
"version": "0.2.0",
"configurations":
[
{
"name": "(gdb) 启动",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": true,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "G:\\MySoftware\\scoop\\apps\\nuwen-mingw-without-git\\current\\bin\\gdb.exe",
"preLaunchTask": "C/C++: gcc.exe 生成活动文件",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe 生成活动文件",
"command": "G:\\MySoftware\\scoop\\apps\\nuwen-mingw-without-git\\current\\bin\\gcc.exe",
"args": [
"-Wall",
"-fdiagnostics-color=always",
"-g",
"${fileDirname}\\*.c",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"-finput-charset=UTF-8", // 输入编译器文本编码 默认为UTF-8
"-fexec-charset=UTF-8" // 编译器输出文本编码 自行选择
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"detail": "编译器: G:\\MySoftware\\scoop\\apps\\nuwen-mingw-without-git\\current\\bin\\gcc.exe"
},
{
"type": "shell",
"label": "C/C++: 运行活动文件",
"dependsOn": "C/C++: gcc.exe 生成活动文件",
"command": [
"chcp 65001", // chcp 65001 设置终端为utf-8,解决乱码问题
";",
"${fileDirname}/${fileBasenameNoExtension}.exe"
],
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
},
]
}
-exec + gdb命令
-exec help + gdb命令
-exec help breakpoints
-exec help backtrace
-exec display /i $rip
-exec display /20i $rip
当前将要执行的20行代码的汇编-exec disassemble
-exec disassemble /m
-exec disassemble /m main
-exec info registers
-exec info frame
-exec print $rip
-exec si
.c
文件和.h
文件的编码格式为utf-8
,否则vscode命令行终端输出中文会乱码https://blog.csdn.net/weixin_44465434/article/details/126379978