防止GDB中的PLT(过程链接表)断点 [英] Prevent PLT (procedure linkage table) breakpoints in GDB
问题描述
在最新版本的GDB中,在库函数调用上设置断点会导致多个实际断点:
In recent versions of GDB, setting a breakpoint on a library function call results in multiple actual breakpoints:
- 调用过程链接表(PLT)
- 实际函数调用
这意味着当库函数为叫做,我们每次都要经历两次休息。在以前的GDB版本中,只会创建#2,因此您只会得到一个中断。
This means that when the library function is called, we end up going through two breaks each time. In previous GDB versions, only #2 would be created and hence you only get one break.
所以问题是:一个人可以创建一个库函数调用断点而无需对应的PLT断点?我知道您可以创建一个常规断点,然后显式禁用PLT,但这确实很繁琐。
So the question is: can one can create a library function call breakpoint without the corresponding PLT breakpoint? I am aware that you can create a regular breakpoint and then explicitly disable the PLT one, but this is really tedious.
推荐答案
I想我找到了解决这个问题的方法。您可以使用
I think I found a solution for this problem. You can use the
break *address
break的语法,但是您没有指定十六进制地址,而是给出了函数的名称(其结果为函数的地址)。
syntax of break, but instead of specifying a hex address, you give the name of the function (which evaluates to the function's address). Something like
break *myfunction
仅在主函数上设置断点,而不在任何PLT版本上设置断点。
That sets a breakpoint only on the main function, and not any of the PLT versions.
这篇关于防止GDB中的PLT(过程链接表)断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!