交叉編譯android版本的gdb
(1)配置交叉編譯連結
make-standalone-toolchain.sh
然後
make-standalone-toolchain.sh
然後配置PATH,CC,C++
export CC="aarch64-linux-android-gcc -pie -fPIE --sysroot=..."
export CXX="aarch64-linux-android-g++ -pie -fPIE --sysroot=..."
export CXXFLAGS="-lstdc++"
(2)下載原始碼
./configure --host=aarch64-linux-android --target=aarch64-linux-android --prefix=.......out
make
make install
-----------------
問題
(1) 找不到stdio_ext.h這個檔案
需要將android 6.0中的./bionic/libc/include/stdio_ext.h 拷貝到sysroot環境中。
https://android.googlesource.com/platform/bionic/+/android-6.0.1_r73/libc/include/stdio_ext.h
可以從這裡下到
(2)../common/sim-events.h:94:3: error: unknown type name 'SIM_ELAPSED_TIME'
SIM_ELAPSED_TIME resume_wallclock;
需要在sim-events.h中新增 #include "sim-utils.h"
(3) ./memory.h:29:44: error: unknown type name 'sim_cpu'
在sim/aarch64/cpustate.h中增加#include "sim-base.h"
(4)linux-thread-db.c: In function 'thread_from_lwp':
linux-thread-db.c:344:5: error: 'td_thrhandle_t' has no member named 'th_unique'
th.th_unique = 0;
//th.th_unique = 0;將該檔案中的這行註釋掉
(5)undefined reference to `setpwent'
修改complete.c對應行
改為:
#if defined(HAVE_GETPWENT)
setpwent();
#endif
(6)linux-low.c:130:3: error: conflicting types for 'Elf64_auxv_t'
} Elf64_auxv_t;
修改sysroot/usr/include/elf.h檔案,將衝突名,改為其他名稱
(7)tracepoint-ipa.o: In function `get_timestamp':
/home/secniu/works/android_tools/android_gdb/gdb-7.11/gdb/gdbserver/tracepoint.c:7349: undefined reference to `rpl_gettimeofday'
(8) line 81: makeinfo: command not found
安裝makeinfo命令,ubuntu環境需要安裝texinfo命令
-----------
refer :
http://blog.csdn.net/xiaolli/article/details/52650036