10

I'm trying to debug a software with gdbserver on ARM to get a backtrace of a crash. Unfortunately I get only question marks. Everywhere, I read this problem is simply related to the lack of symbols, but symbols are not stripped from my libraries.

If I try to use the file command to load the symbols in the client I get:

reading symbols from <path>/libQtWebKit.so.4.7.2...(no debugging symbols found)...done.

and then, when the crash occurs:

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x4bf38b88 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

My libraries are compiled in release but the symbols are actually there. With nm I can find those. Why do I only get question marks? Is this only because the libraries are compiled with optimization? Isn't it possible to debug with libraries in release mode?

4

2 回答 2

3

corrupt stack笔记可能是你的问题。它看起来像一个返回地址或虚拟表条目或被零覆盖的东西,然后控制权转移到那里。即使您有可用的符号,这些地址也没有指向有效的符号。因此出现了段错误。

我不羡慕你的任务。这些是一些最难追踪的错误,甚至可以在您更改代码以尝试捕获它们时移动或暂时消失。你最好的选择通常是类似的东西git bisect或你的 VCS 等价物来找到引入它的提交。希望复制起来不会太难。

于 2011-12-08T21:00:29.670 回答
1

当您遇到“地址 0 处的 SEGV”问题时,有时可以使用的一个技巧是手动将返回地址从堆栈顶部弹出到 pc 中,并尝试从那里进行堆栈跟踪。这假设您必须通过 NULL 指针进行间接调用来寻址 0,这是获取地址 0 的最常见方式。

现在我对 ARM 不太熟悉,但在 x86 PC 上,你会这样做:

(gdb) set $eip = *(void **)$esp
(gdb) set $esp = $esp + 4

然后再做一次回溯,找出你真正在哪里。

如果你能弄清楚编译器用于 ARM 的调用约定,你应该可以做类似的事情。

于 2011-12-08T22:37:57.403 回答