aarch64 gdb: not in executable format: file format not recognized

编译时选项配置错误,导致报此错误,修改编译配置即可。

报错时配置:

/home/share/work/gdb-9.2/configure --disable-host-shared --build=arm --host=aarch64-linux-gnu --target=arm-linux --prefix=/home/share/work/gdb

修改后配置:

/home/share/work/gdb-9.2/configure --build=aarch64 --host=aarch64-linux-gnu --target=aarch64-linux-gnu --prefix=/home/share/work/gdb --disable-host-shared --disable-libmcheck

板上运行时参看GDB的编译配置参数:

(gdb) show configuration
This GDB was configured as follows:
   configure --host=aarch64-linux-gnu --target=aarch64-linux-gnu
             --with-auto-load-dir=$debugdir:$datadir/auto-load
             --with-auto-load-safe-path=$debugdir:$datadir/auto-load
             --without-expat
             --with-gdb-datadir=/home/share/work/gdb/share/gdb (relocatable)
             --with-jit-reader-dir=/home/share/work/gdb/lib/gdb (relocatable)
             --without-libunwind-ia64
             --without-lzma
             --without-babeltrace
             --without-intel-pt
             --without-mpfr
             --without-xxhash
             --without-python
             --without-guile
             --disable-source-highlight
             --with-separate-debug-dir=/home/share/work/gdb/lib/debug (relocatable)

说明:

最关键的三个参数,--build、--host、--target,请把这三个参数与编译环境、运行环境配置好,不然容易运行失败。

你可能感兴趣的:(Embedded,linux)