[Lldb-commits] [PATCH] D92692: Ignore DBGArchitecture from DebugSymbols DBGShellCommands outputs

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 4 14:17:17 PST 2020


jasonmolenda created this revision.
jasonmolenda added a reviewer: jingham.
jasonmolenda added a project: LLDB.
Herald added subscribers: JDevlieghere, kristof.beyls.
jasonmolenda requested review of this revision.

The plist returned by a DBGShellCommands program (dsymForUUID etc) may include an architecture in the DBGArchitecture kv.  lldb uses this to fill in the ArchSpec of the ModuleSpec it returns along with the executable/dsym file path.  The bug I'm fixing here is that lldb and the provider of DBGArchitecture may *disagree* about what the architecture is called, and when lldb tries to load the actual binary, it will find that the ArchSpec of the binary does not match the ModuleSpec it is looking for, and ignore the binary.

In the specific case I'm fixing, it was an arm cortex-m corefile where lldb calls it armv7em, but dwarfdump (I suspect) was calling it thumbv7em to for MC to treat the instructions as pure thumb (lldb does the same when it creates the MCDisassembler).  The process of picking the matching ModuleSpec is looking for an exact match, and this fails.

The architecture in the plist is of little importance, we're working with binaries with UUIDs and that is what we need to be depending on.  I thought about different ways of trying to address this, and ultimately, ignoring DBGArchitecture which adds no benefits to lldb, is the best.

rdar://problem/71612561


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92692

Files:
  lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
  lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py


Index: lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
===================================================================
--- lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
+++ lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
@@ -85,7 +85,7 @@
                 'fi',
                 'echo "<dict><key>$uuid</key><dict>"',
                 '',
-                'echo "<key>DBGArchitecture</key><string>x86_64</string>"',
+                'echo "<key>DBGArchitecture</key><string>i386</string>"',
                 'echo "<key>DBGDSYMPath</key><string>$dsym</string>"',
                 'echo "<key>DBGSymbolRichExecutable</key><string>$bin</string>"',
                 'echo "</dict></dict></plist>"',
Index: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
===================================================================
--- lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
+++ lldb/source/Symbol/LocateSymbolFileMacOSX.cpp
@@ -342,13 +342,6 @@
       }
     }
 
-    cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict,
-                                               CFSTR("DBGArchitecture"));
-    if (cf_str && CFGetTypeID(cf_str) == CFStringGetTypeID()) {
-      if (CFCString::FileSystemRepresentation(cf_str, str))
-        module_spec.GetArchitecture().SetTriple(str.c_str());
-    }
-
     std::string DBGBuildSourcePath;
     std::string DBGSourcePath;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92692.309654.patch
Type: text/x-patch
Size: 1454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201204/6f670d4c/attachment.bin>


More information about the lldb-commits mailing list