[Lldb-commits] [PATCH] D124801: [lldb] Make GetSharedModuleWithLocalCache consider the device support directory
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon May 2 13:17:01 PDT 2022
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jasonmolenda, mib.
Herald added a project: All.
JDevlieghere requested review of this revision.
Make GetSharedModuleWithLocalCache consider the device support directory. In the past we only needed the device support directory to debug remote processes. Since the introduction of Apple Silicon and Rosetta this stopped being true. When debugging a Rosetta process on macOS we need to consider the Rosetta expanded shared cache. This patch and it dependencies move that logic out of PlatfromRemoteDarwinDevice into a new abstract class called PlatfromDarwinDevice. The new platform sit in between PlatformDarwin and PlatformMacOSX and PlatformRemoteDarwinDevice and has all the necessary logic to deal with the device support directory.
Technically I could have moved everything in PlatfromDarwinDevice into PlatfromDarwin but decided that this logic is sufficiently self contained that it warrants its own abstraction.
rdar://91966349
https://reviews.llvm.org/D124801
Files:
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwinDevice.cpp
@@ -328,6 +328,29 @@
return err;
}
}
+
+ // We failed to find the module in our shared cache. Let's see if we have a
+ // copy in our device support directory.
+ FileSpec device_support_spec(GetDeviceSupportDirectoryForOSVersion());
+ device_support_spec.AppendPathComponent("Symbols");
+ device_support_spec.AppendPathComponent(
+ module_spec.GetFileSpec().GetPath());
+ FileSystem::Instance().Resolve(device_support_spec);
+ if (FileSystem::Instance().Exists(device_support_spec)) {
+ ModuleSpec local_spec(device_support_spec, module_spec.GetUUID());
+ err = ModuleList::GetSharedModule(local_spec, module_sp,
+ module_search_paths_ptr, old_modules,
+ did_create_ptr);
+ if (module_sp) {
+ LLDB_LOGF(log,
+ "[%s] module %s was found in Device Support "
+ "directory: %s",
+ (IsHost() ? "host" : "remote"),
+ module_spec.GetFileSpec().GetPath().c_str(),
+ local_spec.GetFileSpec().GetPath().c_str());
+ return err;
+ }
+ }
}
err = ModuleList::GetSharedModule(module_spec, module_sp,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124801.426502.patch
Type: text/x-patch
Size: 1508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220502/9eacc5f1/attachment.bin>
More information about the lldb-commits
mailing list