Debugging remotely on DaVinci using gdb

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

An alternative walkthrough more specific to MVL 5.0 debugging is available at Debugging a Linux Application with MontaVista 5.0

Remote debugging using GDB

This topic discusses how to debug Linux applications remotely on your target using GDB (the GNU Debugger). This procedure applies to user space applications. If you want to debug the Linux kernel you will want to use KGDB, BDI2000/BDI3000, Lauterbach or Ronetix_PEEDI.

We will discuss how to debug the decode demo included in the DVEVM, but the instructions apply to any Linux application.

The application you want to debug should have debugging symbols added using the -g flag, and preferably be compiled without optimization.

In our case this means we need the debug version of the decode demo. This executable is named decoded and is available from /path/to/DVEVM/demos/decode/debug/decoded.

On your target execute /sbin/ifconfig to find out the target ip address (assuming 192.168.1.101 going forward). Now execute ./loadmodules.sh as always to insert necessary kernel modules (CMEM on ARM Linux-based devices, and DSP Link for heterogeneous devices). Then execute:

gdbserver localhost:4567 ./decoded -v data/videos/davincieffect_ntsc.m2v

This will launch and halt the decode demo on the target. On your Linux host execute:

arm_v5t_le-gdb /path/to/DVEVM/demos/decode/debug/decoded

and enter the following commands:

target remote 192.168.1.101:4567
b main
cont

GDB should now be halted in the main() function of the decode demo.

Executing one or more of these commands every time can be tedious. Instead, put the commands you execute every time (one per line) in a file somewhere on your host file system and name it something like gdbstart.txt. To execute these commands when gdb is started execute arm_v5t_le-gdb -x gdbstart.txt. Alternatively if you are always working on one project you can put the commands in your .gdbinit file in your home directory (this way they will always be executed when you start gdb).

Note! The Montavista Linux target file system comes with a gdb compiled for ARM which you can execute locally on the target using gdb. This can sometimes be simpler than remote debugging.

Commonly used GDB commands

You can display mixed C/ASM by executing display/i $pc. Then step using si to get a view of each source line as both C and ASM.

Note! If you press return without giving a command in GDB you will execute the last command you gave once again. This is particularly useful for single stepping.

Gdb is complete with a command line history, tab completion of variable names and commands, and scripting / aliasing of commands.

Wrapping Remote GDB with Eclipse

Eclipse provides an nice GUI that can sit on top of GDB. To configure Eclipse to remotely debug over gdb you need to do the following


  1. Download Eclipse from Eclipse Downloads page. Make sure that you download for your host OS. The C/C++ version is the one we want.
  2. Install Eclipse by following the procedures that are provided by their documentation
  3. To setup remote debug, you need to create and configure a project.
  4. In project configuration, there is a debug tab. Choose that tab
  5. Choose gdbserver Debugger as the Debugger option, and browse and choose the path to arm_v5t_le-gdb
  6. Under the connections sub-tab, choose TCP as the connection Type and configure the IP address and Port

Now you should be ready to debug any target application using the Eclipse GUI.

E2e.jpg For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Debugging remotely on DaVinci using gdb here.
Hyperlink blue.png Links
ARM Microcontroller MCU ARM Processor Digital Media Processor Digital Signal Processing Microcontroller MCU Multi Core Processor
Ultra Low Power DSP 8 bit Microcontroller MCU 16 bit Microcontroller MCU 32 bit Microcontroller MCU

Leave a Comment

Comments

Comments on Debugging remotely on DaVinci using gdb


Ckw089 said ...

It will be great to extend this to include the renote multithreaded application debugging. Especially how to avoid the problem caused by different version of shared libraries on target file system and host.

--Ckw089 01:43, 11 September 2010 (CDT)

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox