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

使用gdb调试出错
This GDB was configured as "mips-linux"...
(no debugging symbols found)
(gdb) b tspecd_api_cmd
Function "tspecd_api_cmd" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (tspecd_api_cmd) pending.
(gdb) run
Starting program: /usr/bin/tspec 
exec /usr/bin/tspec : cannot open

Program exited with code 0377.
(no debugging symbols found)
No registers.

tspecd_api_cmd()是tspec模块的函数,我想要调试tspecd_api_cmd()函数,但是报错,不知道是什么原因。请各位大侠帮忙看看。

------解决方案--------------------
首先编译时加-g选项没(将.c文件编译成.o文件时)
$ gdb
(gdb) file ./execute_file
(gdb) set args  // (如果需要参数)
(gdb) b xxx
------解决方案--------------------
gdb要加载你编译出来的二进制物件才行啊,而且得是debug的版本才行哦。
------解决方案--------------------
g++ -g   源文件名.c  -o 目标文件名
gdb  目标文件名
break main    //设置断点
list    //查看源代码