From: Toni Wilen Date: Sun, 18 Jan 2015 13:02:00 +0000 (+0200) Subject: Cycle count breakpoint. X-Git-Tag: 3100~118 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6113af119e074a1039317ca29c46395c29931ccb;p=francis%2Fwinuae.git Cycle count breakpoint. --- 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;