Debugger: add new command: 'bpv <vpos,[len]>'

. break on video-scanner's vpos matching
. NB. auto disable when hit
This commit is contained in:
tomcw 2022-10-08 19:17:47 +01:00
parent e6cdd5a2c9
commit 8e2ee62d37
7 changed files with 102 additions and 18 deletions

View File

@ -98,6 +98,14 @@ Default comparison operator is equal
</td>
</tr>
<tr bgcolor="#999999">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPV vpos[,len]</span></b></font></font></p>
</td>
<td width="75%">
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Add Breakpoint trigger when video-scanner's vertical position matches vpos. (NB. Auto-disable when hit.)</span></i></p>
</td>
</tr>
<tr bgcolor="#cccccc">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPD</span></b></font></font></p>
</td>
@ -105,7 +113,7 @@ Default comparison operator is equal
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Disable Breakpoint (grayed out).</span></i></p>
</td>
</tr>
<tr bgcolor="#cccccc">
<tr bgcolor="#999999">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPE</span></b></font></font></p>
</td>
@ -113,7 +121,7 @@ Default comparison operator is equal
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Enable Breakpoint (colored red).</span></i></p>
</td>
</tr>
<tr bgcolor="#999999">
<tr bgcolor="#cccccc">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPC #</span></b></font></font></p>
</td>
@ -122,7 +130,7 @@ Default comparison operator is equal
Note: The asterisk * may be used to clear all breakpoints.</span></i></p>
</td>
</tr>
<tr bgcolor="#cccccc">
<tr bgcolor="#999999">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPL</span></b></font></font></p>
</td>
@ -130,7 +138,7 @@ Note: The asterisk
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">List Breakpoints.</span></i></p>
</td>
</tr>
<tr bgcolor="#999999">
<tr bgcolor="#cccccc">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPIO</span></b></font></font></p>
</td>
@ -138,7 +146,7 @@ Note: The asterisk
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">(In a future version, will add Breakpoint trigger on memory read or write.)</span></i></p>
</td>
</tr>
<tr bgcolor="#cccccc">
<tr bgcolor="#999999">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPP</span></b></font></font></p>
</td>
@ -146,7 +154,7 @@ Note: The asterisk
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">(In a future version, will add Breakpoint trigger on specific flag cleared or set.)</span></i></p>
</td>
</tr>
<tr bgcolor="#999999">
<tr bgcolor="#cccccc">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRK [0|1|2|3|all] [on|off]</span></b></font></font></p>
</td>
@ -154,7 +162,7 @@ Note: The asterisk
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Break on BRK or Invalid 1-3 byte opcodes</span></i></p>
</td>
</tr>
<tr bgcolor="#cccccc">
<tr bgcolor="#999999">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRKOP [opcode]</span></b></font></font></p>
</td>
@ -162,7 +170,7 @@ Note: The asterisk
<p><i><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">Break on Opcode</span></i></p>
</td>
</tr>
<tr bgcolor="#999999">
<tr bgcolor="#cccccc">
<td width="25%">
<p><font color="#000000"><font face="Courier"><b><span style="BACKGROUND: 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRKINT [on|off]</span></b></font></font></p>
</td>
@ -399,6 +407,14 @@ Note: The asterisk
<p><font color="#ffffff"><i>Add Breakpoint when Stack has had something pushed onto it.</i></font></p>
</td>
</tr>
<tr bgcolor="#000000">
<td bgcolor="#000000" width="25%">
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BPV A0</span></b></font></font></p>
</td>
<td bgcolor="#000000" width="75%">
<p><font color="#ffffff"><i>Add Breakpoint when video-scanner is at line 160 ($A0) which is the start of the MIXED area.</i></font></p>
</td>
</tr>
<tr bgcolor="#000000">
<td bgcolor="#000000" width="25%">
<p><font color="#00b8ff"><font face="Courier"><b><span style="BACKGROUND: rgb(0,0,0) 0% 50%; moz-background-clip: initial; moz-background-origin: initial; moz-background-inline-policy: initial">BRK ON</span></b></font></font></p>

View File

@ -114,8 +114,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"M", // Mem RW
"M", // Mem READ_ONLY
"M", // Mem WRITE_ONLY
// Watches
"M", // Memory
"V", // Video Scanner
// TODO: M0 ram bank 0, M1 aux ram ?
};
@ -1335,6 +1333,33 @@ void ClearTempBreakpoints ()
}
}
// Returns true if a video breakpoint is triggered
//===========================================================================
int CheckBreakpointsVideo()
{
int bBreakpointHit = 0;
for (int iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++)
{
Breakpoint_t* pBP = &g_aBreakpoints[iBreakpoint];
if (!_BreakpointValid(pBP))
continue;
if (pBP->eSource != BP_SRC_VIDEO_SCANNER)
continue;
if (_CheckBreakpointValue(pBP, g_nVideoClockVert))
{
bBreakpointHit = BP_HIT_VIDEO_POS;
pBP->bEnabled = false; // Disable, otherwise it'll trigger many times on this scan-line
break;
}
}
return bBreakpointHit;
}
//===========================================================================
static int CheckBreakpointsDmaToOrFromIOMemory(void)
{
@ -1502,6 +1527,15 @@ bool _CmdBreakpointAddReg( Breakpoint_t *pBP, BreakpointSource_t iSrc, Breakpoin
_ASSERT(nLen <= _6502_MEM_LEN);
if (nLen > (int) _6502_MEM_LEN) nLen = (int) _6502_MEM_LEN;
if (iSrc == BP_SRC_VIDEO_SCANNER)
{
if (nAddress >= NTSC_GetVideoLines())
nAddress = NTSC_GetVideoLines() - 1;
if ((nAddress + (UINT)nLen) >= NTSC_GetVideoLines())
nLen = NTSC_GetVideoLines() - nAddress;
}
pBP->eSource = iSrc;
pBP->eOperator = iCmp;
pBP->nAddress = nAddress;
@ -1651,7 +1685,7 @@ Update_t CmdBreakpointAddMemW(int nArgs)
return CmdBreakpointAddMem(nArgs, BP_SRC_MEM_WRITE_ONLY);
}
//===========================================================================
Update_t CmdBreakpointAddMem (int nArgs, BreakpointSource_t bpSrc /*= BP_SRC_MEM_RW*/)
Update_t CmdBreakpointAddMem(int nArgs, BreakpointSource_t bpSrc /*= BP_SRC_MEM_RW*/)
{
BreakpointSource_t iSrc = bpSrc;
BreakpointOperator_t iCmp = BP_OP_EQUAL;
@ -1678,6 +1712,33 @@ Update_t CmdBreakpointAddMem (int nArgs, BreakpointSource_t bpSrc /*= BP_SRC_ME
return UPDATE_BREAKPOINTS | UPDATE_CONSOLE_DISPLAY;
}
//===========================================================================
Update_t CmdBreakpointAddVideo(int nArgs)
{
BreakpointSource_t iSrc = BP_SRC_VIDEO_SCANNER;
BreakpointOperator_t iCmp = BP_OP_EQUAL;
int iArg = 0;
while (iArg++ < nArgs)
{
if (g_aArgs[iArg].bType & TYPE_OPERATOR)
{
return Help_Arg_1(CMD_BREAKPOINT_ADD_VIDEO);
}
else
{
int dArg = _CmdBreakpointAddCommonArg(iArg, nArgs, iSrc, iCmp);
if (!dArg)
{
return Help_Arg_1(CMD_BREAKPOINT_ADD_VIDEO);
}
iArg += dArg;
}
}
return UPDATE_BREAKPOINTS | UPDATE_CONSOLE_DISPLAY;
}
//===========================================================================
void _BWZ_Clear( Breakpoint_t * aBreakWatchZero, int iSlot )
@ -6713,7 +6774,7 @@ Update_t CmdWatchAdd (int nArgs)
{
g_aWatches[iWatch].bSet = true;
g_aWatches[iWatch].bEnabled = true;
g_aWatches[iWatch].eSource = BP_SRC_MEMORY;
g_aWatches[iWatch].eSource = BP_SRC_MEM_RW;
g_aWatches[iWatch].nAddress = (WORD) nAddress;
bAdded = true;
g_nWatches++;
@ -8395,7 +8456,7 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
g_bDebugBreakpointHit |= BP_HIT_INTERRUPT;
}
g_bDebugBreakpointHit |= CheckBreakpointsIO() | CheckBreakpointsReg() | CheckBreakpointsDmaToOrFromIOMemory() | CheckBreakpointsDmaToOrFromMemory(-1);
g_bDebugBreakpointHit |= CheckBreakpointsIO() | CheckBreakpointsReg() | CheckBreakpointsVideo() | CheckBreakpointsDmaToOrFromIOMemory() | CheckBreakpointsDmaToOrFromMemory(-1);
}
if (regs.pc == g_nDebugStepUntil || g_bDebugBreakpointHit)
@ -8421,6 +8482,8 @@ void DebugContinueStepping(const bool bCallerWillUpdateDisplay/*=false*/)
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);
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)
stopReason = StrFormat("HDD DMA to I/O memory or ROM at $%04X", g_DebugBreakOnDMAIO.memoryAddr);
else if (g_bDebugBreakpointHit & BP_DMA_FROM_IO_MEM)

View File

@ -43,6 +43,7 @@
, BP_DMA_FROM_IO_MEM = (1 << 9)
, BP_DMA_TO_MEM = (1 << 10)
, BP_DMA_FROM_MEM = (1 << 11)
, BP_HIT_VIDEO_POS = (1 << 12)
};
extern int g_nBreakpoints;

View File

@ -90,6 +90,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
{TEXT("BPM") , CmdBreakpointAddMemA , CMD_BREAKPOINT_ADD_MEM , "Add breakpoint on memory access" }, // SoftICE
{TEXT("BPMR") , CmdBreakpointAddMemR , CMD_BREAKPOINT_ADD_MEMR , "Add breakpoint on memory read access" },
{TEXT("BPMW") , CmdBreakpointAddMemW , CMD_BREAKPOINT_ADD_MEMW , "Add breakpoint on memory write access" },
{TEXT("BPV") , CmdBreakpointAddVideo, CMD_BREAKPOINT_ADD_VIDEO , "Add breakpoint on video scanner position" },
{TEXT("BPC") , CmdBreakpointClear , CMD_BREAKPOINT_CLEAR , "Clear (remove) breakpoint" }, // SoftICE
{TEXT("BPD") , CmdBreakpointDisable , CMD_BREAKPOINT_DISABLE , "Disable breakpoint- it is still in the list, just not active" }, // SoftICE

View File

@ -2767,7 +2767,7 @@ void DrawWatches (int line)
#if DEBUG_FORCE_DISPLAY // Watch
if (true)
#else
if (g_aWatches[iWatch].bEnabled && g_aWatches[iWatch].eSource == BP_SRC_MEMORY)
if (g_aWatches[iWatch].bEnabled && g_aWatches[iWatch].eSource == BP_SRC_MEM_RW)
#endif
{
RECT rect2 = rect;

View File

@ -940,7 +940,10 @@ Update_t CmdHelpSpecific (int nArgs)
ConsoleColorizePrint( " Usage: <range>" );
Help_Range();
break;
// Config - Load / Save
case CMD_BREAKPOINT_ADD_VIDEO:
ConsoleColorizePrint( " Usage: <vpos[,length]>" );
break;
// Config - Load / Save
case CMD_CONFIG_LOAD:
ConsoleColorizePrint( " Usage: [\"filename\"]" );
ConsoleBufferPushFormat( " Load debugger configuration from '%s', or the specificed file.", g_sFileNameConfig.c_str() );

View File

@ -183,9 +183,7 @@
BP_SRC_MEM_RW,
BP_SRC_MEM_READ_ONLY,
BP_SRC_MEM_WRITE_ONLY,
BP_SRC_MEMORY, // For watches
BP_SRC_VIDEO_SCANNER, // For watches
BP_SRC_VIDEO_SCANNER,
NUM_BREAKPOINT_SOURCES
};
@ -337,6 +335,7 @@
, CMD_BREAKPOINT_ADD_MEM // break on: [$0000-$FFFF], excluding IO
, CMD_BREAKPOINT_ADD_MEMR // break on read on: [$0000-$FFFF], excluding IO
, CMD_BREAKPOINT_ADD_MEMW // break on write on: [$0000-$FFFF], excluding IO
, CMD_BREAKPOINT_ADD_VIDEO // break on video scanner position
, CMD_BREAKPOINT_CLEAR
// , CMD_BREAKPOINT_REMOVE = CMD_BREAKPOINT_CLEAR // alias
@ -644,6 +643,7 @@
Update_t CmdBreakpointAddMemA (int nArgs);
Update_t CmdBreakpointAddMemR (int nArgs);
Update_t CmdBreakpointAddMemW (int nArgs);
Update_t CmdBreakpointAddVideo (int nArgs);
Update_t CmdBreakpointClear (int nArgs);
Update_t CmdBreakpointDisable (int nArgs);
Update_t CmdBreakpointEdit (int nArgs);