print stack trace in arm-linux(在arm-linux中打印堆栈跟踪)
问题描述
我按照这篇文章打印堆栈跟踪 当我的 gcc C++ 应用程序崩溃时如何生成堆栈跟踪.它在 x86 linux 中运行良好.谁能教我如何让它在 arm-linux 上工作?
I followed this post to print stack trace How to generate a stacktrace when my gcc C++ app crashes . It works well in x86 linux. Can anyone teach me how to make it work on arm-linux?
我正在使用 arm-linux-gcc 4.4.3.
I am using arm-linux-gcc 4.4.3.
[root@FriendlyARM /]# ./test1
Error: signal 11:
[0x0]
在 x86 中
mickey@mickeyvm:~/Desktop/workspace/test/testCatchSeg/src$ ./test1
Error: signal 11:
./test1(_Z7handleri+0x19)[0x804876d]
[0xedd400]
./test1(_Z3bazv+0x10)[0x80487c2]
./test1(_Z3barv+0xb)[0x80487e1]
./test1(_Z3foov+0xb)[0x80487ee]
./test1(main+0x22)[0x8048812]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x84de37]
./test1[0x80486c1]
这就是我为 arm-linux 编译的方式
This is how I compile for arm-linux
arm-linux-g++ -g -rdynamic ./testCatchSeg.cpp -o testCatchSeg
推荐答案
ARM在跳转到子程序时不会将返回地址存储在堆栈上,而是希望任何调用子程序的函数都保存链接寄存器 在调用其他函数之前到自己的栈帧,所以没有调试信息是不可能跟随栈帧的.
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.
这篇关于在arm-linux中打印堆栈跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在arm-linux中打印堆栈跟踪
基础教程推荐
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- CString 到 char* 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
