Arm-Linux-GDB + gdbserver environment setup and remote debugging

Source: Internet
Author: User

0) GDB source code download: http://ftp.gnu.org/gnu/gdb/

1) Compile arm-Linux-GDB

Specifies the location of the cross-compilation tool chain

Export Path = $ path:/usr/local/ARM/3.4.1/bin
Start configuration and compilation

$ Gdb-6.6 CD
$./configure --target=arm-linux --prefix=/usr/local/arm/gdb -v
   $make
   

Some areas may be compiled in the middle, such

gdb declared with attribute warn_unused_result

After checking, it is found that the check is too strict. You can simply remove the forced warning checks similar to-wall in makefile.

 

2) Compile gdbserver
$ Cd gdb/gdbserver
$./Configure -- target = arm-Linux -- Host = arm-Linux
Target indicates that the compiled gdbserver runs on ARM-Linux. The reason why the host is not set is that
Arm-Linux-GDB runs on PC Linux, just like arm-Linux-GCC (well understood :))
$
make CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc

 

   #gdbserver 192.168.1.200:7777 test
     Process test created; pid                                                                                   
     Listening on port 7777

Under the host Shell
$ Cd ~ /Tftpboot
$ Arm-Linux-GDB Test
Gnu gdb 6.6
Copyright (c) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
Welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "-- Host = i686-pc-linux-gnu -- target = arm-Linux "...
(GDB)
Pay attention to the last -- Host = i686-pc-linux-gnu -- target = arm-Linux that shows the information...
Target remote 192.168.1.168: 7777 -- connect to gdbserver
Remote debugging using 192.168.1.168: 7777
0x40000dd0 in _ start () from/lib/ld-linux.so.2
Indicates that the server is connected, :), and debugging is now available. Arm-Linux-GDB and GDB are used in the same way, but they do not have the R command.
Run the C command to run the program.
(GDB) L
1 # include <stdio. h>
2
3 int main ()
4 {
5 char * PTR = "csdn ";
6 printf ("% C/N", * (PTR ++ ));
7 return 0;
8}
(GDB) B 3
Breakpoint 1 at 0x83d0: file test. C, line 3.

In addition, because the program runs on the target board and debugging is in the PC, the program results will still be displayed on the target board,
For example, minicom and LCD.
BTW: a recent article about GDB: http://blog.csdn.net/haoel/archive/2003/07.aspx. Ha

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.