From d13299b1843a96a05bef04a00a62db1f5d6597f5 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Fri, 1 Jan 2021 13:05:25 +0100 Subject: [PATCH] replaced the highlighting fix with a much better one :) --- src/debugger/CartDebug.cxx | 11 +++++++---- src/debugger/gui/RomWidget.cxx | 20 -------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 47d3212ab..d5232b68e 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -302,12 +302,15 @@ bool CartDebug::disassemble(int bank, uInt16 PC, bool force) AddressList::const_iterator i; for(i = addresses.cbegin(); i != addresses.cend(); ++i) { - if (PC == *i) // already present + if(PC == *i) // already present break; } // Otherwise, add the item at the end - if (i == addresses.end()) + if(i == addresses.end()) + { addresses.push_back(PC); + addDirective(Device::AccessType::CODE, PC, PC, bank); + } } // Always attempt to resolve code sections unless it's been @@ -347,8 +350,8 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search) const DisassemblyTag& tag = myDisassembly.list[i]; const uInt16 address = tag.address & 0xFFF; - // Exclude 'Device::ROW'; they don't have a valid address - if(tag.type != Device::ROW) + // Exclude 'Device::ROW|NONE'; they don't have a valid address + if(tag.type != Device::ROW && tag.type != Device::NONE) { // Create a mapping from addresses to line numbers myAddrToLineList.emplace(address, i); diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index ba3a6003c..16f8da5e7 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -76,26 +76,6 @@ void RomWidget::loadConfig() // Update romlist to point to current PC (if it has changed) int pcline = cart.addressToLine(dbg.cpuDebug().pc()); - if(pcline < 0) - { - // If tentative code detection is disabled, the code where PC points to is - // not disassembled the first time it is executed. Therefore the rom list - // highlight would never be updated! - // The following code tries to fix that and moves the highlight to the - // line following the last know dissassembled code. - const CpuState& oldCpuState = static_cast(dbg.cpuDebug().getOldState()); - int oldPc = oldCpuState.PC; - - if(dbg.cpuDebug().pc() > oldPc && dbg.cpuDebug().pc() - oldPc <= 3) - // we assume the code moved forward by one instruction - pcline = cart.addressToLine(oldPc); - else - // code jumped, try to find previous line - for(int i = 1; i <= 3 && pcline < 0; ++i) - pcline = cart.addressToLine(dbg.cpuDebug().pc() - i); - if(pcline >= 0) - pcline++; - } if(pcline >= 0 && pcline != myRomList->getHighlighted()) myRomList->setHighlighted(pcline);