diff options
| author | Tamas Berghammer <tberghammer@google.com> | 2015-05-26 11:58:52 +0000 |
|---|---|---|
| committer | Tamas Berghammer <tberghammer@google.com> | 2015-05-26 11:58:52 +0000 |
| commit | 068f8a7e2d7ece12cc00726bb2e6df180b217848 (patch) | |
| tree | 3ac16e6c32a2a44799ad79fa0f141f30c990c66a /lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h | |
| parent | b2b901c607ae3149b6d3a0c53a45f22e3542fb04 (diff) | |
| download | llvm-068f8a7e2d7ece12cc00726bb2e6df180b217848.tar.gz llvm-068f8a7e2d7ece12cc00726bb2e6df180b217848.tar.bz2 llvm-068f8a7e2d7ece12cc00726bb2e6df180b217848.zip | |
Move register reading form NativeProcessLinux to NativeRegisterContextLinux*
This change reorganize the register read/write code inside lldb-server on Linux
with moving the architecture independent code into a new class called
NativeRegisterContextLinux and all of the architecture dependent code into the
appropriate NativeRegisterContextLinux_* class. As part of it the compilation of
the architecture specific register contexts are only compiled on the specific
architecture because they can't be used in other cases.
The purpose of this change is to remove a lot of duplicated code from the different
register contexts and to remove the architecture dependent codes from the global
NativeProcessLinux class.
Differential revision: http://reviews.llvm.org/D9935
llvm-svn: 238196
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h')
| -rw-r--r-- | lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h new file mode 100644 index 000000000000..d63a073ad5cb --- /dev/null +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h @@ -0,0 +1,105 @@ +//===-- NativeRegisterContextLinux.h ----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_NativeRegisterContextLinux_h +#define lldb_NativeRegisterContextLinux_h + +#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h" +#include "lldb/Host/common/NativeThreadProtocol.h" + +#include "Plugins/Process/Linux/NativeProcessLinux.h" + +namespace lldb_private { +namespace process_linux { + +class NativeRegisterContextLinux : public NativeRegisterContextRegisterInfo +{ +public: + NativeRegisterContextLinux(NativeThreadProtocol &native_thread, + uint32_t concrete_frame_idx, + RegisterInfoInterface *reg_info_interface_p); + + // This function is implemented in the NativeRegisterContextLinux_* subclasses to create a new + // instance of the host specific NativeRegisterContextLinux. The implementations can't collide + // as only one NativeRegisterContextLinux_* variant should be compiled into the final + // executable. + static NativeRegisterContextLinux* + CreateHostNativeRegisterContextLinux(const ArchSpec& target_arch, + NativeThreadProtocol &native_thread, + uint32_t concrete_frame_idx); + +protected: + lldb::ByteOrder + GetByteOrder() const; + + virtual Error + ReadRegisterRaw(uint32_t reg_index, RegisterValue& reg_value); + + virtual Error + WriteRegisterRaw(uint32_t reg_index, const RegisterValue& reg_value); + + virtual Error + ReadRegisterSet(void *buf, size_t buf_size, unsigned int regset); + + virtual Error + WriteRegisterSet(void *buf, size_t buf_size, unsigned int regset); + + virtual Error + ReadGPR(); + + virtual Error + WriteGPR(); + + virtual Error + ReadFPR(); + + virtual Error + WriteFPR(); + + virtual void* + GetGPRBuffer() { return nullptr; }; + + virtual size_t + GetGPRSize() { return GetRegisterInfoInterface().GetGPRSize(); } + + virtual void* + GetFPRBuffer() { return nullptr; } + + virtual size_t + GetFPRSize() { return 0; } + + virtual NativeProcessLinux::OperationUP + GetReadRegisterValueOperation(uint32_t offset, + const char* reg_name, + uint32_t size, + RegisterValue &value); + + virtual NativeProcessLinux::OperationUP + GetWriteRegisterValueOperation(uint32_t offset, + const char* reg_name, + const RegisterValue &value); + + virtual NativeProcessLinux::OperationUP + GetReadGPROperation(void *buf, size_t buf_size); + + virtual NativeProcessLinux::OperationUP + GetWriteGPROperation(void *buf, size_t buf_size); + + virtual NativeProcessLinux::OperationUP + GetReadFPROperation(void *buf, size_t buf_size); + + virtual NativeProcessLinux::OperationUP + GetWriteFPROperation(void *buf, size_t buf_size); +}; + +} // namespace process_linux +} // namespace lldb_private + +#endif // #ifndef lldb_NativeRegisterContextLinux_h + |
