yj423@ubuntu:~/nfswork$ ls
bin dev gdbserver home linuxrc proc ***in tmp var
boot etc hello lib mnt root sys usr welcome
可以看到gdbserver和hello。
接着,在开发板上使用NFS:
[root@yj423 /]#mount -o nolock 192.168.1.103:/home/yj423/nfswork /mnt/nfs
[root@yj423 /]#cd /mnt/nfs
[root@yj423 nfs]#ls
bin dev gdbserver home linuxrc proc ***in tmp var
boot etc hello lib mnt root sys usr welcome
然后执行gdbserver:
[root@yj423 nfs]#./gdbserver localhost:2001 hello
Process hello created; pid = 948
Listening on port 2001
2001为端口号,hello表示要调试的程序。此时gdbserver等待PC机进行链接。
在PC机上执行gdb:
yj423@ubuntu:~$ ./armgdb -q /home/yj423/nfswork/hello
Reading symbols from /home/yj423/nfswork/hello...done.
执行远程链接:
(gdb) target remote 192.168.1.6:2001
Remote debugging using 192.168.1.6:2001
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x400007b0 in ?? ()
(gdb)
这里的192.168.1.6为开发板的IP地址。
至此PC端的gdb和开发板的gdbserver已经建立连接,接下来可以调试。
(gdb) b main
Cannot access memory at address 0x0
Breakpoint 1 at 0x83e0: file hello.c, line 5.
(gdb) c
Continuing.
warning: `/lib/libc.so.6': Shared library architecture unknown is not compatible with target architecture arm.
warning: Could not load shared library symbols for /lib/ld-linux.so.3.
Do you need "set solib-search-path" or "set sysroot"?
Breakpoint 1, main () at hello.c:5
5 printf("hello worldn");
(gdb) n
6 printf("hello worldn");
(gdb) n
7 }
这里只是简单的调试。后面还会有共享库调试和多进程调试,尽请期待!
未完待续~~~~~~~~~