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)
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
}
}

View File

@ -4845,7 +4845,7 @@ size_t Util_GetDebuggerText( char* &pText_ )
memset( pBeg, 0, sizeof( g_aTextScreen ) );
memset( g_aDebuggerVirtualTextScreen, 0, sizeof( g_aDebuggerVirtualTextScreen ) );
DebugDisplay(1);
DebugDisplay(TRUE);
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_nDisasmCurAddress = regs.pc;
DisasmCalcTopBotAddress();
InitDisasm();
DebugVideoMode::Instance().Reset();
UpdateDisplay( UPDATE_ALL );
#if DEBUG_APPLE_FONT
@ -9576,13 +9579,16 @@ void DebuggerProcessKey( int keycode )
}
// Still called from external file
void DebugDisplay( BOOL bDrawBackground )
void DebugDisplay( BOOL bDrawBackground, BOOL bInitDisasm/*=FALSE*/ )
{
Update_t bUpdateFlags = UPDATE_ALL;
// if (! bDrawBackground)
// bUpdateFlags &= ~UPDATE_BACKGROUND;
if (bInitDisasm)
InitDisasm();
UpdateDisplay( bUpdateFlags );
}

View File

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

View File

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