国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

gdb本地調試版本移植至ARM-Linux系統

發布時間:2023-12-12 15:21    發布者:武漢萬象奧科
關鍵詞: 全志 , T3 , A40i-H , Linux , gbd移植
移植ncurses庫
本文使用的ncurses版本為ncurses-5.9.tar.gz
下載地址:https://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz

1.       將ncurses壓縮包拷貝至Linux主機或使用wget命令下載并解壓

tar-zxvf ncurses-5.9.tar.gz

2.       解壓后進入到ncurses-5.9目錄下

cdncurses-5.9

3.       在ncurses-5.9目錄下創建編譯完成后生成文件位置
mkdiroutput
cdoutput
mkdirarm-linux

4.       生成Makefile文件
./configure--target=arm-none-linux-gnueabi --prefix=$PWD/output/arm-linux  --enable-termcap --with-shared --without-ada
l  --target表示編譯器的前綴,需要根據編譯的不同需求進行修改
l  --prefix表示編譯完成后生成文件的位置
l  --nable-termcap表示 關鍵代碼使用 termcap(terminalcapabilities)數據庫 [自動檢測]
l  --with-shared表示動態編譯

5.       編譯
make
當遇到如下報錯時
Makefile:794:recipe for target '../obj_s/lib_gen.o' failed
make[1]:*** [../obj_s/lib_gen.o] Error 1
make[1]eaving directory '.../ncurses-5.9/ncurses'
Makefile:109:recipe for target 'all' failed
make:*** [all] Error 2

需要進入ncurses-5.9/include文件夾,修改 curses.tail 文件下的如下內容,將注釋 /* generated */ 去掉
externNCURSES_EXPORT(bool)    mouse_trafo(int*, int*, bool);         /* generated*/

6.       安裝
Makeinstall

7.       安裝完成后會在/output/arm-linux目錄下生成庫文件,我們只需將lib目錄下的libncurses.so.5 庫拷貝至開發板


移植gdb
本文使用的gdb版本為gdb-7.12.tar.gz
下載地址:https://ftp.gnu.org/gnu/gdb/gdb-7.12.tar.gz

1.       將gdb壓縮包拷貝至Linux主機或使用wget命令下載并解壓

tar-zxvf gdb-7.12.tar.gz

2.       解壓后進入到ncurses-5.9目錄下

cdgdb-7.12

3.       生成Makefile文件
./configure -host=arm-none-linux-gnueabi CC=/home/vanxoak/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-gcc  --enable-shared--prefix=$PWD/output/arm-linux --disable-werror --without-x --disable-gdbtk--disable-tui --without-included-regex --without-included-gettextLDFLAGS="-L$PWD/../output/arm-linux/lib"CPPFLASS="-I$PWD/../output/arm-linux/include"

l  --host=arm-none-linux-gnueabi 用arm-none-linux-gnueabi編譯
l  CC為交叉編譯器絕對路徑
l  --enable-shared 動態編譯
l  prefix=“$PWD/output/arm-linux” 安裝目錄
l  --disable-werror 屏蔽werror報警
l  --without-x 取消x windows 支持
l  --disable-gdbtk 取消gdbtk
l  --disable-tui 取消tui 界面
l  --without-included-gettext 去掉用于多語言處理的gettext庫
l  "LDFLAGS=XXX"指交叉編譯完成的ncurse的lib目錄路徑
l  "CPPFLAGS=XXX"指是交叉編譯完成的ncurse的include目錄路徑

4.       編譯
make

5.       安裝
makeinstall

安裝完成后會在.../gdb-7.12/output/arm-linux/bin/目錄下生成gdb可執行程序。

移植至HDT3-EVM 開發板
1.       將libncurses.so.5庫 文件拷貝至/usr/lib目錄下,若/usr目錄下無lib目錄可手動創建mkdir lib
2.       將gdb程序拷貝至/bin目錄下

測試調試
1.  編寫可執行測試程序,示例hello.c代碼如下,該代碼執行后會打印Hello World。
#include
intmain(int argc, char *argv[])
{
    printf("Hello World\n");
    return 0;
}
2.  使用交叉編譯器進行編譯,需要注意的是,要使用gdb調試程序,需要在使用交叉編譯器編譯源代碼時加上 " -g " 參數保留調試信息,否則不能使用GDB進行調試且報如下最后一行所示錯誤:
/home# gdb hello
GNUgdb (GDB) 7.12
Copyright(C) 2016 Free Software Foundation, Inc.
LicenseGPLv3+: GNU GPL version 3 or later
Thisis free software: you are free to change and redistribute it.
Thereis NO WARRANTY, to the extent permitted by law. Type "show copying"
and"show warranty" for details.
ThisGDB was configured as "arm-none-linux-gnueabi".
Type"show configuration" for configuration details.
Forbug reporting instructions, please see:
.
Findthe GDB manual and other documentation resources online at:
.
Forhelp, type "help".
Type"apropos word" to search for commands related to "word"...
Readingsymbols from hello...(no debugging symbols found)...done.

3.       使用交叉編譯器編譯測試程序
arm-none-linux-gnueabi-gcc-g  -o hello hello.c

4.       將生成的hello文件拷貝至HDT3-EVM 開發板上并使用sync命令保存

5.       輸入gbd命令啟動gdb程序
/home# gdb
GNUgdb (GDB) 7.12
Copyright(C) 2016 Free Software Foundation, Inc.
LicenseGPLv3+: GNU GPL version 3 or later
Thisis free software: you are free to change and redistribute it.
Thereis NO WARRANTY, to the extent permitted by law. Type "show copying"
and"show warranty" for details.
ThisGDB was configured as "arm-none-linux-gnueabi".
Type"show configuration" for configuration details.
Forbug reporting instructions, please see:
.
Findthe GDB manual and other documentation resources online at:
.
Forhelp, type "help".
Type"apropos word" to search for commands related to "word".
(gdb)

上述代碼(gdb)為GBD內部命令引導符,表示等待用戶輸入gbd命令

6.       使用 " file hello " 命令載入被調試的測試程序
(gdb)file hello
Readingsymbols from hello...done.

顯示Reading symbols from hello...done.表示被測程序加載成功

7.       使用 " r "命令執行調試測試程序
(gdb)r
Startingprogram: /home/hello
HelloWorld
[Inferior1 (process 849) exited normally]
如上述代碼顯示 " Hello World " 即表示hello程序執行完成


(gdb)help
Listof classes of commands:

aliases-- Aliases of other commands
breakpoints-- Making program stop at certain points
data-- Examining data
files-- Specifying and examining files
internals-- Maintenance commands
obscure-- Obscure features
running-- Running the program
stack-- Examining the stack
status-- Status inquiries
support-- Support facilities
tracepoints-- Tracing of program execution without stopping the program
user-defined-- User-defined commands

Type"help" followed by a class name for a list of commands in that class.
Type"help all" for the list of all commands.
Type"help" followed by command name for full documentation.
Type"apropos word" to search for commands related to "word".
Commandname abbreviations are allowed if unambiguous.


本文地址:http://www.qingdxww.cn/thread-848268-1-1.html     【打印本頁】

本站部分文章為轉載或網友發布,目的在于傳遞和分享信息,并不代表本網贊同其觀點和對其真實性負責;文章版權歸原作者及原出處所有,如涉及作品內容、版權和其它問題,我們將根據著作權人的要求,第一時間更正或刪除。
您需要登錄后才可以發表評論 登錄 | 立即注冊

廠商推薦

  • Microchip視頻專區
  • Dev Tool Bits——使用MPLAB® Discover瀏覽資源
  • Dev Tool Bits——使用條件軟件斷點宏來節省時間和空間
  • Dev Tool Bits——使用DVRT協議查看項目中的數據
  • Dev Tool Bits——使用MPLAB® Data Visualizer進行功率監視
  • 貿澤電子(Mouser)專區

相關視頻

關于我們  -  服務條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯系我們
電子工程網 © 版權所有   京ICP備16069177號 | 京公網安備11010502021702
快速回復 返回頂部 返回列表
主站蜘蛛池模板: 国产日韩欧美一区 | 色婷婷激婷婷深爱五月小蛇 | 六月婷婷在线视频 | 精品影视网站入口 | 欧美成人三级网站在线观看 | 日日夜夜精品 | 国产精品激情综合久久 | 一二三区视频 | 妈妈的朋友韩国在线 | avtom影院永久转四虎入口 | 国产一级持黄大片99久久 | 99re这里有免费视频精品 | 亚洲女同在线 | 欧美 日韩 国产 色 欧美 日韩 成人 | 91麻豆精品国产自产在线 | 四虎影院免费观看视频 | 男女性高爱潮免费网站 | 美女黄频视频免费国产大全 | www.四虎影院.con | 亚洲国产精品自在现线让你爽 | 特级毛片aaaa级毛片免费 | 国产高清视频在线观看69 | 王茜麻豆 | 欧美成人中文字幕在线视频 | 欧美成人精品第一区二区三区 | 国产成在线人视频免费视频 | 四虎成人免费影院网址 | 欧美人与性动交α欧美精品 | juc-398中文字幕| 色一情一伦一区二区三 | 国产福利在线免费观看 | 91瑟瑟| 四虎网址在线观看 | 91免费永久国产在线观看 | 午夜向日葵在线视频观看下载 | 草莓视频丝瓜视频下载 | 国产精品入口麻豆高清在线 | 一级日韩一级欧美 | 好属妞这里只有精品久久 | 男女强吻摸下面揉免费 | 欧美日韩激情一区二区三区 |