GDB遠端除錯技術---基於mini2440
GDB偵錯程式提供了兩種不同的除錯代理用於支援遠端除錯,即gdbserver方式和stub(插樁)方式。
這兩種遠端除錯方式是有區別的。gdbserver本身的體積很小,能夠在具有很少儲存容量的目標系統上獨立執行,因而非常適合於嵌入式環境;而stub方式則需要通過連結器把除錯代理和要除錯的程式連結成一個可執行的應用程式檔案,如果程式執行在沒有作業系統的機器上,那麼stub需要提供異常和中斷處理序,以及串列埠驅動程式,如果程式執行在有作業系統的嵌入式平臺上,那麼stub需要修改串列埠驅動程式和作業系統異常處理。顯然,對於在有嵌入式作業系統支援下的開發而言,gdbserver比stub程式更容易使用。這裡使用的是GDB+gdbserver的方式,建立遠端除錯的環境。
gdbserver是一個可以獨立執行的控制程式,它可以執行在類UNIX作業系統上,當然,也可以執行在Linux的諸多變種。gdbserver允許遠端GDB偵錯程式通過target remote命令與執行在目標板上的程式建立連線。
GDB和gdbserver之間可以通過串列埠線或TCP/IP網路連線通訊,採用的通訊協議是標準的GDB遠端序列協議( Remote Serial Protocol RSP)。
使用gdbserver除錯方式時,在目標機端需要一份要除錯的程式的拷貝,這通常是通過ftp或NFS下載到目標機上的,宿主機端也需要這信一份拷貝。由於gdbserver不處理程式符號表,所以如果有必要,可以用strip工具將要複製到目標機上的程式中的符號表去掉以節省空間。符號表是由執行在主機端的GDB偵錯程式處理的,不能將主機端的程式中的符號表去掉。
雖然大部分的Linux發行版都已經安裝了GDB,但是那都是基於PC的平臺的,我們要使用的是在ARM平臺上,所以要重新下載gdb的原始碼,並修改以適應自己的目標平臺。可以從http://www.gnu.org/software/gdb/download,獲得。這裡使用的是GDB的最新的版本7.1。首先將下載到的gdb-7.1.tar.bz2複製到/home/zfz/gdb目錄下。在控制檯下輸入下面的解包命令
|
在gdb-7.1目錄下,輸入下面的命令,配置GDB原始碼:
|
linux-用來指定在編譯生成的二進位制可執行檔名之前加上字首,這裡加上的字首是arm-linux-。這樣就可以和宿主機上的除錯檔案相區別。
|
|
編譯完arm-linux-gdb之後,接下來就需要編譯在目標板上執行的gdbserver了,在gdb/gdb7.1/gdb下有一個gdbserver的子目錄,這個目錄包括了編譯gdbserver所需要的所有的東西。
首先,進行gdbserver目錄
|
|
|
|
所有的工作都已經完成了,只要把生成的gdbserver下載到目標板上,或者是通過NFS掛載到目標板上就可能進行遠端的除錯了,如果就是足夠幸運的話,編譯中沒有出現什麼錯誤的話,這樣完全可以了,不過在我的系統上卻不是那麼幸運。我一直使用的是友善之臂的arm-linux-gcc-4.3.2交叉編譯器,這個版本的編譯器中,已經自帶了arm-linux-gdb.
在終端中輸入arm-linux-gdb -v 可以看到下面的資訊
|
GNU gdb (Sourcery G++ Lite 2008q3-72) 6.8.50.20080821-cvs
|
先在目標機上執行下面的gdbserver,注意這裡的IP地址是宿主機上的IP地址。
|
|
|
|
這樣再一次檢視arm-linux-gdb的資訊。
|
|
|
|
|
GDB偵錯程式提供了兩種不同的除錯代理用於支援遠端除錯,即gdbserver方式和stub(插樁)方式。
這兩種遠端除錯方式是有區別的。gdbserver本身的體積很小,能夠在具有很少儲存容量的目標系統上獨立執行,因而非常適合於嵌入式環境;而stub方式則需要通過
# GDB遠端除錯程式
**該檔案是用於遠端除錯gdb,資料夾中的gdbserver和arm-linux-gdb的版本已經保持一致均為6.4**
1. target:`./gdbserver6.4 192.168.100.101:8888 ./test_scale` 2. hos
最近在除錯程式碼的時候鬧人的segmentation-fault段錯誤,又來煩人了,不過程式碼都是自己寫的 ,有事也是作繭自縛,自作自受,先自責下。
來看看在串列埠段錯誤給了我們什麼資訊:
可以看出 Fault addr=0x328,出錯的地址在 0x328,這個哪 啊
使用gdb遠端除錯android native程式1.準備工作:android native程式:demoandroid 上執行的除錯工具:gdbserver,該程式位於ndk目錄/prebuilt/a
# GDB遠端除錯程式
**該檔案是用於遠端除錯gdb,資料夾中的gdbserver和arm-linux-gdb的版本已經保持一致均為6.4**
1. target:`./gdbserver6.4 192.168.100.101:8888 ./test_scale`
2
GDB遠端除錯錯誤解決使用GDB 7.2版本進行遠端除錯時出現:Remote ‘g’ packet reply is too long錯誤,需要修改gdb程式碼解決,辦法是:修改gdb/remote.c檔案,遮蔽process_g_packet函式中的下列兩行:if (bu 盜版行為日益猖獗,嚴重影響到軟體開發者和開發商的智慧財產權及利益,反盜版技術的重要性也越來越引起人們的重視。在反盜版技術中,起最大作用的當屬反除錯技術。然而傳統的反除錯技術都存在一個弱點:他們都在程式真正開始執行之後才採取反除錯手段。實際上在反除錯程式碼被執行前,偵錯程式有大量的時間來影響程式的執行,甚至可以
簡介
本篇部落格介紹一下在Intellij IDEA下對Springboot型別的專案的遠端除錯功能。所謂的遠端除錯就是服務端程式執行在一臺遠端伺服器上,我們可以在本地服務端的程式碼(前提是本地的程式碼必須和遠端伺
網上有很多 基於mini2440的MP3播放器設計的資料,多是按鍵控制,這裡博主做了些輕微改動,利用遠端WEB來控制MP3播放,具體怎麼實現,下面會給出,大家先看看效果:
WEB介面:
後臺執行:
因為不是什麼課程設計報告,博主就不闡述的那麼詳細,這個設計主要有三部分組
總結一下linux下交叉編譯gdb並遠端除錯程式的知識
1.配置交叉編譯工具鏈到系統環境變數PATH下
export PATH=$PATH:'交叉編譯工具鏈的絕對路徑‘
2.編譯主機端執行的gdb,但是處理的程式碼是arm平臺
./configure --target=
專案中用了ARM的板,希望配置gdbserver進行遠端除錯,結果卻遇到了很多問題。先把坑說了:1)要支援遠端除錯,arm板需要支援ssh2)要gdb能在Qt上用,必須在configure gdb的時候使用--with-python選項啟用python支援3)需要安裝pyth
Nomad原始碼閱讀的遠端除錯環境搭建
簡要記錄遠端除錯環境搭建,方便除錯,閱讀Nomad原始碼。
環境
Remote
VMWare 14
- 虛擬機器 Ubuntu 18.04
虛擬機器名local-dev2,IP地址192.168.2
由於嵌入式系統資源有限性,一般不能直接在ARM上進行除錯,通常採用arm-linux-gdb+gdbserver的方式進行遠端除錯。Target端(ARM)使用 Gdbserver,host端(PC主機)使用arm-linux-gdb,雙方最好統一編譯工具鏈。在應用
使用netbeans進行PHP團隊開發和基於xdebug進行多人遠端除錯
[2012/03/27 10:02]
不少的非單純PHP架構的網站系統中,PHP開發的Web系統,往往對特定的伺服器環境有依賴,例如使用php開發某些面向開放平臺的系統,或者帶有支付介面功能的系
開發人員在進行程式編碼的過程中,不可避免的需要對程式碼進行除錯,其目的是能精確定位程式的執行狀況。本文對spark原始碼進行除錯,此除錯方式可以除錯任何JVM相關的程式,如:普通的命令列程式、web程式等。
1、實驗環境
IP
hostname
maste
操作環境
PC: OS Debian9.4.0, Qt 5.11.0, IP: 192.168.1.10
BeagleBone Black: Debian 9.3.0, IP:
轉自http://blog.163.com/[email protected]/blog/static/8725911920137685232272/
一開始是根據此教程編譯http://www.qtcn.org/bbs/read-htm-tid-58074-ds
基礎技術:
遠端除錯tomcat步驟:
1==遠端登入至伺服器,開啟tomcat的bin/catalina檔案;
2==在JAVA_OPTS變數後增加:-Xdebug -Xrunjdwp
gdb偵錯程式是一款GNU開發組織併發布的UNIX/Linux下的程式除錯工具,具有強大的功能,足有與Visual Stido媲美,當然友好的介面是沒法相比的,呵呵。
開始編譯程式將除錯資訊包含進去,gdb偵錯程式執行在shell中輸入gdb就好,也可以輸
把 c 編譯成 arm 指令的可執行檔案
/usr/bin/arm-linux-gnueabi-g++ hello.cpp
cat hello.cpp
#include <stdio.h>
void crash(){
char *a=0;
|