print stack trace in arm-linux

南楼画角 提交于 2019-12-01 20:48:27

ARM does not store the return address on the stack when branching to a subroutine but rather expects any function calling subroutines to save the link register to its own stack frame before calling other functions, so it is impossible to follow stack frames without debug information.

I just got backtrace() to work with GCC for ARM. The key for me was compiling with -funwind-tables. Otherwise the stack depth was always 1 (i.e. empty).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!