]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
f breakpoint hit count support
authorToni Wilen <twilen@winuae.net>
Sun, 30 Oct 2022 14:08:08 +0000 (16:08 +0200)
committerToni Wilen <twilen@winuae.net>
Sun, 30 Oct 2022 14:08:08 +0000 (16:08 +0200)
debug.cpp
include/debug.h

index 1ace79cb382e443ea00cbe94a45388d03c43d47c..8c7ba5502c620d5c40bc77d6844a17fb3ad6cf0a 100644 (file)
--- 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 {
index 79fad4b879201a97128ad87aceafdfd5f34b43ad..69037064214ebf1651eaa591dfdb55b10a1f942c 100644 (file)
@@ -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];