天天看點

gdb+gdb Server安裝配置zz

1.下載下傳 http://www.gnu.org/software/gdb/download/ 下載下傳最新的gdb-7.2.tar.gz 2.簡介 GDB使用了autoconf/automake,是以編譯時隻需配置configure腳本的--target,--host,--prefix等參數就可實作友善的移植。 --target:指定編譯環境,一般設定為交叉編譯器字首,ix86-linux,arm-linux等 --prefix;指定安裝路徑。 --host:指定編譯後檔案運作平台,一般設定為交叉編譯器字首,ix86-linux,arm-linux等 --program-prefix:将生成可執行檔案前加字首 3.編譯安裝gdb [email protected]:#cd /opt [email protected]/opt:#tar zxvf gdb-7.2.tar.gz [email protected]/opt:#mkdir gdb [email protected]/opt:#cd gdb-7.2 [email protected]/opt/gdb-7.2:#./configure --target=arm-linux --prefix=/opt/gdb [email protected]/opt/gdb-7.2:#make ****此處可能會的錯誤************ configure:error:no termcap library found ****解決方法******************** [email protected]/opt/gdb-7.2:#apt-get install libncurses5-dev [email protected]/opt/gdb-7.2:#make install 安裝成功會在/opt/gdb/bin下看到以下三個檔案 arm-linux-gdb arm-linux-gdbtui arm-linux-run 4為arm-linux-gdb添加環境變量  在添加環境變量之前先确定自己系統沒有安裝其它版本的arm-linux-gdb,可通過指令 [email protected]/opt/gdb:#arm-linux-gdb --v 如果系統已經安裝arm-linux-gdb,但版本不同則最好将已安裝版本删除掉,否則會導緻後續調試出現問題 ******************************************************************************************* 我在安裝gdb時沒有做這一步的檢查,導緻最後進行調試過程中因為gdb和gdbserver版本不同經常出現如下錯誤:******************  ***arm-linux-gdb********                   ****arm-linux-gdbserver******** #arm-linux-gdb gdbtest            #arm-linux-gdbserver hostIP:portnum gdbtest   ******  一些列印資訊                                        Listening on port portnum 

                                                          (gdb)target remote bordIP:portnum           Remote debugging using bordIP:portnum                 Remote debugging from host hostIP Couldn't establish connection to remote target       readchar:Got EOF Remote failure reply:EO1          Remote side has terminated connection.   (gdb)                                                GDBserver will reopen the connection ****************************************************************************************** 将/opt/gdb/bin加入環境變量/etc/profile中 再次驗證系統arm-linux-gdb版本為所安裝版本及7.2 5.編譯安裝#arm-linux-gdbserver [email protected]/opt:#mkdir gdbserver [email protected]/opt:#cd gdb-7.2/gdb/gdbserver [email protected]/opt/gdb-7.2/gdb/gdbserver:#./configure --target=arm-linux --host=arm-linux --prefix=/opt/gdbserver [email protected]/opt/gdb-7.2/gdb/gdbserver:# make CC=arm-linux-gcc  [email protected]/opt/gdb-7.2/gdb/gdbserver:#make install 安裝成功會在/opt/gdbserver/bin目錄下生成arm-linux-gdbserver檔案 6.拷貝/arm/lib目錄下libthread_db-1.0.so和生成的rm-linux-gdbserver到開發闆 将libthread_db-1.0.so放在開發闆/lib目錄下 #ln -s libthread_db-1.0.so libthread_db.so.1 #ln -s libthread_db.so.1 libthread_db.so 7. eclipse + cdt + gdb 進行arm linux 交叉調試 http://zengzhizhuan.blog.163.com/blog/static/142114911201057114211329/ http://www.ibm.com/developerworks/cn/linux/opensource/os-ecbug/

繼續閱讀