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();
break;
#ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER:
#ifdef DEBUGGER_SUPPORT
myOverlay = &myOSystem.debugger();
enableTextEvents(true);
#endif
break;
#endif
case EventHandlerState::NONE:
myOverlay = nullptr;

View File

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

View File

@ -69,12 +69,12 @@ M6502::M6502(const Settings& settings)
myDataAddressForPoke(0),
myOnHaltCallback(nullptr),
myHaltRequested(false),
myGhostReadsTrap(true),
myStepStateByInstruction(false)
{
#ifdef DEBUGGER_SUPPORT
myDebugger = nullptr;
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
myGhostReadsTrap = true;
#endif
}
@ -210,7 +210,10 @@ inline void M6502::handleHalt()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::updateStepStateByInstruction()
{
// Currently only used in debugger mode
#ifdef DEBUGGER_SUPPORT
myStepStateByInstruction = myCondBreaks.size() || myCondSaveStates.size() || myTrapConds.size();
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -218,6 +221,7 @@ bool M6502::execute(uInt32 number)
{
const bool status = _execute(number);
#ifdef DEBUGGER_SUPPORT
// 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
// 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.
mySystem->tia().updateEmulation();
mySystem->m6532().updateEmulation();
#endif
return status;
}
@ -248,7 +253,7 @@ inline bool M6502::_execute(uInt32 number)
{
for(; !myExecutionStatus && (number != 0); --number)
{
#ifdef DEBUGGER_SUPPORT
#ifdef DEBUGGER_SUPPORT
if(myJustHitReadTrapFlag || myJustHitWriteTrapFlag)
{
bool read = myJustHitReadTrapFlag;
@ -279,7 +284,7 @@ inline bool M6502::_execute(uInt32 number)
msg << "conditional savestate [" << Common::Base::HEX2 << cond << "]";
myDebugger->addState(msg.str());
}
#endif // DEBUGGER_SUPPORT
#endif // DEBUGGER_SUPPORT
uInt16 operandAddress = 0, intermediateAddress = 0;
uInt8 operand = 0;
@ -301,17 +306,17 @@ inline bool M6502::_execute(uInt32 number)
// Oops, illegal instruction executed so set fatal error flag
myExecutionStatus |= FatalErrorBit;
}
//cycles = mySystem->cycles() - c0;
#ifdef DEBUGGER_SUPPORT
if (myStepStateByInstruction) {
#ifdef DEBUGGER_SUPPORT
if(myStepStateByInstruction)
{
// Check out M6502::execute for an explanation.
handleHalt();
tia.updateEmulation();
riot.updateEmulation();
}
#endif
#endif
}
// See if we need to handle an interrupt

View File

@ -445,8 +445,6 @@ class M6502 : public Serializable
int address;
};
HitTrapInfo myHitTrapInfo;
// trap on ghost reads
bool myGhostReadsTrap;
vector<unique_ptr<Expression>> myCondBreaks;
StringList myCondBreakNames;
@ -454,11 +452,13 @@ class M6502 : public Serializable
StringList myCondSaveStateNames;
vector<unique_ptr<Expression>> myTrapConds;
StringList myTrapCondNames;
bool myStepStateByInstruction;
#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:
// Following constructors and assignment operators not supported
M6502() = delete;

View File

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

View File

@ -1708,14 +1708,10 @@ void TIA::toggleCollBLPF()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::createAccessBase()
{
#ifdef DEBUGGER_SUPPORT
myAccessBase = make_unique<uInt8[]>(TIA_SIZE);
memset(myAccessBase.get(), CartDebug::NONE, TIA_SIZE);
myAccessDelay = make_unique<uInt8[]>(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;
uInt8 myJitterFactor;
#ifdef DEBUGGER_SUPPORT
#ifdef DEBUGGER_SUPPORT
// The arrays containing information about every byte of TIA
// indicating whether and how (RW) it is used.
BytePtr myAccessBase;
// The array used to skip the first two TIA access trackings
BytePtr myAccessDelay;
#endif // DEBUGGER_SUPPORT
#endif // DEBUGGER_SUPPORT
static constexpr uInt16
TIA_SIZE = 0x40, TIA_MASK = TIA_SIZE - 1, TIA_READ_MASK = 0x0f, TIA_BIT = 0x080, TIA_DELAY = 2;

View File

@ -44,7 +44,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent)
{
const int VGAP = 4;
@ -375,13 +375,13 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
{
int tabID = myTab->addTab("Debugger");
WidgetArray wid;
#ifdef DEBUGGER_SUPPORT
const int HBORDER = 10;
const int VBORDER = 8;
const int VGAP = 4;
WidgetArray wid;
VariantList items;
int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
@ -473,7 +473,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
// Add items for tab 1
addToFocusList(wid, myTab, tabID);
#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);
#endif
@ -1199,6 +1199,7 @@ void DeveloperDialog::handleDebugColours(const string& colors)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleFontSize()
{
#ifdef DEBUGGER_SUPPORT
uInt32 minW, minH;
int fontSize = myDebuggerFontSize->getSelected();
@ -1233,4 +1234,5 @@ void DeveloperDialog::handleFontSize()
myDebuggerHeightSlider->setValue(minH);
myDebuggerHeightLabel->setValue(minH);
}
#endif
}

View File

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