Ubuntu10.04 how to port gdbserver and gdbserver

Source: Internet
Author: User
Porting gdbserver and gdbserver usage in Ubuntu10.04 was successful (for CCSV5.2 remote debugging of ARMCORTEX-A8 programs ). Recently it was necessary to use CCSV5 to remotely debug the ARMcortex-a8 program with gdbserver, port successfully gdbserve, use a gdb-7.1, host environment for ubuntu10.04, nfs file system mounted on the Development Board. CCSV5 already comes with zylincdt, so you only need to construct

Gdbserver and gdbserver porting in Ubuntu 10.04 (for CCSV5.2 remote debugging ARM CORTEX-A8 program ).

Recently you need to use CCSV5 to use gdbserver to remotely debug the ARM cortex-a8 program, port the successful gdbserve, use the version package is gdb-7.1, the host environment is ubuntu10.04, the nfs file system mounted on the Development Board. CCSV5 already comes with zylincdt, so you only need to build the gdbserver on the Development Board. The following is a detailed process.

1. Download and install gdb
Download gdb-7.1.tar.bz2 to the working directory
Gdb source code download: http://ftp.gnu.org/gnu/gdb/
The command is as follows:
$ Tar-jxvf gdb-7.1.tar.bz2
$ Gdb-7.1 cd
$ Sudo./configure -- target = arm-none-linux-gnueabi -- enable-sim -- prefix =/home/ss/develop_environment/gdb7.1
-- Prefix is used to specify the installation path
$ Make
If any error occurs
Linux-arm-low.c: 61: 21: error: sys/reg. h: No such file or directory
Make: *** [linux-arm-low.o] Error 1
Gdb-7.1/gdb/gdbserver/linux-arm-low.c in:
# Ifdef HAVE_SYS_REG_H
// # Include (Comment this line)
# Endif
Then re-make
$ Sudo make install
 
You can find the arm-linux-gdb file in/home/ss/develop_environment/gdb7.1.
 


2. Compile and install the arm-linux-gdbserver (gdbserver must use gdb to compile files in the directory, so they are not released separately)
Go to./gdb/gdbserver
The command is as follows:
$ Cd gdb/gdbserver./configure -- target = arm-none-linux-gnueabi -- host = arm-none-linux-gnueabi
$ Make CC = arm-none-linux-gnueabi-gcc
(CC = arm-none-linux-gnueabi-gcc is used to specify the arm-linux compiler)
If the PATH_MAX undeclared error occurs during compilation: (most do not)
Add in the hostio. c file
# Include
The reason is that the macro PATH_MAX is Is not defined, but is defined in Medium
(Red indicates that I did not encounter this error during compilation. This error was compiled by netizens and will be left here for future reference)
After compilation is successful, the gdbserver file is generated in the current directory and copied to the Development Board (you can put it in the Development Board/usr/bin/directory so that the gdbserver command can be executed in any directory)
 
3. The compiled gdbserver has the following problems:
Remote 'G' packet reply is too long "0000000000000000000000000000000000000000000000000000000000000000000000000000000000"
GDB remote debugging error Solution
When you use GDB 7.1 for Remote debugging, the following error occurs: remote 'G' packet reply is too long. You need to modify the gdb code to solve this problem: Modify gdb/Remote. in the c file, comment out the following two rows in the process_g_packet function:
// If (buf_len> 2 * rsa-> sizeof_g_packet)
// Error (_ ("Remote 'G' packet reply is too long: % s"), rs-> buf );
Add:
 
If (buf_len> 2 * rsa-> sizeof_g_packet ){
Rsa-> sizeof_g_packet = buf_len;
For (I = 0; I <gdbarch_num_regs (gdbarch); I ++ ){
If (rsa-> regs-> pnum =-1)
Continue;
If (rsa-> regs-> offset> = rsa-> sizeof_g_packet)
Rsa-> regs-> in_g_packet = 0;
Else
Rsa-> regs-> in_g_packet = 1;
}
}

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.