LLDB Slow Breakpoints Despite Disabling Swift C++ Interop

We’re running into a performance issue with LLDB when hitting a breakpoint in a specific file. The function(in lldb-rpc-server sample) takes around ~10 seconds when a breakpoint is triggered

lldb_private::Module::IsSwiftCxxInteropEnabled()

To disable Swift C++ interop, we’ve set the following in our .lldbinit and also have "-cxx-interoperability-mode=off" in copts, but this doesn't seem to mitigate the above lag.

settings set target.experimental.swift-enable-cxx-interop false

Is there an alternative setting that explicitly disables Swift/C++ interop checks in lldb?
If not,are there known workarounds or optimizations to mitigate this performance hit?

Hi, what's lldb version are you running? I'm surprised to hear that setting the setting doesn't work, the code does check for the setting before looking for it in debug info.

We are on:

lldb-1600.0.39.3
Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Xcode 16.1 (16B40)

I also enclosed the lldb-rpc-server sample in this FB

I unfortunately don't have a reproducer, but in case I can help with any other info, please let me know.

2 Likes

I notice that when I run:

(lldb) settings show target.experimental

the output does not include target.experimental.swift-enable-cxx-interop.

Here’s what I see instead:

target.experimental.inject-local-vars (boolean) = true
target.experimental.ptrauth-jit-codgen (boolean) = true
target.experimental.swift-allow-explicit-modules (boolean) = true
target.experimental.swift-discover-implicit-search-paths (boolean) = true
target.experimental.swift-enable-bare-slash-regex (boolean) = false
target.experimental.swift-pcm-validation (enum) = auto
target.experimental.swift-plugin-server-for-path (dictionary of strings) =
target.experimental.swift-read-metadata-from-dsym (boolean) = false
target.experimental.swift-read-metadata-from-file-cache (boolean) = true
target.experimental.swift-use-reflection-symbols (boolean) = true

Hey @augusto2112 ,

Do you think this could be a regression in LLDB, a change in the relevant setting names, or something specific to our setup? Since this is all within a private implementation of lldb plugin which we don't have access to, any insight would be helpful in determining our next steps.

what do you see with settings show symbols.swift-enable-cxx-interop?

I see it set to auto. (its default value)

(lldb) settings show symbols.swift-enable-cxx-interop
symbols.swift-enable-cxx-interop (enum) = auto

When I set it to false, I notice that the instance creation checks for IsEmbeddedSwift instead and invites the same lag, as it checks into the dwarf info. I've included a sample in the above feedback. Is there a setting to disable the IsEmbeddedSwift check?

@chiragramani I have a patch to speed up the check for C++ here, I will also open one for embedded swift later after this one is merged. Thanks for the report!

1 Like

Thank you so much, @augusto2112! Appreciate all your help :folded_hands:
Is there a way to override the Xcode LLDB plugin's behavior locally following your changes so developers can benefit from them immediately, without having to wait for Xcode 16.3 or later releases?

Unfortunately, besides compiling your own toolchain, there's no real way to override this :pensive_face:

If building our own toolchain is an option, what steps would you recommend to ensure Xcode properly detects and utilizes this custom LLDB toolchain? Any guidance on integration, or known issues to watch out for would be incredibly helpful as we plan our next steps.