diff options
author | Malfurious <m@lfurio.us> | 2023-07-20 14:55:13 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2024-04-24 13:31:08 -0400 |
commit | d070fde6478431c71fb4a55e783a577439c7cb99 (patch) | |
tree | 1ff5f980eca499518943e4c36e5103d8be1847a8 /debugger.h | |
parent | 1b5f8d2e5a118a80a4373a7be1ca4e4eceebf7be (diff) | |
download | misplays-d070fde6478431c71fb4a55e783a577439c7cb99.tar.gz misplays-d070fde6478431c71fb4a55e783a577439c7cb99.zip |
Multithread version 1
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'debugger.h')
-rw-r--r-- | debugger.h | 86 |
1 files changed, 72 insertions, 14 deletions
@@ -8,13 +8,19 @@ #define BREAKPOINT_INSN 0xcc +extern PANEL *consolepan; + struct breakpoint { LINKEDLIST; + unsigned long orig; unsigned long address; unsigned long stack; - unsigned long orig; + pid_t tid; int enabled; int active; + /* add count field + * and stop boolean + * to implement checkpoints? */ }; struct map { @@ -31,25 +37,77 @@ struct state { struct list maps; }; -struct tracee { - struct list breaks; +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 child; int stopped; - int status; int signal; int cont; - void *buff; - size_t buffsize; + const char *status; }; -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 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 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); |