如何使用命令标志在未来的共享库上设置断点 [英] How to set breakpoints on future shared libraries with a command flag

查看:23
本文介绍了如何使用命令标志在未来的共享库上设置断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

设置参数/home/shlomi/conf/bugs/kde/font-break.txtb IA__FcFontMatchr

但是,我得到以下信息:

<前>shlomi:~/progs/bugs-external/kde/font-breaking$ gdb --command=cmds.gdb...GNU gdb 6.8-2mdv2009.0(Mandriva Linux 2009.0 版)版权所有 (C) 2008 Free Software Foundation, Inc.许可证 GPLv3+:GNU GPL 版本 3 或更高版本这是免费软件:您可以自由更改和重新分发它.在法律允许的范围内,不提供任何保证.输入显示复制"和显示保修"了解详情.这个 GDB 被配置为i586-mandriva-linux-gnu"...(未找到调试符号)函数IA__FcFontMatch"未定义.在未来的共享库加载时使断点挂起?(y 或 [n]) [回答 N;输入不是来自终端]

所以它毕竟没有设置断点.如何使其默认回答y"以在未决的未来共享库加载时设置断点?

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

解决方案

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

<前>(gdb) apropos 待定actions -- 指定要在跟踪点执行的操作set breakpoint -- 断点特定设置set breakpoint pending -- 设置调试器关于挂起断点的行为show breakpoint -- 断点特定设置显示断点挂起——显示调试器关于挂起断点的行为

所以设置断点挂起就行了;它在 cmds.gdb 中使用,例如

设置断点挂起break <源文件名>:<行号>

I'm trying to automate a gdb session using the --command flag. I'm trying to set a breakpoint on a function in a shared library (the Unix equivalent of a DLL) . My cmds.gdb looks like this:

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

However, I'm getting the following:

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]

So it doesn't set the breakpoint after all. How can I make it default to answer "y" to set breakpoints on pending future shared library load?

I recall that I was able to do something, but cannot recall what.

解决方案

Replying to myself, I'd like to give the answer that someone gave me on 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>

这篇关于如何使用命令标志在未来的共享库上设置断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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