Debugger: Fixed profiler counting jsr/rts cycles in the wrong function
This commit is contained in:
parent
2cbae24ded
commit
7fe6ae6a0d
3 changed files with 15 additions and 8 deletions
|
@ -353,10 +353,10 @@ void Debugger::PrivateProcessRamOperation(MemoryOperationType type, uint16_t &ad
|
||||||
_disassembler->BuildCache(absoluteAddr, absoluteRamAddr, addr, isSubEntryPoint);
|
_disassembler->BuildCache(absoluteAddr, absoluteRamAddr, addr, isSubEntryPoint);
|
||||||
_lastInstruction = _memoryManager->DebugRead(addr);
|
_lastInstruction = _memoryManager->DebugRead(addr);
|
||||||
|
|
||||||
UpdateCallstack(addr);
|
|
||||||
ProcessStepConditions(addr);
|
ProcessStepConditions(addr);
|
||||||
|
|
||||||
_profiler->ProcessInstructionStart(absoluteAddr);
|
_profiler->ProcessInstructionStart(absoluteAddr);
|
||||||
|
UpdateCallstack(addr);
|
||||||
|
|
||||||
breakDone = SleepUntilResume();
|
breakDone = SleepUntilResume();
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ Profiler::Profiler(Debugger * debugger)
|
||||||
{
|
{
|
||||||
_debugger = debugger;
|
_debugger = debugger;
|
||||||
|
|
||||||
|
_nextFunctionAddr = -1;
|
||||||
_currentCycleCount = 0;
|
_currentCycleCount = 0;
|
||||||
_currentInstruction = 0;
|
_currentInstruction = 0;
|
||||||
|
|
||||||
|
@ -32,14 +33,8 @@ void Profiler::ProcessCycle()
|
||||||
void Profiler::StackFunction(int32_t instructionAddr, int32_t functionAddr)
|
void Profiler::StackFunction(int32_t instructionAddr, int32_t functionAddr)
|
||||||
{
|
{
|
||||||
if(functionAddr >= 0) {
|
if(functionAddr >= 0) {
|
||||||
_cycleCountStack.push(_currentCycleCount);
|
_nextFunctionAddr = functionAddr;
|
||||||
_functionStack.push(_currentFunction);
|
|
||||||
|
|
||||||
_currentFunction = functionAddr;
|
|
||||||
_currentCycleCount = 0;
|
|
||||||
_jsrStack.push(instructionAddr);
|
_jsrStack.push(instructionAddr);
|
||||||
|
|
||||||
_functionCallCount[functionAddr]++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +68,17 @@ void Profiler::UnstackFunction()
|
||||||
|
|
||||||
void Profiler::ProcessInstructionStart(int32_t absoluteAddr)
|
void Profiler::ProcessInstructionStart(int32_t absoluteAddr)
|
||||||
{
|
{
|
||||||
|
if(_nextFunctionAddr >= 0) {
|
||||||
|
_cycleCountStack.push(_currentCycleCount);
|
||||||
|
_functionStack.push(_currentFunction);
|
||||||
|
|
||||||
|
_currentFunction = _nextFunctionAddr;
|
||||||
|
_currentCycleCount = 0;
|
||||||
|
_functionCallCount[_nextFunctionAddr]++;
|
||||||
|
|
||||||
|
_nextFunctionAddr = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if(absoluteAddr >= 0) {
|
if(absoluteAddr >= 0) {
|
||||||
_currentInstruction = absoluteAddr;
|
_currentInstruction = absoluteAddr;
|
||||||
ProcessCycle();
|
ProcessCycle();
|
||||||
|
|
|
@ -31,6 +31,7 @@ private:
|
||||||
|
|
||||||
int32_t _currentFunction;
|
int32_t _currentFunction;
|
||||||
int32_t _currentInstruction;
|
int32_t _currentInstruction;
|
||||||
|
int32_t _nextFunctionAddr;
|
||||||
|
|
||||||
uint32_t _resetFunctionIndex;
|
uint32_t _resetFunctionIndex;
|
||||||
uint32_t _inMemoryFunctionIndex;
|
uint32_t _inMemoryFunctionIndex;
|
||||||
|
|
Loading…
Add table
Reference in a new issue