]> git.tdb.fi Git - gldbg.git/blobdiff - source/gldbg.cpp
Fix limit query in Inspector/GlState
[gldbg.git] / source / gldbg.cpp
index 4bc169fcd0079abb2f99811a87db777266e4e86f..9da31ea85917f76731126188690ee1727b0058dc 100644 (file)
@@ -20,8 +20,10 @@ using namespace std;
 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),
@@ -56,7 +58,7 @@ int GlDbg::main()
        printf("Copyright © 2009-2010 Mikkosoft Productions\n");
        printf("Type \"help\" for a list of commands\n");
 
-       while(1)
+       while(!done)
                tick();
 
        return 0;
@@ -132,7 +134,7 @@ void GlDbg::set_breakpoint(unsigned short func, unsigned char flag, Tool *owner)
                        breakpoints.back().add_owner(owner);
                }
 
-               if(process.get_state()>=Process::RUNNING)
+               if(process.get_state()!=Process::INACTIVE)
                        send_breakpoint(func, flag, 0);
        }
 }
@@ -156,7 +158,7 @@ void GlDbg::clear_breakpoint(unsigned short func, unsigned char flag, Tool *owne
                                        break;
                                }
 
-                       if(process.get_state()>=Process::RUNNING)
+                       if(process.get_state()!=Process::INACTIVE)
                                send_breakpoint(func, 0, flag);
                }
        }
@@ -179,7 +181,7 @@ void GlDbg::quit(bool force)
 {
        if(!force && process.get_state()!=Process::INACTIVE)
                throw runtime_error("Program is still running");
-       exit(0);
+       done = true;
 }
 
 void GlDbg::tick()
@@ -225,7 +227,7 @@ void GlDbg::tick()
                        free(line);
                }
                else if(pstate==Process::INACTIVE)
-                       exit(0);
+                       done = true;
        }
 }