From a9bec97e472fd70d446da9b0fb1eff28dd0f0549 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 15 Dec 2011 22:40:32 -0500 Subject: [PATCH] Add previous CPU state member and associated accessors. Used to store the unwound state of the CPU from this frame, which will form the actual state of the following frame. Needed in order to properly support continuation of unwinding from a partial stack trace. --- src/apps/debugger/model/StackFrame.cpp | 14 ++++++++++++++ src/apps/debugger/model/StackFrame.h | 5 +++++ 2 files changed, 19 insertions(+) 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;