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;
|
2009-07-08 00:47:39 +04:00
|
|
|
class FunctionInstance;
|
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);
|
|
|
|
|
2009-07-08 00:47:39 +04:00
|
|
|
FunctionInstance* Function() const { return fFunction; }
|
|
|
|
void SetFunction(FunctionInstance* function);
|
2009-06-20 21:20:49 +04:00
|
|
|
|
|
|
|
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;
|
2009-07-08 00:47:39 +04:00
|
|
|
FunctionInstance* fFunction;
|
2009-06-18 23:57:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // STACK_FRAME_H
|