2009-06-18 23:57:46 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef STACK_FRAME_H
|
|
|
|
#define STACK_FRAME_H
|
|
|
|
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
#include <Referenceable.h>
|
|
|
|
|
2009-06-30 02:38:15 +04:00
|
|
|
#include "Types.h"
|
2009-06-18 23:57:46 +04:00
|
|
|
|
|
|
|
|
2009-06-20 02:13:32 +04:00
|
|
|
enum stack_frame_type {
|
2009-06-25 02:10:07 +04:00
|
|
|
STACK_FRAME_TYPE_SYSCALL, // syscall frame
|
|
|
|
STACK_FRAME_TYPE_STANDARD, // standard frame
|
2009-06-20 02:13:32 +04:00
|
|
|
STACK_FRAME_TYPE_SIGNAL, // signal handler frame
|
|
|
|
STACK_FRAME_TYPE_FRAMELESS // dummy frame for a frameless function
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-06-18 23:57:46 +04:00
|
|
|
class CpuState;
|
2009-06-20 21:20:49 +04:00
|
|
|
class Image;
|
|
|
|
class FunctionDebugInfo;
|
2009-06-18 23:57:46 +04:00
|
|
|
|
|
|
|
|
2009-06-20 21:20:49 +04:00
|
|
|
class StackFrame : public Referenceable {
|
2009-06-18 23:57:46 +04:00
|
|
|
public:
|
2009-06-20 21:20:49 +04:00
|
|
|
StackFrame(stack_frame_type type,
|
|
|
|
CpuState* cpuState,
|
2009-06-25 02:10:07 +04:00
|
|
|
target_addr_t frameAddress,
|
|
|
|
target_addr_t instructionPointer);
|
2009-06-20 21:20:49 +04:00
|
|
|
~StackFrame();
|
|
|
|
|
|
|
|
stack_frame_type Type() const { return fType; }
|
|
|
|
CpuState* GetCpuState() const { return fCpuState; }
|
|
|
|
target_addr_t FrameAddress() const { return fFrameAddress; }
|
|
|
|
|
2009-06-25 02:10:07 +04:00
|
|
|
target_addr_t InstructionPointer() const
|
|
|
|
{ return fInstructionPointer; }
|
|
|
|
|
2009-06-20 21:20:49 +04:00
|
|
|
target_addr_t ReturnAddress() const { return fReturnAddress; }
|
|
|
|
void SetReturnAddress(target_addr_t address);
|
|
|
|
|
|
|
|
Image* GetImage() const { return fImage; }
|
|
|
|
void SetImage(Image* image);
|
|
|
|
|
|
|
|
FunctionDebugInfo* Function() const { return fFunction; }
|
|
|
|
void SetFunction(FunctionDebugInfo* function);
|
|
|
|
|
|
|
|
private:
|
|
|
|
stack_frame_type fType;
|
|
|
|
CpuState* fCpuState;
|
|
|
|
target_addr_t fFrameAddress;
|
2009-06-25 02:10:07 +04:00
|
|
|
target_addr_t fInstructionPointer;
|
2009-06-20 21:20:49 +04:00
|
|
|
target_addr_t fReturnAddress;
|
|
|
|
Image* fImage;
|
|
|
|
FunctionDebugInfo* fFunction;
|
2009-06-18 23:57:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // STACK_FRAME_H
|