Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?

[Embedded in Electronic Design]

Tracing The Almost Perfect Program



William Wong  |   ED Online ID #22005  |   November 5, 2009

Article Rating: Not Rated

Those of you who write perfect programs the first time around may leave the room. Now for the rest of us, what debug tools do you use?

The crude but effective printf (for C and C++) is probably at the top of everyone’s list. Variations include watch variables in debuggers and control panels for graphical environments like National Instruments’ LabVIEW, but the idea is the same—see what the program is doing and then figure out what’s going wrong.

Unfortunately, printf is often the only technique many programmers know about when it comes to debugging. The problem is that the technique is so easy, at least initially and for small projects, that other debugging tools are frequently overlooked. Some programmers take advantage of conditional compilation so debugging support can be maintained with the program. But the typical approach still adds and deletes printf statements.

Many debuggers provide sophisticated watch windows and macro support that are designed to expose the interior of a running application. These aids are invaluable. Like text editors and the integrated development environments (IDEs) of old, however, they’re distinctly unique.

This isn’t an issue in dealing with a particular debugger for a project, though it makes migration to a new debugger frustrating and tedious. The lack of consistency between debuggers often leads to the least common denominator, the GNU GDB debugger, at least for C/C++.

In the embedded world, collections of open-source tools from different vendors generally include the same compilers and linkers, but a proprietary package often replaces the debugger. This is frequently the case when vendors of development tools migrate to the Eclipse IDE, which is common these days. In this case, the original debugger comes along for the ride.

The printf approach to debugging is essentially the poor man’s version of a trace tool. Developers are usually aware of trace tools, but they typically target tracing system level interfaces. Likewise, hardware trace probes are well known to hardware developers but tend to be overlooked by software developers as useful application debugging tools.

HARDWARE PRINTF
Another overlooked tool, the hardware printf, takes advantage of unused hardware resources such as I/O ports that can be hooked to a logic analyzer to deliver a hardware trace facility. Alternatively, the outputs can drive LEDs or other user interface hardware. This approa

ch gets more interesting in dealing with flexible hardware architectures such as FPGAs and Cypress Semiconductor’s PSoC 3 and 5 microcontrollers (see “Field Programmable I/O Augments 8-Bit Microcontroller”). In these cases, internal signals can be made available without software interaction. Likewise, the ability to add custom logic allows trace information to be massaged.

WORK IN PROGRESS
One interesting emerging option is the Eclipse project’s Debugger Services Framework (DSF). DSF-GDB is building the GDB debugger on DSF and adding new features for reverse debugging, multiprocess, and non-stop debugging support.

It will be the basis for the current GDB 7. DSF provides a modular approach to the debugger and should provide extensibility similar to the rest of the Eclipse framework. This should permit a more extensible debugger while enabling the kinds of extensions in proprietary debuggers.

So if you don’t initially spawn perfect programs, let me know what your debugging regimen is like and how your debugger and trace tools fare against the competition.

ECLIPSEwww.eclipse.org




Reprints     Printer-Friendly    Email this Article    RSS        Font Size     What's This?


  • Network-On-Chip Tools Arrive for The Masses
  • Tackling System Design Challenges Through Early Verification
  • ESL Tools Take Center Stage As Designers Move Up
  • Parasitic Extraction Tool Targets Next-Generation Custom ICs
  • Synopsys Jumps Into ESL-Synthesis Pool
  • Verify Control Systems Before Committing To Hardware
  • You're Using How Many FPGAs?
  • Tool Up For The FPGA Blitz
    1) Build A Smart Battery Charger Using A Single-Transistor Circuit
    (180 views today)
    2) Hot Hands For Some Cool Rock: Motion Sensing Meets Audio Engineering
    (164 views today)
    3) Adjustment-Free Fan Controller For Under $1
    (117 views today)
    4) What's All This Transimpedance Amplifier Stuff, Anyhow? (Part 1)
    (112 views today)
    5) Science Fiction Meets Science Fact In Today's Robot Research
    (112 views today)
    ALL TOP 20







    POST YOUR COMMENTS HERE

    Name:

    Email:
    Rate this article:

     less useful more useful 
    1
    2
    3
    4
    5
    Your Comments:

    Enter the text from the image below




    Please refresh the page if you have trouble reading this text.
    (Acceptable Use Policy)
     
     

    PartFinder

    Find real-time pricing, stock status, same-day/next-day shipping options and more. Brought to you by Digi-Key. Go to PartFinder.    
    GlobalSpec

    PART SEARCH :
    Powered by: GlobalSpec - The Engineering Search Engine
    Sponsored Links

    Electronic Design Europe Electronic Design China EEPN Power Electronics Auto Electronics Microwaves & RF
    Mobile Dev & Design Schematics Find Power Products Military Electronics EE Events Related Resources