Debugger: Fixed callstack displaying incorrect data when breaking on a RTS instruction

This commit is contained in:
Sour 2018-02-25 10:38:45 -05:00
parent 5b8800f038
commit 7ccf093a7e
2 changed files with 7 additions and 4 deletions

View File

@ -365,9 +365,10 @@ void Debugger::RemoveExcessCallstackEntries()
}
}
void Debugger::UpdateCallstack(uint32_t addr)
void Debugger::UpdateCallstack(uint8_t currentInstruction, uint32_t addr)
{
_hideTopOfCallstack = false;
if((_lastInstruction == 0x60 || _lastInstruction == 0x40) && !_callstackRelative.empty()) {
//RTS & RTI
_callstackRelative.pop_back();
@ -376,7 +377,9 @@ void Debugger::UpdateCallstack(uint32_t addr)
_callstackAbsolute.pop_back();
_profiler->UnstackFunction();
} else if(_lastInstruction == 0x20) {
}
if(currentInstruction == 0x20) {
//JSR
RemoveExcessCallstackEntries();
@ -591,8 +594,8 @@ bool Debugger::PrivateProcessRamOperation(MemoryOperationType type, uint16_t &ad
}
}
UpdateCallstack(value, addr);
_lastInstruction = value;
UpdateCallstack(addr);
breakDone = SleepUntilResume();

View File

@ -129,7 +129,7 @@ private:
void PrivateProcessVramWriteOperation(uint16_t addr, uint8_t &value);
void ProcessBreakpoints(BreakpointType type, OperationInfo &operationInfo, bool allowBreak = true);
void UpdateCallstack(uint32_t addr);
void UpdateCallstack(uint8_t currentInstruction, uint32_t addr);
void PrivateProcessInterrupt(uint16_t cpuAddr, uint16_t destCpuAddr, bool forNmi);
void ProcessStepConditions(uint32_t addr);