Cannot view std::string when compiled with clang

前端 未结 4 910
深忆病人
深忆病人 2021-02-12 13:38

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

4条回答
  •  庸人自扰
    2021-02-12 14:34

    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.

提交回复
热议问题