[Lldb-commits] [lldb] r205329 - mips64: clean up register context storage
Ed Maste
emaste at freebsd.org
Tue Apr 1 10:27:26 PDT 2014
Author: emaste
Date: Tue Apr 1 12:27:25 2014
New Revision: 205329
URL: http://llvm.org/viewvc/llvm-project?rev=205329&view=rev
Log:
mips64: clean up register context storage
Store the gpr data in a DataBufferHeap and use a DataExtractor to
extract register values with appropriate endianness. This avoids hard-
coding the register count, and with some further work would allow this
class to provide generic register context storage for any CPU.
Modified:
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
Modified: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp?rev=205329&r1=205328&r2=205329&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp Tue Apr 1 12:27:25 2014
@@ -21,13 +21,9 @@ RegisterContextCorePOSIX_mips64::Registe
const DataExtractor &fpregset)
: RegisterContextPOSIX_mips64(thread, 0, register_info)
{
- size_t i;
- lldb::offset_t offset = 0;
-
- for (i = 0; i < k_num_gpr_registers_mips64; i++)
- {
- m_reg[i] = gpregset.GetU64(&offset);
- }
+ m_gpr_buffer.reset(new DataBufferHeap(gpregset.GetDataStart(), gpregset.GetByteSize()));
+ m_gpr.SetData(m_gpr_buffer);
+ m_gpr.SetByteOrder(gpregset.GetByteOrder());
}
RegisterContextCorePOSIX_mips64::~RegisterContextCorePOSIX_mips64()
@@ -63,10 +59,14 @@ RegisterContextCorePOSIX_mips64::WriteFP
bool
RegisterContextCorePOSIX_mips64::ReadRegister(const RegisterInfo *reg_info, RegisterValue &value)
{
- int reg_num = reg_info->byte_offset / 8;
- assert(reg_num < k_num_gpr_registers_mips64);
- value = m_reg[reg_num];
- return true;
+ lldb::offset_t offset = reg_info->byte_offset;
+ uint64_t v = m_gpr.GetMaxU64(&offset, reg_info->byte_size);
+ if (offset == reg_info->byte_offset + reg_info->byte_size)
+ {
+ value = v;
+ return true;
+ }
+ return false;
}
bool
Modified: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h?rev=205329&r1=205328&r2=205329&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.h Tue Apr 1 12:27:25 2014
@@ -10,6 +10,7 @@
#ifndef liblldb_RegisterContextCorePOSIX_mips64_H_
#define liblldb_RegisterContextCorePOSIX_mips64_H_
+#include "lldb/Core/DataBufferHeap.h"
#include "Plugins/Process/Utility/RegisterContextPOSIX_mips64.h"
class RegisterContextCorePOSIX_mips64 :
@@ -52,7 +53,8 @@ protected:
WriteFPR();
private:
- uint64_t m_reg[40];
+ lldb::DataBufferSP m_gpr_buffer;
+ lldb_private::DataExtractor m_gpr;
};
#endif // #ifndef liblldb_RegisterContextCorePOSIX_mips64_H_
More information about the lldb-commits
mailing list