gdb 指定不需要调试的文件(file.c, file.cc, file.h, file.cpp等),函数

使用skip命令,可以指定不需要调试的文件或函数

比如指定了函数foo,当执行到调用函数foo的地方,即使使用命令s,也不会进入到函数foo了。

skip有下面选项

  • -file file

  • -fi file

    指定不需要调试的源文件

  • -gfile file-glob-pattern

  • -gfi file-glob-pattern

    指定不需要调试的源文件,可以使用glob-style pattern 。man 7 glob

  • -function linespec

  • -fu linespec

    Functions named by linespec or the function containing the line named by linespec will be skipped over when stepping. See Specify Location.

  • -rfunction regexp

  • -rfu regexp

    Functions whose name matches regexp will be skipped over when stepping.

    This form is useful for complex function names. For example, there is generally no need to step into C++ std::string constructors or destructors. Plus with C++ templates it can be hard to write out the full name of the function, and often it doesn’t matter what the template arguments are. Specifying the function to be skipped as a regular expression makes this easier.

    (gdb) skip -rfu ^std::(allocator|basic_string)<.*>::~?1 *(
    

    If you want to skip every templated C++ constructor and destructor in the std namespace you can do:

    (gdb) skip -rfu ^std::([a-zA-z0-9_]+)<.*>::~?1 *(
    

以上的选项在gdb 7.7.1里是没有的。以下的选项在7.7.1里有

  • skip function [linespec]
  • skip file [filename]

查看skip命令

info skip

skip delete [range]

Delete the specified skip(s). If range is not specified, delete all skips.

skip enable [range]

Enable the specified skip(s). If range is not specified, enable all skips.

skip disable [range]

Disable the specified skip(s). If range is not specified, disable all skips.

set debug skip [on|off]

Set whether to print the debug output about skipping files and functions.

show debug skip

Show whether the debug output about skipping files and functions is printed.

c/c++ 学习互助QQ群:877684253

本人微信:xiaoshitou5854

gdb 指定不需要调试的文件(file.c, file.cc, file.h, file.cpp等),函数

原文链接: https://www.cnblogs.com/xiaoshiwang/p/12895255.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍;

也有高质量的技术群,里面有嵌入式、搜广推等BAT大佬

    gdb 指定不需要调试的文件(file.c, file.cc, file.h, file.cpp等),函数

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/348692

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年3月2日 上午5:11
下一篇 2023年3月2日 上午5:12

相关推荐