ARM 上的共享库缺少帧
我目前正在调试环境中工作,在 ARM 上创建有效的核心文件时遇到问题,其中导致分段错误的崩溃发生在共享库代码上。
似乎当调用共享库中的函数时,帧指针会丢失。
我已经检查了我能想到的所有 gcc 标志。我没有使用任何优化,没有使用 -fomit-frame-pointer 并且我尝试使用 -rdynamic,但都没有成功。另外,我没有使用 abort(),因为我读到它在 ARM 上有点问题,因为函数不返回而没有保存帧信息。相反,我使用 memset(NULL, 0, 1) 来获取分段错误。
我使用的是 arm-cortex_a8-linux-gnuabi 工具链,该工具链是我使用 crosstool-NG 的默认 cortex-a8 配置自行编译的。 (海湾合作委员会 4.4.3、GSB 6.8)。在主机(Ubuntu)上,一切正常。
GDB 的输出如下(通过 set solib-search-path 加载所有共享库后)。为了便于阅读,我省略了不相关的输出。
(gdb) thread apply all bt full
Thread 1 (process 535):
#0 0x402ff624 in memset () from <my libc path>
No Symbol table info available.
#1 0x4011f60c in my_asserting_func () at src1.cc:5
No locals.
Backtrace stopped: frame did not save the PC
src1.cc:main.cc
#include <src1.h>
#include <string.h>
void my_asserting_func(void)
{
memset(NULL, 0, 1);
}
:
#include <src1.h>
int main(void)
{
my_asserting_func();
return 0;
}
任何帮助都会非常感激,
安德鲁。
PS:使用objjump,这是my_asserting_func函数的反汇编:
00000654 <_Z17my_asserting_funcv>:
654: e1a0c00d mov ip, sp
658: e92dd800 push {fp, ip, lr, pc}
65c: e24cb004 sub fp, ip, #4
660: e3a00000 mov r0, #0
664: e3a01000 mov r1, #0
668: e3a02001 mov r2, #1
66c: ebffffb1 bl 538 <_init+0x38>
670: e89da800 ldm sp, {fp, sp, pc}
I'm currently working on a debugging environment, and I'm have trouble creating valid core files on ARM where the crash that caused a segmentation fault occurred on shared library code.
It seems that when there's a call to a function in a shared library, the frame pointer gets lost.
I've checked all the gcc flags I could think of. I'm not using any optimizations, not using -fomit-frame-pointer and I've tried using -rdynamic, all without success. Also, I'm not using abort(), since I read it is somewhat problematic on ARM since the frame information isn't saved since the function does not return. Instead, I'm using memset(NULL, 0, 1) to get the segmentation fault.
I'm using an arm-cortex_a8-linux-gnuabi toolchain that I compiled myself using crosstool-NG's default cortex-a8 configuration. (gcc 4.4.3, gsb 6.8). On the host machine (Ubuntu), everything works fine.
The output of GDB is like so (after loading all the shared libraries via set solib-search-path.) I omitted unrelevant output for readability.
(gdb) thread apply all bt full
Thread 1 (process 535):
#0 0x402ff624 in memset () from <my libc path>
No Symbol table info available.
#1 0x4011f60c in my_asserting_func () at src1.cc:5
No locals.
Backtrace stopped: frame did not save the PC
src1.cc:
#include <src1.h>
#include <string.h>
void my_asserting_func(void)
{
memset(NULL, 0, 1);
}
main.cc:
#include <src1.h>
int main(void)
{
my_asserting_func();
return 0;
}
Any help would be much appriciated,
Andrew.
PS: using objump, here's the disassembly of the my_asserting_func function:
00000654 <_Z17my_asserting_funcv>:
654: e1a0c00d mov ip, sp
658: e92dd800 push {fp, ip, lr, pc}
65c: e24cb004 sub fp, ip, #4
660: e3a00000 mov r0, #0
664: e3a01000 mov r1, #0
668: e3a02001 mov r2, #1
66c: ebffffb1 bl 538 <_init+0x38>
670: e89da800 ldm sp, {fp, sp, pc}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论