dw-link can turn your Arduino board into a hardware debugger, and dw-probe connects it to any target board.
Continue readingCategory: Debugging
Everything about debugging

That’s One Small Step for a Man, One Giant Leap for a Debugger: On Single-Stepping and Interrupts
The featured image of this post is by WikiImages on Pixabay
You want to make a single step in your program, but the debugger takes you to some unknown area of the program. This was, in fact, my first experience when I tried out Microchip’s MPLAB X IDE debugger on the innocent blinking sketch. Is this a bug or a feature?
Continue readingThere has never been an unexpectedly short debugging period in the history of computers
… but the periods might have become shorter with the right tools

dw-link: A New Hardware Debugger for ATtinys and Small ATmegas
As mentioned in an earlier blog post this year, hardware debuggers are the premier class of embedded debugging tools. However, until today, there were only very few relatively expensive tools around supporting the debugWIRE interface that is used by the classic ATtinys and a few ATmega MCUs.
The good news is that now you can turn an Arduino UNO, Nano, or Pro Mini into a debugWIRE hardware debugger that communicates with avr-gdb
, the AVR version of the GNU project debugger.

Surprise, Surprise!
The featured image of this post is by Albert Guillaume – Gils Blas, 24 décembre 1895, Public Domain, Link
When you develop a tool for a protocol that is undocumented, it is not surprising that you will encounter situations you will not have be anticipated. This was exactly what I experienced developing the hardware debugger dw-link, which connects debugWIRE MCUs to the GDB debugger. Although a substantial part of the debugWIRE protocol has been reverse-engineered, I encountered plenty of surprising situations: Split personality MCUs, stuck-at-one bits in program counters, secret I/O addresses, half-legal opcodes, and more.
Continue reading
Debugging a Debugger With Itself
The featured image of this post is is a comic from xkcd.com.
The above xkcd comic, which is titled Debugger, alludes to the concern that when you try to apply a particular method to itself, you might not get what you asked for. Turing’s Halting problem is a very famous example of this, i.e., you cannot algorithmically decide whether an algorithm terminates on an input. So, does that issue apply to debuggers as well? In particular, I asked myself whether it makes sense to debug the hardware debugger I am developing with itself.
Continue reading
Link-Time Optimization and Debugging of Object-Oriented Programs on AVR MCUs
The featured image of this post is based on a picture by TheDigitalArtist on Pixabay.
Link-time optimization (LTO) is a very powerful compiler-optimization technique. As I noticed, it does not go very well together with debugging object-oriented programs under GCC, at least for AVR MCUs. I noticed that in the context of debugging an Arduino program, and it took me quite a while to figure out that LTO is the culprit.
Continue readingLubarsky’s Law of Cybernetic Entomology: There’s always one more bug
(Who the hell is Lubarsky?)

Doing it the Logical Way
When things go wrong, although your program logic appears to be correct, it is time to look at the signals going into the MCU and coming out of the MCU. The best tool for that is a logic analyzer.
Continue readingTesting is not responsible for the bugs inserted into software any more than the sun is responsible for creating dust in the air.
(Dorothy Graham)
While I have talked a lot about bugs and debugging in my tutorial, I still have to tell you when to start debugging in the first place and why testing is an important task in the development process.