X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgldbg.h;h=dd6d60c6d8f1a97c13078d6da3fe51e82498228a;hb=81f1ddee977603293d0c5710f2db69130dac6a96;hp=5f75164539153b06554bd41fcae0528b6f639b88;hpb=c6b2f7585d51164dc32f4dd2a05855913e464c58;p=gldbg.git diff --git a/source/gldbg.h b/source/gldbg.h index 5f75164..dd6d60c 100644 --- a/source/gldbg.h +++ b/source/gldbg.h @@ -1,48 +1,78 @@ /* $Id$ This file is part of gldbg -Copyright © 2009 Mikko Rasa, Mikkosoft Productions +Copyright © 2009-2011 Mikko Rasa, Mikkosoft Productions Distributed under the GPL */ #ifndef GLDBG_H_ #define GLDBG_H_ +#include #include #include -#include -#include #include "commandinterpreter.h" +#include "packet.h" #include "process.h" -#include "tracer.h" -class GlDbg: public Msp::Application +class Tool; + +class GlDbg { private: + 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; + CommandInterpreter cmd_interp; Process process; int sock_fd; std::string buffer; unsigned buf_offset; bool flushing; - Tracer tracer; + 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(); - Tracer &get_tracer() { return tracer; } + CommandInterpreter &get_command_interpreter() { return cmd_interp; } Process &get_process() { return process; } void launch(); - void quit(); + 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 check_child(); void read_stream(); - long ptrace(int, void *, void *); - virtual void sighandler(int); + Breakpoint *get_breakpoint(unsigned short, unsigned char); + + static void sighandler(int); }; #endif