Debugger: LBR: support the unset/undefined case (eg. reset to undefined when beginning a new debug session)

This commit is contained in:
tomcw 2022-11-19 20:39:41 +00:00
parent 0000e8b9c3
commit 7100bfa5b5
1 changed files with 11 additions and 4 deletions

View File

@ -353,7 +353,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
static bool g_bIgnoreNextKey = false;
static WORD g_LBR = 0x0000; // Last Branch Record
const UINT LBR_UNDEFINED = -1;
static UINT g_LBR = LBR_UNDEFINED; // Last Branch Record
static bool g_bScriptReadOk = false;
@ -2410,7 +2411,10 @@ Update_t CmdOut (int nArgs)
//===========================================================================
Update_t CmdLBR(int nArgs)
{
ConsolePrintFormat(" LBR = $%04X", g_LBR);
if (g_LBR == LBR_UNDEFINED)
ConsolePrintFormat(" LBR not set yet. Hint: Run from the debugger via 'g' command.");
else
ConsolePrintFormat(" LBR = $%04X", g_LBR);
return ConsoleUpdate();
}
@ -8281,6 +8285,8 @@ void DebugBegin ()
DebugVideoMode::Instance().Reset();
UpdateDisplay( UPDATE_ALL );
g_LBR = LBR_UNDEFINED; // reset LBR, so LBR isn't stale from a previous debugging session
#if DEBUG_APPLE_FONT
int iFG = 7;
int iBG = 4;
@ -8502,7 +8508,8 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
else if (g_bDebugBreakpointHit & BP_HIT_PC_READ_FLOATING_BUS_OR_IO_MEM)
stopReason = "PC reads from floating bus or I/O memory";
else if (g_bDebugBreakpointHit & BP_HIT_INTERRUPT)
stopReason = StrFormat("Interrupt occurred at $%04X", g_LBR);
stopReason = (g_LBR == LBR_UNDEFINED) ? StrFormat("Interrupt occurred (LBR unknown)")
: StrFormat("Interrupt occurred at $%04X", g_LBR);
else if (g_bDebugBreakpointHit & BP_HIT_VIDEO_POS)
stopReason = StrFormat("Video scanner position matches at vpos=$%04X", g_nVideoClockVert);
else if (g_bDebugBreakpointHit & BP_DMA_TO_IO_MEM)
@ -8794,7 +8801,7 @@ void DebugInitialize ()
void DebugReset(void)
{
g_videoScannerDisplayInfo.Reset();
g_LBR = 0x0000;
g_LBR = LBR_UNDEFINED;
}
// Add character to the input line