"error: summary string parsing error" on Fedora 30

With Clang 8.0.0 and libstd++ 9.1.1 on Fedora 30 x86_64, I get this
error from LLDB when trying to see the value of a string:

"error: summary string parsing error"

The code is simply:

std::string msg{"foo bar baz"};

With libcxx 8.0.0, instead of the above error, I simply see "??" when
inspecting the msg variable.

All of the above works fine for me in Ubuntu 19.04. I only have the
problem with Fedora 30. Tried in both CLion and VS Code.

How should I troubleshoot this? Could I be missing a package?

We have a summary provider for std::string that is built into LLDB that must not be working with the C++ runtime you are using. The current summary string that is used is in source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp in LoadLibStdcppFormatters:

lldb::TypeSummaryImplSP std_string_summary_sp(
new StringSummaryFormat(stl_summary_flags, “${var._M_dataplus._M_p}”));

So do a “frame var --raw msg” and see what the members of your std::string look like. I am guessing you won’t see “_M_dataplus” or “_M_p” in there. The “${var” means your std::string variable, and we are trying to access “msg._M_dataplus._M_p” to see what the string looks like.

Thanks for the info. "frame var --raw msg" is empty on my Fedora 30
system, but populated correctly on Ubuntu 19.04. E.g., on Fedora 30:

(lldb) frame var --raw msg
(std::string) msg = {}

I compiled with "clang++ -g main.cpp". Nothing fancy. Installed
Clang with "dnf install clang". Again, nothing fancy.

I'm a LLVM newb. Can you point me in the right direction?

Sounds like the compiler omitted the type info for std::string. Try "-glldb" in your compiler flags. This tunes debug info for LLDB. A lot of compilers will try to omit types from debug info if the type doesn't originate in the current executable. std::string would be one of those classes. If that flag doesn't work, then you might try -fno-limit-debug-info.

Let me know if that helps!

Thanks, Greg. Using "-g -fno-limit-debug-info" did the trick. All
works as expected now. Apparently the versions which ship with Ubuntu
19.04 and Fedora 30 differ with respect to this flag.

Sounds like the compiler omitted the type info for std::string. Try "-glldb" in your compiler flags. This tunes debug info for LLDB. A lot of compilers will try to omit types from debug info if the type doesn't originate in the current executable. std::string would be one of those classes. If that flag doesn't work, then you might try -fno-limit-debug-info.

Thanks, Greg. Using "-g -fno-limit-debug-info" did the trick. All works as expected now.

Great! Glad I could help.

Apparently the versions which ship with Ubuntu 19.04 and Fedora 30 differ with respect to this flag.

So are you saying "-glldb" is wrong on Fedora but "-fno-limit-debug-info" works?

On Fedora 30:

-g: no debug info
-glldb: no debug info
-g -glldb: no debug info
-g -fno-limit-debug-info: debug info present

I'm trying to determine if "-fno-limit-debug-info" is enabled by
default on Fedora 30, but don't have it it figured out yet.

Seems like you should fix "-g" so it emits debug info and then try to figure this out after that.

Behavior of the -g variants is probably better discussed on llvm-dev.
--paulr