首页 > 其他分享 >VS code debug c代码 配置

VS code debug c代码 配置

时间:2023-03-23 10:36:37浏览次数:32  
标签:bin gcc code gdb json VS debug true exe

 

 1.配置c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "E:\\MINGW\\bin\\gcc.exe",
            "cStandard": "c11",
            "cppStandard": "gnu++14",
            "intelliSenseMode": "windows-gcc-x86"
        }
    ],
    "version": 4
}

2.配置launch.json

/* launch.json */
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) 启动",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",   //${fileDirname}为文件所在目录
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",        //调试程序时的工作目录,可改成${fileDirname}
            "environment": [],
            "externalConsole": true,        // 为true时使用系统的控制台窗口
            "internalConsoleOptions": "neverOpen",
            "MIMode": "gdb",
            "miDebuggerPath": "E:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
                    "description": "将反汇编风格设置为 Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "gcc"
        },
    ]
}

3.配置tasks.json

/* tasks.json */
{
    "tasks": [
        {
            "type": "shell",
            "label": "gcc",    //一定要和launch.json的preLaunchTask名字一致
            "command": "E:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                 "-fexec-charset=GBK", //GBK编码,用于解决Winows中文乱码
            ],
            "options": {
                "cwd": "E:\\MinGW\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

4.加断点

 

 5.debug

标签:bin,gcc,code,gdb,json,VS,debug,true,exe
From: https://www.cnblogs.com/wanglongjiang/p/17246534.html

相关文章

  • LeetCode344. 反转字符串
    题目描述:编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组s的形式给出。不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用O(1)的额外......
  • 使用 Windows Debugger 调试托管代码
    使用WindowsDebugger调试托管代码 使用WindowsDebugger调试托管代码https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-manage......
  • fix btoa decoded error All In One
    fixbtoadecodederrorAllInOnebase64encode/decodeUncaughtDOMException:Failedtoexecute'atob'on'Window':Thestringtobedecodedcontainschara......
  • Codeforces 70D. Professor's task
    题目链接:D-Professor'stask题目大意:初始给三个点,之后要求实现两种操作:加点;判断给定点是否在凸包内部。动态凸包板子题,留档怕忘了,参考https://www.cnblogs.com/enzymi......
  • XCode汇编调试
    开启Xcode汇编调试选中AlwaysShowDisassembly项。XCode->Debug->DebugWorkflow->AlwaysShowDisassembly 在计算机中,虽然数据是存储在内存中,但内存中数据......
  • tensorrt的VS props配置
    版本:TensorRT-8.5.3.1.Windows10.x86_64.cuda-11.8.cudnn8.6cuda_11.8.0_522.06_windowscudnn-windows-x86_64-8.6.0.163_cuda11-archiveZlibOpenCV4.7.0安装参考......
  • Codeforces Round 644 (Div. 3) D. Buying Shovels(数论)
    https://codeforces.com/contest/1360/problem/DD.BuyingShovels题目大意:一个人想买正好n把铲子。店内有k种包装的铲子:第i种包装正好由i把铲子组成(1≤i≤k)。这家......
  • Codeforces Round 859 (Div
    F.BouncyBall给定\(n×m\)矩形,起点\(st\),终点\(ed\),有一小球从起点出发,每次可以选择4个方向,如果碰到边界就反弹,询问最后能否到达终点题解:\(DFS\)+\(map\)记录状......
  • 让你的vscode搭载ChatGPT获得来自 AI 的编程指导
    一直以来,VSCode都是开发者心目中的生产力神器,它免费、开源且跨平台,被称为最好用的IDE。把VSCode和ChatGPT结合使用,用户将获得来自AI的编程指导,包括代码解释、找......
  • AtCoder Beginner Contest 246
    AtCoderBeginnerContest246D题意求一个\(x\geqn\)使得\(x=a^3+a^2b+ab^2+b^3\)且\(n\leq10^{18}\)思路变形\(x=(a+b)(a^2+b^2)\),那么a、b的范围在1e6从大到小......