Debugger shows no local variables on Ubuntu 20.04

Hello all,

I'm new to swift and started to use the debugger in swift. Debugging works in a sense that I can put breaking point but when I reach the breaking point there are no local variables. I tried the debugger both in clion and vscode but in both editors I don't see any variables. For example, In the image below I would expect to see the constant x and variable j as local variables.

I'm not sure whether this is because I miss a dependency or because it's simply not possible to see any local variables but I hope that some one can help me to figure this out.

I'm using:

  • Swift version 5.2.4 (swift-5.2.4-RELEASE)
  • Ubuntu 20.04
  • clang version 7.0.0

My debug configurations in vscode are:

{
"version": "0.2.0",
"configurations": [
{
"type": "lldb", // 1
"request": "launch",
"name": "Debug",
"program": "{workspaceFolder}/.build/debug/test_debugger", // 2 "args": [], "cwd": "{workspaceFolder}",
"preLaunchTask": "swift-build" // 3
}
]
}

{
"version": "2.0.0",
"tasks": [
{
"label": "swift-build", // 1
"type": "shell", // 2
"command": "swift build" // 3
}
]
}

Hi Aram,

At that breakpoint, x and j are static variables, not local. Do you see them under "Static" ?

Hey Steven,

This is what is shown under the static variables. So also from static I cannot tell what variables x and j are.

I just noticed that when I'm in my debug console I get the warning:
This version of LLDB has no plugin for the swift language. Inspection of frame variables will be limited.

So I guess I have to download another version?

See my setup instructions for Visual Studio Code:

You can set the Lldb: Library setting of the CodeLLDB extension to point at the version of LLDB that comes with Swift. This should give you proper variable names in the debugger (as you can see on the screenshots in those instructions).

2 Likes

Thank you very much that did the trick :)

Terms of Service

Privacy Policy

Cookie Policy