Can anyone tell how to debug the sketch of arduino

hi friends,

can anybody tell me how to debug the sketch . is there any third party tools available for debugging without visualmicro ? kindly help me out how to debug the code