LLDB hangs when attached to the JUCE library

Hey all! This is my first post here.

For some reason, using LLDB version 11.1.0, it hangs with JUCE-based projects before running the program for about 5-7 seconds. It only happens on Intel-based macs, and only on Big Sur.

To test, grab this repo:

And generate a project using

cmake -G Xcode -B build

Then try building the console app example target and attaching LLDB to it.
In my tests after calling ‘run’ it takes about 5-7 seconds until ‘Hello World’ shows up.

Using non-JUCE apps seems to work fine, so it’s probably something they’re doing that’s dramatically slowing down the projects. Using Xcode with the same projects works instantly.

Thanks!
Eyal

I managed to isolate the issue to linking with Mac core libs:

cmake_minimum_required(VERSION 3.20)
project(TestMacDebug)

set(CMAKE_CXX_STANDARD 14)

add_executable(TestMacDebug main.cpp)

#comment this in/out to see the difference in debug speed:
target_link_libraries(TestMacDebug PRIVATE
        "-framework Cocoa"
        "-framework Foundation"
        "-framework IOKit")

Will cause lldb to hang even with an empty main() function.

int main()
{
    return 0;
}

This sounds a bit like a but that got fixed recently: ⚙ D102833 [debugserver]Add platform cache support to improve performance.Under BigSur 11.3 this function causes a performance loss of 0.68s per execution.

That patch hasn’t made it into a release yet, but if you could compiling the latest LLDB from source then you could check if this has been resolved.

Otherwise you could use the sample command to see what lldb (and the debugserver process) are spending their time on when attaching.