Though an emulator is quite useful for debugging code that has no side effects, most real-world applications include some circuitry besides the Arduino. If a microcontroller on an Arduino had a JTAG interface, it would be pretty straight-forward, but what if it's e.g. an Arduino Uno?
2 Answers
The Arduino Uno uses the Atmel Atmega328p microcontroller, which only has one debug option, DebugWire. There are a few tools that can work with it, but the least expensive and most commonly available is the AVR Dragon.
You can use AVR Studio 6 for this. You can use the .elf file file produced during the Arduino build process directly, but setting up the debugger is a little easier if you port the Arduino program to the AVR Studio. It's not difficult, but there are a lot of little pieces to deal with. There are guides online to help you through this.
- 678
- 5
- 7
This might not be right for you, but the Visual Micro plugin for Atmel Studio and Visual Studio has a USB debugger which only uses Arduino code.
In the background the debugger uses Serial which might affect some time-sensitive applications.

- 435
- 3
- 12
- 1,027
- 6
- 13