Python summaries for LLDB in CLion on Windows
settings set target.load-cwd-lldbinit true
command script import <dir/formatter.py> # e.g. formatters/motley_formatter.py
CLion: turn on MSVC+lldb (or else default is gdb)
Settings > Build,Execution,Deployment > CMake
Change toolchain to "Visual Studio"
Categories seems broken on CLion, use default category
just dont provide category, omit -w or --category
Sometimes lldb uses the struct name sometimes typedef
if you define your structs like:
typede struct foo {
int a;
} foo_t
you will need to add pattern to match both
one option is to use regex:
debugger.HandleCommand('type summary add --regex "^mo_name(_t)?$" --python-function motley_formatter.mo_name_SummaryProvider')
The shorthand params sometimes confuse lldb, use the full ones (the real issue is probably some param order thing)
--regex instead of -x
--python-function not -F
etc
CLion adds synthetic types for unnamed unions
use raw_struct = valobj.GetNonSyntheticValue()
valobj.CreateValueFromAddress() does not always work for pointers to heap arrays, but valobj.CreateChildAtOffset() might work