I have a problem with Debugging Arduino Code .
I am writing my code using Atmel studio tool chain and flashing
the generated hex file into Arduino board using Xloader. The question is,
You have to make a hardware modification to most arduino boards to get debugging to work, because the auto-reset functionality interferes with debug communications. Also, you DO need external debugging hardware.
Easiest solution: get an Atmel ATmega328P Xplained Mini development board, which has an on-board debugger chip.