summaryrefslogtreecommitdiffstats
path: root/debugger.h
diff options
context:
space:
mode:
Diffstat (limited to 'debugger.h')
-rw-r--r--debugger.h64
1 files changed, 43 insertions, 21 deletions
diff --git a/debugger.h b/debugger.h
index 6305e96..cea3bba 100644
--- a/debugger.h
+++ b/debugger.h
@@ -3,18 +3,20 @@
#include <sys/user.h>
#include <unistd.h>
-#include "console.h"
#include "list.h"
-#define BREAKPOINT_INSN 0xcc
-
struct breakpoint {
LINKEDLIST;
+
unsigned long address;
+ unsigned long text;
+ int installed;
+ int hits;
+ int user;
+
unsigned long stack;
- unsigned long orig;
+ pid_t tid;
int enabled;
- int active;
};
struct map {
@@ -27,29 +29,49 @@ struct map {
struct state {
LINKEDLIST;
struct user_regs_struct regs;
- struct user_fpregs_struct fpregs;
struct list maps;
};
-struct tracee {
- struct list breaks;
+struct process {
+ LINKEDLIST;
+ pid_t id;
+ int child;
+ struct list breakpoints;
+ struct list threads;
+ char status[128];
+};
+
+struct thread {
+ LINKEDLIST;
+ struct process *proc;
+
struct list states;
struct state *state;
+ int clearstates;
+
pid_t id;
- int child;
int stopped;
- int status;
int signal;
- int cont;
- void *buff;
- size_t buffsize;
+ int doing;
+ int donext;
+
+ char status[128];
};
-extern int dbg_process(struct tracee *dbg, pid_t pid);
-extern int dbg_new_process(struct tracee *dbg, char **argv, struct console *cons);
-extern int dbg_wait(struct tracee *dbg);
-extern int dbg_stepin(struct tracee *dbg);
-extern int dbg_stepover(struct tracee *dbg);
-//extern int dbg_stepout(struct tracee *dbg);
-extern int dbg_cont(struct tracee *dbg, int mode);
-extern void *deref(struct tracee *dbg, unsigned long addr, size_t size);
+extern struct breakpoint*add_breakpoint(struct process*proc,unsigned long address);
+extern struct breakpoint*get_breakpoint(struct process*proc,unsigned long address);
+
+extern struct process *dbg_attach(pid_t pid, int child);
+extern void dbg_detach(struct process *proc);
+extern int dbg_free(struct thread *th);
+
+extern void dbg_sync(struct process *proc);
+
+extern int dbg_intr(struct thread *th);
+extern int dbg_cont(struct thread *th);
+extern int dbg_syscall(struct thread *th);
+extern int dbg_stepin(struct thread *th);
+extern int dbg_stepover(struct thread *th);
+extern int dbg_stepback(struct thread *th);
+
+extern void *deref(struct thread *th, unsigned long address, size_t size);