日期:2014-05-16  浏览次数:20586 次

嵌入式gdb的使用
1,pc端使用gdb,嵌入式板子使用gdbserver,因为板子程序用到SIGALARM,每秒gdbserver都会被中断,请问gdbserver如何屏蔽这个中断以至于不影响正常调试?
2,如何在pc端对嵌入式程序设置断点?pc端gdb需要载入嵌入式端源程序?还是可执行程序?

3,另外还有个小小的疑惑,嵌入式arm端使用的gdbserver在编译的时候并未涉及平台选项(arm9,arm11,arm cortex A8等),gdbserver(或者gdb)是如何获取其寄存器的?不同的平台其寄存器应该不同啊。。。

------解决方案--------------------
第一个问题貌似可以在gdb 命令行上:
handle SIGALARM nostop noprint
试试.
------解决方案--------------------
2 包含调试信息的可执行文件,不然貌似只能看到反汇编的信息(至于能不能调,我也没试过)
------解决方案--------------------
gdb不太懂,多线程也没怎么用过.
推荐引用:
第一个问题貌似可以在gdb 命令行上:
handle SIGALARM nostop noprint
试试.


引用:
While debuging a remote multithread program by means of gdb/gdbserver, frequently I see gdb complaints like this:

Program received signal SIG32, Real-time event 32.
0x400d7e84 in ?? ()
(gdb)

Then gdb is suspended to wait for new commands, and on this occasion, typing 'c' can make the debuging continue. But instruction 'info threads' can not list correct information.

In fact, this results from stripped libpthread/libthread_db, which can be easily verified by means of '/usr/bin/file'. To remove the problem, simply refer the libs to unstripped versions via gdb instructions like:

set solib-absolute-prefix [dir]

set solib-search-path [dir1];[dir2]

如上面所示,我的程序也是多线程,启动调试的时候出现了上诉问题;网上有人说直接
handle SIG32 nostop noprint pass   可以解决,但是想知道为什么会出现这个SIG32,上面E文描述说是strriped库的问题,不是很明白,有了解的吗