diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index 10cbed1d..cf42ce18 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -6334,6 +6334,14 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg) } } + // rjf: programmatic user breakpoints (we do not have state for it, + // but the target program(s) did something breakpoint-like, and we + // want to treat it as if we did) + if(event->address != 0) + { + hit_user_bp = 1; + } + // rjf: evaluate hit stop conditions if(conditions.node_count != 0) ProfScope("evaluate hit stop conditions") { diff --git a/src/demon/win32/demon_core_win32.c b/src/demon/win32/demon_core_win32.c index 1b99996d..f27ba706 100644 --- a/src/demon/win32/demon_core_win32.c +++ b/src/demon/win32/demon_core_win32.c @@ -2383,7 +2383,6 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) // hit - so if we have data breakpoints set, we need to // check this thread's debug registers, to determine if this // is a regular single-step or a data breakpoint hit. - if(first_flagged_trap_task != 0) { // rjf: first determine the flagged trap index U64 flagged_trap_idx = 0; @@ -2398,10 +2397,10 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) { e->kind = DMN_EventKind_Breakpoint; if(0){} - else if(regs.dr7.u64 & (1ull<<0) && regs.dr6.u64 & (1ull<<0)) { flagged_trap_idx = 0; } - else if(regs.dr7.u64 & (1ull<<2) && regs.dr6.u64 & (1ull<<1)) { flagged_trap_idx = 1; } - else if(regs.dr7.u64 & (1ull<<4) && regs.dr6.u64 & (1ull<<2)) { flagged_trap_idx = 2; } - else if(regs.dr7.u64 & (1ull<<8) && regs.dr6.u64 & (1ull<<3)) { flagged_trap_idx = 3; } + else if(regs.dr7.u64 & (1ull<<0) && regs.dr6.u64 & (1ull<<0)) { flagged_trap_idx = 0; e->address = regs.dr0.u64; } + else if(regs.dr7.u64 & (1ull<<2) && regs.dr6.u64 & (1ull<<1)) { flagged_trap_idx = 1; e->address = regs.dr1.u64; } + else if(regs.dr7.u64 & (1ull<<4) && regs.dr6.u64 & (1ull<<2)) { flagged_trap_idx = 2; e->address = regs.dr2.u64; } + else if(regs.dr7.u64 & (1ull<<8) && regs.dr6.u64 & (1ull<<3)) { flagged_trap_idx = 3; e->address = regs.dr3.u64; } } }break; } diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 0d80c480..788a4419 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -10405,6 +10405,14 @@ rd_stop_explanation_fstrs_from_ctrl_event(Arena *arena, CTRL_Event *event) dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" ")); dr_fstrs_concat_in_place(&fstrs, &thread_fstrs); dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" hit a breakpoint")); + if(event->vaddr_rng.min != 0) + { + dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(" (Address: ")); + dr_fstrs_push_new(arena, &fstrs, ¶ms, push_str8f(arena, "0x%I64x", event->vaddr_rng.min), + .font = rd_font_from_slot(RD_FontSlot_Code), + .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Code)); + dr_fstrs_push_new(arena, &fstrs, ¶ms, str8_lit(")")); + } } }break;