summaryrefslogtreecommitdiff
path: root/source/Plugins/Process/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/Process/Utility')
-rw-r--r--source/Plugins/Process/Utility/DynamicRegisterInfo.cpp28
-rw-r--r--source/Plugins/Process/Utility/RegisterContextLLDB.cpp10
-rw-r--r--source/Plugins/Process/Utility/RegisterContextMemory.cpp10
-rw-r--r--source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp10
-rw-r--r--source/Plugins/Process/Utility/RegisterContextThreadMemory.h12
-rw-r--r--source/Plugins/Process/Utility/ThreadMemory.cpp12
-rw-r--r--source/Plugins/Process/Utility/ThreadMemory.h2
-rw-r--r--source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp4
8 files changed, 41 insertions, 47 deletions
diff --git a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index 5e933d3b3dee..0bd90dbf7620 100644
--- a/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -48,10 +48,10 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
if (dict.GetValueForKeyAsArray("sets", sets)) {
const uint32_t num_sets = sets->GetSize();
for (uint32_t i = 0; i < num_sets; ++i) {
- std::string set_name_str;
+ llvm::StringRef set_name_str;
ConstString set_name;
if (sets->GetItemAtIndexAsString(i, set_name_str))
- set_name.SetCString(set_name_str.c_str());
+ set_name.SetString(set_name_str);
if (set_name) {
RegisterSet new_set = {set_name.AsCString(), NULL, 0, NULL};
m_sets.push_back(new_set);
@@ -115,7 +115,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
// expression
// we can calculate the offset
bool success = false;
- std::string slice_str;
+ llvm::StringRef slice_str;
if (reg_info_dict->GetValueForKeyAsString("slice", slice_str, nullptr)) {
// Slices use the following format:
// REGNAME[MSBIT:LSBIT]
@@ -131,9 +131,9 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
llvm::StringRef reg_name_str;
std::string msbit_str;
std::string lsbit_str;
- if (regex_match.GetMatchAtIndex(slice_str.c_str(), 1, reg_name_str) &&
- regex_match.GetMatchAtIndex(slice_str.c_str(), 2, msbit_str) &&
- regex_match.GetMatchAtIndex(slice_str.c_str(), 3, lsbit_str)) {
+ if (regex_match.GetMatchAtIndex(slice_str, 1, reg_name_str) &&
+ regex_match.GetMatchAtIndex(slice_str, 2, msbit_str) &&
+ regex_match.GetMatchAtIndex(slice_str, 3, lsbit_str)) {
const uint32_t msbit =
StringConvert::ToUInt32(msbit_str.c_str(), UINT32_MAX);
const uint32_t lsbit =
@@ -269,17 +269,15 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
reg_info.byte_size = bitsize / 8;
- std::string dwarf_opcode_string;
+ llvm::StringRef dwarf_opcode_string;
if (reg_info_dict->GetValueForKeyAsString("dynamic_size_dwarf_expr_bytes",
dwarf_opcode_string)) {
- reg_info.dynamic_size_dwarf_len = dwarf_opcode_string.length() / 2;
+ reg_info.dynamic_size_dwarf_len = dwarf_opcode_string.size() / 2;
assert(reg_info.dynamic_size_dwarf_len > 0);
std::vector<uint8_t> dwarf_opcode_bytes(reg_info.dynamic_size_dwarf_len);
uint32_t j;
- StringExtractor opcode_extractor;
- // Swap "dwarf_opcode_string" over into "opcode_extractor"
- opcode_extractor.GetStringRef().swap(dwarf_opcode_string);
+ StringExtractor opcode_extractor(dwarf_opcode_string);
uint32_t ret_val = opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes);
UNUSED_IF_ASSERT_DISABLED(ret_val);
assert(ret_val == reg_info.dynamic_size_dwarf_len);
@@ -290,9 +288,9 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
reg_info.dynamic_size_dwarf_expr_bytes = m_dynamic_reg_size_map[i].data();
}
- std::string format_str;
+ llvm::StringRef format_str;
if (reg_info_dict->GetValueForKeyAsString("format", format_str, nullptr)) {
- if (Args::StringToFormat(format_str.c_str(), reg_info.format, NULL)
+ if (Args::StringToFormat(format_str.str().c_str(), reg_info.format, NULL)
.Fail()) {
Clear();
printf("error: invalid 'format' value in register dictionary\n");
@@ -304,7 +302,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
eFormatHex);
}
- std::string encoding_str;
+ llvm::StringRef encoding_str;
if (reg_info_dict->GetValueForKeyAsString("encoding", encoding_str))
reg_info.encoding = Args::StringToEncoding(encoding_str, eEncodingUint);
else
@@ -334,7 +332,7 @@ DynamicRegisterInfo::SetRegisterInfo(const StructuredData::Dictionary &dict,
reg_info.kinds[lldb::eRegisterKindEHFrame] = eh_frame_regno;
reg_info_dict->GetValueForKeyAsInteger(
"dwarf", reg_info.kinds[lldb::eRegisterKindDWARF], LLDB_INVALID_REGNUM);
- std::string generic_str;
+ llvm::StringRef generic_str;
if (reg_info_dict->GetValueForKeyAsString("generic", generic_str))
reg_info.kinds[lldb::eRegisterKindGeneric] =
Args::StringToGenericRegister(generic_str);
diff --git a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 485a39e6c9a5..312c1887b581 100644
--- a/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -1055,7 +1055,7 @@ bool RegisterContextLLDB::ReadRegisterValueFromRegisterLocation(
case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation:
llvm_unreachable("FIXME debugger inferior function call unwind");
case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: {
- Error error(ReadRegisterValueFromMemory(
+ Status error(ReadRegisterValueFromMemory(
reg_info, regloc.location.target_memory_location, reg_info->byte_size,
value));
success = error.Success();
@@ -1097,7 +1097,7 @@ bool RegisterContextLLDB::WriteRegisterValueToRegisterLocation(
case UnwindLLDB::RegisterLocation::eRegisterSavedAtHostMemoryLocation:
llvm_unreachable("FIXME debugger inferior function call unwind");
case UnwindLLDB::RegisterLocation::eRegisterSavedAtMemoryLocation: {
- Error error(WriteRegisterValueToMemory(
+ Status error(WriteRegisterValueToMemory(
reg_info, regloc.location.target_memory_location, reg_info->byte_size,
value));
success = error.Success();
@@ -1514,7 +1514,7 @@ RegisterContextLLDB::SavedLocationForRegister(
unwindplan_regloc.GetDWARFExpressionLength());
dwarfexpr.SetRegisterKind(unwindplan_registerkind);
Value result;
- Error error;
+ Status error;
if (dwarfexpr.Evaluate(&exe_ctx, nullptr, nullptr, this, 0, nullptr,
nullptr, result, &error)) {
addr_t val;
@@ -1769,7 +1769,7 @@ bool RegisterContextLLDB::ReadCFAValueForRow(
GetRegisterInfoAtIndex(cfa_reg.GetAsKind(eRegisterKindLLDB));
RegisterValue reg_value;
if (reg_info) {
- Error error = ReadRegisterValueFromMemory(
+ Status error = ReadRegisterValueFromMemory(
reg_info, cfa_reg_contents, reg_info->byte_size, reg_value);
if (error.Success()) {
cfa_value = reg_value.GetAsUInt64();
@@ -1824,7 +1824,7 @@ bool RegisterContextLLDB::ReadCFAValueForRow(
row->GetCFAValue().GetDWARFExpressionLength());
dwarfexpr.SetRegisterKind(row_register_kind);
Value result;
- Error error;
+ Status error;
if (dwarfexpr.Evaluate(&exe_ctx, nullptr, nullptr, this, 0, nullptr,
nullptr, result, &error)) {
cfa_value = result.GetScalar().ULongLong();
diff --git a/source/Plugins/Process/Utility/RegisterContextMemory.cpp b/source/Plugins/Process/Utility/RegisterContextMemory.cpp
index eed5eec8fae8..8f0dfd2a5b50 100644
--- a/source/Plugins/Process/Utility/RegisterContextMemory.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextMemory.cpp
@@ -18,7 +18,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/Error.h"
+#include "lldb/Utility/Status.h"
using namespace lldb;
using namespace lldb_private;
@@ -101,8 +101,8 @@ bool RegisterContextMemory::WriteRegister(const RegisterInfo *reg_info,
if (m_reg_data_addr != LLDB_INVALID_ADDRESS) {
const uint32_t reg_num = reg_info->kinds[eRegisterKindLLDB];
addr_t reg_addr = m_reg_data_addr + reg_info->byte_offset;
- Error error(WriteRegisterValueToMemory(reg_info, reg_addr,
- reg_info->byte_size, reg_value));
+ Status error(WriteRegisterValueToMemory(reg_info, reg_addr,
+ reg_info->byte_size, reg_value));
m_reg_valid[reg_num] = false;
return error.Success();
}
@@ -113,7 +113,7 @@ bool RegisterContextMemory::ReadAllRegisterValues(DataBufferSP &data_sp) {
if (m_reg_data_addr != LLDB_INVALID_ADDRESS) {
ProcessSP process_sp(CalculateProcess());
if (process_sp) {
- Error error;
+ Status error;
if (process_sp->ReadMemory(m_reg_data_addr, data_sp->GetBytes(),
data_sp->GetByteSize(),
error) == data_sp->GetByteSize()) {
@@ -130,7 +130,7 @@ bool RegisterContextMemory::WriteAllRegisterValues(
if (m_reg_data_addr != LLDB_INVALID_ADDRESS) {
ProcessSP process_sp(CalculateProcess());
if (process_sp) {
- Error error;
+ Status error;
SetAllRegisterValid(false);
if (process_sp->WriteMemory(m_reg_data_addr, data_sp->GetBytes(),
data_sp->GetByteSize(),
diff --git a/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp b/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
index 7d990e73b5be..96ad139f7364 100644
--- a/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
+++ b/source/Plugins/Process/Utility/RegisterContextThreadMemory.cpp
@@ -10,7 +10,7 @@
#include "lldb/Target/OperatingSystem.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
-#include "lldb/Utility/Error.h"
+#include "lldb/Utility/Status.h"
#include "lldb/lldb-private.h"
#include "RegisterContextThreadMemory.h"
@@ -194,26 +194,26 @@ bool RegisterContextThreadMemory::HardwareSingleStep(bool enable) {
return false;
}
-Error RegisterContextThreadMemory::ReadRegisterValueFromMemory(
+Status RegisterContextThreadMemory::ReadRegisterValueFromMemory(
const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr,
uint32_t src_len, RegisterValue &reg_value) {
UpdateRegisterContext();
if (m_reg_ctx_sp)
return m_reg_ctx_sp->ReadRegisterValueFromMemory(reg_info, src_addr,
src_len, reg_value);
- Error error;
+ Status error;
error.SetErrorString("invalid register context");
return error;
}
-Error RegisterContextThreadMemory::WriteRegisterValueToMemory(
+Status RegisterContextThreadMemory::WriteRegisterValueToMemory(
const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr,
uint32_t dst_len, const RegisterValue &reg_value) {
UpdateRegisterContext();
if (m_reg_ctx_sp)
return m_reg_ctx_sp->WriteRegisterValueToMemory(reg_info, dst_addr, dst_len,
reg_value);
- Error error;
+ Status error;
error.SetErrorString("invalid register context");
return error;
}
diff --git a/source/Plugins/Process/Utility/RegisterContextThreadMemory.h b/source/Plugins/Process/Utility/RegisterContextThreadMemory.h
index 7e0a2a9f7f1e..3b3b0856a4ca 100644
--- a/source/Plugins/Process/Utility/RegisterContextThreadMemory.h
+++ b/source/Plugins/Process/Utility/RegisterContextThreadMemory.h
@@ -80,13 +80,13 @@ public:
bool HardwareSingleStep(bool enable) override;
- Error ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info,
- lldb::addr_t src_addr, uint32_t src_len,
- RegisterValue &reg_value) override;
+ Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info,
+ lldb::addr_t src_addr, uint32_t src_len,
+ RegisterValue &reg_value) override;
- Error WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info,
- lldb::addr_t dst_addr, uint32_t dst_len,
- const RegisterValue &reg_value) override;
+ Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info,
+ lldb::addr_t dst_addr, uint32_t dst_len,
+ const RegisterValue &reg_value) override;
protected:
void UpdateRegisterContext();
diff --git a/source/Plugins/Process/Utility/ThreadMemory.cpp b/source/Plugins/Process/Utility/ThreadMemory.cpp
index b3cac1c854d1..5ff928c69e59 100644
--- a/source/Plugins/Process/Utility/ThreadMemory.cpp
+++ b/source/Plugins/Process/Utility/ThreadMemory.cpp
@@ -24,15 +24,11 @@ ThreadMemory::ThreadMemory(Process &process, tid_t tid,
: Thread(process, tid), m_backing_thread_sp(),
m_thread_info_valobj_sp(thread_info_valobj_sp), m_name(), m_queue() {}
-ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid, const char *name,
- const char *queue, lldb::addr_t register_data_addr)
+ThreadMemory::ThreadMemory(Process &process, lldb::tid_t tid,
+ llvm::StringRef name, llvm::StringRef queue,
+ lldb::addr_t register_data_addr)
: Thread(process, tid), m_backing_thread_sp(), m_thread_info_valobj_sp(),
- m_name(), m_queue(), m_register_data_addr(register_data_addr) {
- if (name)
- m_name = name;
- if (queue)
- m_queue = queue;
-}
+ m_name(name), m_queue(queue), m_register_data_addr(register_data_addr) {}
ThreadMemory::~ThreadMemory() { DestroyThread(); }
diff --git a/source/Plugins/Process/Utility/ThreadMemory.h b/source/Plugins/Process/Utility/ThreadMemory.h
index 095544d244ba..89229710da4d 100644
--- a/source/Plugins/Process/Utility/ThreadMemory.h
+++ b/source/Plugins/Process/Utility/ThreadMemory.h
@@ -24,7 +24,7 @@ public:
const lldb::ValueObjectSP &thread_info_valobj_sp);
ThreadMemory(lldb_private::Process &process, lldb::tid_t tid,
- const char *name, const char *queue,
+ llvm::StringRef name, llvm::StringRef queue,
lldb::addr_t register_data_addr);
~ThreadMemory() override;
diff --git a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
index e2691be603ec..f907735d8f58 100644
--- a/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
+++ b/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
@@ -105,7 +105,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_i386(
m_cursors.push_back(cursor);
const size_t k_frame_size = sizeof(frame);
- Error error;
+ Status error;
while (frame.fp != 0 && frame.pc != 0 && ((frame.fp & 7) == 0)) {
// Read both the FP and PC (8 bytes)
if (process->ReadMemory(frame.fp, &frame.fp, k_frame_size, error) !=
@@ -196,7 +196,7 @@ size_t UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64(
Frame_x86_64 frame = {cursor.fp, cursor.pc};
m_cursors.push_back(cursor);
- Error error;
+ Status error;
const size_t k_frame_size = sizeof(frame);
while (frame.fp != 0 && frame.pc != 0 && ((frame.fp & 7) == 0)) {
// Read both the FP and PC (16 bytes)