国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

使用gdbserver+arm-linux-gdb 調(diào)試應(yīng)用程序

2019-11-11 03:15:51
字體:
供稿:網(wǎng)友

1.下載gdb的源碼 2.編譯:

cd gdb-7.10.1./configure --target=arm-linux --PRefix=$PWD/installed -v

解釋一下: –target配置gdb的目標(biāo)平臺; –prefix配置安裝路徑,我在gdb-7.10.1的目錄下創(chuàng)建了installed這個目錄,用來存放編譯后生成的文件。 下面就是開始編譯了。

編譯 make

安裝 make install

至此,gdb安裝完成。

接下來為linux-arm安裝gdbserver

進入gdb-7.10.1/gdb/gdbserver

配置

./configure --target=arm-linux --host=arm-linux

make CC=arm-linux-gcc

沒有錯誤的話就在當(dāng)前路徑下生成gdbserver. 下面是做一下權(quán)限的修改和去掉無關(guān)的調(diào)試信息,這些東西用不到,去掉后還能減少文件大小。

chmod 777 gdbserver arm-linux-strip gdbserver

此時需要注意的是 1.gdbserver這個文件需要通過nfs弄到板子上去,且在板子上運行; 2.與gdbserver配套的需要使用剛才編譯gdb時生成的arm-linux-gdb,它在pc上運行

開始調(diào)試: 在板子的終端中運行 gdbserver –multi 10.0.14.38:1234 這里沒有指定待調(diào)試的應(yīng)用程序文件名,這個文件名一會將會在pc端使用命令指定,然后pc端的arm-linux-gdb通過網(wǎng)絡(luò)把這寫信息發(fā)給gdbserver。 10.0.14.38這個地址是我的pc端的IP

在PC端運行

[zhang@zwfedora23 tmp]$ ./arm-linux-gdb GNU gdb (GDB) 7.10.1Copyright (C) 2015 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. Type "show copying"and "show warranty" for details.This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-linux".Type "show configuration" for configuration details.For bug reporting instructions, please see:<http://www.gnu.org/software/gdb/bugs/>.Find the GDB manual and other documentation resources online at:<http://www.gnu.org/software/gdb/documentation/>.For help, type "help".Type "apropos Word" to search for commands related to "word".(gdb) target extended-remote 10.0.14.221:1234Remote debugging using 10.0.14.221:1234(gdb) set remote exec-file /mnt/nfs/sample_audio(gdb) file ~/work/60G/my_tools/hi3518-mpp/bak/ mpp/ mpp-2017-02-06-static-ok.tar.bz2 convertfile.sh mpp-2017-01-24-dynamic-ok.tar.bz2 mpp.tgz (gdb) file ~/work/60G/my_tools/hi3518-mpp/bak/ mpp/ mpp-2017-02-06-static-ok.tar.bz2 convertfile.sh mpp-2017-01-24-dynamic-ok.tar.bz2 mpp.tgz (gdb) file ~/work/60G/my_tools/hi3518-mpp/mpp/Makefile.param component/ cscope.out extdrv/ include/ ko/ lib/ sample/ tags tools/ types_c.taghl(gdb) file ~/work/60G/my_tools/hi3518-mpp/mpp/sample/audio/sample_audioReading symbols from ~/work/60G/my_tools/hi3518-mpp/mpp/sample/audio/sample_audio...done.(gdb) b mainBreakpoint 1 at 0xa61c: file sample_audio.c, line 457.(gdb) rStarting program: /home/zhang/work/60G/my_tools/hi3518-mpp/mpp/sample/audio/sample_audio Reading /lib/ld-linux.so.3 from remote target...warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.Reading /lib/ld-linux.so.3 from remote target...Reading /lib/libpthread.so.0 from remote target...Reading /lib/libm.so.6 from remote target...Reading /system/lib/libasound.so.2 from remote target...Reading /usr/lib/librb.so from remote target...Reading /lib/libc.so.6 from remote target...Reading /lib/libdl.so.2 from remote target...Reading /system/lib/librt.so.1 from remote target...Reading /system/lib/libgcc_s.so.1 from remote target...Breakpoint 1, main (argc=1, argv=0xbefffe54) at sample_audio.c:457457 HI_S32 s32Ret= HI_SUCCESS;(gdb) cContinuing.

說明: 1.target extended_remote 10.0.14.221:1234 這里的ip是板子的ip。

2.(gdb) set remote exec-file /mnt/nfs/sample_audio 指定在板子上需要運行的應(yīng)用程序路徑。

3.file ~/work/60G/my_tools/hi3518-mpp/mpp/sample/audio/sample_audio 指定在PC上需要調(diào)試的應(yīng)用程序的路徑。

接下來就行了。 設(shè)置斷點就可以開始調(diào)試了。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 仁布县| 昌黎县| 鹰潭市| 马尔康县| 濮阳市| 赣州市| 弋阳县| 勐海县| 城市| 中牟县| 赣榆县| 大城县| 北海市| 兴隆县| 工布江达县| 长海县| 湖州市| 兖州市| 武威市| 集安市| 乌拉特后旗| 高邑县| 阿巴嘎旗| 黄石市| 淳安县| 十堰市| 苗栗市| 水城县| 云梦县| 江达县| 渝中区| 新郑市| 林西县| 东方市| 田林县| 双城市| 陇川县| 新乐市| 色达县| 阳西县| 盖州市|