summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/NativeThreadProtocol.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-11-10 11:05:49 +0000
committerPavel Labath <labath@google.com>2017-11-10 11:05:49 +0000
commitd37349f380a405fc7224c79ca41b28a69672500f (patch)
treec140b002a6c7ce05d38101d462bf9fdb00ea192d /lldb/source/Host/common/NativeThreadProtocol.cpp
parentbd5c522e4db8a9783eb9150e62bc8329d2a1d7c6 (diff)
downloadbcm5719-llvm-d37349f380a405fc7224c79ca41b28a69672500f.tar.gz
bcm5719-llvm-d37349f380a405fc7224c79ca41b28a69672500f.zip
Clean up NativeRegisterContext
Summary: This commit removes the concrete_frame_idx member from NativeRegisterContext and related functions, which was always set to zero and never used. I also change the native thread class to store a NativeRegisterContext as a unique_ptr (documenting the ownership) and make sure it is always initialized (most of the code was already blindly dereferencing the register context pointer, assuming it would always be present -- this makes its treatment consistent). Reviewers: eugene, clayborg, krytarowski Subscribers: aemerson, sdardis, nemanjai, javed.absar, arichardson, kristof.beyls, kbarton, uweigand, alexandreyy, lldb-commits Differential Revision: https://reviews.llvm.org/D39837 llvm-svn: 317881
Diffstat (limited to 'lldb/source/Host/common/NativeThreadProtocol.cpp')
-rw-r--r--lldb/source/Host/common/NativeThreadProtocol.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/lldb/source/Host/common/NativeThreadProtocol.cpp b/lldb/source/Host/common/NativeThreadProtocol.cpp
index 54ac96dd3c6..3f3915e006d 100644
--- a/lldb/source/Host/common/NativeThreadProtocol.cpp
+++ b/lldb/source/Host/common/NativeThreadProtocol.cpp
@@ -22,43 +22,33 @@ NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol &process,
Status NativeThreadProtocol::ReadRegister(uint32_t reg,
RegisterValue &reg_value) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
+ NativeRegisterContext &register_context = GetRegisterContext();
const RegisterInfo *const reg_info =
- register_context_sp->GetRegisterInfoAtIndex(reg);
+ register_context.GetRegisterInfoAtIndex(reg);
if (!reg_info)
return Status("no register info for reg num %" PRIu32, reg);
- return register_context_sp->ReadRegister(reg_info, reg_value);
+ return register_context.ReadRegister(reg_info, reg_value);
;
}
Status NativeThreadProtocol::WriteRegister(uint32_t reg,
const RegisterValue &reg_value) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
+ NativeRegisterContext& register_context = GetRegisterContext();
const RegisterInfo *const reg_info =
- register_context_sp->GetRegisterInfoAtIndex(reg);
+ register_context.GetRegisterInfoAtIndex(reg);
if (!reg_info)
return Status("no register info for reg num %" PRIu32, reg);
- return register_context_sp->WriteRegister(reg_info, reg_value);
+ return register_context.WriteRegister(reg_info, reg_value);
}
Status NativeThreadProtocol::SaveAllRegisters(lldb::DataBufferSP &data_sp) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
- return register_context_sp->WriteAllRegisterValues(data_sp);
+ return GetRegisterContext().WriteAllRegisterValues(data_sp);
}
Status NativeThreadProtocol::RestoreAllRegisters(lldb::DataBufferSP &data_sp) {
- NativeRegisterContextSP register_context_sp = GetRegisterContext();
- if (!register_context_sp)
- return Status("no register context");
- return register_context_sp->ReadAllRegisterValues(data_sp);
+ return GetRegisterContext().ReadAllRegisterValues(data_sp);
}
OpenPOWER on IntegriCloud