libdebugger: Add accessor for cpu state size.

Architecture:
- Store and provide accessor for the size in bytes of the low-level
  debug_cpu_state size of the respective target CPU. Adjust subclasses
  to pass in the appropriate size information.
This commit is contained in:
Rene Gollent 2016-07-31 17:00:08 -04:00
parent b02ee147b1
commit 9c9c24ce08
4 changed files with 18 additions and 7 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011-2015, Rene Gollent, rene@gollent.com.
* Copyright 2011-2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef ARCHITECTURE_H
@ -50,12 +50,17 @@ enum {
class Architecture : public BReferenceable {
public:
Architecture(TeamMemory* teamMemory,
uint8 addressSize, bool bigEndian);
uint8 addressSize,
size_t debugCpuStateSize,
bool bigEndian);
virtual ~Architecture();
virtual status_t Init();
inline uint8 AddressSize() const { return fAddressSize; }
inline size_t DebugCpuStateSize() const
{ return fDebugCpuStateSize; }
inline bool IsBigEndian() const { return fBigEndian; }
inline bool IsHostEndian() const;
@ -136,6 +141,7 @@ public:
protected:
TeamMemory* fTeamMemory;
uint8 fAddressSize;
size_t fDebugCpuStateSize;
bool fBigEndian;
};

View File

@ -1,5 +1,6 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -24,10 +25,11 @@
Architecture::Architecture(TeamMemory* teamMemory, uint8 addressSize,
bool bigEndian)
size_t debugCpuStateSize, bool bigEndian)
:
fTeamMemory(teamMemory),
fAddressSize(addressSize),
fDebugCpuStateSize(debugCpuStateSize),
fBigEndian(bigEndian)
{
}

View File

@ -1,6 +1,6 @@
/*
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011-2015, Rene Gollent, rene@gollent.com.
* Copyright 2011-2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -127,7 +127,7 @@ struct ArchitectureX86::FromDwarfRegisterMap : RegisterMap {
ArchitectureX86::ArchitectureX86(TeamMemory* teamMemory)
:
Architecture(teamMemory, 4, false),
Architecture(teamMemory, 4, sizeof(x86_debug_cpu_state), false),
fFeatureFlags(0),
fAssemblyLanguage(NULL),
fToDwarfRegisterMap(NULL),
@ -155,6 +155,9 @@ ArchitectureX86::Init()
return B_NO_MEMORY;
#if defined(__INTEL__)
// TODO: this needs to be determined/retrieved indirectly from the
// target host interface, as in the remote case the CPU features may
// differ from those of the local CPU.
cpuid_info info;
status_t error = get_cpuid(&info, 1, 0);
if (error != B_OK)

View File

@ -1,7 +1,7 @@
/*
* Copyright 2012, Alex Smith, alex@alex-smith.me.uk.
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2011-2015, Rene Gollent, rene@gollent.com.
* Copyright 2011-2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
@ -144,7 +144,7 @@ struct ArchitectureX8664::FromDwarfRegisterMap : RegisterMap {
ArchitectureX8664::ArchitectureX8664(TeamMemory* teamMemory)
:
Architecture(teamMemory, 8, false),
Architecture(teamMemory, 8, sizeof(x86_64_debug_cpu_state), false),
fAssemblyLanguage(NULL),
fToDwarfRegisterMap(NULL),
fFromDwarfRegisterMap(NULL)