Files
haiku-beta6/src/apps/debugger/model/StackFrame.cpp
T

73 lines
1.1 KiB
C++
Raw Normal View History

/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
2009-06-18 19:57:46 +00:00
#include "StackFrame.h"
#include "CpuState.h"
#include "FunctionDebugInfo.h"
#include "Image.h"
StackFrame::StackFrame(stack_frame_type type, CpuState* cpuState,
target_addr_t frameAddress)
:
fType(type),
fCpuState(cpuState),
fFrameAddress(frameAddress),
fReturnAddress(0),
fImage(NULL),
fFunction(NULL)
{
fCpuState->AddReference();
}
2009-06-18 19:57:46 +00:00
StackFrame::~StackFrame()
{
SetImage(NULL);
SetFunction(NULL);
fCpuState->RemoveReference();
}
target_addr_t
StackFrame::InstructionPointer() const
{
return fCpuState->InstructionPointer();
}
void
StackFrame::SetReturnAddress(target_addr_t address)
{
fReturnAddress = address;
}
void
StackFrame::SetImage(Image* image)
{
if (fImage != NULL)
fImage->RemoveReference();
fImage = image;
if (fImage != NULL)
fImage->AddReference();
}
void
StackFrame::SetFunction(FunctionDebugInfo* function)
{
if (fFunction != NULL)
fFunction->RemoveReference();
fFunction = function;
if (fFunction != NULL)
fFunction->AddReference();
}