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

David Blaikie via cfe-users cfe-users at lists.llvm.org
Thu Jul 25 20:35:14 PDT 2019


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.

To see a case where GCC does the same thing - try a variable of type
std::fstream. GCC, similarly, will produce only a declaration for the
basic_fstream type, not the definition.

(& here's a lightning talk that discusses, briefly, some of this:
https://www.youtube.com/watch?v=XvkLHIASlp8 )

On Thu, Jul 25, 2019 at 11:41 AM Bob Eastbrook via cfe-users <
cfe-users at lists.llvm.org> wrote:

> On Fedora 30, "clang++ -g main.cc" does not emit debugging information
> for types such as std::string.  I can only get complete debugging
> information by including "-fno-limit-debug-info".
>
> On Ubuntu 19.04, "clang++ -g" emits debugging info for std::string as
> expected.
>
> Which behavior of "-g" is correct?  Can anyone explain why each
> platform behaves differently?
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20190725/3885acce/attachment.html>


More information about the cfe-users mailing list