summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-10-07 02:26:08 -0400
committerMalfurious <m@lfurio.us>2024-04-24 13:31:08 -0400
commit5bb0dfbdb6c0dc1f4a4f0e28393619469a1d4851 (patch)
tree24032ce2b01ccccd9982b344900e6186f1934924
parent5589a9e3afd51bdf3d8715fb09b1667c6773b73f (diff)
downloadmisplays-5bb0dfbdb6c0dc1f4a4f0e28393619469a1d4851.tar.gz
misplays-5bb0dfbdb6c0dc1f4a4f0e28393619469a1d4851.zip
Tweak SCHEDULER_DELAY for use with installing breakpoints
Signed-off-by: Malfurious <m@lfurio.us>
-rw-r--r--debugger.c7
-rw-r--r--misplays.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/debugger.c b/debugger.c
index b646dc4..3435cf4 100644
--- a/debugger.c
+++ b/debugger.c
@@ -20,7 +20,7 @@ static const int PTRACE_OPTIONS =
static const int PTRACE_CHILD_OPTIONS = PTRACE_OPTIONS | PTRACE_O_EXITKILL;
//static const int STOP_ALL_ON_EVENT = 1;
-static const useconds_t SCHEDULER_DELAY = 100000;
+static const useconds_t SCHEDULER_DELAY = 10000;
static const unsigned int BREAKPOINT_INSN = 0xcc;
static struct process *new_process(pid_t id, int child) {
@@ -224,6 +224,7 @@ static void continue_all_threads(struct process *proc) {
static void resume_threads(struct process *proc) {
struct list *threads = &proc->threads;
+ int once = 0;
for (struct thread *th = threads->head; th != threads->end; th = th->next) {
if (th->doing == PTRACE_SINGLESTEP) {
@@ -236,6 +237,10 @@ static void resume_threads(struct process *proc) {
for (struct thread *th = threads->head; th != threads->end; th = th->next) {
if (th->doing && th->doing != PTRACE_SINGLESTEP) {
+ if (!once) {
+ usleep(SCHEDULER_DELAY);
+ once = 1;
+ }
install_breakpoints(th);
ptrace(th->doing, th->id, NULL, th->signal);
th->stopped = 0;
diff --git a/misplays.c b/misplays.c
index c064f75..e30cc2c 100644
--- a/misplays.c
+++ b/misplays.c
@@ -27,7 +27,7 @@ static pid_t dofork(char **argv, struct console *cons) {
}
if (pid == 0) {
- usleep(100000);
+ usleep(10000);
console_configslave(cons);
close_range(STDERR_FILENO+1, ~0U, CLOSE_RANGE_UNSHARE);
//raise(SIGSTOP); // ptrace(PTRACE_TRACEME, 0, NULL, NULL);