summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-05-09 20:18:18 +0000
committerGreg Clayton <gclayton@apple.com>2011-05-09 20:18:18 +0000
commit7349bd90786bb6f738d775a5044181f6111eb614 (patch)
treecac83b5e20bfe6cf8053948566c567fd9daf5d69 /lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
parent112a2de78cfa8a32965f1c87243fe601941809f0 (diff)
downloadbcm5719-llvm-7349bd90786bb6f738d775a5044181f6111eb614.tar.gz
bcm5719-llvm-7349bd90786bb6f738d775a5044181f6111eb614.zip
While implementing unwind information using UnwindAssemblyInstEmulation I ran
into some cleanup I have been wanting to do when reading/writing registers. Previously all RegisterContext subclasses would need to implement: virtual bool ReadRegisterBytes (uint32_t reg, DataExtractor &data); virtual bool WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0); There is now a new class specifically designed to hold register values: lldb_private::RegisterValue The new register context calls that subclasses must implement are: virtual bool ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0; virtual bool WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0; The RegisterValue class must be big enough to handle any register value. The class contains an enumeration for the value type, and then a union for the data value. Any integer/float values are stored directly in an appropriate host integer/float. Anything bigger is stored in a byte buffer that has a length and byte order. The RegisterValue class also knows how to copy register value bytes into in a buffer with a specified byte order which can be used to write the register value down into memory, and this does the right thing when not all bytes from the register values are needed (getting a uint8 from a uint32 register value..). All RegiterContext and other sources have been switched over to using the new regiter value class. llvm-svn: 131096
Diffstat (limited to 'lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h')
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
index ac2c5609cdc..b255636291a 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.h
@@ -50,13 +50,13 @@ public:
GetRegisterSet (uint32_t reg_set);
virtual bool
- ReadRegisterBytes (uint32_t reg, lldb_private::DataExtractor &data);
+ ReadRegister (const lldb_private::RegisterInfo *reg_info, lldb_private::RegisterValue &value);
virtual bool
- ReadAllRegisterValues (lldb::DataBufferSP &data_sp);
-
+ WriteRegister (const lldb_private::RegisterInfo *reg_info, const lldb_private::RegisterValue &value);
+
virtual bool
- WriteRegisterBytes (uint32_t reg, lldb_private::DataExtractor &data, uint32_t data_offset = 0);
+ ReadAllRegisterValues (lldb::DataBufferSP &data_sp);
virtual bool
WriteAllRegisterValues (const lldb::DataBufferSP &data_sp);
@@ -92,7 +92,7 @@ private:
eRegisterSavedAtMemoryLocation, // register is saved at a specific word of target mem (target_memory_location)
eRegisterInRegister, // register is available in a (possible other) register (register_number)
eRegisterSavedAtHostMemoryLocation, // register is saved at a word in lldb's address space
- eRegisterValueInferred // register val was computed (and is in register_value)
+ eRegisterValueInferred // register val was computed (and is in inferred_value)
};
struct RegisterLocation
@@ -103,7 +103,7 @@ private:
lldb::addr_t target_memory_location;
uint32_t register_number; // in eRegisterKindLLDB register numbering system
void* host_memory_location;
- uint64_t register_value; // eRegisterValueInferred - e.g. stack pointer == cfa + offset
+ uint64_t inferred_value; // eRegisterValueInferred - e.g. stack pointer == cfa + offset
} location;
};
@@ -138,10 +138,14 @@ private:
SavedLocationForRegister (uint32_t lldb_regnum, RegisterLocation &regloc);
bool
- ReadRegisterBytesFromRegisterLocation (uint32_t regnum, RegisterLocation regloc, lldb_private::DataExtractor &data);
+ ReadRegisterValueFromRegisterLocation (RegisterLocation regloc,
+ const lldb_private::RegisterInfo *reg_info,
+ lldb_private::RegisterValue &value);
bool
- WriteRegisterBytesToRegisterLocation (uint32_t regnum, RegisterLocation regloc, lldb_private::DataExtractor &data, uint32_t data_offset);
+ WriteRegisterValueToRegisterLocation (RegisterLocation regloc,
+ const lldb_private::RegisterInfo *reg_info,
+ const lldb_private::RegisterValue &value);
// Get the contents of a general purpose (address-size) register for this frame
// (usually retrieved from the m_next_frame)
OpenPOWER on IntegriCloud