fixed #90 (debug breakpoint missing if conditions used)

This commit is contained in:
g0me3 2020-01-12 16:56:37 +03:00
parent e43fe75b67
commit db003f841d
4 changed files with 91 additions and 33 deletions

View File

@ -533,35 +533,36 @@ void IncrementInstructionsCounters()
delta_instructions++;
}
void BreakHit(int bp_num, bool force)
{
if(!force)
bool CondForbidTest(int bp_num) {
if (bp_num >= 0 && !condition(&watchpoint[bp_num]))
{
if (bp_num >= 0 && !condition(&watchpoint[bp_num]))
{
return; // condition rejected
}
return false; // condition rejected
}
//check to see whether we fall in any forbid zone
for (int i = 0; i < numWPs; i++)
{
watchpointinfo& wp = watchpoint[i];
if(!(wp.flags & WP_F) || !(wp.flags & WP_E))
continue;
//check to see whether we fall in any forbid zone
for (int i = 0; i < numWPs; i++)
{
watchpointinfo& wp = watchpoint[i];
if (!(wp.flags & WP_F) || !(wp.flags & WP_E))
continue;
if (condition(&wp))
{
if (wp.endaddress) {
if( (wp.address <= _PC) && (wp.endaddress >= _PC) )
return; //forbid
} else {
if(wp.address == _PC)
return; //forbid
}
if (condition(&wp))
{
if (wp.endaddress) {
if ((wp.address <= _PC) && (wp.endaddress >= _PC))
return false; //forbid
}
else {
if (wp.address == _PC)
return false; //forbid
}
}
}
return true;
}
void BreakHit(int bp_num)
{
FCEUI_SetEmulationPaused(EMULATIONPAUSED_PAUSED); //mbg merge 7/19/06 changed to use EmulationPaused()
#ifdef WIN32
@ -585,17 +586,17 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
if (break_asap)
{
break_asap = false;
BreakHit(BREAK_TYPE_LUA, true);
BreakHit(BREAK_TYPE_LUA);
}
if (break_on_cycles && ((timestampbase + (uint64)timestamp - total_cycles_base) > break_cycles_limit))
BreakHit(BREAK_TYPE_CYCLES_EXCEED, true);
BreakHit(BREAK_TYPE_CYCLES_EXCEED);
if (break_on_instructions && (total_instructions > break_instructions_limit))
BreakHit(BREAK_TYPE_INSTRUCTIONS_EXCEED, true);
BreakHit(BREAK_TYPE_INSTRUCTIONS_EXCEED);
//if the current instruction is bad, and we are breaking on bad opcodes, then hit the breakpoint
if(dbgstate.badopbreak && (size == 0))
BreakHit(BREAK_TYPE_BADOP, true);
BreakHit(BREAK_TYPE_BADOP);
//if we're stepping out, track the nest level
if (dbgstate.stepout) {
@ -614,7 +615,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
//if we're stepping, then we'll always want to break
if (dbgstate.step) {
dbgstate.step = false;
BreakHit(BREAK_TYPE_STEP, true);
BreakHit(BREAK_TYPE_STEP);
return;
}
@ -626,7 +627,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
if (diff<=0)
{
dbgstate.runline=false;
BreakHit(BREAK_TYPE_STEP, true);
BreakHit(BREAK_TYPE_STEP);
return;
}
}
@ -635,7 +636,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
if ((watchpoint[64].address == _PC) && (watchpoint[64].flags)) {
watchpoint[64].address = 0;
watchpoint[64].flags = 0;
BreakHit(BREAK_TYPE_STEP, true);
BreakHit(BREAK_TYPE_STEP);
return;
}
@ -657,7 +658,7 @@ static void breakpoint(uint8 *opcode, uint16 A, int size) {
default: break;
}
#define BREAKHIT(x) { breakHit = (x); goto STOPCHECKING; }
#define BREAKHIT(x) { if (CondForbidTest(x)) { breakHit = (x); goto STOPCHECKING; } }
int breakHit = -1;
for (i = 0; i < numWPs; i++)
{

View File

@ -93,7 +93,7 @@ static INLINE int FCEUI_GetLoggingCD() { return debug_loggingCD; }
extern int iaPC;
extern uint32 iapoffset; //mbg merge 7/18/06 changed from int
void DebugCycle();
void BreakHit(int bp_num, bool force = false);
void BreakHit(int bp_num);
extern bool break_asap;
extern uint64 total_cycles_base;

View File

@ -1218,7 +1218,64 @@ static void RefreshLine(int lastpixel) {
#undef PPU_VRC5FETCH
} else {
for (X1 = firsttile; X1 < lasttile; X1++) {
#include "pputile.inc"
// #include "pputile.inc"
uint8 *C;
register uint8 cc;
uint32 vadr;
register uint8 zz;
if (X1 >= 2) {
uint8 *S = PALRAM;
uint32 pixdata;
pixdata = ppulut1[(pshift[0] >> (8 - XOffset)) & 0xFF] | ppulut2[(pshift[1] >> (8 - XOffset)) & 0xFF];
pixdata |= ppulut3[XOffset | (atlatch << 3)];
P[0] = S[pixdata & 0xF];
pixdata >>= 4;
P[1] = S[pixdata & 0xF];
pixdata >>= 4;
P[2] = S[pixdata & 0xF];
pixdata >>= 4;
P[3] = S[pixdata & 0xF];
pixdata >>= 4;
P[4] = S[pixdata & 0xF];
pixdata >>= 4;
P[5] = S[pixdata & 0xF];
pixdata >>= 4;
P[6] = S[pixdata & 0xF];
pixdata >>= 4;
P[7] = S[pixdata & 0xF];
P += 8;
}
zz = RefreshAddr & 0x1F;
C = vnapage[(RefreshAddr >> 10) & 3];
vadr = (C[RefreshAddr & 0x3ff] << 4) + vofs; // Fetch name table byte.
cc = C[0x3c0 + (zz >> 2) + ((RefreshAddr & 0x380) >> 4)]; // Fetch attribute table byte.
cc = ((cc >> ((zz & 2) + ((RefreshAddr & 0x40) >> 4))) & 3);
atlatch >>= 2;
atlatch |= cc << 2;
pshift[0] <<= 8;
pshift[1] <<= 8;
C = VRAMADR(vadr);
if (ScreenON)
RENDER_LOGP(C);
pshift[0] |= C[0];
if (ScreenON)
RENDER_LOGP(C + 8);
pshift[1] |= C[8];
if ((RefreshAddr & 0x1f) == 0x1f)
RefreshAddr ^= 0x41F;
else
RefreshAddr++;
}
}
}

View File

@ -51,7 +51,7 @@ void EKROM_Init(CartInfo *info);
void ELROM_Init(CartInfo *info);
void ETROM_Init(CartInfo *info);
void EWROM_Init(CartInfo *info);
void GNROM_Init(CartInfo *info);
//void GNROM_Init(CartInfo *info);
void HKROM_Init(CartInfo *info);
void LE05_Init(CartInfo *info);
void LH10_Init(CartInfo *info);