【问题标题】:Exclude files from vscode C++ debug step into?从 vscode C++ 调试步骤中排除文件?
【发布时间】:2017-08-04 13:59:28
【问题描述】:

是否可以在 vscode C++ 调试器中排除某些文件被单步执行?我正在使用 gdb 进行调试。

我的可执行文件是在 Docker 容器中远程构建和运行的,VSCode 的主机环境没有标准的头文件,而是用于 Docker 环境。

特别是,它试图进入 STL 代码,无论如何我宁愿将其排除在外。

谢谢

【问题讨论】:

    标签: c++ debugging gdb visual-studio-code


    【解决方案1】:

    您可以跳过某些文件被单步执行。请参阅skip 的文档:

    -file file
    -fi file
    
        Functions in file will be skipped over when stepping.
    -gfile file-glob-pattern
    -gfi file-glob-pattern
    
        Functions in files matching file-glob-pattern will be skipped over when stepping.
    
        (gdb) skip -gfi utils/*.c
    

    【讨论】:

      【解决方案2】:

      要在 VSCode 中使用 gdb 进行调试时跳过文件,可以将以下部分添加到 launch.json 的 setupCommands

       "setupCommands": [
                            {
                              "description": "Skip library files",
                              "text": "-interpreter-exec console \"skip -gfi **/bits/*.h\""
                            }  
                        ],
      

      这将跳过所有名为bits 的文件夹中的所有头文件。同样,可以在 VSCode 调试控制台中输入-exec skip -gfi **/bits/*.h

      【讨论】:

        猜你喜欢
        • 2021-08-15
        • 1970-01-01
        • 2021-12-22
        • 2016-12-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-02-15
        相关资源
        最近更新 更多