GlDbg *GlDbg::instance = 0;
GlDbg::GlDbg(int argc, char **argv):
+ done(false),
cmd_interp(*this),
process(vector<string>(argv+1, argv+argc)),
+ sock_fd(-1),
buf_offset(0),
flushing(false),
got_sigchld(false),
printf("Copyright © 2009-2010 Mikkosoft Productions\n");
printf("Type \"help\" for a list of commands\n");
- while(1)
+ while(!done)
tick();
return 0;
void GlDbg::send(GlPacket *pkt)
{
+ if(process.get_state()==Process::INACTIVE)
+ throw runtime_error("Program is not running");
+
packet_send(pkt, sock_fd);
}
{
if(!force && process.get_state()!=Process::INACTIVE)
throw runtime_error("Program is still running");
- exit(0);
+ done = true;
}
void GlDbg::tick()
free(line);
}
else if(pstate==Process::INACTIVE)
- exit(0);
+ done = true;
}
}