从 vscode C++ 调试步骤中排除文件?

Ste*_*lly 5 c++ debugging gdb visual-studio-code

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

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

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

谢谢

amb*_*hed 9

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

 "setupCommands": [
                      {
                        "description": "Skip library files",
                        "text": "-interpreter-exec console \"skip -gfi **/bits/*.h\""
                      }  
                  ],
Run Code Online (Sandbox Code Playgroud)

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


ks1*_*322 4

您可以跳过某些文件。请参阅跳过的文档

-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
Run Code Online (Sandbox Code Playgroud)