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():