From: Toni Wilen Date: Sun, 30 Oct 2022 14:08:08 +0000 (+0200) Subject: f breakpoint hit count support X-Git-Tag: 41000~97 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=c5a24d7e22f0cea0b7fc74a6ff63fcafc81c7f34;p=francis%2Fwinuae.git f breakpoint hit count support --- diff --git a/debug.cpp b/debug.cpp index 1ace79cb..8c7ba550 100644 --- a/debug.cpp +++ b/debug.cpp @@ -5346,11 +5346,19 @@ static struct regstruct trace_prev_regs; #endif static uaecptr nextpc; -int instruction_breakpoint (TCHAR **c) +int instruction_breakpoint(TCHAR **c) { struct breakpoint_node *bpn; + int bpcnt = 0; int i; + if (more_params(c)) { + TCHAR nc = _totupper((*c)[0]); + if (nc == 'N') { + next_char(c); + bpcnt = readint(c); + } + } if (more_params (c)) { TCHAR nc = _totupper ((*c)[0]); if (nc == 'O') { @@ -5360,6 +5368,7 @@ int instruction_breakpoint (TCHAR **c) int bpidx = readint(c); if (more_params(c) && bpidx >= 0 && bpidx < BREAKPOINT_TOTAL) { bpn = &bpnodes[bpidx]; + bpn->cnt = bpcnt; int regid = getregidx(c); if (regid >= 0) { bpn->type = regid; @@ -5465,6 +5474,7 @@ int instruction_breakpoint (TCHAR **c) bpn->value1 = trace_param[0]; bpn->type = BREAKPOINT_REG_PC; bpn->oper = BREAKPOINT_CMP_EQUAL; + bpn->cnt = bpcnt; bpn->enabled = 1; console_out (_T("Breakpoint added.\n")); trace_mode = 0; @@ -7001,8 +7011,16 @@ void debug (void) debug_continue(); return; } - if (bp > 0) + if (bp > 0) { + if (bpnodes[bp - 1].cnt > 0) { + bpnodes[bp - 1].cnt--; + } + if (bpnodes[bp - 1].cnt > 0) { + debug_continue(); + return; + } console_out_f(_T("Breakpoint %d triggered.\n"), bp - 1); + } debug_cycles(1); } } else { diff --git a/include/debug.h b/include/debug.h index 79fad4b8..69037064 100644 --- a/include/debug.h +++ b/include/debug.h @@ -120,7 +120,8 @@ struct breakpoint_node { uae_u32 mask; int type; int oper; - int enabled; + int enabled; + int cnt; }; extern struct breakpoint_node bpnodes[BREAKPOINT_TOTAL];