X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgldbg.h;h=36ca1df25848a83c22333183cb3f869974af9507;hb=d72ef6d75a11f6cc05ab8ec039520719e1044741;hp=d8b56f825e2c92b0135f16e4bfd2b3db0f67fca7;hpb=7bd7fc784a6f6cff69f79914a445bc2115a7e768;p=gldbg.git diff --git a/source/gldbg.h b/source/gldbg.h index d8b56f8..36ca1df 100644 --- a/source/gldbg.h +++ b/source/gldbg.h @@ -1,35 +1,49 @@ -/* $Id$ - -This file is part of gldbg -Copyright © 2009-2010 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" class Tool; -class GlDbg: public Msp::Application +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; - std::list tools; + 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 **); @@ -39,13 +53,19 @@ public: 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 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