2016-10-31 78 views
1

我有一個原本應該在Android設備上運行的C++應用程序。應用程序在啓動時崩潰,很可能在從鏈接庫調用函數時崩潰。我正在嘗試使用gdb進行調試,但我無法成功。在Android上使用GDB調試本機應用程序

我開始在Android設備上gdbserver的一些隨機選取的端口(2000)上:

[email protected]: gdbserver :2000 my_app 
Process my_app created; pid = 3420 
Listening on port 2000 

現在我要附加到這個過程,得到了GDB我的主機系統(Windows 7)在Android-NDK中。

C:\> gdb 
(gdb) attach 3420 
Can't attach to process. 
(gdb) target remote :2000 
:2000: The system tried to join a drive to a directory on a joined drive. 

什麼問題?

編輯: 此前運行GDB我使用亞行轉發的端口2000:

adb forward tcp:2000 tcp:2000 

這至少幫助我建立一些溝通,但:

(gdb) target remote :2000 
Remote debugging using :2000 
warning: Architecture rejected target-supplied description 
Remote 'g' packet reply is too long: 00000000000000000000000000000... 

在設備方:

Listening on port 2000 
Remote debugging from host 127.0.0.1 
readchar: Got EOF 
Remote side has terminated connection. GDBserver will reopen the connection. 
Listening on port 2000 

回答

0

你很可能使用不同的架構/版本的gdb。當您啓動GDB,它會顯示一條線一樣(我顯示我什麼GDB顯示):

這GDB被配置爲「主機= x86_64的Linux的GNU的 --target =手臂Linux的-roid「

檢查這是否與您的手機的體系結構相匹配。
下載正確的GDB版本可能會解決您的問題。