Vanilla LLDB (cli) unable to import python type formatting

I’m working to get LLDB running. Getting it to start a crystal --debug binary isn’t bad, but I can’t get it to emit formatted data types with the formatter library

After copying that to ~/.lldb/crystal_lang.py:

> lldb
(lldb) command script import ~/.lldb/crystal_lang.py
warning: The provided class does not exist - please define it before attempting to use this synthetic provider
warning: The provided function "crystal_formatters.CrystalString_SummaryProvider" does not exist - please define it before attempting to use this summary.

It’s processing the import but not able to resolve the class/function definitions. I’m sure I’m doing something subtly wrong, but I’m not sure what.

$ lldb --version
lldb-1200.0.32.1
Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)

Thanks

with lldb version 10.0.0 the

(lldb) command script import ~/.lldb/crystal_lang.py

executes successfully.

LLVM 10 is the latest release we currently support.

1 Like

All right, okay. Thanks.

For posterity, my system llvm is 11.0.0 – I had no idea from the lldb version:

$ llvm-gcc --version
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

It looks like Crystal is building with brew-keg of LLVM anyway – I don’t know why I didn’t remember that. Brew’s llvm recipe now points to llvm 11 as of about a month ago – they’ve yet to provide a versioned release for llvm@10 as they do with older versions.

Recently the homebrew folks decided to roll out updates more aggressively, and installing one package will suddenly reinstall a landslide of packages. I’d guess this is where I got the llvm 11 keg.

The good news is crystal still builds my projects, at least so far.

/usr/local/opt/llvm/bin/lldb 
(lldb) command script import ~/.lldb/crystal_lang.py
error: module importing failed: This script interpreter does not support importing modules.

The issue with Apple LLDB is that it does not have a built-in Python interpreter for scripting.

1 Like