summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-08-30 18:12:11 +0000
committerZachary Turner <zturner@google.com>2016-08-30 18:12:11 +0000
commitd08f09c1130acc528cf5f417bcf9f9de4dd4b27d (patch)
treecbf9510969c7484ad4296d217397b361ca1d63f4 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parentb7668d516443231cba62e29786463587b61f90bb (diff)
downloadbcm5719-llvm-d08f09c1130acc528cf5f417bcf9f9de4dd4b27d.tar.gz
bcm5719-llvm-d08f09c1130acc528cf5f417bcf9f9de4dd4b27d.zip
Convert some StringExtractor functions to accept MutableArrayRefs.
MutableArrayRef<T> is essentially a safer version of passing around (T*, length) pairs and provides some convenient functions for working with the data without having to manually manipulate indices. This is a minor NFC. llvm-svn: 280123
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 169d69e1b51..3f7b64c8221 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -649,8 +649,7 @@ ProcessGDBRemote::BuildDynamicRegisterInfo (bool force)
reg_info.dynamic_size_dwarf_len = dwarf_opcode_len;
StringExtractor opcode_extractor(value);
- uint32_t ret_val =
- opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes.data(), dwarf_opcode_len);
+ uint32_t ret_val = opcode_extractor.GetHexBytesAvail(dwarf_opcode_bytes);
assert(dwarf_opcode_len == ret_val);
reg_info.dynamic_size_dwarf_expr_bytes = dwarf_opcode_bytes.data();
@@ -1986,9 +1985,8 @@ ProcessGDBRemote::SetThreadStopInfo (lldb::tid_t tid,
StringExtractor reg_value_extractor;
reg_value_extractor.GetStringRef() = pair.second;
DataBufferSP buffer_sp(new DataBufferHeap(reg_value_extractor.GetStringRef().size() / 2, 0));
- reg_value_extractor.GetHexBytes(buffer_sp->GetBytes(), buffer_sp->GetByteSize(), '\xcc');
- gdb_thread->PrivateSetRegisterValue(
- pair.first, llvm::ArrayRef<uint8_t>(buffer_sp->GetBytes(), buffer_sp->GetByteSize()));
+ reg_value_extractor.GetHexBytes(buffer_sp->GetData(), '\xcc');
+ gdb_thread->PrivateSetRegisterValue(pair.first, buffer_sp->GetData());
}
thread_sp->SetName (thread_name.empty() ? NULL : thread_name.c_str());
@@ -2366,7 +2364,7 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
const size_t byte_size = bytes.GetStringRef().size()/2;
DataBufferSP data_buffer_sp(new DataBufferHeap(byte_size, 0));
- const size_t bytes_copied = bytes.GetHexBytes (data_buffer_sp->GetBytes(), byte_size, 0);
+ const size_t bytes_copied = bytes.GetHexBytes (data_buffer_sp->GetData(), 0);
if (bytes_copied == byte_size)
m_memory_cache.AddL1CacheData(mem_cache_addr, data_buffer_sp);
}
@@ -2585,7 +2583,7 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
StringExtractor bytes(bytes_str);
const size_t byte_size = bytes.GetBytesLeft() / 2;
DataBufferSP data_buffer_sp(new DataBufferHeap(byte_size, 0));
- const size_t bytes_copied = bytes.GetHexBytes (data_buffer_sp->GetBytes(), byte_size, 0);
+ const size_t bytes_copied = bytes.GetHexBytes (data_buffer_sp->GetData(), 0);
if (bytes_copied == byte_size)
m_memory_cache.AddL1CacheData(mem_cache_addr, data_buffer_sp);
}
@@ -3086,7 +3084,7 @@ ProcessGDBRemote::DoReadMemory (addr_t addr, void *buf, size_t size, Error &erro
}
else
{
- return response.GetHexBytes(buf, size, '\xdd');
+ return response.GetHexBytes(llvm::MutableArrayRef<uint8_t>((uint8_t*)buf, size), '\xdd');
}
}
else if (response.IsErrorResponse())
@@ -4587,8 +4585,7 @@ ParseRegisters (XMLNode feature_node, GdbServerTargetInfo &target_info, GDBRemot
dwarf_opcode_bytes.resize (dwarf_opcode_len);
reg_info.dynamic_size_dwarf_len = dwarf_opcode_len;
opcode_extractor.GetStringRef ().swap (opcode_string);
- uint32_t ret_val = opcode_extractor.GetHexBytesAvail (dwarf_opcode_bytes.data (),
- dwarf_opcode_len);
+ uint32_t ret_val = opcode_extractor.GetHexBytesAvail (dwarf_opcode_bytes);
assert (dwarf_opcode_len == ret_val);
reg_info.dynamic_size_dwarf_expr_bytes = dwarf_opcode_bytes.data ();
OpenPOWER on IntegriCloud