[Lldb-commits] [PATCH] D48479: Represent invalid UUIDs as UUIDs with length zero

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 25 08:35:09 PDT 2018


clayborg added a comment.

We should allow 4 and 8 byte UUIDs as pointed out by inlined comments. This means we should probably modify the UUID dumper to handle those cases as well.



================
Comment at: include/lldb/Utility/UUID.h:109
+
+  uint32_t m_num_uuid_bytes = 0; // Should be 0, 16 or 20
   ValueType m_uuid;
----------------
Do we need this comment here? We currently take a 4 byte debug info CRC and call it a 16 byte UUID for no reason. Can we remove the need for this comment and allow any length?


================
Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:735-736
               // Use 4 bytes of crc from the .gnu_debuglink section.
               uint32_t uuidt[4] = {gnu_debuglink_crc, 0, 0, 0};
-              uuid.SetBytes(uuidt, sizeof(uuidt));
+              uuid = UUID::fromData(uuidt, sizeof(uuidt));
             } else if (core_notes_crc) {
----------------
Should we just save the UUId is 4 bytes long here?


================
Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:741-742
               // of note segments crc.
               uint32_t uuidt[4] = {g_core_uuid_magic, core_notes_crc, 0, 0};
-              uuid.SetBytes(uuidt, sizeof(uuidt));
+              uuid = UUID::fromData(uuidt, sizeof(uuidt));
             }
----------------
Should we just save the UUId is 8 bytes long here?


================
Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:929
       uint32_t uuidt[4] = {g_core_uuid_magic, core_notes_crc, 0, 0};
-      m_uuid.SetBytes(uuidt, sizeof(uuidt));
+      m_uuid = UUID::fromData(uuidt, sizeof(uuidt));
     }
----------------
Should we just save the UUId is 8 bytes long here?


================
Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:938
       uint32_t uuidt[4] = {m_gnu_debuglink_crc, 0, 0, 0};
-      m_uuid.SetBytes(uuidt, sizeof(uuidt));
+      m_uuid = UUID::fromData(uuidt, sizeof(uuidt));
     }
----------------
Should we just save the UUId is 4 bytes long here?


================
Comment at: source/Utility/DataExtractor.cpp:1101
 //----------------------------------------------------------------------
 void DataExtractor::DumpUUID(Stream *s, offset_t offset) const {
   if (s) {
----------------
This should take a UUID byte size as a second parameter and callers should be required to specify it explicitly


https://reviews.llvm.org/D48479





More information about the lldb-commits mailing list