Documenting the Porting of GDB 16.2 on RK3399

To quickly locate program issues, it is necessary to compile gdb 16.2 on the RK3399 development board and use gdb 16.2 to debug the program.

UnsetUnsetCompilation EnvironmentUnsetUnset

  • Ubuntu 24.04

  • gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu

UnsetUnsetPrerequisitesUnsetUnset

  • GDB Official Website: https://sourceware.org/gdb/Documenting the Porting of GDB 16.2 on RK3399

  • Source Code Download Link: https://sourceware.org/pub/gdb/releases/?C=M;O=DDocumenting the Porting of GDB 16.2 on RK3399

  • The gdb 16.2 version depends on higher versions of gmp and mpfr, so these two software packages need to be cross-compiled first.

UnsetUnsetCompile gmp-6.3.0UnsetUnset

Documenting the Porting of GDB 16.2 on RK3399
wget https://gmplib.org/download/gmp/gmp-6.3.0.tar.xz

xz -d gmp-6.3.0.tar.xz

tar -xvf gmp-6.3.0.tar

cd gmp-6.3.0

./configure --prefix=/opt/software/gdb-16.2-aarch64-10.2.1/gmp --build=x86_64-pc-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu CC=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc CXX=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ LD=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld AR=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc-ar RANLIB=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ranlib

make -j4

sudo make install
Documenting the Porting of GDB 16.2 on RK3399

UnsetUnsetCompile mpfr-4.2.1UnsetUnset

Documenting the Porting of GDB 16.2 on RK3399
wget https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.gz

tar -zxvf mpfr-4.2.1.tar.gz

cd mpfr-4.2.1

./configure --prefix=/opt/software/gdb-16.2-aarch64-10.2.1/mpfr-4.2.1 --build=x86_64-pc-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu CC=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc CXX=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ LD=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld AR=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc-ar RANLIB=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ranlib --with-gmp=/opt/software/gdb-16.2-aarch64-10.2.1/gmp-6.3.0

make -j4

sudo make install

UnsetUnsetCompile gdb 16.2UnsetUnset

./configure --prefix=/opt/software/gdb-16.2-aarch64-10.2.1/gdb-16.2 --build=x86_64-pc-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu CC=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc CXX=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ LD=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld AR=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc-ar RANLIB=/opt/tools/gcc-linaro-10.2.1-2021.01-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ranlib --with-gmp=/opt/software/gdb-16.2-aarch64-10.2.1/gmp --with-mpfr=/opt/software/gdb-16.2-aarch64-10.2.1/mpfr-4.2.1 CFLAGS="-I/opt/software/gdb-16.2-aarch64-10.2.1/gmp/include" CXXFLAGS="-I/opt/software/gdb-16.2-aarch64-10.2.1/gmp/include"

make -j4

make install
Documenting the Porting of GDB 16.2 on RK3399

Documenting the Porting of GDB 16.2 on RK3399

END

Source:Linux Armory

Copyright belongs to the original author. If there is any infringement, please contact for deletion..Recommended ReadingI violently dismantled an STM32 chip to verify its authenticity!Some companies are using Ubuntu on their embedded platforms~Is there any privilege allowing children to become software developers?→ Follow for more updates ←

Leave a Comment