]> git.tdb.fi Git - gldbg.git/blobdiff - source/gldbg.h
Track owners of breakpoints
[gldbg.git] / source / gldbg.h
index fce7d7fa2fd4790f4fa96439690a8ce34875d945..99f0863c2c3f72cf91852ea0e356781aed23994c 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of gldbg
-Copyright © 2009  Mikko Rasa, Mikkosoft Productions
+Copyright © 2009-2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the GPL
 */
 
@@ -12,27 +12,67 @@ Distributed under the GPL
 #include <vector>
 #include <msp/core/application.h>
 #include <msp/fs/path.h>
-#include "gldecoder.h"
+#include "commandinterpreter.h"
+#include "packet.h"
+#include "process.h"
+
+class Tool;
 
 class GlDbg: public Msp::Application
 {
 private:
-       Msp::FS::Path libdir;
-       int pid;
-       std::vector<std::string> args;
+       typedef std::list<Tool *> ToolList;
+
+       struct Breakpoint
+       {
+               unsigned short function;
+               unsigned char flag;
+               ToolList owners;
+
+               Breakpoint(unsigned short, unsigned char);
+
+               void add_owner(Tool *);
+               bool has_owner(Tool *) const;
+               void remove_owner(Tool *);
+       };
+
+       typedef std::list<Breakpoint> BreakList;
+
+       CommandInterpreter cmd_interp;
+       Process process;
        int sock_fd;
        std::string buffer;
        unsigned buf_offset;
-       GlDecoder *glprint;
+       bool flushing;
+       ToolList tools;
+       bool got_sigchld;
+       int stop_reason;
+       BreakList breakpoints;
+       const Breakpoint *current_break;
+       ToolList break_holders;
 
        static RegApp<GlDbg> reg;
 
 public:
        GlDbg(int, char **);
+       ~GlDbg();
+
        int main();
+       CommandInterpreter &get_command_interpreter() { return cmd_interp; }
+       Process &get_process() { return process; }
+       void launch();
+       void send(GlPacket *);
+       void hold();
+       void set_breakpoint(unsigned short, unsigned char, Tool *);
+       void clear_breakpoint(unsigned short, unsigned char, Tool *);
+       void resume_from_break(Tool *);
+       void quit(bool);
 private:
        void tick();
-       void launch();
+       void check_child();
+       void read_stream();
+       Breakpoint *get_breakpoint(unsigned short, unsigned char);
+       virtual void sighandler(int);
 };
 
 #endif