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 ARCHITECTURE_H
|
|
|
|
#define ARCHITECTURE_H
|
|
|
|
|
|
|
|
#include <OS.h>
|
|
|
|
|
|
|
|
#include <Referenceable.h>
|
|
|
|
|
2009-06-26 03:51:09 +04:00
|
|
|
#include "ArchitectureTypes.h"
|
|
|
|
|
2009-06-18 23:57:46 +04:00
|
|
|
|
|
|
|
class CpuState;
|
|
|
|
class DebuggerInterface;
|
2009-06-20 21:20:49 +04:00
|
|
|
class FunctionDebugInfo;
|
|
|
|
class Image;
|
|
|
|
class ImageDebugInfoProvider;
|
2009-06-26 03:51:09 +04:00
|
|
|
class InstructionInfo;
|
2009-06-19 04:05:45 +04:00
|
|
|
class Register;
|
2009-06-21 17:17:21 +04:00
|
|
|
class SourceCode;
|
2009-06-20 21:20:49 +04:00
|
|
|
class StackFrame;
|
2009-06-20 02:13:32 +04:00
|
|
|
class StackTrace;
|
2009-06-26 03:51:09 +04:00
|
|
|
class Statement;
|
2009-06-20 02:13:32 +04:00
|
|
|
class Team;
|
2009-06-18 23:57:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
class Architecture : public Referenceable {
|
|
|
|
public:
|
|
|
|
Architecture(
|
|
|
|
DebuggerInterface* debuggerInterface);
|
|
|
|
virtual ~Architecture();
|
|
|
|
|
2009-06-19 04:05:45 +04:00
|
|
|
virtual status_t Init();
|
|
|
|
|
|
|
|
virtual int32 CountRegisters() const = 0;
|
|
|
|
virtual const Register* Registers() const = 0;
|
|
|
|
|
2009-06-18 23:57:46 +04:00
|
|
|
virtual status_t CreateCpuState(const void* cpuStateData,
|
|
|
|
size_t size, CpuState*& _state) = 0;
|
2009-06-20 21:20:49 +04:00
|
|
|
virtual status_t CreateStackFrame(Image* image,
|
|
|
|
FunctionDebugInfo* function,
|
2009-06-24 20:37:11 +04:00
|
|
|
CpuState* cpuState, bool isTopFrame,
|
2009-06-20 21:20:49 +04:00
|
|
|
StackFrame*& _previousFrame,
|
|
|
|
CpuState*& _previousCpuState) = 0;
|
|
|
|
// returns reference to previous frame
|
|
|
|
// and CPU state; returned CPU state
|
|
|
|
// can be NULL
|
2009-06-25 02:10:07 +04:00
|
|
|
virtual void UpdateStackFrameCpuState(
|
|
|
|
const StackFrame* frame,
|
|
|
|
Image* previousImage,
|
|
|
|
FunctionDebugInfo* previousFunction,
|
|
|
|
CpuState* previousCpuState) = 0;
|
|
|
|
// Called after a CreateStackFrame()
|
|
|
|
// with the image/function corresponding
|
|
|
|
// to the CPU state.
|
2009-06-26 03:51:09 +04:00
|
|
|
|
2009-06-21 17:17:21 +04:00
|
|
|
virtual status_t DisassembleCode(FunctionDebugInfo* function,
|
|
|
|
const void* buffer, size_t bufferSize,
|
|
|
|
SourceCode*& _sourceCode) = 0;
|
2009-06-26 03:51:09 +04:00
|
|
|
virtual status_t GetStatement(FunctionDebugInfo* function,
|
|
|
|
target_addr_t address,
|
|
|
|
Statement*& _statement) = 0;
|
|
|
|
virtual status_t GetInstructionInfo(target_addr_t address,
|
|
|
|
InstructionInfo& _info) = 0;
|
2009-06-20 21:20:49 +04:00
|
|
|
|
|
|
|
status_t CreateStackTrace(Team* team,
|
|
|
|
ImageDebugInfoProvider* imageInfoProvider,
|
|
|
|
CpuState* cpuState,
|
|
|
|
StackTrace*& _stackTrace);
|
2009-06-20 02:13:32 +04:00
|
|
|
// team is not locked
|
2009-06-18 23:57:46 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DebuggerInterface* fDebuggerInterface;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ARCHITECTURE_H
|