You might want to read this :
http://www.console-d...bort-exception/ ; it explains how to use the "guru meditation error" you might sometimes see in homebrew games (among other things) to debug your games. Basically, every time your program crashes, it will give you information which you can use to know which line of your code is faulty. Of course, it's only one tool and it won't give useful information every time, but it's better than nothing, and it'll work on the DS (you don't need an emulator to get it to work).