--- hatari/src/debug/debugInfo.c 2019/04/09 08:55:34 1.1.1.7 +++ hatari/src/debug/debugInfo.c 2019/04/09 08:58:03 1.1.1.9 @@ -152,6 +152,22 @@ static Uint32 GetBasepageValue(unsigned } /** + * DebugInfo_DTA: if no DTA address given, get one from current + * basepage and ask GEMDOS to show its info. + */ +static void DebugInfo_DTA(FILE *fp, Uint32 dta_addr) +{ + if (!dta_addr) { + dta_addr = GetBasepageValue(0x20); + if (!dta_addr) { + fprintf(fp, "ERROR: no valid basepage!\n"); + return; + } + } + GemDOS_InfoDTA(fp, dta_addr); +} + +/** * DebugInfo_GetTEXT: return current program TEXT segment address * or zero if basepage missing/invalid. For virtual debugger variable. */ @@ -160,14 +176,14 @@ Uint32 DebugInfo_GetTEXT(void) return GetBasepageValue(0x08); } /** - * DebugInfo_GetTEXTEnd: return current program TEXT segment end address + * DebugInfo_GetTEXTEnd: return address following current program TEXT segment * or zero if basepage missing/invalid. For virtual debugger variable. */ Uint32 DebugInfo_GetTEXTEnd(void) { Uint32 addr = GetBasepageValue(0x08); if (addr) { - return addr + GetBasepageValue(0x0C) - 1; + return addr + GetBasepageValue(0x0C); } return 0; } @@ -331,7 +347,7 @@ static void DebugInfo_PrintOSHeader(FILE langbits = osconf >> 1; if (langbits == 127) { lang = "all"; - } else if (langbits < ARRAYSIZE(langs)) { + } else if (langbits < ARRAY_SIZE(langs)) { lang = langs[langbits]; } else { lang = "unknown"; @@ -652,6 +668,7 @@ static const struct { { true, "dspmemdump",DebugInfo_DspMemDump, DebugInfo_DspMemArgs, "Dump DSP memory from given
" }, { true, "dspregs", DebugInfo_DspRegister,NULL, "Show DSP register contents" }, #endif + { false, "dta", DebugInfo_DTA, NULL, "Show current [or given] DTA information" }, { true, "file", DebugInfo_FileParse, DebugInfo_FileArgs, "Parse commands from given debugger input " }, { false,"gemdos", GemDOS_Info, NULL, "Show GEMDOS HDD emu information (with , show opcodes)" }, { true, "history", History_Show, NULL, "Show history of last instructions" }, @@ -695,7 +712,7 @@ static char *DebugInfo_Match(const char i = 0; } /* next match */ - while (i++ < ARRAYSIZE(infotable)) { + while (i++ < ARRAY_SIZE(infotable)) { if (!lock && infotable[i-1].lock) { continue; } @@ -729,7 +746,7 @@ int DebugInfo_Command(int nArgc, char *p if (nArgc > 1) { cmd = psArgs[1]; /* which subcommand? */ - for (i = 0; i < ARRAYSIZE(infotable); i++) { + for (i = 0; i < ARRAY_SIZE(infotable); i++) { if (strcmp(cmd, infotable[i].name) == 0) { sub = i; break; @@ -756,7 +773,7 @@ int DebugInfo_Command(int nArgc, char *p if (sub < 0 || !ok) { /* no subcommand or something wrong with value, show info */ fprintf(stderr, "%s subcommands are:\n", psArgs[0]); - for (i = 0; i < ARRAYSIZE(infotable); i++) { + for (i = 0; i < ARRAY_SIZE(infotable); i++) { if (!lock && infotable[i].lock) { continue; }