Debugger: 'cycles' now shows step-cycle-count (before was abs cumulative cycles) (Fixes #737)

And fixed single-step to only UpdateDisplay() once.
This commit is contained in:
tomcw
2019-12-20 09:15:24 +00:00
parent 82f6bf35a5
commit 418687e3d8
5 changed files with 32 additions and 9 deletions
+12 -6
View File
@@ -2015,7 +2015,7 @@ Update_t CmdStepOver (int nArgs)
CmdStepOut(0);
g_nDebugSteps = 0xFFFF;
while (g_nDebugSteps != 0)
DebugContinueStepping();
DebugContinueStepping(true);
}
}
@@ -2047,7 +2047,7 @@ Update_t CmdTrace (int nArgs)
g_nDebugStepUntil = -1;
g_nAppMode = MODE_STEPPING;
FrameRefreshStatus(DRAW_TITLE);
DebugContinueStepping();
DebugContinueStepping(true);
return UPDATE_ALL; // TODO: Verify // 0
}
@@ -2107,7 +2107,7 @@ Update_t CmdTraceLine (int nArgs)
g_nAppMode = MODE_STEPPING;
FrameRefreshStatus(DRAW_TITLE);
DebugContinueStepping();
DebugContinueStepping(true);
return UPDATE_ALL; // TODO: Verify // 0
}
@@ -8629,7 +8629,7 @@ static void CheckBreakOpcode( int iOpcode )
g_bDebugBreakpointHit |= BP_HIT_OPCODE;
}
void DebugContinueStepping ()
void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
{
static bool bForceSingleStepNext = false; // Allow at least one instruction to execute so we don't trigger on the same invalid opcode
@@ -8743,8 +8743,8 @@ void DebugContinueStepping ()
DisasmCalcTopBotAddress();
Update_t bUpdate = UPDATE_ALL;
UpdateDisplay( bUpdate );
if (!bCallerWillUpdateDisplay)
UpdateDisplay( UPDATE_ALL );
}
}
@@ -9054,6 +9054,12 @@ void DebugInitialize ()
CmdMOTD(0);
}
//===========================================================================
void DebugReset(void)
{
g_videoScannerDisplayInfo.Reset();
}
// Add character to the input line
//===========================================================================
void DebuggerInputConsoleChar( TCHAR ch )
+2 -1
View File
@@ -168,11 +168,12 @@
void DebugBegin ();
void DebugExitDebugger ();
void DebugContinueStepping ();
void DebugContinueStepping(const bool bCallerWillUpdateDisplay = false);
void DebugStopStepping(void);
void DebugDestroy ();
void DebugDisplay ( BOOL bInitDisasm = FALSE );
void DebugInitialize ();
void DebugReset(void);
void DebuggerInputConsoleChar( TCHAR ch );
void DebuggerProcessKey( int keycode );
+8 -1
View File
@@ -3735,6 +3735,7 @@ void DrawVideoScannerValue(int line, int vert, int horz, bool isVisible)
}
//===========================================================================
void DrawVideoScannerInfo (int line)
{
NTSC_VideoGetScannerAddressForDebugger(); // update g_nVideoClockHorz/g_nVideoClockVert
@@ -3755,6 +3756,12 @@ void DrawVideoScannerInfo (int line)
}
}
if (g_nCumulativeCycles != g_videoScannerDisplayInfo.lastCumulativeCycles)
{
g_videoScannerDisplayInfo.cycleDelta = (UINT) (g_nCumulativeCycles - g_videoScannerDisplayInfo.lastCumulativeCycles);
g_videoScannerDisplayInfo.lastCumulativeCycles = g_nCumulativeCycles;
}
DrawVideoScannerValue(line, v, h, NTSC_IsVisible());
line++;
@@ -3778,7 +3785,7 @@ void DrawVideoScannerInfo (int line)
rect.left += nameWidth * nFontWidth;
char sValue[10];
sprintf_s(sValue, sizeof(sValue), "%08X", (UINT32)g_nCumulativeCycles);
sprintf_s(sValue, sizeof(sValue), "%08X", g_videoScannerDisplayInfo.cycleDelta);
PrintText(sValue, rect);
}
+7 -1
View File
@@ -98,13 +98,19 @@
extern char g_aDebuggerVirtualTextScreen[ DEBUG_VIRTUAL_TEXT_HEIGHT ][ DEBUG_VIRTUAL_TEXT_WIDTH ];
extern size_t Util_GetDebuggerText( char* &pText_ ); // Same API as Util_GetTextScreen()
extern unsigned __int64 g_nCumulativeCycles;
class VideoScannerDisplayInfo
{
public:
VideoScannerDisplayInfo() : isDecimal(false), isHorzReal(false) {}
VideoScannerDisplayInfo(void) : isDecimal(false), isHorzReal(false),
lastCumulativeCycles(0), cycleDelta(0) {}
void Reset(void) { lastCumulativeCycles = g_nCumulativeCycles; cycleDelta = 0; }
bool isDecimal;
bool isHorzReal;
unsigned __int64 lastCumulativeCycles;
UINT cycleDelta;
};
extern VideoScannerDisplayInfo g_videoScannerDisplayInfo;
+3
View File
@@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Applewin.h"
#include "CardManager.h"
#include "CPU.h"
#include "Debug.h"
#include "Disk.h"
#include "Frame.h"
#include "Joystick.h"
@@ -453,6 +454,8 @@ static void Snapshot_LoadState_v2(void)
MemUpdatePaging(TRUE);
SetMouseCardInstalled( g_CardMgr.IsMouseCardInstalled() );
DebugReset();
DebugDisplay(TRUE);
}
catch(std::string szMessage)
{