Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift support with codelldb: need to set lldb_library in SublimeDebugger preferences? #229

Open
peterkos opened this issue Sep 19, 2023 · 2 comments

Comments

@peterkos
Copy link

peterkos commented Sep 19, 2023

Morning!

I was struggling to attach lldb to a SwiftPM-built project (sourcekit-lsp, of course) with the following config:

"debugger_configurations":[{
    "type": "lldb",
    "request": "attach",
    "name": "Attach",
    "program": "${folder}/.build/arm64-apple-macosx/debug/sourcekit-lsp",
    "waitFor": true,
    "lldb.library": "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB",
    "lldb.verboseLogging": true
}]

(Opting for A over the /Current/ symlink, and targeting the macos SPM debug output)

After much hoopla, I found a teeny little setting in Debugger.sublime-settings that overrides the debugger configurations!

// Which lldb library to use
"lldb_library": null,

In fact -- codelldb, contrary to its Swift documentation, doesn't need to have lldb.library set in this case, because of this setting. Nor does it need LLDB_DEBUGSERVER_PATH as a lldb.launch.env 😅

Working config:

// sourcekit-lsp.sublime-project
"debugger_configurations":[{
    "type": "lldb",
    "request": "attach",
    "name": "Attach",
    "program": "${folder}/.build/arm64-apple-macosx/debug/sourcekit-lsp",
    "waitFor": true,
    "lldb.verboseLogging": true
}]
// Debugger.sublime-settings
{
    "lldb_library": "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB",
}

Maybe a callout in the README for this setting would be helpful? I'd normally throw it in codelldb, but that's VSCode specific 👀 Happy to add one wherever!

@peterkos
Copy link
Author

peterkos commented Sep 19, 2023

The "symptom" here was hitting breakpoints, but unable to print any vars in the console, and the callstack was obfuscated, like so:

s18SKSwiftPMWorkspace05SwiftB0C3url17toolchainRegistry10buildSetupACSg10Foundation3URLV_6SKCore09ToolchainF0CAK05BuildH0VtcfC

Attempting to print a var would yield this fun error, informing us (tldr) that lldb wasn't loaded, + we're runnin' only the debug symbols from the executable:

:po buildSetup
error: Could not find type system for language swift: TypeSystem for language swift doesn't exist

@daveleroy
Copy link
Owner

daveleroy commented Nov 4, 2023

Does lldb.library in the configuration work in vsocde? I was under the impression that was a workspace setting similar to Debugger.sublime-preferences.

There currently isn't a great place to add notes for specific adapters besides the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants