gpt4 book ai didi

c - ARM架构下调用函数的GCC返回地址

转载 作者:太空狗 更新时间:2023-10-29 16:32:29 26 4
gpt4 key购买 nike

我很好奇为什么 __builtin_return_address() 在 ARM 中不支持除 0 以外的其他参数?这是一个问题,你不能以某种方式从 ARM 的堆栈中推断出调用函数地址?还是别的?

谢谢

最佳答案

根据这篇文章 < http://codingrelic.geekhold.com/2009/05/pre-mortem-backtracing.html >,

Also on some architectures, including my beloved MIPS, only __builtin_return_address(0) works. MIPS has no frame pointer, making it difficult to walk back up the stack. Frame 0 can use the return address register directly. If ARM also does not have a frame pointer, this would explain the limitation.

另见 http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html .

关于c - ARM架构下调用函数的GCC返回地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9229702/

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