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; 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) inline bool M6502::_execute(uInt32 number)
{ {
@ -258,23 +273,19 @@ inline bool M6502::_execute(uInt32 number)
{ {
bool read = myJustHitReadTrapFlag; bool read = myJustHitReadTrapFlag;
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false; myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
if(myDebugger && myDebugger->start(myHitTrapInfo.message, myHitTrapInfo.address, read))
{ if (startDebugger(myHitTrapInfo.message, myHitTrapInfo.address, read)) return true;
return true;
}
} }
if(myBreakPoints.isInitialized() && myBreakPoints.isSet(PC)) if(myBreakPoints.isInitialized() && myBreakPoints.isSet(PC) && startDebugger("BP: ", PC))
if(myDebugger && myDebugger->start("BP: ", PC)) return true;
return true;
int cond = evalCondBreaks(); int cond = evalCondBreaks();
if(cond > -1) if(cond > -1)
{ {
stringstream msg; stringstream msg;
msg << "CBP[" << Common::Base::HEX2 << cond << "]: " << myCondBreakNames[cond]; msg << "CBP[" << Common::Base::HEX2 << cond << "]: " << myCondBreakNames[cond];
if(myDebugger && myDebugger->start(msg.str())) if (startDebugger(msg.str())) return true;
return true;
} }
cond = evalCondSaveStates(); cond = evalCondSaveStates();

View File

@ -326,6 +326,12 @@ class M6502 : public Serializable
*/ */
bool _execute(uInt32 number); 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: private:
/** /**
Bit fields used to indicate that certain conditions need to be Bit fields used to indicate that certain conditions need to be