gpt4 book ai didi

gdb - gdb 如何从堆栈中的所有帧中找到所有寄存器的值

转载 作者:行者123 更新时间:2023-12-01 10:53:46 29 4
gpt4 key购买 nike

调试时加断点,运行bt可以看到栈帧。

通过运行信息寄存器选择帧时,可以看到特定帧上的寄存器值。

例如,考虑在第 5 帧设置断点。当断点被击中时,进入第 3 帧,可以看到查看寄存器值。

在第 5 帧设置断点时,gdb 如何从第 3 帧获取寄存器值?

最佳答案

作为堆栈展开过程的一部分,它依赖于编译器生成的调试信息来恢复前一帧的(某些)寄存器值。

http://gnu.wildebeest.org/blog/mjw/2007/08/23/stack-unwinding/

To help debuggers still get all the information needed to unwind a stack and restore all needed registers the debugging information (DWARF) generated by compilers was extended to include Call Frame Information (CFI) that allows a debugger to reconstruct the calling pc and registers of a function (see the DWARF 3 spec – section 6.4).



有关相对容易遵循的 DWARF 堆栈展开实现,请参阅 _Unwind_Backtrace()在 libgcc 中。这是进程内的,而不是像 GDB 那样的进程外。

关于gdb - gdb 如何从堆栈中的所有帧中找到所有寄存器的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16598860/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com