aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
diff options
context:
space:
mode:
authorJaroslav Sevcik <jarin@google.com>2020-06-01 20:43:18 +0000
committerJaroslav Sevcik <jarin@google.com>2020-06-07 10:03:41 +0000
commit1beffc18886ae4cd72dfe1f9b6b79204cac51e5e (patch)
treefd4e32963c0152c7aa628426f15697158f18c61a /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
parentbd67d68ca1ddb0f857f39761a061eed45072718a (diff)
downloadllvm-1beffc18886ae4cd72dfe1f9b6b79204cac51e5e.zip
llvm-1beffc18886ae4cd72dfe1f9b6b79204cac51e5e.tar.gz
llvm-1beffc18886ae4cd72dfe1f9b6b79204cac51e5e.tar.bz2
Support build-ids of other sizes than 16 in UUID::SetFromStringRef
SBTarget::AddModule currently handles the UUID parameter in a very weird way: UUIDs with more than 16 bytes are trimmed to 16 bytes. On the other hand, shorter-than-16-bytes UUIDs are completely ignored. In this patch, we change the parsing code to handle UUIDs of arbitrary size. To support arbitrary size UUIDs in SBTarget::AddModule, this patch changes UUID::SetFromStringRef to parse UUIDs of arbitrary length. We subtly change the semantics of SetFromStringRef - SetFromStringRef now only succeeds if the entire input is consumed to prevent some prefix-parsing confusion. This is up for discussion, but I believe this is more consistent - we always return false for invalid UUIDs rather than sometimes truncating to a valid prefix. Also, all the call-sites except the API and interpreter seem to expect to consume the entire input. This also adds tests for adding existing modules 4-, 16-, and 20-byte build-ids. Finally, we took the liberty of testing the minidump scenario we care about - removing placeholder module from minidump and replacing it with the real module. Reviewed By: labath, friss Differential Revision: https://reviews.llvm.org/D80755
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index fdf1397..47aa150 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3623,7 +3623,7 @@ bool GDBRemoteCommunicationClient::GetModuleInfo(
StringExtractor extractor(value);
std::string uuid;
extractor.GetHexByteString(uuid);
- module_spec.GetUUID().SetFromStringRef(uuid, uuid.size() / 2);
+ module_spec.GetUUID().SetFromStringRef(uuid);
} else if (name == "triple") {
StringExtractor extractor(value);
std::string triple;
@@ -3659,8 +3659,7 @@ ParseModuleSpec(StructuredData::Dictionary *dict) {
if (!dict->GetValueForKeyAsString("uuid", string))
return llvm::None;
- if (result.GetUUID().SetFromStringRef(string, string.size() / 2) !=
- string.size())
+ if (!result.GetUUID().SetFromStringRef(string))
return llvm::None;
if (!dict->GetValueForKeyAsInteger("file_offset", integer))