Fixed compilation when '--disable-debugger' is used.

This commit is contained in:
Stephen Anthony 2018-01-09 23:16:50 -03:30
parent af19f9f2b8
commit 9e403826d2
9 changed files with 31 additions and 29 deletions

View File

@ -2189,12 +2189,12 @@ void EventHandler::setEventState(EventHandlerState state)
myEvent.clear(); myEvent.clear();
break; break;
#ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER: case EventHandlerState::DEBUGGER:
#ifdef DEBUGGER_SUPPORT
myOverlay = &myOSystem.debugger(); myOverlay = &myOSystem.debugger();
enableTextEvents(true); enableTextEvents(true);
#endif
break; break;
#endif
case EventHandlerState::NONE: case EventHandlerState::NONE:
myOverlay = nullptr; myOverlay = nullptr;

View File

@ -339,13 +339,13 @@ void FrameBuffer::update()
break; // EventHandlerState::LAUNCHER break; // EventHandlerState::LAUNCHER
} }
#ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER: case EventHandlerState::DEBUGGER:
{ {
#ifdef DEBUGGER_SUPPORT
myOSystem.debugger().draw(true); myOSystem.debugger().draw(true);
#endif
break; // EventHandlerState::DEBUGGER break; // EventHandlerState::DEBUGGER
} }
#endif
case EventHandlerState::NONE: case EventHandlerState::NONE:
return; return;

View File

@ -69,12 +69,12 @@ M6502::M6502(const Settings& settings)
myDataAddressForPoke(0), myDataAddressForPoke(0),
myOnHaltCallback(nullptr), myOnHaltCallback(nullptr),
myHaltRequested(false), myHaltRequested(false),
myGhostReadsTrap(true),
myStepStateByInstruction(false) myStepStateByInstruction(false)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
myDebugger = nullptr; myDebugger = nullptr;
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false; myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
myGhostReadsTrap = true;
#endif #endif
} }
@ -210,7 +210,10 @@ inline void M6502::handleHalt()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::updateStepStateByInstruction() void M6502::updateStepStateByInstruction()
{ {
// Currently only used in debugger mode
#ifdef DEBUGGER_SUPPORT
myStepStateByInstruction = myCondBreaks.size() || myCondSaveStates.size() || myTrapConds.size(); myStepStateByInstruction = myCondBreaks.size() || myCondSaveStates.size() || myTrapConds.size();
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -218,6 +221,7 @@ bool M6502::execute(uInt32 number)
{ {
const bool status = _execute(number); const bool status = _execute(number);
#ifdef DEBUGGER_SUPPORT
// Debugger hack: this ensures that stepping a "STA WSYNC" will actually end at the // Debugger hack: this ensures that stepping a "STA WSYNC" will actually end at the
// beginning of the next line (otherwise, the next instruction would be stepped in order for // beginning of the next line (otherwise, the next instruction would be stepped in order for
// the halt to take effect). This is safe because as we know that the next cycle will be a read // the halt to take effect). This is safe because as we know that the next cycle will be a read
@ -228,6 +232,7 @@ bool M6502::execute(uInt32 number)
// to maintain a consistent state for the debugger after stepping. // to maintain a consistent state for the debugger after stepping.
mySystem->tia().updateEmulation(); mySystem->tia().updateEmulation();
mySystem->m6532().updateEmulation(); mySystem->m6532().updateEmulation();
#endif
return status; return status;
} }
@ -248,7 +253,7 @@ inline bool M6502::_execute(uInt32 number)
{ {
for(; !myExecutionStatus && (number != 0); --number) for(; !myExecutionStatus && (number != 0); --number)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if(myJustHitReadTrapFlag || myJustHitWriteTrapFlag) if(myJustHitReadTrapFlag || myJustHitWriteTrapFlag)
{ {
bool read = myJustHitReadTrapFlag; bool read = myJustHitReadTrapFlag;
@ -279,7 +284,7 @@ inline bool M6502::_execute(uInt32 number)
msg << "conditional savestate [" << Common::Base::HEX2 << cond << "]"; msg << "conditional savestate [" << Common::Base::HEX2 << cond << "]";
myDebugger->addState(msg.str()); myDebugger->addState(msg.str());
} }
#endif // DEBUGGER_SUPPORT #endif // DEBUGGER_SUPPORT
uInt16 operandAddress = 0, intermediateAddress = 0; uInt16 operandAddress = 0, intermediateAddress = 0;
uInt8 operand = 0; uInt8 operand = 0;
@ -301,17 +306,17 @@ inline bool M6502::_execute(uInt32 number)
// Oops, illegal instruction executed so set fatal error flag // Oops, illegal instruction executed so set fatal error flag
myExecutionStatus |= FatalErrorBit; myExecutionStatus |= FatalErrorBit;
} }
//cycles = mySystem->cycles() - c0;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if (myStepStateByInstruction) { if(myStepStateByInstruction)
{
// Check out M6502::execute for an explanation. // Check out M6502::execute for an explanation.
handleHalt(); handleHalt();
tia.updateEmulation(); tia.updateEmulation();
riot.updateEmulation(); riot.updateEmulation();
} }
#endif #endif
} }
// See if we need to handle an interrupt // See if we need to handle an interrupt

View File

@ -445,8 +445,6 @@ class M6502 : public Serializable
int address; int address;
}; };
HitTrapInfo myHitTrapInfo; HitTrapInfo myHitTrapInfo;
// trap on ghost reads
bool myGhostReadsTrap;
vector<unique_ptr<Expression>> myCondBreaks; vector<unique_ptr<Expression>> myCondBreaks;
StringList myCondBreakNames; StringList myCondBreakNames;
@ -454,11 +452,13 @@ class M6502 : public Serializable
StringList myCondSaveStateNames; StringList myCondSaveStateNames;
vector<unique_ptr<Expression>> myTrapConds; vector<unique_ptr<Expression>> myTrapConds;
StringList myTrapCondNames; StringList myTrapCondNames;
bool myStepStateByInstruction;
#endif // DEBUGGER_SUPPORT #endif // DEBUGGER_SUPPORT
// These are both used only by the debugger, but since they're included
// in save states, they cannot be conditionally compiled
bool myGhostReadsTrap; // trap on ghost reads
bool myStepStateByInstruction;
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
M6502() = delete; M6502() = delete;

View File

@ -264,12 +264,12 @@ FBInitStatus OSystem::createFrameBuffer()
return fbstatus; return fbstatus;
break; break;
#ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER: case EventHandlerState::DEBUGGER:
#ifdef DEBUGGER_SUPPORT
if((fbstatus = myDebugger->initializeVideo()) != FBInitStatus::Success) if((fbstatus = myDebugger->initializeVideo()) != FBInitStatus::Success)
return fbstatus; return fbstatus;
#endif
break; break;
#endif
case EventHandlerState::NONE: // Should never happen case EventHandlerState::NONE: // Should never happen
logMessage("ERROR: Unknown emulation state in createFrameBuffer()", 0); logMessage("ERROR: Unknown emulation state in createFrameBuffer()", 0);

View File

@ -1708,14 +1708,10 @@ void TIA::toggleCollBLPF()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::createAccessBase() void TIA::createAccessBase()
{ {
#ifdef DEBUGGER_SUPPORT
myAccessBase = make_unique<uInt8[]>(TIA_SIZE); myAccessBase = make_unique<uInt8[]>(TIA_SIZE);
memset(myAccessBase.get(), CartDebug::NONE, TIA_SIZE); memset(myAccessBase.get(), CartDebug::NONE, TIA_SIZE);
myAccessDelay = make_unique<uInt8[]>(TIA_SIZE); myAccessDelay = make_unique<uInt8[]>(TIA_SIZE);
memset(myAccessDelay.get(), TIA_DELAY, TIA_SIZE); memset(myAccessDelay.get(), TIA_DELAY, TIA_SIZE);
#else
myAccessBase = nullptr;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -776,13 +776,14 @@ class TIA : public Device
bool myEnableJitter; bool myEnableJitter;
uInt8 myJitterFactor; uInt8 myJitterFactor;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// The arrays containing information about every byte of TIA // The arrays containing information about every byte of TIA
// indicating whether and how (RW) it is used. // indicating whether and how (RW) it is used.
BytePtr myAccessBase; BytePtr myAccessBase;
// The array used to skip the first two TIA access trackings // The array used to skip the first two TIA access trackings
BytePtr myAccessDelay; BytePtr myAccessDelay;
#endif // DEBUGGER_SUPPORT #endif // DEBUGGER_SUPPORT
static constexpr uInt16 static constexpr uInt16
TIA_SIZE = 0x40, TIA_MASK = TIA_SIZE - 1, TIA_READ_MASK = 0x0f, TIA_BIT = 0x080, TIA_DELAY = 2; TIA_SIZE = 0x40, TIA_MASK = TIA_SIZE - 1, TIA_READ_MASK = 0x0f, TIA_BIT = 0x080, TIA_DELAY = 2;

View File

@ -375,13 +375,13 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
void DeveloperDialog::addDebuggerTab(const GUI::Font& font) void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
{ {
int tabID = myTab->addTab("Debugger"); int tabID = myTab->addTab("Debugger");
WidgetArray wid;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
const int HBORDER = 10; const int HBORDER = 10;
const int VBORDER = 8; const int VBORDER = 8;
const int VGAP = 4; const int VGAP = 4;
WidgetArray wid;
VariantList items; VariantList items;
int fontWidth = font.getMaxCharWidth(), int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
@ -473,7 +473,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
// Add items for tab 1 // Add items for tab 1
addToFocusList(wid, myTab, tabID); addToFocusList(wid, myTab, tabID);
#else #else
new StaticTextWidget(myTab, font, 0, 20, _w - 20, fontHeight, new StaticTextWidget(myTab, font, 0, 20, _w - 20, font.getFontHeight(),
"Debugger support not included", TextAlign::Center); "Debugger support not included", TextAlign::Center);
#endif #endif
@ -1199,6 +1199,7 @@ void DeveloperDialog::handleDebugColours(const string& colors)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleFontSize() void DeveloperDialog::handleFontSize()
{ {
#ifdef DEBUGGER_SUPPORT
uInt32 minW, minH; uInt32 minW, minH;
int fontSize = myDebuggerFontSize->getSelected(); int fontSize = myDebuggerFontSize->getSelected();
@ -1233,4 +1234,5 @@ void DeveloperDialog::handleFontSize()
myDebuggerHeightSlider->setValue(minH); myDebuggerHeightSlider->setValue(minH);
myDebuggerHeightLabel->setValue(minH); myDebuggerHeightLabel->setValue(minH);
} }
#endif
} }

View File

@ -183,9 +183,7 @@ class DeveloperDialog : public Dialog
void handleUncompressed(); void handleUncompressed();
void handleInterval(); void handleInterval();
void handleHorizon(); void handleHorizon();
#ifdef DEBUGGER_SUPPORT
void handleFontSize(); void handleFontSize();
#endif
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
DeveloperDialog() = delete; DeveloperDialog() = delete;