From 6113af119e074a1039317ca29c46395c29931ccb Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 18 Jan 2015 15:02:00 +0200 Subject: [PATCH] Cycle count breakpoint. --- debug.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/debug.cpp b/debug.cpp index 14d32f05..c6755b2d 100644 --- a/debug.cpp +++ b/debug.cpp @@ -3519,6 +3519,42 @@ static void show_exec_lists (TCHAR *t) } } +static void breakfunc(uae_u32 v) +{ + write_log(_T("Cycle breakpoint hit\n")); + debugging = 1; + set_special (SPCFLAG_BRK); +} + +static int cycle_breakpoint(TCHAR **c) +{ + TCHAR nc = _totupper((*c)[0]); + next_char(c); + if (more_params(c)) { + int count = readint(c); + if (nc == 'L') { + if (more_params(c)) { + int hp = readint(c); + if (count >= vpos) { + count = vpos - count; + } else { + count += maxvpos - vpos; + } + if (hp >= current_hpos()) { + count += hp - current_hpos(); + } else { + count += maxhpos - current_hpos(); + } + } else { + count *= maxhpos; + } + } + event2_newevent_x(-1, count, 0, breakfunc); + return 1; + } + return 0; +} + #if 0 static int trace_same_insn_count; static uae_u8 trace_insn_copy[10]; @@ -4339,6 +4375,9 @@ static BOOL debug_line (TCHAR *input) inptr++; if (process_breakpoint (&inptr)) return true; + } else if (inptr[0] == 'c' || inptr[0] == 'l') { + if (cycle_breakpoint(&inptr)) + return true; } else { if (instruction_breakpoint (&inptr)) return true; -- 2.47.3