Linux 内核调试 十:搭建ARM GDB的调试环境

一、源码下载

GDB: The GNU Project Debugger (sourceware.org)

http://ftp.gnu.org/gnu/gdb/

BuildingCrossGDBandGDBserver - GDB Wiki (sourceware.org)

二、工具链选择

1、目标机工具链

onlylove@ubuntu:~/My/gcc/gcc-linaro-4.9.4-2017.01/bin$ pwd
/home/onlylove/My/gcc/gcc-linaro-4.9.4-2017.01/bin
onlylove@ubuntu:~/My/gcc/gcc-linaro-4.9.4-2017.01/bin$ ls
arm-linux-gnueabihf-addr2line  arm-linux-gnueabihf-gcc         arm-linux-gnueabihf-gprof    arm-linux-gnueabihf-size
arm-linux-gnueabihf-ar         arm-linux-gnueabihf-gcc-4.9.4   arm-linux-gnueabihf-ld       arm-linux-gnueabihf-strings
arm-linux-gnueabihf-as         arm-linux-gnueabihf-gcc-ar      arm-linux-gnueabihf-ld.bfd   arm-linux-gnueabihf-strip
arm-linux-gnueabihf-c++        arm-linux-gnueabihf-gcc-nm      arm-linux-gnueabihf-nm       gdbserver
arm-linux-gnueabihf-c++filt    arm-linux-gnueabihf-gcc-ranlib  arm-linux-gnueabihf-objcopy  runtest
arm-linux-gnueabihf-cpp        arm-linux-gnueabihf-gcov        arm-linux-gnueabihf-objdump
arm-linux-gnueabihf-elfedit    arm-linux-gnueabihf-gdb         arm-linux-gnueabihf-ranlib
arm-linux-gnueabihf-g++        arm-linux-gnueabihf-gfortran    arm-linux-gnueabihf-readelf
onlylove@ubuntu:~/My/gcc/gcc-linaro-4.9.4-2017.01/bin$ file arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=50daa35047312e6ca44d6792c05d266e98eb4666, stripped
onlylove@ubuntu:~/My/gcc/gcc-linaro-4.9.4-2017.01/bin$
onlylove@ubuntu:~/My/gcc/gcc-linaro-4.9.4-2017.01/bin$ ./arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Linaro GCC 4.9-2017.01) 4.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

onlylove@ubuntu:~/My/gcc/gcc-linaro-4.9.4-2017.01/bin$

2、本地机工具链

onlylove@ubuntu:~$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

onlylove@ubuntu:~$

3、设置环境变量

将交叉编译工具链路径添加到环境变量中。

export PATH=$PATH:/home/onlylove/My/gcc/gcc-linaro-4.9.4-2017.01/bin/
onlylove@ubuntu:~$ export PATH=$PATH:/home/onlylove/My/gcc/gcc-linaro-4.9.4-2017.01/bin/
onlylove@ubuntu:~$ arm-linux-gnueabihf-
arm-linux-gnueabihf-addr2line   arm-linux-gnueabihf-gcc-4.9.4   arm-linux-gnueabihf-ld.bfd
arm-linux-gnueabihf-ar          arm-linux-gnueabihf-gcc-ar      arm-linux-gnueabihf-nm
arm-linux-gnueabihf-as          arm-linux-gnueabihf-gcc-nm      arm-linux-gnueabihf-objcopy
arm-linux-gnueabihf-c++         arm-linux-gnueabihf-gcc-ranlib  arm-linux-gnueabihf-objdump
arm-linux-gnueabihf-c++filt     arm-linux-gnueabihf-gcov        arm-linux-gnueabihf-ranlib
arm-linux-gnueabihf-cpp         arm-linux-gnueabihf-gdb         arm-linux-gnueabihf-readelf
arm-linux-gnueabihf-elfedit     arm-linux-gnueabihf-gfortran    arm-linux-gnueabihf-size
arm-linux-gnueabihf-g++         arm-linux-gnueabihf-gprof       arm-linux-gnueabihf-strings
arm-linux-gnueabihf-gcc         arm-linux-gnueabihf-ld          arm-linux-gnueabihf-strip
onlylove@ubuntu:~$ arm-linux-gnueabihf-

特别说明:使用 xshell 远程登录后,以上配置只对配置的窗口生效。

三、GDB 编译

1、解压

tar -zxvf gdb-8.3.1.tar.gz

2、创建编译输出目录

mkdir build

3、配置GDB

# --target:指定目标机交叉编译器前缀
# --program-prefix:指定生成的可执行文件的前缀
# --prefix:指定可执行文件安装在哪个目录
# --host:指定编译后运行主机

# 示例:
# --target=arm-linux:目标平台是运行于ARM体系结构的linux内核
./configure \
--target=arm-linux-gnueabihf \
--program-prefix=arm-linux- \
--prefix=/home/onlylove/My/gdb/gdb-8.3.1/build
onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ ./configure --target=arm-linux-gnueabihf --program-prefix=arm-linux- --prefix=/home/onlylove/My/gdb/gdb-8.3.1/build
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... arm-unknown-linux-gnueabihf
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for gawk... no
checking for mawk... mawk
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for isl 0.15 or later... no
required isl version is 0.15 or later
checking for default BUILD_CONFIG... 
checking for --enable-vtable-verify... no
checking for bison... no
checking for byacc... no
checking for yacc... no
checking for bison... no
checking for gm4... no
checking for gnum4... no
checking for m4... no
checking for flex... no
checking for lex... no
checking for flex... no
checking for makeinfo... no
/home/onlylove/My/gdb/gdb-8.3.1/missing: 81: makeinfo: not found
checking for expect... no
checking for runtest... runtest
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for arm-linux-gnueabihf-cc... no
checking for arm-linux-gnueabihf-gcc... arm-linux-gnueabihf-gcc
checking for arm-linux-gnueabihf-c++... arm-linux-gnueabihf-c++
checking for arm-linux-gnueabihf-gcc... arm-linux-gnueabihf-gcc
checking for arm-linux-gnueabihf-gfortran... arm-linux-gnueabihf-gfortran
checking for arm-linux-gnueabihf-gccgo... no
checking for arm-linux-gnueabihf-ar... arm-linux-gnueabihf-ar
checking for arm-linux-gnueabihf-as... arm-linux-gnueabihf-as
checking for arm-linux-gnueabihf-dlltool... no
checking for arm-linux-gnueabihf-ld... arm-linux-gnueabihf-ld
checking for arm-linux-gnueabihf-lipo... no
checking for arm-linux-gnueabihf-nm... arm-linux-gnueabihf-nm
checking for arm-linux-gnueabihf-objcopy... arm-linux-gnueabihf-objcopy
checking for arm-linux-gnueabihf-objdump... arm-linux-gnueabihf-objdump
checking for arm-linux-gnueabihf-ranlib... arm-linux-gnueabihf-ranlib
checking for arm-linux-gnueabihf-readelf... arm-linux-gnueabihf-readelf
checking for arm-linux-gnueabihf-strip... arm-linux-gnueabihf-strip
checking for arm-linux-gnueabihf-windres... no
checking for arm-linux-gnueabihf-windmc... no
checking where to find the target ar... pre-installed
checking where to find the target as... pre-installed
checking where to find the target cc... pre-installed
checking where to find the target c++... pre-installed
checking where to find the target c++ for libstdc++... pre-installed
checking where to find the target dlltool... pre-installed
checking where to find the target gcc... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target gccgo... pre-installed
checking where to find the target ld... pre-installed
checking where to find the target lipo... pre-installed
checking where to find the target nm... pre-installed
checking where to find the target objcopy... pre-installed
checking where to find the target objdump... pre-installed
checking where to find the target ranlib... pre-installed
checking where to find the target readelf... pre-installed
checking where to find the target strip... pre-installed
checking where to find the target windres... pre-installed
checking where to find the target windmc... pre-installed
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ 

4、编译GDB

make -j4

make install

编译成功后会在–prefix指定的目录下生成四个子目录:bin、include、lib、share,我们需要的arm-linux-gdb就在其中的bin目录下。

onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ pwd
/home/onlylove/My/gdb/gdb-8.3.1
onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ ls
ar-lib        config-ml.in   COPYING3      include       lt~obsolete.m4  Makefile.tpl    README                  ylwrap
bfd           config.rpath   COPYING3.LIB  install-sh    ltoptions.m4    md5.sum         README-maintainer-mode  zlib
build         config.status  COPYING.LIB   intl          ltsugar.m4      missing         serdep.tmp
ChangeLog     config.sub     cpu           libdecnumber  ltversion.m4    mkdep           sim
compile       configure      depcomp       libiberty     MAINTAINERS     mkinstalldirs   src-release.sh
config        configure.ac   djunpack.bat  libtool.m4    Makefile        move-if-change  symlink-tree
config.guess  contrib        etc           ltgcc.m4      Makefile.def    opcodes         test-driver
config.log    COPYING        gdb           ltmain.sh     Makefile.in     readline        texinfo
onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ tree build/
build/
├── bin
│   ├── arm-linux-gdb
│   ├── arm-linux-gdb-add-index
│   └── arm-linux-run
├── include
│   └── gdb
│       └── jit-reader.h
├── lib
│   └── libarm-linux-gnueabihf-sim.a
└── share
    ├── info
    │   ├── bfd.info
    │   └── dir
    └── locale
        ├── da
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── de
        │   └── LC_MESSAGES
        │       └── opcodes.mo
        ├── es
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── fi
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── fr
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── ga
        │   └── LC_MESSAGES
        │       └── opcodes.mo
        ├── hr
        │   └── LC_MESSAGES
        │       └── bfd.mo
        ├── id
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── it
        │   └── LC_MESSAGES
        │       └── opcodes.mo
        ├── ja
        │   └── LC_MESSAGES
        │       └── bfd.mo
        ├── nl
        │   └── LC_MESSAGES
        │       └── opcodes.mo
        ├── pt
        │   └── LC_MESSAGES
        │       └── bfd.mo
        ├── pt_BR
        │   └── LC_MESSAGES
        │       └── opcodes.mo
        ├── ro
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── ru
        │   └── LC_MESSAGES
        │       └── bfd.mo
        ├── rw
        │   └── LC_MESSAGES
        │       └── bfd.mo
        ├── sr
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── sv
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── tr
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── uk
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        ├── vi
        │   └── LC_MESSAGES
        │       ├── bfd.mo
        │       └── opcodes.mo
        └── zh_CN
            └── LC_MESSAGES
                ├── bfd.mo
                └── opcodes.mo

51 directories, 41 files
onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ 

注:输出日志太多,不进行记录了。

5、为GDB瘦身

onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$ pwd
/home/onlylove/My/gdb/gdb-8.3.1/build/bin
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$ ls -lh
total 104M
-rwxr-xr-x 1 onlylove onlylove  96M May  4 02:09 arm-linux-gdb
-rwxr-xr-x 1 onlylove onlylove 3.2K May  4 02:09 arm-linux-gdb-add-index
-rwxr-xr-x 1 onlylove onlylove 8.3M May  4 02:09 arm-linux-run
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$

通过以上信息可以反馈,编译后的 GDB 为 96M。因此我们使用如下命令为 GDB 瘦身:

strip arm-linux-gdb -o arm-linux-gdb-stripped
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$ pwd
/home/onlylove/My/gdb/gdb-8.3.1/build/bin
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$ ls -lh
total 111M
-rwxr-xr-x 1 onlylove onlylove  96M May  4 01:48 arm-linux-gdb
-rwxr-xr-x 1 onlylove onlylove 3.2K May  4 01:48 arm-linux-gdb-add-index
-rwxrwxr-x 1 onlylove onlylove 6.3M May  4 01:51 arm-linux-gdb-stripped
-rwxr-xr-x 1 onlylove onlylove 8.3M May  4 01:48 arm-linux-run
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$

通过以上日志确定,瘦身后的 GDB 大小为 6.3M。

6、确认GDB

file arm-linux-gdb
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$ file arm-linux-gdb
arm-linux-gdb: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=eb4538c58b376c1f167b3f7f78c90acee2c29020, for GNU/Linux 3.2.0, with debug_info, not stripped
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/build/bin$

四、gdbserver 编译

1、进入编译目录

onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ cd gdb/gdbserver/
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ pwd
/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ ls
acinclude.m4        hostio.h                        linux-m32r-low.c            lynx-low.h         target.c
aclocal.m4          i387-fp.c                       linux-m68k-low.c            lynx-ppc-low.c     target.h
ax.c                i387-fp.h                       linux-mips-low.c            Makefile.in        tdesc.c
ax.h                inferiors.c                     linux-nios2-low.c           mem-break.c        tdesc.h
ChangeLog           inferiors.h                     linux-ppc-ipa.c             mem-break.h        thread-db.c
config.in           linux-aarch32-low.c             linux-ppc-low.c             notif.c            tracepoint.c
configure           linux-aarch32-low.h             linux-ppc-tdesc-init.h      notif.h            tracepoint.h
configure.ac        linux-aarch64-ipa.c             linux-s390-ipa.c            nto-low.c          utils.c
configure.srv       linux-aarch64-low.c             linux-s390-low.c            nto-low.h          utils.h
debug.c             linux-aarch64-tdesc.c           linux-s390-tdesc.h          nto-x86-low.c      win32-arm-low.c
debug.h             linux-aarch64-tdesc.h           linux-sh-low.c              proc-service.c     win32-i386-low.c
dll.c               linux-aarch64-tdesc-selftest.c  linux-sparc-low.c           proc-service.list  win32-low.c
dll.h               linux-amd64-ipa.c               linux-tic6x-low.c           README             win32-low.h
event-loop.c        linux-arm-low.c                 linux-tile-low.c            regcache.c         wincecompat.c
event-loop.h        linux-bfin-low.c                linux-x86-low.c             regcache.h         wincecompat.h
fork-child.c        linux-cris-low.c                linux-x86-tdesc.c           remote-utils.c     x86-low.c
gdb_proc_service.h  linux-crisv32-low.c             linux-x86-tdesc.h           remote-utils.h     x86-low.h
gdbreplay.c         linux-i386-ipa.c                linux-x86-tdesc-selftest.c  server.c           x86-tdesc.h
gdbthread.h         linux-ia64-low.c                linux-xtensa-low.c          server.h           xtensa-xtregs.c
hostio.c            linux-low.c                     lynx-i386-low.c             spu-low.c
hostio-errno.c      linux-low.h                     lynx-low.c                  symbol.c
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$

2、创建编译出目录

onlylove@ubuntu:~/My/gdb/gdb-8.3.1$ cd gdb/gdbserver/
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ pwd
/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ ls
acinclude.m4        hostio.h                        linux-m32r-low.c            lynx-low.h         target.c
aclocal.m4          i387-fp.c                       linux-m68k-low.c            lynx-ppc-low.c     target.h
ax.c                i387-fp.h                       linux-mips-low.c            Makefile.in        tdesc.c
ax.h                inferiors.c                     linux-nios2-low.c           mem-break.c        tdesc.h
ChangeLog           inferiors.h                     linux-ppc-ipa.c             mem-break.h        thread-db.c
config.in           linux-aarch32-low.c             linux-ppc-low.c             notif.c            tracepoint.c
configure           linux-aarch32-low.h             linux-ppc-tdesc-init.h      notif.h            tracepoint.h
configure.ac        linux-aarch64-ipa.c             linux-s390-ipa.c            nto-low.c          utils.c
configure.srv       linux-aarch64-low.c             linux-s390-low.c            nto-low.h          utils.h
debug.c             linux-aarch64-tdesc.c           linux-s390-tdesc.h          nto-x86-low.c      win32-arm-low.c
debug.h             linux-aarch64-tdesc.h           linux-sh-low.c              proc-service.c     win32-i386-low.c
dll.c               linux-aarch64-tdesc-selftest.c  linux-sparc-low.c           proc-service.list  win32-low.c
dll.h               linux-amd64-ipa.c               linux-tic6x-low.c           README             win32-low.h
event-loop.c        linux-arm-low.c                 linux-tile-low.c            regcache.c         wincecompat.c
event-loop.h        linux-bfin-low.c                linux-x86-low.c             regcache.h         wincecompat.h
fork-child.c        linux-cris-low.c                linux-x86-tdesc.c           remote-utils.c     x86-low.c
gdb_proc_service.h  linux-crisv32-low.c             linux-x86-tdesc.h           remote-utils.h     x86-low.h
gdbreplay.c         linux-i386-ipa.c                linux-x86-tdesc-selftest.c  server.c           x86-tdesc.h
gdbthread.h         linux-ia64-low.c                linux-xtensa-low.c          server.h           xtensa-xtregs.c
hostio.c            linux-low.c                     lynx-i386-low.c             spu-low.c
hostio-errno.c      linux-low.h                     lynx-low.c                  symbol.c
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ 
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ mkdir build
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ ls
acinclude.m4        hostio-errno.c                  linux-low.h                 lynx-low.c         symbol.c
aclocal.m4          hostio.h                        linux-m32r-low.c            lynx-low.h         target.c
ax.c                i387-fp.c                       linux-m68k-low.c            lynx-ppc-low.c     target.h
ax.h                i387-fp.h                       linux-mips-low.c            Makefile.in        tdesc.c
build               inferiors.c                     linux-nios2-low.c           mem-break.c        tdesc.h
ChangeLog           inferiors.h                     linux-ppc-ipa.c             mem-break.h        thread-db.c
config.in           linux-aarch32-low.c             linux-ppc-low.c             notif.c            tracepoint.c
configure           linux-aarch32-low.h             linux-ppc-tdesc-init.h      notif.h            tracepoint.h
configure.ac        linux-aarch64-ipa.c             linux-s390-ipa.c            nto-low.c          utils.c
configure.srv       linux-aarch64-low.c             linux-s390-low.c            nto-low.h          utils.h
debug.c             linux-aarch64-tdesc.c           linux-s390-tdesc.h          nto-x86-low.c      win32-arm-low.c
debug.h             linux-aarch64-tdesc.h           linux-sh-low.c              proc-service.c     win32-i386-low.c
dll.c               linux-aarch64-tdesc-selftest.c  linux-sparc-low.c           proc-service.list  win32-low.c
dll.h               linux-amd64-ipa.c               linux-tic6x-low.c           README             win32-low.h
event-loop.c        linux-arm-low.c                 linux-tile-low.c            regcache.c         wincecompat.c
event-loop.h        linux-bfin-low.c                linux-x86-low.c             regcache.h         wincecompat.h
fork-child.c        linux-cris-low.c                linux-x86-tdesc.c           remote-utils.c     x86-low.c
gdb_proc_service.h  linux-crisv32-low.c             linux-x86-tdesc.h           remote-utils.h     x86-low.h
gdbreplay.c         linux-i386-ipa.c                linux-x86-tdesc-selftest.c  server.c           x86-tdesc.h
gdbthread.h         linux-ia64-low.c                linux-xtensa-low.c          server.h           xtensa-xtregs.c
hostio.c            linux-low.c                     lynx-i386-low.c             spu-low.c
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ 

3、配置 gdbserver

./configure \
--target=arm-linux-gnueabihf \
--host=arm-linux-gnueabihf \
--prefix=/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver/build/
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ ./configure --target=arm-linux-gnueabihf --host=arm-linux-gnueabihf --prefix=/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver/build/
checking whether to enable maintainer-specific portions of Makefiles... no
checking for arm-linux-gnueabihf-gcc... arm-linux-gnueabihf-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabihf-gcc accepts -g... yes
checking for arm-linux-gnueabihf-gcc option to accept ISO C89... none needed
checking for arm-linux-gnueabihf-g++... arm-linux-gnueabihf-g++
checking whether we are using the GNU C++ compiler... yes
checking whether arm-linux-gnueabihf-g++ accepts -g... yes
checking how to run the C preprocessor... arm-linux-gnueabihf-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabihf
checking target system type... arm-unknown-linux-gnueabihf
checking for a BSD-compatible install... /usr/bin/install -c
checking for arm-linux-gnueabihf-ar... arm-linux-gnueabihf-ar
checking for arm-linux-gnueabihf-ranlib... arm-linux-gnueabihf-ranlib
checking whether arm-linux-gnueabihf-g++ supports C++11 features by default... no
checking whether arm-linux-gnueabihf-g++ supports C++11 features with -std=gnu++11... yes
checking for ANSI C header files... (cached) yes
checking dependency style of arm-linux-gnueabihf-gcc... gcc3
=== configuring in build-gnulib-gdbserver (/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver/build-gnulib-gdbserver)
configure: running /bin/bash .././../gnulib/configure --disable-option-checking '--prefix=/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver/build'  '--target=arm-linux-gnueabihf' '--host=arm-linux-gnueabihf' 'host_alias=arm-linux-gnueabihf' 'target_alias=arm-linux-gnueabihf' --cache-file=/dev/null --srcdir=.././../gnulib
checking whether to enable maintainer-specific portions of Makefiles... no
checking for arm-linux-gnueabihf-gcc... arm-linux-gnueabihf-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabihf-gcc accepts -g... yes
checking for arm-linux-gnueabihf-gcc option to accept ISO C89... none needed
checking whether arm-linux-gnueabihf-gcc understands -c and -o together... yes
checking how to run the C preprocessor... arm-linux-gnueabihf-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for Minix Amsterdam compiler... no
checking for arm-linux-gnueabihf-ar... arm-linux-gnueabihf-ar
checking the archiver (arm-linux-gnueabihf-ar) interface... ar
checking for arm-linux-gnueabihf-ar... (cached) arm-linux-gnueabihf-ar
checking for arm-linux-gnueabihf-ranlib... arm-linux-gnueabihf-ranlib
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabihf
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking for arm-linux-gnueabihf-gcc... (cached) arm-linux-gnueabihf-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether arm-linux-gnueabihf-gcc accepts -g... (cached) yes
checking for arm-linux-gnueabihf-gcc option to accept ISO C89... (cached) none needed
checking whether arm-linux-gnueabihf-gcc understands -c and -o together... (cached) yes
checking target system type... arm-unknown-linux-gnueabihf
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking features.h usability... yes
checking features.h presence... yes
checking for features.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for unistd.h... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking dirent.h usability... yes
checking dirent.h presence... yes
checking for dirent.h... yes
checking wctype.h usability... yes
checking wctype.h presence... yes
checking for wctype.h... yes
checking for sys/stat.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/cdefs.h usability... yes
checking sys/cdefs.h presence... yes
checking for sys/cdefs.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking whether the preprocessor supports include_next... yes
checking whether system header files limit the line length... no
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for canonicalize_file_name... yes
checking for getcwd... yes
checking for readlink... yes
checking for realpath... yes
checking for _set_invalid_parameter_handler... no
checking for fchdir... yes
checking for fcntl... yes
checking for symlink... yes
checking for fdopendir... yes
checking for mempcpy... yes
checking for btowc... yes
checking for isblank... yes
checking for iswctype... yes
checking for mbsrtowcs... yes
checking for wmemchr... yes
checking for wmemcpy... yes
checking for wmempcpy... yes
checking for fstatat... yes
checking for getdtablesize... yes
checking for getlogin_r... yes
checking for getprogname... no
checking for getexecname... no
checking for gettimeofday... yes
checking for getpwnam_r... yes
checking for lstat... yes
checking for mbsinit... yes
checking for mbrtowc... yes
checking for mprotect... yes
checking for mkostemp... yes
checking for openat... yes
checking for link... yes
checking for secure_getenv... yes
checking for getuid... yes
checking for geteuid... yes
checking for getgid... yes
checking for getegid... yes
checking for setenv... yes
checking for strdup... yes
checking for pipe... yes
checking for iswcntrl... yes
checking whether // is distinct from /... unknown, assuming no
checking whether realpath works... guessing yes
checking if environ is properly declared... yes
checking for complete errno.h... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking whether fchdir is declared... yes
checking for working fcntl.h... cross-compiling
checking for pid_t... yes
checking for mode_t... yes
checking for mbstate_t... yes
checking whether frexp() can be used without linking with libm... yes
checking whether alarm is declared... yes
checking whether long double and double are the same... yes
checking whether stat file-mode macros are broken... no
checking for nlink_t... yes
checking whether fchmodat is declared without a macro... yes
checking whether fstat is declared without a macro... yes
checking whether fstatat is declared without a macro... yes
checking whether futimens is declared without a macro... yes
checking whether lchmod is declared without a macro... yes
checking whether lstat is declared without a macro... yes
checking whether mkdirat is declared without a macro... yes
checking whether mkfifo is declared without a macro... yes
checking whether mkfifoat is declared without a macro... yes
checking whether mknod is declared without a macro... yes
checking whether mknodat is declared without a macro... yes
checking whether stat is declared without a macro... yes
checking whether utimensat is declared without a macro... yes
checking whether lstat correctly handles trailing slash... guessing yes
checking whether getcwd (NULL, 0) allocates memory for result... guessing yes
checking for getcwd with POSIX signature... yes
checking whether getcwd is declared... yes
checking whether getdtablesize is declared... yes
checking whether getlogin_r is declared... yes
checking whether getlogin is declared... yes
checking for C/C++ restrict keyword... __restrict
checking for struct timeval... yes
checking for wide-enough struct timeval.tv_sec member... yes
checking whether gettimeofday is declared without a macro... yes
checking whether <sys/socket.h> is self-contained... yes
checking for shutdown... yes
checking whether <sys/socket.h> defines the SHUT_* macros... yes
checking for struct sockaddr_storage... yes
checking for sa_family_t... yes
checking for struct sockaddr_storage.ss_family... yes
checking whether socket is declared without a macro... yes
checking whether connect is declared without a macro... yes
checking whether accept is declared without a macro... yes
checking whether bind is declared without a macro... yes
checking whether getpeername is declared without a macro... yes
checking whether getsockname is declared without a macro... yes
checking whether getsockopt is declared without a macro... yes
checking whether listen is declared without a macro... yes
checking whether recv is declared without a macro... yes
checking whether send is declared without a macro... yes
checking whether recvfrom is declared without a macro... yes
checking whether sendto is declared without a macro... yes
checking whether setsockopt is declared without a macro... yes
checking whether shutdown is declared without a macro... yes
checking whether accept4 is declared without a macro... yes
checking for IPv4 sockets... yes
checking for IPv6 sockets... yes
checking whether limits.h has ULLONG_WIDTH etc.... no
checking for unsigned long long int... yes
checking for long long int... yes
checking whether stdint.h conforms to C99... yes
checking whether stdint.h predates C++11... no
checking whether stdint.h has UINTMAX_WIDTH etc.... no
checking whether imaxabs is declared without a macro... yes
checking whether imaxdiv is declared without a macro... yes
checking whether strtoimax is declared without a macro... yes
checking whether strtoumax is declared without a macro... yes
checking for inttypes.h... (cached) yes
checking whether the inttypes.h PRIxNN macros are broken... no
checking where to find the exponent in a 'double'... unknown
checking whether byte ordering is bigendian... no
checking for nl_langinfo and CODESET... yes
checking whether getc_unlocked is declared... yes
checking whether we are using the GNU C Library >= 2.1 or uClibc... yes
checking whether malloc, realloc, calloc are POSIX compliant... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for a traditional japanese locale... none
checking for a transitional chinese locale... none
checking for a french Unicode locale... none
checking for a traditional french locale... none
checking for mmap... yes
checking for MAP_ANONYMOUS... yes
checking whether memchr works... guessing no
checking whether memmem is declared... yes
checking for memmem... yes
checking whether memmem works... guessing yes
checking whether memrchr is declared... yes
checking for promoted mode_t type... mode_t
checking whether setenv is declared... yes
checking search.h usability... yes
checking search.h presence... yes
checking for search.h... yes
checking for tsearch... yes
checking for sigset_t... yes
checking for uid_t in sys/types.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for wchar_t... yes
checking whether strdup is declared... yes
checking whether strerror(0) succeeds... guessing yes
checking whether ffsl is declared without a macro... yes
checking whether ffsll is declared without a macro... yes
checking whether memmem is declared without a macro... yes
checking whether mempcpy is declared without a macro... yes
checking whether memrchr is declared without a macro... yes
checking whether rawmemchr is declared without a macro... yes
checking whether stpcpy is declared without a macro... yes
checking whether stpncpy is declared without a macro... yes
checking whether strchrnul is declared without a macro... yes
checking whether strdup is declared without a macro... yes
checking whether strncat is declared without a macro... yes
checking whether strndup is declared without a macro... yes
checking whether strnlen is declared without a macro... yes
checking whether strpbrk is declared without a macro... yes
checking whether strsep is declared without a macro... yes
checking whether strcasestr is declared without a macro... yes
checking whether strtok_r is declared without a macro... yes
checking whether strerror_r is declared without a macro... yes
checking whether strsignal is declared without a macro... yes
checking whether strverscmp is declared without a macro... yes
checking whether strtok_r is declared... (cached) yes
checking for struct timespec in <time.h>... yes
checking whether unsetenv is declared... yes
checking whether <wchar.h> uses 'inline' correctly... yes
checking for wint_t... yes
checking for alloca as a compiler built-in... yes
checking whether inet_ntop is declared without a macro... yes
checking whether inet_pton is declared without a macro... yes
checking whether this system has an arbitrary file name length limit... yes
checking for closedir... yes
checking for d_ino member in directory struct... guessing yes
checking for d_type member in directory struct... yes
checking whether alphasort is declared without a macro... yes
checking whether closedir is declared without a macro... yes
checking whether dirfd is declared without a macro... yes
checking whether fdopendir is declared without a macro... yes
checking whether opendir is declared without a macro... yes
checking whether readdir is declared without a macro... yes
checking whether rewinddir is declared without a macro... yes
checking whether scandir is declared without a macro... yes
checking for dirfd... yes
checking whether dirfd is declared... (cached) yes
checking whether dirfd is a macro... no
checking whether // is distinct from /... (cached) unknown, assuming no
checking whether dup works... guessing yes
checking whether dup2 works... guessing yes
checking for error_at_line... yes
checking whether fcntl handles F_DUPFD correctly... guessing yes
checking whether fcntl understands F_DUPFD_CLOEXEC... needs runtime check
checking whether fcntl is declared without a macro... yes
checking whether openat is declared without a macro... yes
checking whether fdopendir is declared... (cached) yes
checking whether fdopendir works... guessing yes
checking for flexible array member... yes
checking whether conversion from 'int' to 'long double' works... guessing yes
checking for working GNU fnmatch... guessing no
checking whether isblank is declared... yes
checking whether isblank is declared... (cached) yes
checking whether frexp works... guessing yes
checking whether frexpl is declared... yes
checking whether frexpl() can be used without linking with libm... yes
checking whether frexpl works... guessing yes
checking whether fstatat (..., 0) works... guessing yes
checking whether getcwd handles long file names properly... no, but it is partly working
checking for getpagesize... yes
checking whether getcwd aborts when 4k < cwd_length < 16k... yes
checking whether getdtablesize works... guessing yes
checking whether getlogin_r works with small buffers... guessing yes
checking whether program_invocation_name is declared... yes
checking whether program_invocation_short_name is declared... yes
checking whether __argv is declared... no
checking whether gettimeofday clobbers localtime buffer... guessing no
checking for gettimeofday with POSIX signature... almost
checking glob.h usability... yes
checking glob.h presence... yes
checking for glob.h... yes
checking for GNU glob interface version 1... yes
checking whether glob lists broken symlinks... no
checking for library containing inet_ntop... none required
checking whether inet_ntop is declared... (cached) yes
checking whether INT32_MAX < INTMAX_MAX... yes
checking whether INT64_MAX == LONG_MAX... no
checking whether UINT32_MAX < UINTMAX_MAX... yes
checking whether UINT64_MAX == ULONG_MAX... no
checking whether isnan(double) can be used without linking with libm... yes
checking whether isnan(long double) can be used without linking with libm... yes
checking whether isnanl works... guessing yes
checking whether NAN macro works... yes
checking whether HUGE_VAL works... yes
checking whether acosf is declared without a macro... yes
checking whether acosl is declared without a macro... yes
checking whether asinf is declared without a macro... yes
checking whether asinl is declared without a macro... yes
checking whether atanf is declared without a macro... yes
checking whether atanl is declared without a macro... yes
checking whether cbrt is declared without a macro... yes
checking whether cbrtf is declared without a macro... yes
checking whether cbrtl is declared without a macro... yes
checking whether ceilf is declared without a macro... yes
checking whether ceill is declared without a macro... yes
checking whether copysign is declared without a macro... yes
checking whether copysignf is declared without a macro... yes
checking whether copysignl is declared without a macro... yes
checking whether cosf is declared without a macro... yes
checking whether cosl is declared without a macro... yes
checking whether coshf is declared without a macro... yes
checking whether expf is declared without a macro... yes
checking whether expl is declared without a macro... yes
checking whether exp2 is declared without a macro... yes
checking whether exp2f is declared without a macro... yes
checking whether exp2l is declared without a macro... yes
checking whether expm1 is declared without a macro... yes
checking whether expm1f is declared without a macro... yes
checking whether expm1l is declared without a macro... yes
checking whether fabsf is declared without a macro... yes
checking whether fabsl is declared without a macro... yes
checking whether floorf is declared without a macro... yes
checking whether floorl is declared without a macro... yes
checking whether fma is declared without a macro... yes
checking whether fmaf is declared without a macro... yes
checking whether fmal is declared without a macro... yes
checking whether fmod is declared without a macro... yes
checking whether fmodf is declared without a macro... yes
checking whether fmodl is declared without a macro... yes
checking whether frexpf is declared without a macro... yes
checking whether frexpl is declared without a macro... yes
checking whether hypotf is declared without a macro... yes
checking whether hypotl is declared without a macro... yes
checking whether ilogb is declared without a macro... yes
checking whether ilogbf is declared without a macro... yes
checking whether ilogbl is declared without a macro... yes
checking whether ldexpf is declared without a macro... yes
checking whether ldexpl is declared without a macro... yes
checking whether log is declared without a macro... yes
checking whether logf is declared without a macro... yes
checking whether logl is declared without a macro... yes
checking whether log10 is declared without a macro... yes
checking whether log10f is declared without a macro... yes
checking whether log10l is declared without a macro... yes
checking whether log1p is declared without a macro... yes
checking whether log1pf is declared without a macro... yes
checking whether log1pl is declared without a macro... yes
checking whether log2 is declared without a macro... yes
checking whether log2f is declared without a macro... yes
checking whether log2l is declared without a macro... yes
checking whether logb is declared without a macro... yes
checking whether logbf is declared without a macro... yes
checking whether logbl is declared without a macro... yes
checking whether modf is declared without a macro... yes
checking whether modff is declared without a macro... yes
checking whether modfl is declared without a macro... yes
checking whether powf is declared without a macro... yes
checking whether remainder is declared without a macro... yes
checking whether remainderf is declared without a macro... yes
checking whether remainderl is declared without a macro... yes
checking whether rint is declared without a macro... yes
checking whether rintf is declared without a macro... yes
checking whether rintl is declared without a macro... yes
checking whether round is declared without a macro... yes
checking whether roundf is declared without a macro... yes
checking whether roundl is declared without a macro... yes
checking whether sinf is declared without a macro... yes
checking whether sinl is declared without a macro... yes
checking whether sinhf is declared without a macro... yes
checking whether sqrtf is declared without a macro... yes
checking whether sqrtl is declared without a macro... yes
checking whether tanf is declared without a macro... yes
checking whether tanl is declared without a macro... yes
checking whether tanhf is declared without a macro... yes
checking whether trunc is declared without a macro... yes
checking whether truncf is declared without a macro... yes
checking whether truncl is declared without a macro... yes
checking whether mbrtowc handles incomplete characters... guessing yes
checking whether mbrtowc works as well as mbtowc... guessing yes
checking whether mbrtowc handles a NULL pwc argument... guessing yes
checking whether mbrtowc handles a NULL string argument... guessing yes
checking whether mbrtowc has a correct return value... guessing yes
checking whether mbrtowc returns 0 when parsing a NUL character... guessing yes
checking whether mbrtowc works on empty input... guessing no
checking whether the C locale is free of encoding errors... guessing no
checking whether mbrtowc handles incomplete characters... (cached) guessing yes
checking whether mbrtowc works as well as mbtowc... (cached) guessing yes
checking whether mbrtowc handles incomplete characters... (cached) guessing yes
checking whether mbrtowc works as well as mbtowc... (cached) guessing yes
checking whether mbsrtowcs works... guessing yes
checking bp-sym.h usability... no
checking bp-sym.h presence... no
checking for bp-sym.h... no
checking whether memmem works in linear time... guessing yes
checking for memmem... (cached) yes
checking whether memmem works... (cached) guessing yes
checking for mempcpy... (cached) yes
checking for memrchr... yes
checking whether mkdir handles trailing slash... guessing yes
checking whether mkdir handles trailing dot... guessing yes
checking for mkdtemp... yes
checking whether <netinet/in.h> is self-contained... yes
checking whether open recognizes a trailing slash... guessing yes
checking for opendir... yes
checking for rawmemchr... yes
checking for readdir... yes
checking whether readlink signature is correct... yes
checking whether readlink handles trailing slash correctly... guessing yes
checking whether rename honors trailing slash on destination... guessing yes
checking whether rename honors trailing slash on source... guessing yes
checking whether rename manages hard links correctly... guessing yes
checking whether rename manages existing destinations correctly... guessing yes
checking for rewinddir... yes
checking whether rmdir works... guessing yes
checking whether setenv validates arguments... guessing yes
checking for volatile sig_atomic_t... yes
checking for sighandler_t... yes
checking whether pthread_sigmask is declared without a macro... yes
checking whether sigaction is declared without a macro... yes
checking whether sigaddset is declared without a macro... yes
checking whether sigdelset is declared without a macro... yes
checking whether sigemptyset is declared without a macro... yes
checking whether sigfillset is declared without a macro... yes
checking whether sigismember is declared without a macro... yes
checking whether sigpending is declared without a macro... yes
checking whether sigprocmask is declared without a macro... yes
checking for socklen_t... yes
checking for ssize_t... yes
checking whether stat handles trailing slashes on directories... guessing yes
checking whether stat handles trailing slashes on files... guessing yes
checking for working stdalign.h... yes
checking for max_align_t... no
checking whether NULL can be used in arbitrary expressions... yes
checking which flavor of printf attribute matches inttypes macros... system
checking whether dprintf is declared without a macro... yes
checking whether fpurge is declared without a macro... no
checking whether fseeko is declared without a macro... yes
checking whether ftello is declared without a macro... yes
checking whether getdelim is declared without a macro... yes
checking whether getline is declared without a macro... yes
checking whether gets is declared without a macro... no
checking whether pclose is declared without a macro... yes
checking whether popen is declared without a macro... yes
checking whether renameat is declared without a macro... yes
checking whether snprintf is declared without a macro... yes
checking whether tmpfile is declared without a macro... yes
checking whether vdprintf is declared without a macro... yes
checking whether vsnprintf is declared without a macro... yes
checking whether _Exit is declared without a macro... yes
checking whether atoll is declared without a macro... yes
checking whether canonicalize_file_name is declared without a macro... yes
checking whether getloadavg is declared without a macro... yes
checking whether getsubopt is declared without a macro... yes
checking whether grantpt is declared without a macro... yes
checking whether initstate is declared without a macro... yes
checking whether initstate_r is declared without a macro... yes
checking whether mkdtemp is declared without a macro... yes
checking whether mkostemp is declared without a macro... yes
checking whether mkostemps is declared without a macro... yes
checking whether mkstemp is declared without a macro... yes
checking whether mkstemps is declared without a macro... yes
checking whether posix_openpt is declared without a macro... yes
checking whether ptsname is declared without a macro... yes
checking whether ptsname_r is declared without a macro... yes
checking whether qsort_r is declared without a macro... yes
checking whether random is declared without a macro... yes
checking whether random_r is declared without a macro... yes
checking whether realpath is declared without a macro... yes
checking whether rpmatch is declared without a macro... yes
checking whether secure_getenv is declared without a macro... yes
checking whether setenv is declared without a macro... yes
checking whether setstate is declared without a macro... yes
checking whether setstate_r is declared without a macro... yes
checking whether srandom is declared without a macro... yes
checking whether srandom_r is declared without a macro... yes
checking whether strtod is declared without a macro... yes
checking whether strtoll is declared without a macro... yes
checking whether strtoull is declared without a macro... yes
checking whether unlockpt is declared without a macro... yes
checking whether unsetenv is declared without a macro... yes
checking for strchrnul... yes
checking whether strchrnul works... guessing yes
checking for working strerror function... guessing yes
checking for strtok_r... yes
checking whether strtok_r works... guessing no
checking for nlink_t... (cached) yes
checking whether fchmodat is declared without a macro... (cached) yes
checking whether fstat is declared without a macro... (cached) yes
checking whether fstatat is declared without a macro... (cached) yes
checking whether futimens is declared without a macro... (cached) yes
checking whether lchmod is declared without a macro... (cached) yes
checking whether lstat is declared without a macro... (cached) yes
checking whether mkdirat is declared without a macro... (cached) yes
checking whether mkfifo is declared without a macro... (cached) yes
checking whether mkfifoat is declared without a macro... (cached) yes
checking whether mknod is declared without a macro... (cached) yes
checking whether mknodat is declared without a macro... (cached) yes
checking whether stat is declared without a macro... (cached) yes
checking whether utimensat is declared without a macro... (cached) yes
checking whether chdir is declared without a macro... yes
checking whether chown is declared without a macro... yes
checking whether dup is declared without a macro... yes
checking whether dup2 is declared without a macro... yes
checking whether dup3 is declared without a macro... yes
checking whether environ is declared without a macro... yes
checking whether euidaccess is declared without a macro... yes
checking whether faccessat is declared without a macro... yes
checking whether fchdir is declared without a macro... yes
checking whether fchownat is declared without a macro... yes
checking whether fdatasync is declared without a macro... yes
checking whether fsync is declared without a macro... yes
checking whether ftruncate is declared without a macro... yes
checking whether getcwd is declared without a macro... yes
checking whether getdomainname is declared without a macro... yes
checking whether getdtablesize is declared without a macro... yes
checking whether getgroups is declared without a macro... yes
checking whether gethostname is declared without a macro... yes
checking whether getlogin is declared without a macro... yes
checking whether getlogin_r is declared without a macro... yes
checking whether getpagesize is declared without a macro... yes
checking whether getusershell is declared without a macro... yes
checking whether setusershell is declared without a macro... yes
checking whether endusershell is declared without a macro... yes
checking whether group_member is declared without a macro... yes
checking whether isatty is declared without a macro... yes
checking whether lchown is declared without a macro... yes
checking whether link is declared without a macro... yes
checking whether linkat is declared without a macro... yes
checking whether lseek is declared without a macro... yes
checking whether pipe is declared without a macro... yes
checking whether pipe2 is declared without a macro... yes
checking whether pread is declared without a macro... yes
checking whether pwrite is declared without a macro... yes
checking whether readlink is declared without a macro... yes
checking whether readlinkat is declared without a macro... yes
checking whether rmdir is declared without a macro... yes
checking whether sethostname is declared without a macro... yes
checking whether sleep is declared without a macro... yes
checking whether symlink is declared without a macro... yes
checking whether symlinkat is declared without a macro... yes
checking whether ttyname_r is declared without a macro... yes
checking whether unlink is declared without a macro... yes
checking whether unlinkat is declared without a macro... yes
checking whether usleep is declared without a macro... yes
checking for unsetenv... yes
checking for unsetenv() return type... int
checking whether unsetenv obeys POSIX... guessing yes
checking whether btowc is declared without a macro... yes
checking whether wctob is declared without a macro... yes
checking whether mbsinit is declared without a macro... yes
checking whether mbrtowc is declared without a macro... yes
checking whether mbrlen is declared without a macro... yes
checking whether mbsrtowcs is declared without a macro... yes
checking whether mbsnrtowcs is declared without a macro... yes
checking whether wcrtomb is declared without a macro... yes
checking whether wcsrtombs is declared without a macro... yes
checking whether wcsnrtombs is declared without a macro... yes
checking whether wcwidth is declared without a macro... yes
checking whether wmemchr is declared without a macro... yes
checking whether wmemcmp is declared without a macro... yes
checking whether wmemcpy is declared without a macro... yes
checking whether wmemmove is declared without a macro... yes
checking whether wmemset is declared without a macro... yes
checking whether wcslen is declared without a macro... yes
checking whether wcsnlen is declared without a macro... yes
checking whether wcscpy is declared without a macro... yes
checking whether wcpcpy is declared without a macro... yes
checking whether wcsncpy is declared without a macro... yes
checking whether wcpncpy is declared without a macro... yes
checking whether wcscat is declared without a macro... yes
checking whether wcsncat is declared without a macro... yes
checking whether wcscmp is declared without a macro... yes
checking whether wcsncmp is declared without a macro... yes
checking whether wcscasecmp is declared without a macro... yes
checking whether wcsncasecmp is declared without a macro... yes
checking whether wcscoll is declared without a macro... yes
checking whether wcsxfrm is declared without a macro... yes
checking whether wcsdup is declared without a macro... yes
checking whether wcschr is declared without a macro... yes
checking whether wcsrchr is declared without a macro... yes
checking whether wcscspn is declared without a macro... yes
checking whether wcsspn is declared without a macro... yes
checking whether wcspbrk is declared without a macro... yes
checking whether wcsstr is declared without a macro... yes
checking whether wcstok is declared without a macro... yes
checking whether wcswidth is declared without a macro... yes
checking whether iswcntrl works... guessing yes
checking for towlower... yes
checking for wctype_t... yes
checking for wctrans_t... yes
checking whether wctype is declared without a macro... yes
checking whether iswctype is declared without a macro... yes
checking whether wctrans is declared without a macro... yes
checking whether towctrans is declared without a macro... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-gnueabihf-strip... arm-linux-gnueabihf-strip
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking dependency style of arm-linux-gnueabihf-gcc... gcc3
checking whether make supports nested variables... (cached) yes
checking whether ln -s works... yes
checking for arm-linux-gnueabihf-ranlib... (cached) arm-linux-gnueabihf-ranlib
checking for arm-linux-gnueabihf-ar... (cached) arm-linux-gnueabihf-ar
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating import/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default commands
=== configuring in build-libiberty-gdbserver (/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver/build-libiberty-gdbserver)
configure: running /bin/bash .././../../libiberty/configure --disable-option-checking '--prefix=/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver/build'  '--target=arm-linux-gnueabihf' '--host=arm-linux-gnueabihf' 'host_alias=arm-linux-gnueabihf' 'target_alias=arm-linux-gnueabihf' --cache-file=/dev/null --srcdir=.././../../libiberty
checking whether to enable maintainer-specific portions of Makefiles... no
checking for makeinfo... no
checking for perl... perl
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-unknown-linux-gnueabihf
checking for arm-linux-gnueabihf-ar... arm-linux-gnueabihf-ar
checking for arm-linux-gnueabihf-ranlib... arm-linux-gnueabihf-ranlib
checking whether to install libiberty headers and static library... no
configure: target_header_dir = 
checking for arm-linux-gnueabihf-gcc... arm-linux-gnueabihf-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabihf-gcc accepts -g... yes
checking for arm-linux-gnueabihf-gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... arm-linux-gnueabihf-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking whether arm-linux-gnueabihf-gcc supports -W... yes
checking whether arm-linux-gnueabihf-gcc supports -Wall... yes
checking whether arm-linux-gnueabihf-gcc supports -Wwrite-strings... yes
checking whether arm-linux-gnueabihf-gcc supports -Wc++-compat... yes
checking whether arm-linux-gnueabihf-gcc supports -Wstrict-prototypes... yes
checking whether arm-linux-gnueabihf-gcc supports -Wshadow=local... no
checking whether arm-linux-gnueabihf-gcc supports -pedantic ... yes
checking whether arm-linux-gnueabihf-gcc and cc understand -c and -o together... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking whether byte ordering is bigendian... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for sys/file.h... yes
checking for sys/param.h... yes
checking for limits.h... yes
checking for stdlib.h... (cached) yes
checking for malloc.h... yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for strings.h... (cached) yes
checking for sys/time.h... yes
checking for time.h... yes
checking for sys/resource.h... yes
checking for sys/stat.h... (cached) yes
checking for sys/mman.h... yes
checking for fcntl.h... yes
checking for alloca.h... yes
checking for sys/pstat.h... no
checking for sys/sysmp.h... no
checking for sys/sysinfo.h... yes
checking for machine/hal_sysinfo.h... no
checking for sys/table.h... no
checking for sys/sysctl.h... yes
checking for sys/systemcfg.h... no
checking for stdint.h... (cached) yes
checking for stdio_ext.h... yes
checking for process.h... no
checking for sys/prctl.h... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether errno must be declared... no
checking size of int... 4
checking size of long... 4
checking size of size_t... 4
checking for long long... yes
checking size of long long... 8
checking for a 64-bit type... uint64_t
checking for intptr_t... yes
checking for uintptr_t... yes
checking for ssize_t... yes
checking for pid_t... yes
checking for library containing strerror... none required
checking for asprintf... yes
checking for atexit... yes
checking for basename... yes
checking for bcmp... yes
checking for bcopy... yes
checking for bsearch... yes
checking for bzero... yes
checking for calloc... yes
checking for clock... yes
checking for ffs... yes
checking for getcwd... yes
checking for getpagesize... yes
checking for gettimeofday... yes
checking for index... yes
checking for insque... yes
checking for memchr... yes
checking for memcmp... yes
checking for memcpy... yes
checking for memmem... yes
checking for memmove... yes
checking for mempcpy... yes
checking for memset... yes
checking for mkstemps... yes
checking for putenv... yes
checking for random... yes
checking for rename... yes
checking for rindex... yes
checking for setenv... yes
checking for snprintf... yes
checking for sigsetmask... yes
checking for stpcpy... yes
checking for stpncpy... yes
checking for strcasecmp... yes
checking for strchr... yes
checking for strdup... yes
checking for strncasecmp... yes
checking for strndup... yes
checking for strnlen... yes
checking for strrchr... yes
checking for strstr... yes
checking for strtod... yes
checking for strtol... yes
checking for strtoul... yes
checking for strtoll... yes
checking for strtoull... yes
checking for strverscmp... yes
checking for tmpnam... yes
checking for vasprintf... yes
checking for vfprintf... yes
checking for vprintf... yes
checking for vsnprintf... yes
checking for vsprintf... yes
checking for waitpid... yes
checking for setproctitle... no
checking whether alloca needs Cray hooks... no
checking stack direction for C alloca... 0
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... cross
configure: WARNING: result yes guessed because of cross compilation
checking for working vfork... (cached) yes
checking for _doprnt... no
checking for sys_errlist... yes
checking for sys_nerr... yes
checking for sys_siglist... yes
checking for external symbol _system_configuration... no
checking for __fsetlocking... yes
checking for canonicalize_file_name... yes
checking for dup3... yes
checking for getrlimit... yes
checking for getrusage... yes
checking for getsysinfo... no
checking for gettimeofday... (cached) yes
checking for on_exit... yes
checking for pipe2... yes
checking for psignal... yes
checking for pstat_getdynamic... no
checking for pstat_getstatic... no
checking for realpath... yes
checking for setrlimit... yes
checking for sbrk... yes
checking for spawnve... no
checking for spawnvpe... no
checking for strerror... yes
checking for strsignal... yes
checking for sysconf... yes
checking for sysctl... yes
checking for sysmp... no
checking for table... no
checking for times... yes
checking for wait3... yes
checking for wait4... yes
checking whether basename is declared... yes
checking whether ffs is declared... yes
checking whether asprintf is declared... yes
checking whether vasprintf is declared... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
checking whether calloc is declared... yes
checking whether getenv is declared... yes
checking whether getopt is declared... yes
checking whether malloc is declared... yes
checking whether realloc is declared... yes
checking whether sbrk is declared... yes
checking whether strtol is declared... yes
checking whether strtoul is declared... yes
checking whether strtoll is declared... yes
checking whether strtoull is declared... yes
checking whether strverscmp is declared... yes
checking whether strnlen is declared... yes
checking whether canonicalize_file_name must be declared... no
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for getpagesize... (cached) yes
checking for working mmap... no
checking for working strncmp... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating testsuite/Makefile
config.status: creating config.h
config.status: executing default commands
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking sys/reg.h usability... no
checking sys/reg.h presence... no
checking for sys/reg.h... no
checking for string.h... (cached) yes
checking proc_service.h usability... no
checking proc_service.h presence... no
checking for proc_service.h... no
checking sys/procfs.h usability... yes
checking sys/procfs.h presence... yes
checking for sys/procfs.h... yes
checking linux/elf.h usability... yes
checking linux/elf.h presence... yes
checking for linux/elf.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... cross
configure: WARNING: result yes guessed because of cross compilation
checking for working vfork... (cached) yes
checking for getauxval... yes
checking for pread... yes
checking for pwrite... yes
checking for pread64... yes
checking for setns... yes
checking for size_t... yes
checking for ANSI C header files... (cached) yes
checking for working alloca.h... yes
checking for alloca... yes
checking for nl_langinfo and CODESET... yes
checking linux/perf_event.h usability... yes
checking linux/perf_event.h presence... yes
checking for linux/perf_event.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking for memory.h... (cached) yes
checking for signal.h... (cached) yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking for sys/socket.h... (cached) yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking thread_db.h usability... yes
checking thread_db.h presence... yes
checking for thread_db.h... yes
checking wait.h usability... yes
checking wait.h presence... yes
checking for wait.h... yes
checking for termios.h... (cached) yes
checking for fdwalk... no
checking for getrlimit... yes
checking for pipe... yes
checking for pipe2... yes
checking for socketpair... yes
checking for sigaction... yes
checking whether strerror is declared... yes
checking whether strstr is declared... yes
checking for sigsetjmp... yes
checking sys/ptrace.h usability... yes
checking sys/ptrace.h presence... yes
checking for sys/ptrace.h... yes
checking ptrace.h usability... no
checking ptrace.h presence... no
checking for ptrace.h... no
checking whether ptrace is declared... yes
checking return type of ptrace... long
checking types of arguments for ptrace... enum __ptrace_request,int,long,long
checking for ust... no
checking compiler warning flags...  -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wformat -Wformat-nonliteral 
checking for dladdr... yes
checking for long long... yes
checking size of long long... 8
checking whether basename is declared... yes
checking whether ffs is declared... yes
checking whether asprintf is declared... yes
checking whether vasprintf is declared... yes
checking whether snprintf is declared... yes
checking whether vsnprintf is declared... yes
checking whether strtol is declared... yes
checking whether strtoul is declared... yes
checking whether strtoll is declared... yes
checking whether strtoull is declared... yes
checking whether strverscmp is declared... yes
checking whether strerror is declared... (cached) yes
checking whether perror is declared... yes
checking whether vasprintf is declared... (cached) yes
checking whether vsnprintf is declared... (cached) yes
checking for struct stat.st_blocks... yes
checking for struct stat.st_blksize... yes
checking for struct user_regs_struct.fs_base... no
checking for struct user_regs_struct.gs_base... no
checking for socklen_t... yes
checking for Elf32_auxv_t... yes
checking for Elf64_auxv_t... yes
checking for PTRACE_GETREGS... yes
checking for PTRACE_GETFPXREGS... yes
checking for lwpid_t in sys/procfs.h... yes
checking for psaddr_t in sys/procfs.h... yes
checking for prgregset_t in sys/procfs.h... yes
checking for prfpregset_t in sys/procfs.h... yes
checking for elf_fpregset_t in sys/procfs.h... yes
checking for dlopen in -ldl... yes
checking for the dynamic export flag... -Wl,--dynamic-list
checking for TD_VERSION... yes
checking whether the target supports __sync_*_compare_and_swap... yes
checking whether ADDR_NO_RANDOMIZE is declared... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depdir commands
mkdir -p -- .deps
config.status: executing gdbdepdir commands
mkdir -p -- arch/.deps
mkdir -p -- common/.deps
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ 

4、编译

make CC=arm-linux-gnueabihf-gcc -j4

说明:日志信息太多,不进行记录。

onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ pwd
/home/onlylove/My/gdb/gdb-8.3.1/gdb/gdbserver
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ ls -lh gdbserver 
-rwxrwxr-x 1 onlylove onlylove 4.2M May  4 02:19 gdbserver
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$

5、确认 gdbserver

onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$ file gdbserver 
gdbserver: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.31, BuildID[sha1]=94b83a47750b70ff7ebc23937348280c25fa1e3d, with debug_info, not stripped
onlylove@ubuntu:~/My/gdb/gdb-8.3.1/gdb/gdbserver$

五、使用

交叉编译的 gdb 基于网络通信来完成 gdb 调试,所以就需要分别在 ARM 端和 PC 端运行各自的工具来保持通信。

1、编译程序

arm-linux-gnueabihf-gcc main.c -g -o a.out

2、在ARM端执行

gdbserver 192.168.9.101:1234 a.out //ARM的IP地址:自定义的一个端口

3、在PC端执行

arm-linux-gdb a.out

4、gdb 连接 gdbserver

(gdb) target remote 192.168.9.101:1234 

连接成功后,ARM端出现:

Remote debugging from host 192.168.9.68

这就说明gdb连接已经建立现在就可以使用gdb调试了

你可能感兴趣的:(Linux内核调试,linux,gdb)