X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgldbg.h;h=9f77430e753ec54f13f31b7d504cd14831086dbb;hb=HEAD;hp=9f26de3f34e872485c5129c0e827f1b69c85d896;hpb=8a1580721a939c3edea2ce1b342148e94ad2b814;p=gldbg.git diff --git a/source/gldbg.h b/source/gldbg.h index 9f26de3..9f77430 100644 --- a/source/gldbg.h +++ b/source/gldbg.h @@ -1,38 +1,75 @@ -/* $Id$ - -This file is part of gldbg -Copyright © 2009 Mikko Rasa, Mikkosoft Productions -Distributed under the GPL -*/ - #ifndef GLDBG_H_ #define GLDBG_H_ +#include #include #include -#include -#include -#include "glstate.h" +#include "commandinterpreter.h" +#include "packet.h" +#include "process.h" -class GlDbg: public Msp::Application +class Tool; + +class GlDbg { private: - Msp::FS::Path libdir; - int pid; - std::vector args; + typedef std::list 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 BreakList; + + bool done; + 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 reg; + static GlDbg *instance; 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(); +private: + void send_breakpoint(unsigned short, unsigned char, unsigned char); +public: + 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); + + static void sighandler(int); }; #endif