Cannot view std::string when compiled with clang

前端 未结 4 921
深忆病人
深忆病人 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:31

    As ks1322 mentioned, this is because clang has decided not to emit debug information for libstc++.

    You can force clang to do so by providing the following flag: -D_GLIBCXX_DEBUG

    I would only provide the flag for debug builds, but if debug is the default and release builds are a special target you should remove it:

    release: CXXFLAGS := $(filter-out -D_GLIBCXX_DEBUG,$(CXXFLAGS)) -O2
    

    This has fixed the same problem for me.

提交回复
热议问题