#pragma once #include #include #include "console.h" #include "list.h" #define BREAKPOINT_INSN 0xcc extern PANEL *consolepan; struct breakpoint { LINKEDLIST; unsigned long orig; unsigned long address; unsigned long stack; pid_t tid; int enabled; int active; /* add count field * and stop boolean * to implement checkpoints? */ }; struct map { LINKEDLIST; unsigned long start; unsigned long end; void *data; }; struct state { LINKEDLIST; struct user_regs_struct regs; struct user_fpregs_struct fpregs; struct list maps; }; struct process { pid_t id; int child; struct list breakpoints; struct list threads; }; struct thread { LINKEDLIST; struct process *proc; struct list states; struct state *state; int clearstates; pid_t id; int stopped; int signal; int cont; const char *status; }; extern void add_breakpoint(struct process *proc, unsigned long address, unsigned long stack, pid_t tid, int enabled); extern int is_breakpoint(struct process *proc, unsigned long address); extern int dbg_process(struct process *proc, pid_t pid, int child); extern int dbg_detach(struct process *proc); extern int dbg_wait(struct thread *th, int dostops); extern int dbg_cont(struct thread *th, int cont); extern int dbg_stepin(struct thread *th); extern int dbg_intr(struct thread *th); extern void *deref(struct thread *th, unsigned long addr, size_t size); /* how to do an async 'all-cont': * * mark all threads for PTRACE_CONT * singlestep all threads * this is needed to step past any thread that may be starting at a breakpoint * wait all single steps (note that some may hang...) * once all single steps completed, install breakpoints and actually cont threads */ //extern void add_breakpoint(struct process *proc, unsigned long address, unsigned long stack, pid_t tid, int enabled); //extern int is_breakpoint(struct process *proc, unsigned long address); // //extern int dbg_process(struct process *proc, pid_t pid); //extern int dbg_wait(struct thread *th, int dostops); //extern int dbg_stepin(struct thread *th); //extern int dbg_stepover(struct thread *th); //extern int dbg_cont(struct thread *th, int cont); //extern int dbg_intr(struct thread *th); //extern int dbg_detach(struct process *proc); //extern void *deref(struct thread *th, unsigned long addr, size_t size); //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, PANEL *pan); //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 void dbg_free(struct tracee *dbg);