Added AddressSize(), IsBigEndian, IsHostEndian().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31634 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-07-18 23:18:06 +00:00
parent e3eda50984
commit f3516af2ca
3 changed files with 28 additions and 5 deletions

View File

@ -20,9 +20,12 @@
#include "Team.h" #include "Team.h"
Architecture::Architecture(TeamMemory* teamMemory) Architecture::Architecture(TeamMemory* teamMemory, uint8 addressSize,
bool bigEndian)
: :
fTeamMemory(teamMemory) fTeamMemory(teamMemory),
fAddressSize(addressSize),
fBigEndian(bigEndian)
{ {
} }
@ -97,7 +100,7 @@ Architecture::CreateStackTrace(Team* team,
CpuState* previousCpuState = NULL; CpuState* previousCpuState = NULL;
if (function != NULL) { if (function != NULL) {
status_t error = functionDebugInfo->GetSpecificImageDebugInfo() status_t error = functionDebugInfo->GetSpecificImageDebugInfo()
->CreateFrame(image, functionDebugInfo, cpuState, previousFrame, ->CreateFrame(image, function, cpuState, previousFrame,
previousCpuState); previousCpuState);
if (error != B_OK && error != B_UNSUPPORTED) if (error != B_OK && error != B_UNSUPPORTED)
break; break;

View File

@ -6,6 +6,7 @@
#define ARCHITECTURE_H #define ARCHITECTURE_H
#include <ByteOrder.h>
#include <OS.h> #include <OS.h>
#include <Referenceable.h> #include <Referenceable.h>
@ -31,11 +32,17 @@ class TeamMemory;
class Architecture : public Referenceable { class Architecture : public Referenceable {
public: public:
Architecture(TeamMemory* teamMemory); Architecture(TeamMemory* teamMemory,
uint8 addressSize, bool bigEndian);
virtual ~Architecture(); virtual ~Architecture();
virtual status_t Init(); virtual status_t Init();
inline uint8 AddressSize() const { return fAddressSize; }
inline bool IsBigEndian() const { return fBigEndian; }
inline bool IsHostEndian() const;
virtual int32 CountRegisters() const = 0; virtual int32 CountRegisters() const = 0;
virtual const Register* Registers() const = 0; virtual const Register* Registers() const = 0;
@ -87,7 +94,16 @@ public:
protected: protected:
TeamMemory* fTeamMemory; TeamMemory* fTeamMemory;
uint8 fAddressSize;
bool fBigEndian;
}; };
bool
Architecture::IsHostEndian() const
{
return fBigEndian == (B_HOST_IS_BENDIAN != 0);
}
#endif // ARCHITECTURE_H #endif // ARCHITECTURE_H

View File

@ -104,7 +104,7 @@ struct ArchitectureX86::FromDwarfRegisterMap : RegisterMap {
ArchitectureX86::ArchitectureX86(TeamMemory* teamMemory) ArchitectureX86::ArchitectureX86(TeamMemory* teamMemory)
: :
Architecture(teamMemory), Architecture(teamMemory, 4, false),
fAssemblyLanguage(NULL), fAssemblyLanguage(NULL),
fToDwarfRegisterMap(NULL), fToDwarfRegisterMap(NULL),
fFromDwarfRegisterMap(NULL) fFromDwarfRegisterMap(NULL)
@ -326,6 +326,10 @@ ArchitectureX86::CreateStackFrame(Image* image, FunctionDebugInfo* function,
return B_NO_MEMORY; return B_NO_MEMORY;
Reference<StackFrame> frameReference(frame, true); Reference<StackFrame> frameReference(frame, true);
status_t error = frame->Init();
if (error != B_OK)
return error;
// read the previous frame and return address, if this is a standard frame // read the previous frame and return address, if this is a standard frame
if (readStandardFrame) { if (readStandardFrame) {
uint32 frameData[2]; uint32 frameData[2];