VS代码在c++调试中忽略断点 [英] VS code is ignoring the breakpoint in c++ debugging

查看:31
本文介绍了VS代码在c++调试中忽略断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 VS Code 中调试 c++ 代码,但它不会在断点处停止并可视化变量、观察和调用堆栈,这是它应该做的.取而代之的是,它在调试控制台中打印:

I am debugging a c++ code in VS Code but it doesn't stop on breakpoint and visualize the variables, watch and call stack, which it was supposed to do. Instead of this, it prints this in debug console:

Breakpoint 1, 0x000000000040074a in main ()
[Inferior 1 (process 9445) exited normally]
The program '/home/hashir/x/a.out' has exited with code 0 (0x00000000)

这里是launch.json文件:

here is launch.json file:

{
    // 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": "/home/hashir/x/a.out",
            "args": [],
            "stopAtEntry": false,
            "cwd": "/home/hashir/x/",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

推荐答案

使用 -g 标签和 g++/clang++

Comiple the program using -g tag alongwith g++/clang++

这篇关于VS代码在c++调试中忽略断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆