[Lldb-commits] [lldb] r263432 - Allow any build-id length between 4 and 20 bytes inclusive

Ed Maste via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 14 07:06:01 PDT 2016


Author: emaste
Date: Mon Mar 14 09:06:00 2016
New Revision: 263432

URL: http://llvm.org/viewvc/llvm-project?rev=263432&view=rev
Log:
Allow any build-id length between 4 and 20 bytes inclusive

Build-id support is being added to lld and by default it may produce a
64-bit build-id.

Prior to this change lldb would reject such a build-id. However, it then
falls back to a 4-byte crc32, which is a poorer quality identifier.

Differential Revision:	http://reviews.llvm.org/D18096

Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=263432&r1=263431&r2=263432&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Mar 14 09:06:00 2016
@@ -1410,8 +1410,9 @@ ObjectFileELF::RefineModuleDetailsFromNo
                     // Only bother processing this if we don't already have the uuid set.
                     if (!uuid.IsValid())
                     {
-                        // 16 bytes is UUID|MD5, 20 bytes is SHA1
-                        if ((note.n_descsz == 16 || note.n_descsz == 20))
+                        // 16 bytes is UUID|MD5, 20 bytes is SHA1. Other linkers may produce a build-id of a different
+                        // length. Accept it as long as it's at least 4 bytes as it will be better than our own crc32.
+                        if (note.n_descsz >= 4 && note.n_descsz <= 20)
                         {
                             uint8_t uuidbuf[20];
                             if (data.GetU8 (&offset, &uuidbuf, note.n_descsz) == nullptr)




More information about the lldb-commits mailing list