#include <msp/core/application.h>
#include <msp/fs/path.h>
#include "commandinterpreter.h"
-#include "glstate.h"
+#include "packet.h"
#include "process.h"
-#include "profiler.h"
-#include "tracer.h"
class Tool;
class GlDbg: public Msp::Application
{
private:
+ 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;
bool flushing;
- std::list<Tool *> tools;
- Tracer tracer;
- GlState glstate;
- Profiler profiler;
+ 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; }
- Tracer &get_tracer() { return tracer; }
- GlState &get_glstate() { return glstate; }
- Profiler &get_profiler() { return profiler; }
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 *);
+ Breakpoint *get_breakpoint(unsigned short, unsigned char);
virtual void sighandler(int);
};