[Lldb-commits] [PATCH] D132191: Treat a UUID of all zeros consistently to mean "Invalid UUID"

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 18 17:34:14 PDT 2022


jingham created this revision.
jingham added reviewers: JDevlieghere, clayborg, labath.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

At present, there are two ways to get data into a UUID object, an unchecked version and what's called the "Optional" version.  So for instance, there's setFromData and setFromOptionalData.  The difference is that the Optional version looks at the UUID bytes and if they are all 0's it clears the data store for the UUID, rendering it an Invalid UUID.

However, there was no apparatus for determining which of these two variants to use.  The PDB version always uses the Optional version, the Darwin support code used both somewhat inconsistently.  The ELF object file code uses the unchecked version.  And the generic parts of the code sometimes use one and sometimes another.  So the current approach is not very coherent.

On Darwin, treating all-zero's UUID's as significant is actually wrong behavior - so that needs to be changed.  But that still leaves the system seeming arbitrary.  For instance, SBModuleSpec::SetUUIDBytes uses the checked method.  So even if some ObjectFile format treats UUID's of 0 as significant, you wouldn't be able to find it with SBModuleSpec.

My guess is this is all just historical and it would be fine to treat UUID's of 0 as meaning "not valid for matching", which is what this patch does.

If this is not the case, we'll have to add something like ObjectFile::AllZerosUUIDIsValid, and then check it everywhere outside the object file reader that we build UUID's.  But I'd rather not do that if there isn't a compelling reason to do so.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132191

Files:
  lldb/include/lldb/Utility/UUID.h
  lldb/source/API/SBModuleSpec.cpp
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
  lldb/source/Utility/UUID.cpp
  lldb/unittests/Utility/UUIDTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132191.453842.patch
Type: text/x-patch
Size: 12424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220819/aee44535/attachment.bin>


More information about the lldb-commits mailing list