--- hatari/src/debug/profile.c 2019/04/09 08:55:36 1.1.1.5 +++ hatari/src/debug/profile.c 2019/04/09 08:58:05 1.1.1.7 @@ -20,9 +20,9 @@ const char Profile_fileid[] = "Hatari pr #include "configuration.h" #include "clocks_timings.h" #include "evaluate.h" +#include "symbols.h" #include "profile.h" #include "profile_priv.h" -#include "symbols.h" profile_loop_t profile_loop; @@ -91,7 +91,7 @@ static void output_caller_info(FILE *fp, if (info->flags) { /* calltypes supported? */ fputc(' ', fp); typecount = 0; - for (k = 0; k < ARRAYSIZE(flaginfo); k++) { + for (k = 0; k < ARRAY_SIZE(flaginfo); k++) { if (info->flags & flaginfo[k].bit) { fputc(flaginfo[k].chr, fp); typecount++; @@ -128,7 +128,7 @@ void Profile_ShowCallers(FILE *fp, int s /* legend */ fputs("# : = [ [ ]], ..., ", fp); fputs("\n# types: ", fp); - for (i = 0; i < ARRAYSIZE(flaginfo); i++) { + for (i = 0; i < ARRAY_SIZE(flaginfo); i++) { fprintf(fp, "%c = %s, ", flaginfo[i].chr, flaginfo[i].info); } fputs("\n# totals: calls/instructions/cycles/i-misses/d-hits\n", fp); @@ -405,7 +405,7 @@ Uint32 Profile_CallEnd(callinfo_t *calli /** * Add costs to all functions still in call stack */ -void Profile_FinalizeCalls(callinfo_t *callinfo, counters_t *totalcost, const char* (*get_symbol)(Uint32 addr)) +void Profile_FinalizeCalls(callinfo_t *callinfo, counters_t *totalcost, const char* (*get_symbol)(Uint32, symtype_t)) { Uint32 addr; if (!callinfo->depth) { @@ -415,7 +415,8 @@ void Profile_FinalizeCalls(callinfo_t *c while (callinfo->depth > 0) { Profile_CallEnd(callinfo, totalcost); addr = callinfo->stack[callinfo->depth].callee_addr; - fprintf(stderr, "- 0x%x: %s (return = 0x%x)\n", addr, get_symbol(addr), + fprintf(stderr, "- 0x%x: %s (return = 0x%x)\n", + addr, get_symbol(addr, SYMTYPE_TEXT), callinfo->stack[callinfo->depth].ret_addr); } } @@ -428,7 +429,7 @@ static void Profile_ShowStack(bool forDs int i; Uint32 addr; callinfo_t *callinfo; - const char* (*get_symbol)(Uint32 addr); + const char* (*get_symbol)(Uint32, symtype_t); if (forDsp) { Profile_DspGetCallinfo(&callinfo, &get_symbol); @@ -442,8 +443,9 @@ static void Profile_ShowStack(bool forDs for (i = 0; i < callinfo->depth; i++) { addr = callinfo->stack[i].callee_addr; - fprintf(stderr, "- 0x%x: %s (return = 0x%x)\n", addr, - get_symbol(addr), callinfo->stack[i].ret_addr); + fprintf(stderr, "- 0x%x: %s (return = 0x%x)\n", + addr, get_symbol(addr, SYMTYPE_TEXT), + callinfo->stack[i].ret_addr); } } @@ -502,7 +504,7 @@ char *Profile_Match(const char *text, in "addresses", "callers", "caches", "counts", "cycles", "d-hits", "i-misses", "loops", "off", "on", "save", "stack", "stats", "symbols" }; - return DebugUI_MatchHelper(names, ARRAYSIZE(names), text, state); + return DebugUI_MatchHelper(names, ARRAY_SIZE(names), text, state); } const char Profile_Description[] = @@ -533,7 +535,7 @@ const char Profile_Description[] = "\tFirst can be limited just to named addresses with 'symbols'.\n" "\tOptional count will limit how many items will be shown.\n" "\n" - "'caches' shows histogram of CPU cache usage.\n" + "\t'caches' shows histogram of CPU cache usage.\n" "\n" "\t'addresses' lists the profiled addresses in order, with the\n" "\tinstructions (currently) residing at them. By default this\n" @@ -570,7 +572,7 @@ static bool Profile_Save(const char *fna freq = MachineClocks.DSP_Freq; proc = "DSP"; } else { - freq = MachineClocks.CPU_Freq; + freq = MachineClocks.CPU_Freq_Emul; proc = "CPU"; } #if ENABLE_WINUAE_CPU @@ -643,6 +645,8 @@ static bool Profile_Loops(int nArgc, cha profile_loop.filename = NULL; fclose(profile_loop.fp); profile_loop.fp = NULL; + } else { + fprintf(stderr, "ERROR: no file name for saving the loop profiling information.\n"); } } return true; @@ -678,9 +682,9 @@ int Profile_Command(int nArgc, char *psA lower = *disasm_addr; } if (bForDsp) { - *disasm_addr = Profile_DspShowAddresses(lower, upper, stdout); + *disasm_addr = Profile_DspShowAddresses(lower, upper, stdout, PAGING_ENABLED); } else { - *disasm_addr = Profile_CpuShowAddresses(lower, upper, stdout); + *disasm_addr = Profile_CpuShowAddresses(lower, upper, stdout, PAGING_ENABLED); } return DEBUGGER_CMDCONT;