There are a number of hardware debuggers that one can use when one wants to debug debugWIRE MCUs. All the commercial debuggers can be used with Microchips’s IDEs. Most of them can also be used employing open-source gdbservers.
Available commercial hardware debuggers
The most affordable one is MPLAB SNAP. You can currently get it for less than €10.00. However, you have to invest a bit to buy cables, adapters, or connectors. It comes simply as a bare PCB. However, if you only want to debug debugWIRE chips, you can order a small PCB from OSH Park (€3.00 + custom), a more versatile PCB at eBay (€10) or you can buy an adapter set from Microchip (roughly €25).

The MPLAB PICkit5 is slightly more expensive, around €120.00. It can power the target system and be used to program targets offline. Similar to the SNAP, it comes without cables or adapters.

A classic hardware debugger is Atmel-ICE, which used to cost roughly €250.00, including cables and adapters. I bought mine from Waveshare, which offers much better deals. They use the original PCB and then produce their own enclosure and cables. The enclosure is made from aluminium and looks more durable than the standard enclosure. The only drawback is that the squid cable terminals that I got are numbered the wrong way (from 0 to 9 instead of from 1 to 10). Most recently, Microchip has lowered the price for these debuggers to less than €100.

From this point on, it gets much more expensive. MPLAP ICE 5, MPLAB ICD 5, and Atmel Power Debugger are all hardware debuggers that cost more than €300.00. However, you can get used ones for much less on eBay, as I did a few days ago.

Available embedded debuggers
Microchip sells some development boards with an onboard hardware debugger. And these boards are very affordable. The XPLAINED-MINI series with ATmega168PB, ATmega328P, and ATmega328PB all cost around €17.00. And they have an Arduino Uno footprint so that you can plug Arduino shields on top of them.

Obsolete debuggers
There is a long list of debuggers that are no longer produced, but you can still use them with Microchip’s software and/or open-source software. The problem is, however, that the list of supported chips might not include the ones you care about.
The most popular obsolete debugger is probably the AVR Dragon because it was quite powerful. It supported ordinary ISP programming and debugging as well as so-called high-voltage programming. In addition, it was quite affordable (around € 60).

By User:Jim1138 – Image taken by Jim1138., GFDL, https://commons.wikimedia.org/w/index.php?curid=7914327
Let me mention two hardware debuggers that are not produced any longer. However, they are very versatile because they support the EDBG protocol (see below). These are PICkit4 and JTAGICE3 shown in the following picture.

EDBG-based hardware debuggers
Let me finally categorize the Microchip debuggers along the dimension of the supported protocol. A number of them use the so-called EDBG protocol, which was in particular developed for embedded debuggers that are shipped on development boards. The following debuggers fit this description:
- MPLAB PICkit 4 In-Circuit Debugger (when in ‘AVR mode’),
- MPLAB Snap In-Circuit Debugger (when in ‘AVR mode’),
- Atmel-ICE,
- Atmel Power Debugger,
- JTAGICE3 (firmware version 3.0 or newer),
- EDBG – on-board debuggers on Xplained Pro/Ultra,
- mEDBG – on-board debuggers on Xplained Mini/Nano, and
- nEDBG – on-board debuggers on Curiosity Nano.
The interesting thing about these debuggers is that there exist Python scripts that support the communication with these debuggers, which can be used to write a full-blown gdbserver for debugWIRE chips (and others).
DIY hardware debuggers
Based on Risku’s reverse engineering work, several DIY hardware debuggers have been developed. However, the big question is what a hardware debugger really is. Before we answer this question, let us consider some examples of systems that connect to debugWIRE OCDs.
The first DIY hardware debugger for debugWIRE MCUs that I tried is the Arduino sketch DebugWireDebuggerProgrammer. It provides a console-line interface (CLI) that enables you to inspect variables, set one (hardware) breakpoint, step through the program, or resume execution. The only hardware you need is an Arduino Uno. So the hardware is here a standard board with some clever firmware. As one can see in the next picture (taken from the video of this project), the author also designed an adapter board to make programming and debugging easier.

One can build a hardware debugger with even less hardware. Dwire-debug is a C program that uses only a USB/UART converter and a diode in order to access the debugWIRE interface. It also provides a CLI and a gdbserver interface, i.e., you can use the GDB debugger to debug an Arduino sketch running on an Arduino board. However, as in the case above, one can only use the one hardware breakpoint debugWIRE provides.

A similar approach was chosen by the dwtk project. It consists of a gdbserver written in the Go language and the hardware that is called dwtk-ice. I have not tried this one.

Another interesting project is gdb-debug-wire-integrated-server. It implements a gdbserver on the ATmega16U2 chip on an Uno board that is used as the USB-UART-converter. A number of physical modifications of the Uno board are necessary for this work.
My contribution to this long list is dw-link. Since I could not get dwire-debug running on my Mac, I took the best parts from dwire-debug and DebugWireDebuggerProgrammer, resulting in an Arduino sketch providing a full-scale gdbserver over the serial line. I also added several niceties, such as robust adaptive single-wire communication, automatic power-cycling, software breakpoints, and speeding up the debugWIRE communication. As in the case of DebugWireDebuggerProgrammer, the hardware is simply an Arduino board. The only additional hardware necessary are jumper cables or a modified ISP cable so that you can connect the hardware debugger to the target. Optional extensions are a 10µF capacitor in order to block the auto-reset feature and a LED to signal the internal state.

Additionally, I designed an Arduino shield that enhances the debugger’s capabilities, e.g., supporting 3.3 V systems, disconnecting the ISP lines when they are not used, and providing power up to 200 mA. Below, you see the debugger with the shield in action.

Returning to the question of what a hardware debugger is, I would say that it is anything that makes it possible to talk with the OCD on your chip.
