summaryrefslogtreecommitdiffstats
path: root/debugger.h
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2024-04-24 13:32:58 -0400
committerMalfurious <m@lfurio.us>2024-04-24 13:32:58 -0400
commitc0a76847fbabd5742ec4b678b9588f394fbefc78 (patch)
treeb80b15c03034aeea0376766bc87cc53563138398 /debugger.h
parent1b5f8d2e5a118a80a4373a7be1ca4e4eceebf7be (diff)
parentb86dd03abe59b6b410de4da3e44f62e62599c5ce (diff)
downloadmisplays-c0a76847fbabd5742ec4b678b9588f394fbefc78.tar.gz
misplays-c0a76847fbabd5742ec4b678b9588f394fbefc78.zip
Merge branch 'threads'
This branch adds initial support for multithreaded targets, as well as forking and exec syscalls. All of the bugs from initial testing are fixed so far. * threads: (25 commits) Don't spin waiting to interrupt zombie process Allow termination and exec events to propagate immediately Implement support for PTRACE_EVENT_FORK and ui Handle PTRACE_EVENT_EXIT to capture a final state snapshot Detect out-of-band thread exec state changes to prevent deadlock Enable user creation of thread-specific breakpoints Add orig_rax to register display Tweak SCHEDULER_DELAY for use with installing breakpoints Ignore breakpoints during singlestep Fix bug with cleaning temporary breakpoints Independent thread control refactor Multithread version 3 Add strict_strtoul Prevent lingering traps after detach Handle PTRACE_EVENT_EXEC Workaround SIGSTOP on child process startup setpgid is redundant with setsid and causes an error Display name of pending signal dbg_realcont for testing purposes Display installed status of breakpoints ...
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);