re-introduce native breakpoints

This commit is contained in:
Alwin Berger 2023-03-13 14:46:09 +01:00
parent 93bdbe3e18
commit d3fca27481
3 changed files with 26 additions and 1 deletions

View File

@ -85,3 +85,8 @@ void libafl_exit_request_crash(CPUState* cpu);
void libafl_exit_request_timeout(void);
struct libafl_exit_reason* libafl_get_exit_reason(void);
#ifndef CONFIG_USER_ONLY
void libafl_qemu_set_native_breakpoint(vaddr pc);
void libafl_qemu_remove_native_breakpoint(vaddr pc);
#endif

View File

@ -182,3 +182,20 @@ void libafl_qemu_breakpoint_run(vaddr pc_next)
bp = bp->next;
}
}
#ifndef CONFIG_USER_ONLY
void libafl_qemu_set_native_breakpoint(vaddr pc)
{
CPUState *cpu;
CPU_FOREACH(cpu) {
cpu_breakpoint_insert(cpu, pc, BP_GDB, NULL);
}
}
void libafl_qemu_remove_native_breakpoint(vaddr pc)
{
CPUState *cpu;
CPU_FOREACH(cpu) {
cpu_breakpoint_remove(cpu, pc, BP_GDB);
}
}
#endif

View File

@ -345,7 +345,10 @@ void cpu_handle_guest_debug(CPUState *cpu)
cpu_single_step(cpu, 0);
}
} else {
gdb_set_stop_cpu(cpu);
/* Begin LibAFL changes */
// With LibAFL Breakpoints there is no gdb attached.
// gdb_set_stop_cpu(cpu);
/* End LibAFL changes */
qemu_system_debug_request();
cpu->stopped = true;
}