hi35xx NVR gdb Debugging

Source: Internet
Author: User

hi35xx NVR gdb Debugging

1. download gdb source code

the GDB Debugging Environment for embedded Linux consists of Host and Target Two parts, theHost side using arm-linuxgdb, TArget BoardEnd UseGdbserver. In this way, the application runs on the embedded target system andgdbDebugging inHostremote debugging is used(remote)the method. MakeGDBDebug, the target system must includeGdbserverprogram(download to the target on the host after the hardware platform is successfully compiled), the host must also be installedGDBprogram. GeneralLinuxin the release, there is a runningGDB, but developers cannot directly use theGDBTo do remote debugging, but to getGDBThe source code package, forArmPlatform for a simple configuration, recompile to get the correspondingGDB. GDBThe source code package is available from the
http://www.gnu.org/software/gdb/download/
http://ftp.gnu.org/gnu/gdb/211.95.105.202:3128 can go up, all the versions have.
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, the domestic common open source community download channels are usually downloaded
http://download.chinaunix.net/download/0004000/3482.shtml,

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

Reference:gdb+gdbserver mode 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 tar zxvf gdb-7.10.tar.gz-c/opt/

2) Enter the gdb source directory,cd/opt/gdb-7.10

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

4) Detailed compilation steps

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

(--target configuration gdb --prefix Configure the installation path, and of course other paths are available, Consistent with the following configuration arm-hisiv 4 00nptl-linux -gdb required, open

VI /etc/profile, add 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 the installation is complete, 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 running arm- hisiv400- Linux -gdb
make build gdbserver

3. code plus -G compilation.

Under Code path E:\my_code\his3520d_v2-8-0-8_3536\Build into the Build directory, open the Rules.mak file for modification.

Define debug = 1 Compile Code, note the path to the executable file generation. the executable file generated by Debug version compilation and the release version produces a different path to the executable file. a debug folder is generated under the Out folder, for example Hi3536: (\out\hi3536\app) directory . The executable program generated by the debug version is stored under this folder.

4. Compile the GDB source code executable gdb,gdbserver Copy to the Mount path.

Board-side Run command:

#./gdbserver 192.168.1.141:2345 Vfware

(Command Format #./gdbs er v er host I P: Port number Program)

The prompt appears:

Process Borad created; PID = 776

Listening on Port 2345

Remote Debugging from Host 192.168.1.141

run the command under ubuntu :

Run Arm-hisiv400-linuxnptl-gdb on the host, note that this gdb is compiled with the source code , in the installation path /opt/hisiv-gdb/ The bin path.

Run 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 ( same as port number running gdbserver on board) )

For detailed debugging steps please see the above document (Gdb+gdbserver mode for ARM Board program debugging . pdf)

#(gdb)C Execution 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 directory,

Execute command ulimit-c 10000000000 Set the temporary core file size to infinity, note that each time you rerun the program you want to set

Then execute ./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 undefined error, so compile time also add -LRT successfully debug version )

If the program produces a segment error segmentation fault. generates a current mount path under the Core file.

After executing ./gdb vfware Core , the following information appears

Use the command BT to View information about the current stack, where errors occur

Note :

The following situation may occur

#0 0x7bf99014 in?? ()

#1 0x7bf020f8 in?? ()

You cannot see the information for the stack, only the address and question mark. We can see the above information

This means that there are 5 shared library functions cannot be found, we can copy the library on the board to mount directory

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

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.