PC机通过dgb来发送命令给gdbserver
ARM板需要gdbserver,给他的子进程发送命令如停止信号
gdb读变量a
app文件带有调试信息
elipes可以当做GUI前台,dgb运行于pc dgbserver运行于arm板
target表示我们编译出来用于什么
./configure–target=arm-linux --disable-werror
make
book@www.100ask.org:/work/tools/gdb-6.7$ mkdir tmp
book@www.100ask.org:/work/tools/gdb-6.7$ make install prefix=$PWD/tmp
book@www.100ask.org:/work/tools/gdb-6.7/tmp/bin$ sudo cp arm-linux-gdb /bin/
book@www.100ask.org:/work/tools/gdb-6.7/tmp/bin$ sudo chmod +x /bin/arm-linux-gdb
编译gdbserver
host表示我们编译出来在哪里执行
book@www.100ask.org:/work/tools/gdb-6.7/gdb/gdbserver$ ./configure --host=arm-linux
make
在交叉编译器下搜索这个宏发现室友的不过是在linux目录下
vi linux-arm-low.c,加入这一行
把gdbserver拷贝到文件系统的bin目录下
cp gdbserver /work/nfs_root
编写一个调试程序:
调试:
gdbserver 加上板子的ip地址:端口号随便给 运行测试的程序
main函数打断点
开发板输入ulimit -c
如果没有错误的话输出结果是0
我们设为不限制:
ulimit -c unlimited
生成core文件,把core文件 考回虚拟机,
在pc上执行下面红色的命令
gdb输入bt命令可以看到程序在C函数出错
si 源码一行一行的执行
main的21行打断电
c继续运行,l列出源代码