Debugger: Allow MODE_DEBUG and MODE_STEPPING states to persist across an F2 ResetMachineState() call (#217)

This commit is contained in:
tomcw 2017-04-22 20:42:42 +01:00
parent 5e6a445bab
commit 124eca4546
4 changed files with 27 additions and 20 deletions

View file

@ -432,7 +432,9 @@ void EnterMessageLoop(void)
{ {
if (g_nAppMode == MODE_DEBUG) if (g_nAppMode == MODE_DEBUG)
DebuggerUpdate(); DebuggerUpdate();
else if ((g_nAppMode == MODE_LOGO) || (g_nAppMode == MODE_PAUSED)) else if (g_nAppMode == MODE_PAUSED)
Sleep(1); // Stop process hogging CPU - 1ms, as need to fade-out speaker sound buffer
else if (g_nAppMode == MODE_LOGO)
Sleep(100); // Stop process hogging CPU Sleep(100); // Stop process hogging CPU
} }
} }

View file

@ -4845,7 +4845,7 @@ size_t Util_GetDebuggerText( char* &pText_ )
memset( pBeg, 0, sizeof( g_aTextScreen ) ); memset( pBeg, 0, sizeof( g_aTextScreen ) );
memset( g_aDebuggerVirtualTextScreen, 0, sizeof( g_aDebuggerVirtualTextScreen ) ); memset( g_aDebuggerVirtualTextScreen, 0, sizeof( g_aDebuggerVirtualTextScreen ) );
DebugDisplay(1); DebugDisplay(TRUE);
for( int y = 0; y < DEBUG_VIRTUAL_TEXT_HEIGHT; y++ ) for( int y = 0; y < DEBUG_VIRTUAL_TEXT_HEIGHT; y++ )
{ {
@ -8393,6 +8393,11 @@ bool ProfileSave()
} }
static void InitDisasm(void)
{
g_nDisasmCurAddress = regs.pc;
DisasmCalcTopBotAddress();
}
// _____________________________________________________________________________________ // _____________________________________________________________________________________
// | | // | |
@ -8423,11 +8428,9 @@ void DebugBegin ()
g_aOpmodes[ AM_3 ].m_nBytes = 3; g_aOpmodes[ AM_3 ].m_nBytes = 3;
} }
g_nDisasmCurAddress = regs.pc; InitDisasm();
DisasmCalcTopBotAddress();
DebugVideoMode::Instance().Reset(); DebugVideoMode::Instance().Reset();
UpdateDisplay( UPDATE_ALL ); UpdateDisplay( UPDATE_ALL );
#if DEBUG_APPLE_FONT #if DEBUG_APPLE_FONT
@ -9576,13 +9579,16 @@ void DebuggerProcessKey( int keycode )
} }
// Still called from external file // Still called from external file
void DebugDisplay( BOOL bDrawBackground ) void DebugDisplay( BOOL bDrawBackground, BOOL bInitDisasm/*=FALSE*/ )
{ {
Update_t bUpdateFlags = UPDATE_ALL; Update_t bUpdateFlags = UPDATE_ALL;
// if (! bDrawBackground) // if (! bDrawBackground)
// bUpdateFlags &= ~UPDATE_BACKGROUND; // bUpdateFlags &= ~UPDATE_BACKGROUND;
if (bInitDisasm)
InitDisasm();
UpdateDisplay( bUpdateFlags ); UpdateDisplay( bUpdateFlags );
} }

View file

@ -168,7 +168,7 @@
void DebugContinueStepping (); void DebugContinueStepping ();
void DebugStopStepping(void); void DebugStopStepping(void);
void DebugDestroy (); void DebugDestroy ();
void DebugDisplay (BOOL); void DebugDisplay (BOOL bDrawBackground, BOOL bInitDisasm = FALSE );
void DebugInitialize (); void DebugInitialize ();
void DebuggerInputConsoleChar( TCHAR ch ); void DebuggerInputConsoleChar( TCHAR ch );

View file

@ -625,7 +625,7 @@ static void DrawFrameWindow ()
if (g_nAppMode == MODE_LOGO) if (g_nAppMode == MODE_LOGO)
VideoDisplayLogo(); VideoDisplayLogo();
else if (g_nAppMode == MODE_DEBUG) else if (g_nAppMode == MODE_DEBUG)
DebugDisplay(1); DebugDisplay(TRUE);
else else
VideoRedrawScreen(); VideoRedrawScreen();
@ -1841,6 +1841,8 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
if( g_bCtrlKey ) if( g_bCtrlKey )
{ {
CtrlReset(); CtrlReset();
if (g_nAppMode == MODE_DEBUG)
DebugDisplay(TRUE, TRUE);
return; return;
} }
@ -1850,22 +1852,19 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
LogFileTimeUntilFirstKeyReadReset(); LogFileTimeUntilFirstKeyReadReset();
g_nAppMode = MODE_RUNNING; g_nAppMode = MODE_RUNNING;
} }
else if (g_nAppMode == MODE_RUNNING) else if ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING) || (g_nAppMode == MODE_PAUSED))
{ {
if (ConfirmReboot(bFromButtonUI)) if (ConfirmReboot(bFromButtonUI))
{ {
ResetMachineState(); ResetMachineState();
g_nAppMode = MODE_RUNNING;
} // NB. Don't exit debugger or stepping
}
else if ((g_nAppMode == MODE_DEBUG) || (g_nAppMode == MODE_STEPPING)) // exit debugger if (g_nAppMode == MODE_DEBUG)
{ DebugDisplay(TRUE, TRUE);
if (ConfirmReboot(bFromButtonUI))
{
DebugExitDebugger();
// Post: g_nAppMode = MODE_RUNNING or MODE_STEPPING
} }
} }
DrawStatusArea((HDC)0,DRAW_TITLE); DrawStatusArea((HDC)0,DRAW_TITLE);
VideoRedrawScreen(); VideoRedrawScreen();
break; break;
@ -1902,9 +1901,9 @@ static void ProcessButtonClick(int button, bool bFromButtonUI /*=false*/)
} }
else if (g_nAppMode == MODE_DEBUG) else if (g_nAppMode == MODE_DEBUG)
{ {
ProcessButtonClick(BTN_RUN); // Exit debugger, switch to MODE_RUNNING or MODE_STEPPING DebugExitDebugger(); // Exit debugger, switch to MODE_RUNNING or MODE_STEPPING
} }
else else // MODE_RUNNING, MODE_LOGO, MODE_PAUSED
{ {
DebugBegin(); DebugBegin();
} }