Skip to content

MachProcess::GetLibrariesInfoForAddresses is quadratic in the number of loaded images #164157

@saagarjha

Description

@saagarjha

When debugging, loading a new image will cause the dyld debugger notifier breakpoint that LLDB sets up to be hit. This gives a chance for the debugger to be informed about the new image that just got loaded. To find out what it is, it calls through a sequence of functions that eventually sends a jGetLoadedDynamicLibrariesInfos packet to debugserver with the solib address that was just added. When debugserver receives this it calls GetAllLoadedBinariesViaDYLDSPI which calls a very slow function in the DYLD private framework to iterate all loaded images. Unfortunately this behavior is quadratic in the number of images loaded: as each new image is brought in, the list is regenerated with the new library. When debugging code that loads many libraries in sequence this can cause debugging sessions to hang for long periods of time as debugserver catches up. There has to be a better/faster way to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions