Debugging with DDD

From EdWiki

Revision as of 04:47, 7 March 2012 by Jshankar (Talk | contribs) (1 revision: Importing from edes32)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

What is DDD?

GNU DDD is a graphical front-end for command-line debuggers such as GDB, DBX, WDB, Ladebug, JDB, XDB, the Perl debugger, the bash debugger bashdb, the GNU Make debugger remake, or the Python debugger pydb. Besides usual front-end features such as viewing source texts, DDD has become famous through its interactive graphical data display, where data structures are displayed as graphs.

DDD is a front-end to a command-line debugger (called inferior debugger, because it lies at the layer beneath DDD). DDD supports the following inferior debuggers:

To debug executable binaries, you can use DDD with GDB, DBX, or XDB.

  • GDB, the GNU debugger, is the recommended inferior debugger for DDD. GDB supports native executables binaries originally written in C, C++, Java, Modula-2, Modula-3, Pascal, Chill, Ada, and FORTRAN.

How to install?

sudo apt-get install ddd

How to Run?

ddd --debugger arm-none-eabi-gdb wordcopy.elf

After a few seconds, DDD comes up. The Source Window contains the source of your debugged program; use the Scroll Bar to scroll through the file.

Initial DDD Window

The Debugger Console (at the bottom) contains DDD version information as well as a GDB prompt.
GNU DDD 3.3.12 (i686-pc-linux-gnu), by Dorothea Lütkehaus and Andreas Zeller.
Copyright © 1995-1999 Technische Universität Braunschweig, Germany.
Copyright © 1999-2001 Universität Passau, Germany.
Copyright © 2001 Universität des Saarlandes, Germany.
Copyright © 2001-2004 Free Software Foundation, Inc.
Reading symbols from /home/jshankar/arm-asm-examples/wordcopy/wordcopy.elf...done.

The first thing to do now is to place a Breakpoint, making sample stop at a location you are interested in. Click on the blank space left to the initialization of a. The Argument field (): now contains the location (sample.c:31). Now, click on Break to create a breakpoint at the location in (). You see a little red stop sign appear in line 31.

The next thing to do is to actually execute the program, such that you can examine its behavior. Select Program > Run to execute the program; the Run Program dialog appears.