From: Toni Wilen Date: Sun, 26 Apr 2026 11:49:39 +0000 (+0300) Subject: Debugger updates X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=0ebdc477c3c334f1d4d426ad144b2fe9a8800460;p=francis%2Fwinuae.git Debugger updates --- diff --git a/custom.cpp b/custom.cpp index 783c4928..c5ed5645 100644 --- a/custom.cpp +++ b/custom.cpp @@ -4376,7 +4376,7 @@ void blitter_done_notify(void) } if (debug_copper) { int hpos = current_hpos(); - record_copper_blitwait(cop_state.ip - 4, hpos, vpos); + record_copper_blitwait(cop_state.ip - 2, hpos, vpos); } } #endif @@ -9005,7 +9005,7 @@ static void process_copper(struct rgabuf *r) #ifdef DEBUGGER if (debug_copper && cop_state.irload2) { - record_copper(cop_state.ip - 4, cop_state.ip, cop_state.ir[0], cop_state.ir[1], agnus_hpos, vpos); + record_copper(cop_state.ip - 2, cop_state.ip, cop_state.ir[0], cop_state.ir[1], agnus_hpos, vpos); } #endif } @@ -9021,13 +9021,13 @@ static void process_copper(struct rgabuf *r) cop_state.strobe = 0; #ifdef DEBUGGER if (debug_copper) { - record_copper(previp - 4, cop_state.ip, cop_state.ir[0], cop_state.ir[1], agnus_hpos, vpos); + record_copper(previp - 2, cop_state.ip, cop_state.ir[0], cop_state.ir[1], agnus_hpos, vpos); } #endif } else { #ifdef DEBUGGER if (debug_copper && cop_state.irload2) { - record_copper(cop_state.ip - 4, cop_state.ip, cop_state.ir[0], cop_state.ir[1], agnus_hpos, vpos); + record_copper(cop_state.ip - 2, cop_state.ip, cop_state.ir[0], cop_state.ir[1], agnus_hpos, vpos); } } #endif diff --git a/debug.cpp b/debug.cpp index a31d67c3..75160446 100644 --- a/debug.cpp +++ b/debug.cpp @@ -6080,6 +6080,7 @@ static void breakfunc(uae_u32 v) debug_hpos = -1; debug_cycles(2); set_special(SPCFLAG_BRK); + trace_mode = TRACE_IMMEDIATE; } void debug_hsync(void) @@ -6603,6 +6604,7 @@ static void debug_sprite(TCHAR **inptr) int ypose, ypose_ecs; int attach; uae_u64 w1, w2, ww1, ww2; + bool detectsize = true; int size = 1, width; int ecs, sh10; int y, i; @@ -6613,16 +6615,28 @@ static void debug_sprite(TCHAR **inptr) ignore_ws(inptr); addr = readhex(inptr, NULL); ignore_ws(inptr); - if (more_params (inptr)) + if (more_params (inptr)) { size = readhex(inptr, NULL); + detectsize = false; + } if (size != 1 && size != 2 && size != 4) { addr2 = size; + detectsize = true; ignore_ws(inptr); - if (more_params(inptr)) + if (more_params(inptr)) { size = readint(inptr, NULL); - if (size != 1 && size != 2 && size != 4) - size = 1; + detectsize = false; + } + } + if ((size != 1 && size != 2 && size != 4) || detectsize) { + size = 1; + if (get_word_debug(addr + 2) == 0 && get_word_debug(addr + 4) != 0 && get_word_debug(addr + 6) == 0) { + size = 2; + } else if (get_word_debug(addr + 2) == 0 && get_word_debug(addr + 4) == 0 && get_word_debug(addr + 6) == 0 && get_word_debug(addr + 8) != 0) { + size = 4; + } } + for (;;) { ecs = 0; sh10 = 0; @@ -8146,6 +8160,8 @@ void debug (void) if (line > 0 && line != trace_param[1]) bp = -1; } + } else if (trace_mode == TRACE_IMMEDIATE) { + bp = -2; } } if (!bp && bpnum < 0) { @@ -8155,7 +8171,9 @@ void debug (void) if (bpnum >= 0) { console_out_f(_T("Breakpoint %d triggered.\n"), bpnum); } - debug_cycles(1); + if (bp >= -1) { + debug_cycles(1); + } } } else { memwatch_hit_msg(memwatch_triggered - 1); diff --git a/include/debug.h b/include/debug.h index e4614b7e..d29ad6fe 100644 --- a/include/debug.h +++ b/include/debug.h @@ -353,6 +353,7 @@ extern int get_dma_debug_color(struct dma_rec *dr, int line, uae_u32 *cp); #define TRACE_RANGE_PC 4 #define TRACE_SKIP_LINE 5 #define TRACE_RAM_PC 6 +#define TRACE_IMMEDIATE 7 #define TRACE_CHECKONLY 10 #else diff --git a/newcpu.cpp b/newcpu.cpp index 476217a4..ebd2d800 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -6933,8 +6933,10 @@ void m68k_dumpstate(uaecptr *nextpc, uaecptr prevpc) } } m68k_disasm (pc, nextpc, pc, 1); - if (nextpc) + if (nextpc) { console_out_f (_T("Next PC: %08x\n"), *nextpc); + *nextpc = pc; + } } void m68k_dumpcache (bool dc)