Fix: 'Debugger: G xxxx not clearing BP' (Bug #16699)

This commit is contained in:
tomch 2010-01-22 23:11:48 +00:00
parent 871ea06e58
commit d17c3d0490
2 changed files with 37 additions and 18 deletions

View File

@ -874,8 +874,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// bool CheckBreakpoint (WORD address, BOOL memory); // bool CheckBreakpoint (WORD address, BOOL memory);
bool CheckBreakpointsIO (); bool CheckBreakpointsIO ();
bool CheckBreakpointsReg (); bool CheckBreakpointsReg ();
bool _CmdBreakpointAddReg ( Breakpoint_t *pBP, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, WORD nAddress, int nLen ); bool _CmdBreakpointAddReg ( Breakpoint_t *pBP, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, WORD nAddress, int nLen, bool bIsTempBreakpoint );
int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp ); int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, bool bIsTempBreakpoint=false );
void _BWZ_Clear( Breakpoint_t * aBreakWatchZero, int iSlot );
// Config - Colors // Config - Colors
static void _ConfigColorsReset ( BYTE *pPalDst = 0 ); static void _ConfigColorsReset ( BYTE *pPalDst = 0 );
@ -1663,37 +1664,52 @@ bool CheckBreakpointsReg ()
switch (pBP->eSource) switch (pBP->eSource)
{ {
case BP_SRC_REG_PC: case BP_SRC_REG_PC:
if (_CheckBreakpointValue( pBP, regs.pc )) bStatus = _CheckBreakpointValue( pBP, regs.pc );
return true;
break; break;
case BP_SRC_REG_A: case BP_SRC_REG_A:
if (_CheckBreakpointValue( pBP, regs.a )) bStatus = _CheckBreakpointValue( pBP, regs.a );
return true;
break; break;
case BP_SRC_REG_X: case BP_SRC_REG_X:
if (_CheckBreakpointValue( pBP, regs.x )) bStatus = _CheckBreakpointValue( pBP, regs.x );
return true;
break; break;
case BP_SRC_REG_Y: case BP_SRC_REG_Y:
if (_CheckBreakpointValue( pBP, regs.y )) bStatus = _CheckBreakpointValue( pBP, regs.y );
return true;
break; break;
case BP_SRC_REG_P: case BP_SRC_REG_P:
if (_CheckBreakpointValue( pBP, regs.ps )) bStatus = _CheckBreakpointValue( pBP, regs.ps );
return true;
break; break;
case BP_SRC_REG_S: case BP_SRC_REG_S:
if (_CheckBreakpointValue( pBP, regs.sp )) bStatus = _CheckBreakpointValue( pBP, regs.sp );
return true;
break; break;
default: default:
break; break;
} }
if (bStatus)
{
if (pBP->bTemp)
_BWZ_Clear(pBP, iBreakpoint);
break;
}
} }
return bStatus; return bStatus;
} }
void ClearTempBreakpoints ()
{
for (int iBreakpoint = 0; iBreakpoint < MAX_BREAKPOINTS; iBreakpoint++)
{
Breakpoint_t *pBP = &g_aBreakpoints[iBreakpoint];
if (! _BreakpointValid( pBP ))
continue;
if (pBP->bTemp)
_BWZ_Clear(pBP, iBreakpoint);
}
}
//=========================================================================== //===========================================================================
Update_t CmdBreakpoint (int nArgs) Update_t CmdBreakpoint (int nArgs)
@ -1807,7 +1823,7 @@ Update_t CmdBreakpointAddReg (int nArgs)
//=========================================================================== //===========================================================================
bool _CmdBreakpointAddReg( Breakpoint_t *pBP, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, WORD nAddress, int nLen ) bool _CmdBreakpointAddReg( Breakpoint_t *pBP, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, WORD nAddress, int nLen, bool bIsTempBreakpoint )
{ {
bool bStatus = false; bool bStatus = false;
@ -1819,6 +1835,7 @@ bool _CmdBreakpointAddReg( Breakpoint_t *pBP, BreakpointSource_t iSrc, Breakpoin
pBP->nLength = nLen; pBP->nLength = nLen;
pBP->bSet = true; pBP->bSet = true;
pBP->bEnabled = true; pBP->bEnabled = true;
pBP->bTemp = bIsTempBreakpoint;
bStatus = true; bStatus = true;
} }
@ -1828,7 +1845,7 @@ bool _CmdBreakpointAddReg( Breakpoint_t *pBP, BreakpointSource_t iSrc, Breakpoin
// @return Number of args processed // @return Number of args processed
//=========================================================================== //===========================================================================
int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp ) int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, BreakpointOperator_t iCmp, bool bIsTempBreakpoint )
{ {
int dArg = 0; int dArg = 0;
@ -1871,7 +1888,7 @@ int _CmdBreakpointAddCommonArg ( int iArg, int nArg, BreakpointSource_t iSrc, Br
nLen = 1; nLen = 1;
} }
if (! _CmdBreakpointAddReg( pBP, iSrc, iCmp, nAddress, nLen )) if (! _CmdBreakpointAddReg( pBP, iSrc, iCmp, nAddress, nLen, bIsTempBreakpoint ))
{ {
dArg = 0; dArg = 0;
} }
@ -7055,7 +7072,7 @@ Update_t ExecuteCommand (int nArgs)
{ {
const int iArg = 1; const int iArg = 1;
ArgsGetValue( &g_aArgs[iArg], &g_aArgs[iArg].nValue ); ArgsGetValue( &g_aArgs[iArg], &g_aArgs[iArg].nValue );
_CmdBreakpointAddCommonArg(iArg, nArgs, BP_SRC_REG_PC, BP_OP_EQUAL); // TC-TODO: Clear this temp BP when it's hit or stepping is cancelled _CmdBreakpointAddCommonArg(iArg, nArgs, BP_SRC_REG_PC, BP_OP_EQUAL, true);
} }
} }
else if (nLen > 1) else if (nLen > 1)
@ -8215,6 +8232,7 @@ void DebuggerInputConsoleChar( TCHAR ch )
if ((g_nAppMode == MODE_STEPPING) && (ch == DEBUG_EXIT_KEY)) if ((g_nAppMode == MODE_STEPPING) && (ch == DEBUG_EXIT_KEY))
{ {
g_nDebugSteps = 0; // Exit Debugger g_nDebugSteps = 0; // Exit Debugger
ClearTempBreakpoints();
} }
if (g_nAppMode != MODE_DEBUG) if (g_nAppMode != MODE_DEBUG)

View File

@ -206,6 +206,7 @@
BreakpointOperator_t eOperator; BreakpointOperator_t eOperator;
bool bSet ; // used to be called enabled pre 2.0 bool bSet ; // used to be called enabled pre 2.0
bool bEnabled; bool bEnabled;
bool bTemp; // If true then remove BP when hit or stepping cancelled (eg. G xxxx)
}; };
typedef Breakpoint_t Bookmark_t; typedef Breakpoint_t Bookmark_t;