diff --git a/src/apps/debugger/arch/Architecture.cpp b/src/apps/debugger/arch/Architecture.cpp index 92c00ede8f..414347d098 100644 --- a/src/apps/debugger/arch/Architecture.cpp +++ b/src/apps/debugger/arch/Architecture.cpp @@ -20,9 +20,12 @@ #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; if (function != NULL) { status_t error = functionDebugInfo->GetSpecificImageDebugInfo() - ->CreateFrame(image, functionDebugInfo, cpuState, previousFrame, + ->CreateFrame(image, function, cpuState, previousFrame, previousCpuState); if (error != B_OK && error != B_UNSUPPORTED) break; diff --git a/src/apps/debugger/arch/Architecture.h b/src/apps/debugger/arch/Architecture.h index 7c6b687aa2..6102a5a7f8 100644 --- a/src/apps/debugger/arch/Architecture.h +++ b/src/apps/debugger/arch/Architecture.h @@ -6,6 +6,7 @@ #define ARCHITECTURE_H +#include #include #include @@ -31,11 +32,17 @@ class TeamMemory; class Architecture : public Referenceable { public: - Architecture(TeamMemory* teamMemory); + Architecture(TeamMemory* teamMemory, + uint8 addressSize, bool bigEndian); virtual ~Architecture(); 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 const Register* Registers() const = 0; @@ -87,7 +94,16 @@ public: protected: TeamMemory* fTeamMemory; + uint8 fAddressSize; + bool fBigEndian; }; +bool +Architecture::IsHostEndian() const +{ + return fBigEndian == (B_HOST_IS_BENDIAN != 0); +} + + #endif // ARCHITECTURE_H diff --git a/src/apps/debugger/arch/x86/ArchitectureX86.cpp b/src/apps/debugger/arch/x86/ArchitectureX86.cpp index feed747776..eeab3596dc 100644 --- a/src/apps/debugger/arch/x86/ArchitectureX86.cpp +++ b/src/apps/debugger/arch/x86/ArchitectureX86.cpp @@ -104,7 +104,7 @@ struct ArchitectureX86::FromDwarfRegisterMap : RegisterMap { ArchitectureX86::ArchitectureX86(TeamMemory* teamMemory) : - Architecture(teamMemory), + Architecture(teamMemory, 4, false), fAssemblyLanguage(NULL), fToDwarfRegisterMap(NULL), fFromDwarfRegisterMap(NULL) @@ -326,6 +326,10 @@ ArchitectureX86::CreateStackFrame(Image* image, FunctionDebugInfo* function, return B_NO_MEMORY; Reference 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 if (readStandardFrame) { uint32 frameData[2];