[Lldb-commits] [lldb] b2cb417 - [LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp (part 2)

Slava Gurevich via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 11 21:08:37 PDT 2022


Author: Slava Gurevich
Date: 2022-08-11T21:08:18-07:00
New Revision: b2cb417ed9a69528ddd9abac704ba12ef5b8f932

URL: https://github.com/llvm/llvm-project/commit/b2cb417ed9a69528ddd9abac704ba12ef5b8f932
DIFF: https://github.com/llvm/llvm-project/commit/b2cb417ed9a69528ddd9abac704ba12ef5b8f932.diff

LOG: [LLDB][NFC] Reliability fixes for ObjectFileMachO.cpp (part 2)

Add the fixes suggested post-push in D131554

Differential Revision: https://reviews.llvm.org/D131743

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index e4832dad1e476..dbf3afff7b0da 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -4114,16 +4114,15 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
         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 @@ ObjectFileMachO::GetCorefileAllImageInfos() {
         }
         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++) {


        


More information about the lldb-commits mailing list