diff --git a/src/apps/debugger/model/StackFrame.cpp b/src/apps/debugger/model/StackFrame.cpp index 14f81ff705..6cb760c7d2 100644 --- a/src/apps/debugger/model/StackFrame.cpp +++ b/src/apps/debugger/model/StackFrame.cpp @@ -25,6 +25,7 @@ StackFrame::StackFrame(stack_frame_type type, CpuState* cpuState, : fType(type), fCpuState(cpuState), + fPreviousCpuState(NULL), fFrameAddress(frameAddress), fInstructionPointer(instructionPointer), fReturnAddress(0), @@ -49,6 +50,7 @@ StackFrame::~StackFrame() SetImage(NULL); SetFunction(NULL); + SetPreviousCpuState(NULL); fDebugInfo->ReleaseReference(); fCpuState->ReleaseReference(); @@ -80,6 +82,18 @@ StackFrame::Init() } +void +StackFrame::SetPreviousCpuState(CpuState* state) +{ + if (fPreviousCpuState != NULL) + fPreviousCpuState->ReleaseReference(); + + fPreviousCpuState = state; + + if (fPreviousCpuState != NULL) + fPreviousCpuState->AcquireReference(); +} + void StackFrame::SetReturnAddress(target_addr_t address) { diff --git a/src/apps/debugger/model/StackFrame.h b/src/apps/debugger/model/StackFrame.h index e4c2f975f7..0e30d53a13 100644 --- a/src/apps/debugger/model/StackFrame.h +++ b/src/apps/debugger/model/StackFrame.h @@ -55,6 +55,10 @@ public: target_addr_t InstructionPointer() const { return fInstructionPointer; } + CpuState* GetPreviousCpuState() const + { return fPreviousCpuState; } + void SetPreviousCpuState(CpuState* state); + target_addr_t ReturnAddress() const { return fReturnAddress; } void SetReturnAddress(target_addr_t address); @@ -89,6 +93,7 @@ private: private: stack_frame_type fType; CpuState* fCpuState; + CpuState* fPreviousCpuState; target_addr_t fFrameAddress; target_addr_t fInstructionPointer; target_addr_t fReturnAddress;