简体   繁体   English

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

[英]Exclude files from vscode C++ debug step into?

Is it possible to exclude certain files from being stepped in to in the vscode C++ debugger?是否可以在 vscode C++ 调试器中排除某些文件? I'm using gdb for debugging.我正在使用 gdb 进行调试。

My executable is built and run remotely in a Docker container, and the host environment for VSCode does not have the standard header files instead for the Docker environment.我的可执行文件是在 Docker 容器中远程构建和运行的,VSCode 的主机环境没有标准头文件,而是用于 Docker 环境。

In particular, it's trying to step into STL code, which I'd rather exclude anyway.特别是,它试图进入 STL 代码,无论如何我宁愿将其排除在外。

Thanks谢谢

You can skip certain files from being stepped in. See documentation for skip :您可以跳过某些文件,以免被介入。请参阅有关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

To skip files while debugging with gdb in VSCode, one could add the following section to setupCommands of launch.json :要在 VSCode 中使用 gdb 调试时跳过文件,可以将以下部分添加到setupCommands的 setupCommands 中:

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

This is going to skip all header files in all folders named bits .这将跳过名为bits所有文件夹中的所有头文件。 Similarly, one could type -exec skip -gfi **/bits/*.h in VSCode debug console.同样,可以在 VSCode 调试控制台中键入-exec skip -gfi **/bits/*.h

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM