Re: GCC Build Defaults to Debug Mode?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/01/17 16:25, Nick wrote:
> I've been building GCC for many years.  Just recently I've noticed that
> it seems to build with debugging information (-g) by default.  Is this
> true?

Yes, since forever.  It's a basic Free Software entitlement: the user
of a piece of software can fix problems, and it's a good idea to ship
production software with full debuginfo.

> So a few questions:
> 1.  Why does it do this by default?

So that when it breaks in use you can find out why it broke.  We want
to see meaningful backtraces in bug reports, too.

> 2.  Does it make sense for me to turn that off?  (I don't want it
> because static analysis is picking up a ton of false positives in
> various GCC modules which get linked into my app).

Probably not.

> 3.  How best to turn it off?

It'd probably be best to strip out the debuginfo into a separate file.

   <Run "objcopy --only-keep-debug foo foo.dbg" to>
       create a file containing the debugging info.

   <Run "objcopy --strip-debug foo" to create a>
       stripped executable.

   <Run "objcopy --add-gnu-debuglink=foo.dbg foo">
       to add a link to the debugging info into the stripped
       executable.

Andrew.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux