Development Environment - Compile gdb tool under Linux

Reference article:
    http://qiusuoge.com/15831.html
    
c When an error occurs :
    https://blog.csdn.net/bailyzheng/article/details/7488664
    
Before debugging the embedded system, a debugger must be generated. Classically, the debugger under the Linux platform is gdb.

1. Download gdb: The
download address is:

http://www.gnu.org/software/gdb/download/

Let's take the file gdb-8.3.tar.gz as an example.

2. Unzip:

tar -vxf gdb-8.3.tar.gz

Note: Tips: The general suffixes of compressed files under Linux are .tar.bz2 and .tar.gz. The two or three options of their decompression commands are the same:
xf(v), the former plus the j option, the latter plus On the z option.

3. Enter the directory:

cd gdb-8.3/

4. Configuration:

3536:
    CC=arm-hisiv400-linux-gcc ./configure --host=arm-hisiv400-linux --target=arm-hisiv400-linux --program-prefix=arm-hisiv400-linux- --prefix=/home1/zhugeyifan/tools/gdb/output/3536
3519:
    CC=arm-hisiv600-linux-gcc ./configure --host=arm-hisiv600-linux --target=arm-hisiv600-linux --program-prefix=arm-hisiv600-linux- --prefix=/home1/zhugeyifan/tools/gdb/output/3519a
3519av100:
    CC=arm-himix200-linux-gcc ./configure --host=arm-himix200-linux --target=arm-himix200-linux --program-prefix=arm-himix200-linux- --prefix=/home1/zhugeyifan/tools/gdb/output/3519av100
开发机:
    ./configure --prefix=/home1/zhugeyifan/tools/gdb/output/pc

编译参数说明:
1)    CC:编译gdb使用的交叉编译工具链,3536和3519的工具不一样
2)    --host:编译出来的gdb运行在什么机器上
3)    --target:要调试的目标板
4)    --program-prefix:编译生成可执行文件的前缀
5)    --prefix:make install的的位置

Note: –target=arm-linux means that the target platform is the linux kernel running on the ARM architecture; –program-prefix=arm-linux- means the prefix of the generated executable file, such as arm-linux-gdb, – The prefix refers to the directory where the generated executable file is installed. This directory needs to be selected according to the actual situation. If the directory does not exist, it will be created automatically, of course, if the permissions are sufficient.
5. Compile and install

    make

    make install

Note: An error may be reported during "make install": "WARNING:'makeinfo' is missing on your system.". The reason is because the "makeinfo" command is missing in the current environment, just install it, as follows

sudo apt-get install texinfo

If you are lucky, three subdirectories will be generated under the directory specified by –prefix: bin, lib, share, and the arm-linux-gdb we need is in the bin directory.
Generate arm-hisiv600-linux-gdb in the directory specified by -prefix, and also generate arm-hisiv600-linux-gdbserver, because gdb runs directly on 3519, here we only focus on arm-hisiv600-linux-gdb.

If you accidentally check its size, you will find that it is as big as 14MB! God! How can it take up so much space? It doesn't matter, we can lose weight for it. That's right! Just use the strip command!
3519av100:

arm-himix200-linux-strip arm-himix200-linux-gdb -o hi3519av100-gdb

 

Guess you like

Origin blog.csdn.net/Ivan804638781/article/details/100740787