[Lldb-commits] [PATCH] D131743: [LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp (part 2)

Slava Gurevich via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 11 18:57:13 PDT 2022


fixathon created this revision.
fixathon added a reviewer: clayborg.
Herald added a project: All.
fixathon requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Add the fixes suggested post-push in D131554 <https://reviews.llvm.org/D131554>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131743

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp


Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -4114,16 +4114,15 @@
         switch (n_type) {
         case N_INDR: {
           const char *reexport_name_cstr = strtab_data.PeekCStr(nlist.n_value);
-          if (reexport_name_cstr && reexport_name_cstr[0]) {
+          if (reexport_name_cstr && reexport_name_cstr[0] && symbol_name) {
             type = eSymbolTypeReExported;
             ConstString reexport_name(reexport_name_cstr +
                                       ((reexport_name_cstr[0] == '_') ? 1 : 0));
             sym[sym_idx].SetReExportedSymbolName(reexport_name);
             set_value = false;
             reexport_shlib_needs_fixup[sym_idx] = reexport_name;
-            indirect_symbol_names.insert(ConstString(
-                symbol_name +
-                ((symbol_name && (symbol_name[0] == '_')) ? 1 : 0)));
+            indirect_symbol_names.insert(
+                ConstString(symbol_name + ((symbol_name[0] == '_') ? 1 : 0)));
           } else
             type = eSymbolTypeUndefined;
         } break;
@@ -6898,10 +6897,9 @@
         }
         uint32_t imgcount = m_data.GetU32(&offset);
         uint64_t entries_fileoff = m_data.GetU64(&offset);
-        /* leaving the following dead code as comments for spec documentation
-            offset += 4; // uint32_t entries_size;
-            offset += 4; // uint32_t unused;
-        */
+        // 'entries_size' is not used, nor is the 'unused' entry.
+        //  offset += 4; // uint32_t entries_size;
+        //  offset += 4; // uint32_t unused;
 
         offset = entries_fileoff;
         for (uint32_t i = 0; i < imgcount; i++) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131743.452049.patch
Type: text/x-patch
Size: 1848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220812/29c6b789/attachment.bin>


More information about the lldb-commits mailing list