Debugger: Fixed step back causing instruction before a JSR to be marked as a function entry point

This commit is contained in:
Sour 2019-02-09 15:24:51 -05:00
parent 2c64d55ddf
commit 5b0b084f6a

View file

@ -783,21 +783,25 @@ bool Debugger::ProcessRamOperation(MemoryOperationType type, uint16_t &addr, uin
_prevInstructionCycle = _curInstructionCycle;
_curInstructionCycle = _cpu->GetCycleCount();
bool isSubEntryPoint = _lastInstruction == 0x20; //Previous instruction was a JSR
_disassembler->BuildCache(addressInfo, addr, isSubEntryPoint, true);
_disassembler->BuildCache(addressInfo, addr, false, true);
if(absoluteAddr >= 0) {
_codeDataLogger->SetFlag(absoluteAddr, CdlPrgFlags::Code);
if(isSubEntryPoint) {
_codeDataLogger->SetFlag(absoluteAddr, CdlPrgFlags::SubEntryPoint);
_functionEntryPoints.emplace(absoluteAddr);
}
}
if(_disassembler->IsJump(value) && value != 0x20) {
//Only mark as jump target if not marked as sub entry point
int32_t targetAddr = GetAbsoluteAddress(_disassembler->GetDisassemblyInfo(addressInfo).GetJumpDestination(_cpu->GetPC(), _memoryManager.get()));
if(targetAddr >= 0) {
_codeDataLogger->SetFlag(targetAddr, CdlPrgFlags::JumpTarget);
if(_disassembler->IsJump(value)) {
uint16_t targetPc = _disassembler->GetDisassemblyInfo(addressInfo).GetJumpDestination(_cpu->GetPC(), _memoryManager.get());
AddressTypeInfo addressInfo;
GetAbsoluteAddressAndType(targetPc, &addressInfo);
if(addressInfo.Address >= 0 && addressInfo.Type == AddressType::PrgRom) {
if(value == 0x20) {
//JSR, mark target as a sub entry point
_disassembler->BuildCache(addressInfo, targetPc, true, false);
_functionEntryPoints.emplace(addressInfo.Address);
_codeDataLogger->SetFlag(addressInfo.Address, CdlPrgFlags::SubEntryPoint);
} else {
//Only mark as jump target if not marked as sub entry point
_codeDataLogger->SetFlag(addressInfo.Address, CdlPrgFlags::JumpTarget);
}
}
}