Make sure that the hardware state is up to date before entering the debugger.

This commit is contained in:
Christian Speckner 2018-03-13 22:12:57 +01:00
parent 36997d4d7a
commit d8178f546b
2 changed files with 26 additions and 9 deletions

View File

@ -237,6 +237,21 @@ bool M6502::execute(uInt32 number)
return status;
}
bool M6502::startDebugger(const string& message, int address, bool read) {
handleHalt();
mySystem->tia().updateEmulation();
mySystem->m6532().updateEmulation();
#ifndef DEBUGGER_SUPPORT
return false;
#endif
if (!myDebugger) return false;
return myDebugger->start(message, address, read);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline bool M6502::_execute(uInt32 number)
{
@ -258,14 +273,11 @@ inline bool M6502::_execute(uInt32 number)
{
bool read = myJustHitReadTrapFlag;
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
if(myDebugger && myDebugger->start(myHitTrapInfo.message, myHitTrapInfo.address, read))
{
return true;
}
if (startDebugger(myHitTrapInfo.message, myHitTrapInfo.address, read)) return true;
}
if(myBreakPoints.isInitialized() && myBreakPoints.isSet(PC))
if(myDebugger && myDebugger->start("BP: ", PC))
if(myBreakPoints.isInitialized() && myBreakPoints.isSet(PC) && startDebugger("BP: ", PC))
return true;
int cond = evalCondBreaks();
@ -273,8 +285,7 @@ inline bool M6502::_execute(uInt32 number)
{
stringstream msg;
msg << "CBP[" << Common::Base::HEX2 << cond << "]: " << myCondBreakNames[cond];
if(myDebugger && myDebugger->start(msg.str()))
return true;
if (startDebugger(msg.str())) return true;
}
cond = evalCondSaveStates();

View File

@ -326,6 +326,12 @@ class M6502 : public Serializable
*/
bool _execute(uInt32 number);
/**
Make sure that the current hardware state is up to date (TIA & RIOT) and dispatch
debugger.
*/
bool startDebugger(const string& message = "", int address = -1, bool read = true);
private:
/**
Bit fields used to indicate that certain conditions need to be