[lldb] Make TestModuleLoadedNotifys work with dyld from the shared cache

Make TestModuleLoadedNotifys work with a dyld from the expanded shared
cache in the DeviceSupport directory. In that case the module path is:

  ~/Library/Developer/Xcode/iOS DeviceSupport/<...>/Symbols/usr/lib/dyld

instead of just:

  /usr/lib/dyld

This makes the test pass when running against an embedded Darwin device.
This commit is contained in:
Jonas Devlieghere 2022-08-03 13:41:33 -07:00
parent 880b2128ef
commit 2b61b770df
No known key found for this signature in database
GPG Key ID: 49CC0BD90FDEED4D
1 changed files with 4 additions and 2 deletions

View File

@ -82,8 +82,10 @@ class ModuleLoadedNotifysTestCase(TestBase):
module = lldb.SBTarget.GetModuleAtIndexFromEvent(i, event)
# On macOS Ventura and later, dyld and the main binary
# will be loaded again when dyld moves itself into the
# shared cache.
if module.file.fullpath not in ['/usr/lib/dyld', exe]:
# shared cache. Use the basename so this also works
# when reading dyld from the expanded shared cache.
exe_basename = lldb.SBFileSpec(exe).basename
if module.file.basename not in ['dyld', exe_basename]:
self.assertTrue(module not in already_loaded_modules, '{} is already loaded'.format(module))
already_loaded_modules.append(module)
if self.TraceOn():