Variables not shown when debugging with LLDB on macOS
Hi,
I've installed the latest LLVM + lldb via https://afnan.io/2018-10-01/using-the-latest-llvm-release-on-macos/, using:
brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc
And now lldb's --version is at v8.x.
I also did:
# pointed to /Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi before
rm /usr/local/bin/lldb-mi
ln -s /usr/local/opt/llvm/bin/lldb-mi /usr/local/bin/lldb-mi
However when debugging I still don't see any variables listed in the debug window. Breakpoints work ok, as to stack traces.
I'm not sure if the issue is vscode still using the older LLDB or if there's another reason the variables don't show up. Any tips?
Actually, it seems that breakpoints only work with the older version, not the one I try to use after installing with homebrew. So that's two separate issues.
sigh.. it really sucks how broken D's ecosystem is. Sorry to rant out loud but it's giving a really bad impression to my coworkers.
Logging output: https://gist.github.com/AndrejMitrovic/059d5a5128e2cdb0f9f4887d6ca06d96
From this simple dub app:
import std.stdio;
class C
{
int x;
}
void main()
{
int x = 100;
int y = 200;
int z = x++ + y++;
auto c = new C();
c.x = x;
c.x++;
writeln(z++);
}
And the debug config:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb-mi",
"request": "launch",
"name": "Launch Program",
"target": "./vstest",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText",
"printCalls": true,
"showDevDebugOutput": true,
"preLaunchTask": "build"
}
]
}
Ah maybe this is an issue unrelated to code-debug. I can't seem to print the variables even using lldb directly in the terminal:
~/dev/vstest $ lldb ./vstest
(lldb) target create "./vstest"
Current executable set to './vstest' (x86_64).
(lldb) info locals
error: 'info' is not a valid command.
(lldb) b app.d : 11
Breakpoint 1: where = vstest`_Dmain + 19, address = 0x0000000100001607
(lldb) r
Process 11988 launched: '/Users/andrejmitrovic/dev/vstest/vstest' (x86_64)
Process 11988 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100001607 vstest`_Dmain at app.d:11
8 void main()
9 {
10 int x = 100;
-> 11 int y = 200;
12 int z = x++ + y++;
13
14 auto c = new C();
Target 0: (vstest) stopped.
(lldb) p x
error: use of undeclared identifier 'x'