I'm thinking that instead of a debugger, you should probably be checking return values from something. If your program called nmap directly, did it also check the exit status from nmap to make sure it worked properly?
Debuggers are useful, yes, but more important is writing code to tell you what goes wrong when something does go wrong.