在arm板上運行 gdbserver
[root@51Board usb]# ./gdbserver 192.168.0.29:1234 arm0702_8.out
Process arm0702_8.out created; pid = 228
從服務器中等待一個請求
這個是對qte程序的調試,先運行程序再調試進程號。在PC機上程序名稱一樣的。
// ./gdbserver 192.168.0.29:1234 --attach 545
說明:
這裡的192.168.0.29是上位PC機的IP(這個應該於ARM板上的IP在一個網段內)
1234這裡規定的端口號,等下要用到的,當然這個也可以用其他的端口號
Arm0702_8.out
上位PC機運行 arm-linux-gdb 調試程序
[root@zieckey collieryMainSrc02]# arm-linux-gdb arm0702_8.out
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux"...
(gdb)
上位PC機連接到ARM板
[root@zieckey collieryMainSrc02]# arm-linux-gdb arm0702_8.out
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux"...
(gdb) target remote 192.168.0.50:1234
Remote debugging using 192.168.0.50:1234
0x40001550 in ?? ()
這時ARM板上的信息應該是這樣的:
[root@51Board usb]# ./gdbserver 192.168.0.29:1234 arm0702_8.out
Process arm0702_8.out created; pid = 228
Remote debugging from host 192.168.0.29
現在就已經建立其了PC機通ARM板山的連接了。
那麼我們就可以像調試本地程序一樣調試ARM板上程序。
例如:
(gdb) list
19 //#include "cmaininterfacewidget.h"
20 //#include "headers.h"
21
22 #include "cwidgetmanager.h"
23 #define _DEBUG_
24 #define _DEBUGCDatabase_
25
26 int main( int argc, char ** argv )
27 {
28 QApplication app( argc, argv );
(gdb) break 28
Breakpoint 1 at 0xf25c: file main.cpp, line 28.
(gdb) target remote 192.168.0.50:1234
Remote debugging using 192.168.0.50:1234
0x4011dc30 in ?? ()
Error while mapping shared library sections:
/usr/qpe/lib/libts-0.0.so.0: 沒有那個文件或目錄.
Error while mapping shared library sections:
/usr/qpe/lib/libqwt.so.4: 沒有那個文件或目錄.
Error while mapping shared library sections:
/usr/qpe/lib/libsqlite3.so.0: 沒有那個文件或目錄.
Error while mapping shared library sections:
/usr/qpe/lib/libsqlitedataset.so.0: 沒有那個文件或目錄.
Error while mapping shared library sections:
/usr/qpe/lib/libqte.so.2: 沒有那個文件或目錄.
Error while mapping shared library sections:
/lib/libstdc++.so.5: 沒有那個文件或目錄.
Error while mapping shared library sections:
/usr/qpe/lib/variance.so: 沒有那個文件或目錄.
Error while mapping shared library sections:
/usr/qpe/lib/dejitter.so: 沒有那個文件或目錄.
Error while mapping shared library sections:
/usr/qpe/lib/linear.so: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/libts-0.0.so.0: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/libqwt.so.4: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/libsqlite3.so.0: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/libsqlitedataset.so.0: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/libqte.so.2: 沒有那個文件或目錄.
Error while reading shared library symbols:
/lib/libstdc++.so.5: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/variance.so: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/dejitter.so: 沒有那個文件或目錄.
Error while reading shared library symbols:
/usr/qpe/lib/linear.so: 沒有那個文件或目錄.
(gdb) quit
上面的那些錯誤是因為在ARM上指定路徑有的庫文件在PC上沒有而引起的。