[cfe-users] Should clang++ -g produce debugging info for all types?

Bob Eastbrook via cfe-users cfe-users at lists.llvm.org
Tue Jul 30 09:50:14 PDT 2019


On Thu, Jul 25, 2019 at 8:35 PM David Blaikie <dblaikie at gmail.com> wrote:

> No, it shouldn't - clang attempts to avoid emitting duplicate debug info across the program (it assumes you built the whole program and all libraries with debug info), gcc assumes the same thing though in slightly different/fewer ways.
>
> The solution is to install the -dbg build of your libstdc++ package (assuming you're using libstdc++), it will include debug info for the standard library, including std::string.

Thanks for the pointer.  Based on what you told me, I was able to dig
deeper and found these relevant links:

https://bugs.llvm.org/show_bug.cgi?id=24202#c1
https://stackoverflow.com/questions/41745527/cannot-view-stdstring-when-compiled-with-clang

I installed the debug version of libstd++ on my Fedora system with
"dnf debuginfo-install libstdc++" and I now see a debug version of
libstdc++:

$ file /usr/lib/debug/lib64/libstdc++.so.6.0.26-9.1.1-1.fc30.x86_64.debug
/usr/lib/debug/lib64/libstdc++.so.6.0.26-9.1.1-1.fc30.x86_64.debug:
ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux),
dynamically linked,
BuildID[sha1]=3b2e1aaafd0cb7e1ebd75627d4cde2504c927159, with
debug_info, not stripped

I don't have things working though.  I still don't see std::string
info when debugging.  My executable is linked against the non-debug
version:

$ ldd a.out
    linux-vdso.so.1 (0x00007ffec03fe000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2fccd31000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f2fccbeb000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2fccbd1000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f2fcca0b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f2fccf45000)

Is that my problem?  Or does LLDB somehow know to use the version in
/usr/lib/debug/lib64?

I'm also puzzled about why the debug version was put in /usr/lib and
not /usr/lib64.



More information about the cfe-users mailing list