Fix DiStella trying to process the same PC address repeatedly (fixes #188).

This commit is contained in:
Stephen Anthony 2017-08-13 13:43:48 -02:30
parent 55111c4ccb
commit 193da6c845
2 changed files with 13 additions and 2 deletions

View File

@ -23,6 +23,9 @@
then back again would pass a 'Tab' key event to the app, which in
most cases would navigate to the next UI element.
* Fixed possible lockups when entering the debugger under certain
circumstances.
* Reverted joystick changes for Decathlon ROMs from last release, as
it was added by mistake.

View File

@ -103,9 +103,16 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
// use all access points determined by Stella during emulation
int codeAccessPoint = 0;
while(!myAddressQueue.empty())
// Sometimes we get a circular reference, in that processing a certain
// PC address leads us to a sequence of addresses that end up trying
// to process the same address again. We detect such consecutive PC
// addresses and only process the first one
uInt16 lastPC = 0;
bool duplicateFound = false;
while(!(myAddressQueue.empty() || duplicateFound))
{
myPC = myAddressQueue.front();
myPC = lastPC = myAddressQueue.front();
uInt16 pcBeg = myPC;
myAddressQueue.pop();
disasm(myPC, 1);
@ -174,6 +181,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
++codeAccessPoint;
}
}
duplicateFound = (myAddressQueue.front() == lastPC);
}
for (int k = 0; k <= myAppData.end; k++)
{