How best to do cheap debugging?

I'm hoping to do step by step debugging of code directly on my Arduino, and do it with the minimum of fuss. I'd rather not modify it, and ideally I'd like to step through code, examine/change values, etc in C, not in machine language/registers (although they would be nice in addition). I like the Arduino ide, but I could switch if it's a factor.

For example, I saw this on ebay: http://cgi.ebay.ca/USB-JTAG-adapter-Programmer-Debugger-AVR-atmega-/190531487895

Now if that's all I need, can someone recommend a tutorial?

On the other hand, reading about jtag, ice and debugwire I'm wondering which is best (or even possible) for the Arduino?

Any "in the trenches" advice would be most welcome.

Unfortunately the arduino's processor doesn't support JTAG and so you can't use that product. As far as I know there is no debug support apart from the usual print statement and lighting up LEDs.

The 328s don't support JTAG, but others do - 324/644/1284, 1280/2560, etc. TDI, TDO, TMS, TCK No clue about tools that can take advantage of them, maybe Atmel has stuff.

One can get quite far with print statements & LEDs. And there'w ways to turn the print statements on/off with a define statement at the start of the sketch or something so you don't have to go thru & comment them all out or something.

Yes but JTAG will only work at the machine code level. In theory you can link this to high level language but I don't know of any arduino system. These are normally quite expensive. The UNO32 (only arduino like) promises a debugger but I don't know what that is like.

Thanks for the info - knowing JTAG won't work saves me looking in that direction any further...

Another option - debugwire - has anyone had experience with that?

Of course, this is just a hope for me - I'm quite prepared in the meantime to instrument the code with prints if necessary - I even found some code that lets me do a more 'normal' printf to serial, with multiple parameters:

http://www.arduino.cc/playground/Main/Printf

Atmel has several documents, such as these, that look helpful

http://www.atmel.com/dyn/resources/prod_documents/DOC2475.PDF http://www.atmel.com/dyn/resources/prod_documents/doc2562.pdf