[Lldb-commits] [PATCH] D157659: Have SBTarget::AddModule force a possibly-slow search for the binary, and if the Target has no arch, initialize it with the binary's arch
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 10 15:05:26 PDT 2023
jasonmolenda created this revision.
jasonmolenda added reviewers: JDevlieghere, bulbazord.
jasonmolenda added a project: LLDB.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.
This patch addresses two issues I found while looking into a problem yesterday. First, SBTarget::AddModule calls Target::GetOrCreate which will find the module in the global module list, the current target, and will call the DebugSymbols framework on macOS and look in specified directories, and do a Spotlight search of the local computer. But it doesn't call `Symbols::DownloadObjectAndSymbolFile()` with a "force expensive lookup" which we should assume the program is trying to do if they gave us a UUID to look up. This matches the behavior of `target modules add -u ....` today in the lldb command line interface.
Also, if the SB API user has created a Target which has no architecture, we normally will set the Target's arch as soon as we find a hint about the arch -- e.g. when we connect to a gdb remote serial protocol stub, or when we get a corefile. But in this case, they are creating a Target with no arch, adding a module to it. We should use the same scheme where a Target inherits the first likely ArchSpec we see when it has none of its own.
Add a test for these two things, using a fake dsym-for-uuid.sh shell (which Jonas has pointed out in the past, I really need to create a utility function that creates these given an array of uuid/binary/dsyms, which I agree with but haven't done yet. :/)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157659
Files:
lldb/source/API/SBTarget.cpp
lldb/test/API/python_api/target-arch-from-module/Makefile
lldb/test/API/python_api/target-arch-from-module/TestTargetArchFromModule.py
lldb/test/API/python_api/target-arch-from-module/main.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157659.549182.patch
Type: text/x-patch
Size: 8230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230810/169a6ef3/attachment-0001.bin>
More information about the lldb-commits
mailing list