g++ (GCC) 5.2.0
clang version 3.7.1 (tags/RELEASE_371/final)
GNU gdb (GDB) 7.12
Gdb is unable to locate the definition of std::string when compiled with
I've reproduced this issue on Fedora with system clang.
It appears that clang is not emitting debug information for std::string
because it was told that libstdc++
provides it. See this comment from bug 24202:
Looks like you don't have debug information for libstdc++ installed:
Missing separate debuginfos, use: dnf debuginfo-install libgcc-5.1.1-4.fc22.x86_64 libstdc++-5.1.1-4.fc22.x86_64
Clang is not emitting debug information for std::string because it was told that libstdc++ provides it (but in your case, it's not installed); this is a debug size optimization that GCC apparently doesn't perform.
Does this work if you install the debug information for libstdc++?
I've installed debug info for libstdc++
with command dnf debuginfo-install libstdc++-6.2.1-2.fc25.x86_64
and that resolved the issue.