一、交叉编译
wget http://ftp.gnu.org/gnu/gdb/gdb-8.1.tar.gz
tar xvzf gdb-8.1.tar.gz
./configure --host=aarch64-v01c01-linux-gnu --prefix=${PWD}/install
make -j 12
make install
二、编译报错处理
报错如下
In file included from ../../gdb/nat/linux-ptrace.c:20:
../../gdb/nat/linux-ptrace.h:180:22: error:expected identifier before numeric constant
180 | # define TRAP_HWBKPT 4
| ^
../../gdb/nat/linux-ptrace.h:180:22: error:expected ‘}’ before numeric constant
修改代码:
vim gdb/nat/linux-ptrace.c ,注释24 25 行
19 #include "common-defs.h"
20 #include "linux-ptrace.h"
21 #include "linux-procfs.h"
22 #include "linux-waitpid.h"
23 #include "buffer.h"
24 //#include "gdb_wait.h"
25 //#include "gdb_ptrace.h"
vim gdb/nat/linux-ptrace.h 增加24行
18 #ifndef COMMON_LINUX_PTRACE_H
19 #define COMMON_LINUX_PTRACE_H
20
21 struct buffer;
22
23 #include "nat/gdb_ptrace.h"
24 #include "gdb_wait.h"
25 #ifdef __UCLIBC__
参考来源:
修改后重新编译GDB即可