Files
haiku-beta6/headers/private/debugger/model/StackFrame.h
T

123 lines
3.2 KiB
C++
Raw Normal View History

2009-06-18 19:57:46 +00:00
/*
* Copyright 2009, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef STACK_FRAME_H
#define STACK_FRAME_H
2009-07-18 23:52:16 +00:00
2009-06-18 19:57:46 +00:00
#include <OS.h>
#include <ObjectList.h>
2009-06-18 19:57:46 +00:00
#include <Referenceable.h>
2009-07-18 23:52:16 +00:00
#include <util/DoublyLinkedList.h>
2009-06-18 19:57:46 +00:00
2009-06-29 22:38:15 +00:00
#include "Types.h"
2009-06-18 19:57:46 +00:00
2009-06-19 22:13:32 +00:00
enum stack_frame_type {
STACK_FRAME_TYPE_SYSCALL, // syscall frame
STACK_FRAME_TYPE_STANDARD, // standard frame
2009-06-19 22:13:32 +00:00
STACK_FRAME_TYPE_SIGNAL, // signal handler frame
STACK_FRAME_TYPE_FRAMELESS // dummy frame for a frameless function
};
2009-06-18 19:57:46 +00:00
class CpuState;
class Image;
class FunctionInstance;
class StackFrameDebugInfo;
class StackFrameValueInfos;
2009-07-18 23:52:16 +00:00
class StackFrameValues;
class TypeComponentPath;
class Variable;
2009-06-18 19:57:46 +00:00
class StackFrame : public BReferenceable {
2009-07-18 23:52:16 +00:00
public:
class Listener;
2009-06-18 19:57:46 +00:00
public:
StackFrame(stack_frame_type type,
CpuState* cpuState,
target_addr_t frameAddress,
target_addr_t instructionPointer,
StackFrameDebugInfo* debugInfo);
~StackFrame();
2009-07-18 23:52:16 +00:00
status_t Init();
stack_frame_type Type() const { return fType; }
CpuState* GetCpuState() const { return fCpuState; }
target_addr_t FrameAddress() const { return fFrameAddress; }
StackFrameDebugInfo* DebugInfo() const { return fDebugInfo; }
target_addr_t InstructionPointer() const
{ return fInstructionPointer; }
2011-12-16 08:38:09 -05:00
CpuState* PreviousCpuState() const
{ return fPreviousCpuState; }
void SetPreviousCpuState(CpuState* state);
target_addr_t ReturnAddress() const { return fReturnAddress; }
void SetReturnAddress(target_addr_t address);
Image* GetImage() const { return fImage; }
void SetImage(Image* image);
FunctionInstance* Function() const { return fFunction; }
void SetFunction(FunctionInstance* function);
int32 CountParameters() const;
Variable* ParameterAt(int32 index) const;
bool AddParameter(Variable* parameter);
int32 CountLocalVariables() const;
Variable* LocalVariableAt(int32 index) const;
bool AddLocalVariable(Variable* variable);
StackFrameValues* Values() const { return fValues; }
StackFrameValueInfos* ValueInfos() const { return fValueInfos; }
2009-07-18 23:52:16 +00:00
// team lock must be held
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
void NotifyValueRetrieved(Variable* variable,
TypeComponentPath* path);
private:
typedef BObjectList<Variable> VariableList;
2009-07-18 23:52:16 +00:00
typedef DoublyLinkedList<Listener> ListenerList;
private:
stack_frame_type fType;
CpuState* fCpuState;
CpuState* fPreviousCpuState;
target_addr_t fFrameAddress;
target_addr_t fInstructionPointer;
target_addr_t fReturnAddress;
StackFrameDebugInfo* fDebugInfo;
Image* fImage;
FunctionInstance* fFunction;
VariableList fParameters;
VariableList fLocalVariables;
2009-07-18 23:52:16 +00:00
StackFrameValues* fValues;
StackFrameValueInfos* fValueInfos;
2009-07-18 23:52:16 +00:00
ListenerList fListeners;
};
class StackFrame::Listener : public DoublyLinkedListLinkImpl<Listener> {
public:
virtual ~Listener();
virtual void StackFrameValueRetrieved(StackFrame* stackFrame,
Variable* variable,
TypeComponentPath* path);
// called with lock held
2009-06-18 19:57:46 +00:00
};
#endif // STACK_FRAME_H