Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix DiStella trying to process the same PC address repeatedly (fixes #…
  • Loading branch information
sa666666 committed Aug 13, 2017
1 parent 55111c4 commit 193da6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changes.txt
Expand Up @@ -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.

Expand Down
12 changes: 10 additions & 2 deletions src/debugger/DiStella.cxx
Expand Up @@ -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);
Expand Down Expand Up @@ -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++)
{
Expand Down

0 comments on commit 193da6c

Please sign in to comment.