mirror of https://github.com/stella-emu/stella.git
debugger start displays labels where possible
prevent repeated trap interrupts some old code cleanup
This commit is contained in:
parent
d15690f5f1
commit
90705babd7
|
@ -168,7 +168,7 @@ FBInitStatus Debugger::initializeVideo()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Debugger::start(const string& message, int address)
|
||||
bool Debugger::start(const string& message, int address, bool read)
|
||||
{
|
||||
if(myOSystem.eventHandler().enterDebugMode())
|
||||
{
|
||||
|
@ -177,8 +177,7 @@ bool Debugger::start(const string& message, int address)
|
|||
ostringstream buf;
|
||||
buf << message;
|
||||
if(address > -1)
|
||||
buf << Common::Base::HEX4 << address;
|
||||
|
||||
buf << cartDebug().getLabel(address, read);
|
||||
myDialog->message().setText(buf.str());
|
||||
return true;
|
||||
}
|
||||
|
@ -368,27 +367,6 @@ bool Debugger::breakPoint(uInt16 bp)
|
|||
return breakPoints().isSet(bp);
|
||||
}
|
||||
|
||||
/*// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::toggleReadTrap(uInt16 t)
|
||||
{
|
||||
readTraps().initialize();
|
||||
readTraps().toggle(t);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::toggleWriteTrap(uInt16 t)
|
||||
{
|
||||
writeTraps().initialize();
|
||||
writeTraps().toggle(t);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::toggleTrap(uInt16 t)
|
||||
{
|
||||
toggleReadTrap(t);
|
||||
toggleWriteTrap(t);
|
||||
}*/
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::addReadTrap(uInt16 t)
|
||||
{
|
||||
|
|
|
@ -88,7 +88,7 @@ class Debugger : public DialogContainer
|
|||
@param message Message to display when entering debugger
|
||||
@param address An address associated with the message
|
||||
*/
|
||||
bool start(const string& message = "", int address = -1);
|
||||
bool start(const string& message = "", int address = -1, bool read = true);
|
||||
bool startWithFatalError(const string& message = "");
|
||||
|
||||
/**
|
||||
|
@ -147,8 +147,6 @@ class Debugger : public DialogContainer
|
|||
PackedBitArray& breakPoints() const { return mySystem.m6502().breakPoints(); }
|
||||
TrapArray& readTraps() const { return mySystem.m6502().readTraps(); }
|
||||
TrapArray& writeTraps() const { return mySystem.m6502().writeTraps(); }
|
||||
/*PackedBitArray& readTrapIfs() const { return mySystem.m6502().readTrapIfs(); }
|
||||
PackedBitArray& writeTrapIfs() const { return mySystem.m6502().writeTrapIfs(); }*/
|
||||
|
||||
/**
|
||||
Run the debugger command and return the result.
|
||||
|
@ -259,9 +257,6 @@ class Debugger : public DialogContainer
|
|||
void toggleBreakPoint(uInt16 bp);
|
||||
|
||||
bool breakPoint(uInt16 bp);
|
||||
/*void toggleReadTrap(uInt16 t);
|
||||
void toggleWriteTrap(uInt16 t);
|
||||
void toggleTrap(uInt16 t);*/
|
||||
void addReadTrap(uInt16 t);
|
||||
void addWriteTrap(uInt16 t);
|
||||
void addTrap(uInt16 t);
|
||||
|
|
|
@ -586,6 +586,7 @@ bool DebuggerParser::saveScriptFile(string file)
|
|||
if(debugger.breakPoint(i))
|
||||
out << "break #" << i << endl;
|
||||
|
||||
// TODO: new trapif
|
||||
for(uInt32 i = 0; i < 0x10000; ++i)
|
||||
{
|
||||
bool r = debugger.readTrap(i);
|
||||
|
|
|
@ -55,6 +55,8 @@ M6502::M6502(const Settings& settings)
|
|||
myLastAddress(0),
|
||||
myLastPeekAddress(0),
|
||||
myLastPokeAddress(0),
|
||||
myLastPeekBaseAddress(0),
|
||||
myLastPokeBaseAddress(0),
|
||||
myLastSrcAddressS(-1),
|
||||
myLastSrcAddressA(-1),
|
||||
myLastSrcAddressX(-1),
|
||||
|
@ -65,7 +67,7 @@ M6502::M6502(const Settings& settings)
|
|||
{
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
myDebugger = nullptr;
|
||||
myJustHitTrapFlag = false;
|
||||
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -98,7 +100,7 @@ void M6502::reset()
|
|||
// Load PC from the reset vector
|
||||
PC = uInt16(mySystem->peek(0xfffc)) | (uInt16(mySystem->peek(0xfffd)) << 8);
|
||||
|
||||
myLastAddress = myLastPeekAddress = myLastPokeAddress = 0;
|
||||
myLastAddress = myLastPeekAddress = myLastPokeAddress = myLastPeekBaseAddress = myLastPokeBaseAddress;
|
||||
myLastSrcAddressS = myLastSrcAddressA =
|
||||
myLastSrcAddressX = myLastSrcAddressY = -1;
|
||||
myDataAddressForPoke = 0;
|
||||
|
@ -130,9 +132,8 @@ inline uInt8 M6502::peek(uInt16 address, uInt8 flags)
|
|||
int cond = evalCondTraps();
|
||||
if(cond > -1)
|
||||
{
|
||||
myJustHitTrapFlag = true;
|
||||
myHitTrapInfo.message = "RTrap: ";
|
||||
//myHitTrapInfo.message = "RTrapIf (" + myTrapCondNames[cond] + "): ";
|
||||
myJustHitReadTrapFlag = true;
|
||||
myHitTrapInfo.message = "RTrap(" + myTrapCondNames[cond] + "): ";
|
||||
myHitTrapInfo.address = address;
|
||||
}
|
||||
}
|
||||
|
@ -163,9 +164,8 @@ inline void M6502::poke(uInt16 address, uInt8 value, uInt8 flags)
|
|||
int cond = evalCondTraps();
|
||||
if(cond > -1)
|
||||
{
|
||||
myJustHitTrapFlag = true;
|
||||
myHitTrapInfo.message = "WTrap: ";
|
||||
//myHitTrapInfo.message = "WTrapIf (" + myTrapCondNames[cond] + "): ";
|
||||
myJustHitWriteTrapFlag = true;
|
||||
myHitTrapInfo.message = "WTrap(" + myTrapCondNames[cond] + "): ";
|
||||
myHitTrapInfo.address = address;
|
||||
}
|
||||
}
|
||||
|
@ -200,11 +200,11 @@ bool M6502::execute(uInt32 number)
|
|||
for(; !myExecutionStatus && (number != 0); --number)
|
||||
{
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
if(myJustHitTrapFlag)
|
||||
if(myJustHitReadTrapFlag || myJustHitWriteTrapFlag)
|
||||
{
|
||||
if(myDebugger && myDebugger->start(myHitTrapInfo.message, myHitTrapInfo.address))
|
||||
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
|
||||
if(myDebugger && myDebugger->start(myHitTrapInfo.message, myHitTrapInfo.address, myJustHitReadTrapFlag))
|
||||
{
|
||||
myJustHitTrapFlag = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -405,7 +405,8 @@ class M6502 : public Serializable
|
|||
TrapArray myReadTraps, myWriteTraps;
|
||||
|
||||
// Did we just now hit a trap?
|
||||
bool myJustHitTrapFlag;
|
||||
bool myJustHitReadTrapFlag;
|
||||
bool myJustHitWriteTrapFlag;
|
||||
struct HitTrapInfo {
|
||||
string message;
|
||||
int address;
|
||||
|
|
Loading…
Reference in New Issue