如何根据gdb中的函数名称跳转到堆栈跟踪中的一帧? [英] How can I jump to a frame in a stack trace according to the function name in gdb?
问题描述
由于无限递归,我正在调试堆栈溢出.当堆栈深达700个调用时,程序将失败.
I'm debugging a stack overflow due to infinite recursion. The program fails when the stack is 700 calls deep.
我想跳到最初调用该函数的框架.但是,gdb一次向我显示了从堆栈顶部开始的堆栈跟踪,大约有20个条目,我想知道是否可以以某种方式直接跳到调用函数而无需查看堆栈跟踪以找到其编号.
I want to jump to the frame in which the function was initially called. However, gdb shows me the stack trace from the top of the stack about 20 entries at a time, and I wonder if I can somehow skip straight to the calling function without looking through the stack trace to find its number.
为此,我希望能够根据其名称而不是其编号跳到堆栈框架.
To that end, I want to be able to jump to a stack frame based on its name instead of its number.
这可以在gdb中完成吗?
Can this be done in gdb?
推荐答案
两个选项:
-
up 200
将为您带来200帧 - 如果您知道递归例程的初始调用方,则可以执行
f [rame]< caller-func>
-这将跳转到地址caller-func
.
up 200
will bring you up 200 frames- If you know the initial caller of the recursive routine, you can do
f[rame] <caller-func>
- this will jump to the frame of addresscaller-func
.
请参见手册中的帧选择.
这篇关于如何根据gdb中的函数名称跳转到堆栈跟踪中的一帧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!