c++ - 如何使用命令标志在未来的共享库上设置断点

标签 c++ c linux unix gdb

我正在尝试使用 --command 标志自动执行 gdb session 。我正在尝试在共享库(DLL 的 Unix 等效项)中的函数上设置断点。我的 cmds.gdb 看起来像这样:

set args /home/shlomi/conf/bugs/kde/font-break.txt
b IA__FcFontMatch
r

但是,我得到以下信息:

shlomi:~/progs/bugs-external/kde/font-breaking$ gdb --command=cmds.gdb...
GNU gdb 6.8-2mdv2009.0 (Mandriva Linux release 2009.0)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
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 "i586-mandriva-linux-gnu"...
(no debugging symbols found)
Function "IA__FcFontMatch" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]

所以它毕竟没有设置断点。如何在未决的 future 共享库加载时默认回答“y”以设置断点?

我记得我能够做某事,但不记得是什么。

最佳答案

回复我自己,我想给出IRC上有人给我的答案:

(gdb) apropos pending
actions -- Specify the actions to be taken at a tracepoint
set breakpoint -- Breakpoint specific settings
set breakpoint pending -- Set debugger's behavior regarding pending breakpoints
show breakpoint -- Breakpoint specific settings
show breakpoint pending -- Show debugger's behavior regarding pending breakpoints

And so set breakpoint pending on does the trick; it is used in cmds.gdb like e.g.

set breakpoint pending on
break <source file name>:<line number>

关于c++ - 如何使用命令标志在未来的共享库上设置断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/100444/

相关文章:

linux - 当值为 0 时存储 grep -c 输出时脚本终止

c++ - 如何阻止Clang发出数百条有关应聘者的消息?

C++ regex_search 捕获检索在运行时失败

c - 如何使用堆栈从函数返回值?

c - C 中未初始化的变量或数组

C++ 将来自 std::cin 的字符串与来自外部 txt 文件的字符串进行比较

c++ - Pc Lint,如何使用 init() 为类抑制错误 613(可能使用空指针)

c++ - 将 std::vector emplace_back() 与 std::pair 与构造函数初始化列表一起使用

c - 两点之间的最短距离。蛮力算法

c - Xlib - 在窗口上仅绘制位图的设置位