[Lldb-commits] [PATCH] D110013: [lldb][crashlog] Avoid specifying arch for image when a UUID is present

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 17 16:34:35 PDT 2021


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

When adding an image to a target for crashlog purposes, avoid specifying
the architecture of the image.

This has the effect of making SBTarget::AddModule infer the ArchSpec for
the image based on the SBTarget's architecture, which LLDB puts serious
effort into calculating correctly (in TargetList::CreateTargetInternal).

The status quo is that LLDB randomly guesses the ArchSpec for a module
if its architecture is specified, via:

    SBTarget::AddModule -> Platform::GetAugmentedArchSpec -> Platform::IsCompatibleArchitecture ->
  GetSupportedArchitectureAtIndex -> {ARM,x86}GetSupportedArchitectureAtIndex

... which means that the same crashlog can fail to load on an Apple
Silicon Mac (due to the random guess of arm64e-apple-macosx for the
module's ArchSpec not being compatible with the SBTarget's (correct)
ArchSpec), while loading just fine on an Intel Mac.

I'm not sure how to add a test for this (it doesn't look like there's
test coverage of this path in-tree). It seems like it would be pretty
complicated to regression test: the host LLDB would need to be built for
arm64e, we'd need a hand-crafted arm64e iOS crashlog, and we'd need a
binary with an iOS deployment target. I'm open to other / simpler
options.

rdar://82679400


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110013

Files:
  lldb/examples/python/symbolication.py


Index: lldb/examples/python/symbolication.py
===================================================================
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -379,7 +379,7 @@
                     return None
                 resolved_path = self.get_resolved_path()
                 self.module = target.AddModule(
-                    resolved_path, str(self.arch), uuid_str, self.symfile)
+                    resolved_path, None, uuid_str, self.symfile)
             if not self.module:
                 return 'error: unable to get module for (%s) "%s"' % (
                     self.arch, self.get_resolved_path())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110013.373367.patch
Type: text/x-patch
Size: 662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210917/27a7eebc/attachment-0001.bin>


More information about the lldb-commits mailing list