From: Toni Wilen Date: Sat, 3 Dec 2022 12:18:12 +0000 (+0200) Subject: debugmem stack frame tracker overflow check X-Git-Tag: 41000~36 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=096ebb6c591339705cca03d4cb7ad6f0bd245d26;p=francis%2Fwinuae.git debugmem stack frame tracker overflow check --- diff --git a/debugmem.cpp b/debugmem.cpp index a182ff86..ac15b80e 100644 --- a/debugmem.cpp +++ b/debugmem.cpp @@ -512,13 +512,21 @@ void branch_stack_pop_rts(uaecptr oldpc) void branch_stack_push(uaecptr oldpc, uaecptr newpc) { - if (!stackframes) + if (!stackframes) { return; + } if (!stackframemode) { - if (debug_waiting || (!regs.s && get_long_host(exec_thistask) != debug_task)) + if (debug_waiting || (!regs.s && get_long_host(exec_thistask) != debug_task)) { return; + } } int cnt = regs.s ? stackframecntsuper : stackframecnt; + if (cnt >= MAX_STACKFRAMES) { + write_log(_T("Stack frame %c max limit reached!\n"), regs.s ? 'S' : 'U'); + stackframecntsuper = 0; + stackframecnt = 0; + return; + } struct debugstackframe *sf = regs.s ? &stackframessuper[cnt] : &stackframes[cnt]; sf->current_pc = regs.instruction_pc; sf->next_pc = newpc;