hi35xx NVR gdb Debugging

Source: Internet
Author: User

hi35xx NVR gdb Debugging

1. download gdb source code

the GDB Debugging Environment of embedded Linux is composed of Host and Target , Host End Use Arm - Linuxgdb , Target Board gdbserver gdb debug on host end, so use remote debugging gdb Debug. The target system must contain gdbserver program ( " , host must also be installed gdb program.

There is one gdbthat can be executed in the general Linux distribution, but developers cannot use GDB directly in the release to do remote debugging, but to get GDB source package. For the arm platform to make a simple configuration, once again compiled to the corresponding GDB.

GDBthe source package can be
http://www.gnu.org/software/gdb/download/
http://ftp.gnu.org/gnu/gdb/211.95.105.202:3128 can go up, all the version number has AH
http://ftp.cs.pu.edu.tw/linux/sourceware/gdb/releases/ download
Ftp://ftp.gnu.org/gnu/gdb
External Network FTP I often do not go. Download channels for common open source communities in China are usually available for download
http://download.chinaunix.net/download/0004000/3482.shtml,

I downloaded the version number gdb-7.10.tar.gz . Download to a folder , such as /opt.

Reference information:gdb+gdbserver method for ARM Board program debugging http://blog.csdn.net/hejianhua/ article/details/7312979

XML:

http://blog.csdn.net/yangzhongxuan/article/details/13002789

2. Configuring the compilation Environment

1) Unzip the gdb source code tar zxvf gdb-7.10.tar.gz-c/opt/

2) Enter the gdb Source code folder,cd/opt/gdb-7.10

3) Configure the compilation environment. Cross-compilation toolchain for HiSilicon cross-tool compilation chain, I configured the cross compiler for v400 arm-hisiv400nptl-linux

4) Specific compilation steps

1. ./configure--target=arm-hisiv 4 00nptl-linux--prefix=/opt/hisi-gdb/-v

(--target configuration gdb --prefix Configure the installation path. Of course other paths are also possible, Consistent with the following configuration Yes. Must be declared in the environment variable, start arm-hisiv 4 00nptl-linux -gdb required, open

VI /etc/profile, join the export path= $PATH:/ Opt/hisi-gdb . source./etc/profile make configuration effective )

build after configuration is complete Makefile

2, make
   make install
     build arm-hisiv 4 00nptl-linux -gdb, and deposited in opt/hisv -gdb Span style= "Color:rgb (51,51,51)" >  /bin

3, after installation, enter CD   /opt/gdb-7.10 /gdb/gdbserver

       ./configure--target=arm- hisiv400- linux  -- host=arm- hisiv400- linux
      &NBSP, --target= arm- Span style= "Color:rgb (51,51,51)" >hisiv400- linux represents the target platform.

--host indicates that the host side is performing arm- hisiv400- Linux -gdb
make build gdbserver

3. code plus -G compilation.

Under the code path, E:\my_code\his3520d_v2-8-0-8_3536\Build into the Build folder. Open the Rules.mak file for changes.

Define debug = 1 Compile Code, note that the file generation path can be run. Debug version number compilation generates a runtime file that is different from the run file path generated by the release version number.

A debug directory will be generated under the out directory, such as Hi3536: (\out\hi3536\app) directory,debug The version number generated by the running program is stored below this directory.

4. Compile the GDB source code to run the program gdb. the gdbserver is copied to the Mount path.

Board-Side Execution command:

#./gdbserver 192.168.1.141:2345 Vfware

(Command Format #./gdbs er v er host I P:port code)

The prompt appears:

Process Borad created; PID = 776

Listening on Port 2345

Remote Debugging from Host 192.168.1.141

execute the command under ubuntu :

Executes the arm-hisiv400-linuxnptl-gdb on the host. Note that this gdb is compiled from source code , under the installation path /opt/hisiv-gdb/bin path.

Executing gdb on the host side

#. /gdb

(gdb)target remote 192.168.1. 143:2,345

(Command format target Remote Development Board I P: Port number (and board execution gdbserver The port number is the same))

For specific debugging steps, please see the above document (Gdb+gdbserver method for ARM Board program debugging . pdf)

#(gdb)C Run the program

When the code has a segment error, enter BT to view the stack information tracking problem where the error occurred.

5. Core File debugging methods

After compiling the above gdb and gdbserver , the same copy of gdb and gdbserver to the Mount folder.

Execute command ulimit-c 10000000000 set the size of the temporary core file to infinity. Note that every time you execute a program, you set

Then run ./gdb  vfware  core     (vfware Span style= "font-family: Arial" To debug program, also add -g compiled program. Note libuv library useful to clock_gettime () , clock_getres () function, plus -g compile will report no error defined, so add -lrt , Talent successfully compiled debug version number )

The procedure assumes that a segment error segmentation fault is generated. generates a current mount path under the Core file.

After running ./gdb vfware Core appears such as the following information

Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center ">

Use the command BT to view information for the current stack. Where there are errors

Note :

There may be a situation like the following

#0 0x7bf99014 in?? ()

#1 0x7bf020f8 in?? ()

There is no information on the stack, just an address and a question mark. We can see the above information

This means that there are 5 shared library functions that cannot be found. We can copy the library from the board to the Mount folder.

cp/lib//mnt/nfs-rf/lib as a mount folder /mnt/nfs the Library directory on the target board

hi35xx NVR gdb Debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.