0
I cross-compiling gdb on ubuntu 16.04 to debug an application running on arm. The main tutorial I'm following is https://sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver
The cross-toolchain installed on my ubuntu is aarch64-himix100-linux, and I had checked the target name via:
aarch64-himix100-linux-gcc -v
and the result shows
Target: aarch64-linux-gnu
I downloaded gdb-7.10.1 sources and extracted them into a folder named "gdb-7.10.1". Then I made two folders, "build_gdb" and "build_gdbserver", alongside the "gdb-7.10.1", and started to build:
cd build_gdb
../gdb-7.10.1/configure --target=aarch64-linux-gnu
make
cd ..
cd build_gdbserver
../gdb-7.10.1/gdb/gdbserver/configure --host=aarch64-linux-gnu
make
the last step, make
of gdbserver, broke with the following information:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c: In function ‘aarch64_fill_gregset’:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:233:62: error: dereferencing pointer to incomplete type ‘struct user_pt_regs’
collect_register (regcache, AARCH64_X0_REGNO + i, ®set->regs[i]);
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c: In function ‘aarch64_store_gregset’:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:246:61: error: dereferencing pointer to incomplete type ‘const struct user_pt_regs’
supply_register (regcache, AARCH64_X0_REGNO + i, ®set->regs[i]);
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c: In function ‘aarch64_fill_fpregset’:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:259:62: error: dereferencing pointer to incomplete type ‘struct user_fpsimd_state’
collect_register (regcache, AARCH64_V0_REGNO + i, ®set->vregs[i]);
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c: In function ‘aarch64_store_fpregset’:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:271:61: error: dereferencing pointer to incomplete type ‘const struct user_fpsimd_state’
supply_register (regcache, AARCH64_V0_REGNO + i, ®set->vregs[i]);
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c: In function ‘aarch64_linux_set_debug_regs’:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:581:29: error: storage size of ‘regs’ isn’t known
struct user_hwdebug_state regs;
^
In file included from /usr/include/signal.h:316:0,
from ../gdb-7.10.1/gdb/gdbserver/linux-low.h:21,
from ../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:23:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:592:35: error: invalid use of undefined type ‘struct user_hwdebug_state’
iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs[count - 1])
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:581:29: warning: unused variable ‘regs’ [-Wunused-variable]
struct user_hwdebug_state regs;
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c: In function ‘aarch64_arch_setup’:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:1220:29: error: storage size of ‘dreg_state’ isn’t known
struct user_hwdebug_state dreg_state;
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:1220:29: warning: unused variable ‘dreg_state’ [-Wunused-variable]
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c: At top level:
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:1272:13: error: invalid application of ‘sizeof’ to incomplete type ‘struct user_pt_regs’
sizeof (struct user_pt_regs), GENERAL_REGS,
^
../gdb-7.10.1/gdb/gdbserver/linux-aarch64-low.c:1275:13: error: invalid application of ‘sizeof’ to incomplete type ‘struct user_fpsimd_state’
sizeof (struct user_fpsimd_state), FP_REGS,
^
Makefile:257: recipe for target 'linux-aarch64-low.o' failed
make: *** [linux-aarch64-low.o] Error 1
Is this error some problems with gdb source code? How to fix it? Thanks!