防止 GDB 单步执行函数(或文件) [英] Preventing GDB from stepping into a function (or file)

查看:15
本文介绍了防止 GDB 单步执行函数(或文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些这样的 C++ 代码,我正在使用 GDB 逐步完成:

I have some C++ code like this that I'm stepping through with GDB:

void foo(int num) { ... }

void main() {
  Baz baz;
  foo (baz.get());
}

当我在 main() 时,我想单步进入 foo(),但我想跨步 over baz.get().

When I'm in main(), I want to step into foo(), but I want to step over baz.get().

GDB docs 说"step 命令只有在函数有行号信息时才进入函数",所以如果我可以从我的可执行文件中删除 baz.get() 的行号信息,我会很高兴.但理想情况下,我可以告诉 GDB永远不要进入 Baz 类中的任何函数".

The GDB docs say that "the step command only enters a function if there is line number information for the function", so I'd be happy if I could remove the line number information for baz.get() from my executable. But ideally, I'd be able to tell GDB "never step into any function in the Baz class".

有人知道怎么做吗?

推荐答案

从GDB 7.4开始,可以使用skip.

Starting with GDB 7.4, skip can be used.

运行 info skip,或查看手册了解详细信息:https://sourceware.org/gdb/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html

Run info skip, or check out the manual for details: https://sourceware.org/gdb/onlinedocs/gdb/Skipping-Over-Functions-and-Files.html

这篇关于防止 GDB 单步执行函数(或文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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