Oh, to be a software developer in Lake Wobegon. In this fictional Minnesota town, created by Garrison Keeler for his radio show, A Prairie Home Companion, “all the women are strong, all the men are good looking, and all the children are above average.” It’s safe to assume that programmers in Lake Wobegon find that their applications compile correctly the first time, run flawlessly, require no debugging and never, ever need optimization.
Unless you live in Lake Wobegon, you probably need to debug applications from time to time. Most developers coming from the desktop or server worlds are used to debugging right on the target platform – on a desktop or server, either directly or using a KVM over the network.
However, when it comes to debugging software written for a Moblin-based netbook or Mobile Internet Device, you’re in a different world. On one hand, your target device is stable and robust, thanks to its nice Intel Atom processor and a version of Linux that you can work with directly. On the other hand, MIDs and netbooks have small screens, limited input options and probably don’t even have the open source GNU software development toolset installed.
Fortunately, we don’t have to use the target device as our debugging solution. We can use software tools, like the Intel Application Debugger 2.x for Intel Atom Processor (which I’m going to simply call the Application Debugger) to make everything a lot easier.
Meet the Application Debugger
The Application Debugger is a key part of the Intel Application Software Development Tool Suite for Intel Atom processor. Available in the U.S. for $599 (pricing may vary in other countries), the full suite contains the Intel C++ Compiler for Linux OS, the Application Debugger, the Intel Integrated Performance Primitives Libraries for Linux OS and Intel VTune Performance Analyzer for Linux OS. We’re not going to cover those other tools here; our focus in this article is on the debugger.
Intel describes the Application Debugger as:
The Intel Application Debugger for Intel Atom processor supports all aspects of debugging, from low-level assembler debugging to high-level language C++ application debugging, with full execution trace support, which helps to identify errors that are normally hard to detect.
The Application Debugger supports native development and testing of Moblin technology-based applications within a KVM environment on the development host before they run on a real Intel Atom processor-powered device. Native testing reduces time and simplifies the development process. The full GUI-driven application debugger supports execution trace support to look back to the history of an executed program, providing OS awareness and thread aware debugging.
Another feature: the debugger supports cross debug from your development host to the actual Atom processor-based based target platform using a small debug agent and TCP/IP communication. The same method is being used for local loop-back smoke testing or virtual machine-based software debug and testing.
Oh, it’s important to note that as we’ll discuss later, execution trace support requires a kernel patch, which is included with the tool suite distribution.
The Eclipse-based Application Debugger has special features that make it ideal for working on Moblin-based projects. It has deep understanding of the Atom processor architecture, including its SSE3 instruction set, and how execution flows through that chip. Not only that, but it has deep understanding of Linux and Moblin, and can handle and display all relevant kernel info, and debugs your app in context with the Moblin operating system. You could, for instance, tell the debugger to halt execution on a specific OS signal (like a segmentation fault) and then use the execution trace to find out how this exception got thrown and identify its root cause.
System requirements should not be a problem. The target device should be running either the Intel Atom processor with Linux 2.6.x, Moblin 2.x, or another Moblin-compliant OS. The host system (i.e., the development workstation) can be any Intel-based workstation running Ubuntu, Asianux or Fedora Linux.
Ready, Set, Debug
One of the beautiful features of the Application Debugger is that you can sit at your workstation and debug an application running on the target device. Just make sure that both the workstation and the target are on the same network. You’ll need to install a little remote server app onto the target; that remote server app can be found on your workstation (after you install the tool suite, of course), at /opt/intel/atom/idb/2.0.xxx/server. Just copy the remote server app over to the target and start it up before you begin the debug session. It is recommended that you start the remote server app up while you’re running as root.
Oh, you’ll also need to prepare your application! It’s generally a good idea, when you’re beginning to debug a new application, to compile it with debug information and without optimizations. You can apply optimizations later, once the application is running to your satisfaction. Use the command-line compiler switch –g to include debug info and –O0 to disable optimizations.
However, if you need to debug your already optimized code and need to track down problems that only occur with optimized code you can of course use the debugger for this purpose as well – as long as you are aware of the effects instruction reordering, inlining and variable propagation in registers can have on the quality of the symbol info.
Okay: You’ve compiled your applications (and installed it onto the target). You’ve also copied the remote server app onto your target (and started it as root). Now, go back to your development workstation and fire up the Application Debugger. Press the Connect button, provide the IP address of your target device, and the Application Debugger should be able to connect to the target. Now, you’re in – it’s time to start debugging! From here, using the debugger is straightforward and intuitive. Refer to the Application Debugger’s documentation for more details, if needed.
Extra Debugging Functionality
The Application Debugger is the perfect tool for remote debugging for Moblin applications on a MID or netbook. It runs on your workstation, but can instrument your target device over the network. It understands the specifics of the Intel Atom processor architecture, and it debugs Linux applications in context. But that’s not all it can do.
The Application Debugger also has the ability to reach beyond your Moblin app into shared libraries. Just make sure that the shared library’s source is available on your target system.
Want to do on-chip execution trace? If you’re interested in that, you can patch the target device’s Linux kernel (see the debugger’s installation guide) and you’ll be able to do that as well.
To summarize: There’s a lot of functionality in the Application Debugger, and it’s just what we need for fixing apps on mobile devices. The above-average citizens of Lake Wobegon are waiting for their new Moblin applications, so let’s get to work.
Application Debugger Resources
Tool Suite documentation: http://software.intel.com/en-us/articles/intel-application-tool-suite-documentation/
Application Debugger installation guide: http://software.intel.com/sites/products/documentation/hpc/atom/application/install_idb.htm
White Paper on using the Application Debugger: http://software.intel.com/sites/products/documentation/hpc/atom/application/using_idb.pdf
White Paper on the Tool Suite: http://software.intel.com/sites/products/documentation/hpc/atom/application/tool_suites.pdf
Moblin Integration Guide for the Tool Suite: http://software.intel.com/sites/products/documentation/hpc/atom/application/moblin_guide.pdf
* All names and brands are the property of their respective owners. Moblinzone is funded by Intel Corporation.
Alan Zeichick is principal analyst at Camden Associates, where he advises enterprises about technology challenges, writes for technology print and online publications and speaks at industry events on enterprise IT, networking, security, software engineering and consumer electronics. Meanwhile, as editorial director of BZ Media’s SD Times, Zeichick drives forward the industry newspaper for software development managers.
A former mainframe developer and systems analyst, Zeichick became a technology analyst and journalist in 1984. He has authored more than 3,000 articles, worked with consulting groups, including PricewaterhouseCoopers, IDC and Anderson Consulting, and has spoken at numerous events such as COMDEX, Networld+Interop, Microsoft TechEd, JavaOne and the Software Development Conference.
Read his personal blog at ztrek.blogspot.com, and follow him at twitter.com/zeichick.


