Some editors/IDEs support Nim debugging:
http://forum.nim-lang.org/t/1139#9445
You can use GDB with the --debugger:native option.
Or you can also use system.writeStackTrace, system.repr, system.locals, system.echo etc.