--- hatari/src/debug/debugcpu.c 2019/04/09 08:56:46 1.1.1.8 +++ hatari/src/debug/debugcpu.c 2019/04/09 08:58:02 1.1.1.9 @@ -11,6 +11,7 @@ const char DebugCpu_fileid[] = "Hatari d #include #include +#include #include "config.h" @@ -143,12 +144,18 @@ static int DebugCpu_SaveBin(int nArgc, c /** * Check whether given address matches any CPU symbol and whether * there's profiling information available for it. If yes, show it. + * + * @return true if symbol was shown, false otherwise */ -static void DebugCpu_ShowAddressInfo(Uint32 addr, FILE *fp) +static bool DebugCpu_ShowAddressInfo(Uint32 addr, FILE *fp) { - const char *symbol = Symbols_GetByCpuAddress(addr); + const char *symbol = Symbols_GetByCpuAddress(addr, SYMTYPE_ALL); if (symbol) + { fprintf(fp, "%s:\n", symbol); + return true; + } + return false; } /** @@ -157,7 +164,7 @@ static void DebugCpu_ShowAddressInfo(Uin int DebugCpu_DisAsm(int nArgc, char *psArgs[]) { Uint32 disasm_upper = 0; - int insts, max_insts; + int shown, lines = INT_MAX; uaecptr nextpc; if (nArgc > 1) @@ -183,20 +190,17 @@ int DebugCpu_DisAsm(int nArgc, char *psA } /* limit is topmost address or instruction count */ - if (disasm_upper) - { - max_insts = INT_MAX; - } - else + if (!disasm_upper) { disasm_upper = 0xFFFFFFFF; - max_insts = ConfigureParams.Debugger.nDisasmLines; + lines = DebugUI_GetPageLines(ConfigureParams.Debugger.nDisasmLines, 8); } /* output a range */ - for (insts = 0; insts < max_insts && disasm_addr < disasm_upper; insts++) + for (shown = 0; shown < lines && disasm_addr < disasm_upper; shown++) { - DebugCpu_ShowAddressInfo(disasm_addr, debugOutput); + if (DebugCpu_ShowAddressInfo(disasm_addr, debugOutput)) + shown++; Disasm(debugOutput, (uaecptr)disasm_addr, &nextpc, 1); disasm_addr = nextpc; } @@ -391,7 +395,8 @@ int DebugCpu_MemDump(int nArgc, char *ps if (!memdump_upper) { - memdump_upper = memdump_addr + MEMDUMP_COLS * ConfigureParams.Debugger.nMemdumpLines; + int lines = DebugUI_GetPageLines(ConfigureParams.Debugger.nMemdumpLines, 8); + memdump_upper = memdump_addr + MEMDUMP_COLS * lines; } while (memdump_addr < memdump_upper) @@ -630,6 +635,15 @@ void DebugCpu_Check(void) { DebugCpu_ShowAddressInfo(M68000_GetPC(), TraceFile); } + if (LOG_TRACE_LEVEL(TRACE_CPU_REGS)) + { + uaecptr nextpc; +#ifdef WINUAE_FOR_HATARI + m68k_dumpstate_file(TraceFile, &nextpc); +#else + m68k_dumpstate(TraceFile, &nextpc); +#endif + } if (nCpuActiveCBs) { if (BreakCond_MatchCpu()) @@ -669,7 +683,7 @@ void DebugCpu_SetDebugging(void) nCpuActiveCBs = BreakCond_CpuBreakPointCount(); if (nCpuActiveCBs || nCpuSteps || bCpuProfiling || History_TrackCpu() - || LOG_TRACE_LEVEL((TRACE_CPU_DISASM|TRACE_CPU_SYMBOLS)) + || LOG_TRACE_LEVEL((TRACE_CPU_DISASM|TRACE_CPU_SYMBOLS|TRACE_CPU_REGS)) || ConOutDevice != CONOUT_DEVICE_NONE) { M68000_SetSpecial(SPCFLAG_DEBUGGER);