summaryrefslogtreecommitdiffstats
path: root/misplays.c
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-10-02 03:18:21 -0400
committerMalfurious <m@lfurio.us>2024-04-24 13:31:08 -0400
commit46f72be263cf29688f684e90f2e149e5c911016b (patch)
tree08a36804eed9ce35470504419dd95553760b3ca7 /misplays.c
parent67a0755a248c9793a1e7a3cf73f4041b2103ebf7 (diff)
downloadmisplays-46f72be263cf29688f684e90f2e149e5c911016b.tar.gz
misplays-46f72be263cf29688f684e90f2e149e5c911016b.zip
Multithread version 3
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'misplays.c')
-rw-r--r--misplays.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/misplays.c b/misplays.c
index 2f0ce8f..815e045 100644
--- a/misplays.c
+++ b/misplays.c
@@ -44,7 +44,10 @@ static void list_breakpoints(struct thread *dbg, PANEL *pan) {
pprintw(pan, "---\n");
for (struct breakpoint *bp=breaks->head; bp!=breaks->end; bp=bp->next) {
- pprintw(pan, "0x%lx (%c) ", bp->address, (bp->installed ? '*' : ' '));
+ pprintw(pan, "0x%lx (%c) (%i) ",
+ bp->address,
+ (bp->installed ? '*' : ' '),
+ bp->hits);
}
pprintw(pan, "\n");
}
@@ -108,7 +111,7 @@ static void disasm(struct thread *dbg, PANEL *pan) {
if (dbg->stopped) {
if (insn->address == dbg->state->regs.rip) {
pattron(pan, COLOR_PAIR(1));
- } else if (is_breakpoint(dbg->proc, insn->address)) {
+ } else if (get_breakpoint(dbg->proc, insn->address)) {
pattron(pan, COLOR_PAIR(3));
} else if (rip_visited(dbg, insn->address)) {
pattron(pan, COLOR_PAIR(2));
@@ -118,7 +121,7 @@ static void disasm(struct thread *dbg, PANEL *pan) {
if (dbg->stopped) {
if (insn->address == dbg->state->regs.rip) {
pattroff(pan, COLOR_PAIR(1));
- } else if (is_breakpoint(dbg->proc, insn->address)) {
+ } else if (get_breakpoint(dbg->proc, insn->address)) {
pattroff(pan, COLOR_PAIR(3));
} else if (rip_visited(dbg, insn->address)) {
pattroff(pan, COLOR_PAIR(2));
@@ -211,7 +214,7 @@ int main(int argc, char **argv) {
th = proc->threads.head;
if (child) {
- dbg_cont(th, PTRACE_CONT);
+ dbg_cont(th);
}
cursinit();
@@ -243,13 +246,13 @@ int main(int argc, char **argv) {
console_enter(&cons, right);
break;
case 'j':
- dbg_step(th, 1);
+ dbg_stepover(th);
break;
case 'k':
- dbg_pets(th);
+ dbg_stepback(th);
break;
case 'l':
- dbg_step(th, 0);
+ dbg_stepin(th);
break;
case 'h':
/* todo: step out */
@@ -265,13 +268,10 @@ int main(int argc, char **argv) {
}
break;
case 's':
- dbg_cont(th, PTRACE_SYSCALL);
+ dbg_syscall(th);
break;
case 'c':
- dbg_cont(th, PTRACE_CONT);
- break;
- case 'C':
- dbg_realcont(th);
+ dbg_cont(th);
break;
case 'p':
dbg_intr(th);
@@ -313,7 +313,8 @@ int main(int argc, char **argv) {
t++;
}
unsigned long address = strtoul(t, NULL, 0);
- add_breakpoint(th->proc, address, 0, 0, en);
+ struct breakpoint *b = add_breakpoint(th->proc, address);
+ b->enabled = en;
break;
}
} else {