debugging - 如何让gdb每次启动时都运行用户定义的函数(在.gdbinit中定义)?

标签 debugging gdb

我在 .gdbinit 中的用户定义 fn setup 中定义了一组基本断点。所以,每次启动 gdb 时,我都必须执行该 fn。在开始调试之前设置我的所有 brkpoints 。我可以配置我的 .gdbinit 以便每当它启动时,它首先执行我的用户定义的 fn setup 吗?

最佳答案

只需通过函数名称调用即可:

我的.gdbinit:

define setup    
  echo Foobar\n
end   

setup #This is the function call

当我运行它时:

$ gdb
GNU gdb Fedora (6.8-37.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Foobar
(gdb) 

关于debugging - 如何让gdb每次启动时都运行用户定义的函数(在.gdbinit中定义)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1913135/

相关文章:

c - 使用 SDL_image 保存 PNG 时出现段错误

c++ - 如何在 gdb 输出中隐藏类型信息

javascript - 如何在 Visual Studio Code 中调试单个 Nightwatch JS 测试

google-chrome - Chrome 开发者工具在 Brackets LivePreview 中显示 favicon 404 错误

c - 为什么 zlib deflate() 挂起?

debugging - 如何在 GDB 中不断观察变量?

c# - Visual Studio 2015 在 Try Catch block 中抛出异常

java - 为什么局部变量不显示在 Eclipse 的调试 View 中?

debugging - Visual Studio 代码调试器未连接到 SAM Local

c++ - 调试堆上损坏的对象