Preparations
You can debug application projects in both Linux and Windows environments. Remote debugging is also supported.
Installing the GDB
If no GDB is installed in the environment, install it using a package manager (such as apt-get install gdb and yum install gdb).
If the GDB cannot be installed using the package manager, perform the following steps to install it by building the source code:
- Obtain the GDB source code, for example gdb-8.1.1.tar.gz.
- Decompress the GDB source package.
tar -zxvf gdb-8.1.1.tar.gz
- Go to the GDB directory and configure the build parameters.
cd gdb-8.1.1 ./configure --host=aarch64-linux-gnu --prefix=/home/install/gdb
- --host is an optional parameter, which is used when cross compilation is required to install the GDB. aarch64-linux-gnu is an example of the cross compiler.
- /home/install/gdb is an example of the specified installation path. Replace it as required.
- Build the code.
make -j8 make install
- Set the required environment variable.
export PATH=/home/install/gdb/bin:$PATH
- Check whether the GDB installation is successful.
gdb --version
If information similar to the following is displayed, the installation is successful.
GNU gdb (GDB) 8.1.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details.
Parent topic: Debugging C/C++ Code