debug program

Dear all

Does anyone know if there is a debug program for a arduino. i mostly struggeling with the software and do some try and error things, on the board itself. It would be nice to run the sketch on a simulator programs which is on the PC