Building with WITH_DEBUG (-g) in make.conf

Peter Jeremy peter at
Thu Sep 6 07:11:17 UTC 2012

On 2012-Sep-04 23:50:35 +0200, Dimitry Andric <dim at> wrote:
>There's a difference between just using '-g', which should never change
>the behaviour of the program at runtime, and adding -DDEBUG or similar
>flags on the command line, which may or may not enable extra code, or
>even cause totally different code paths.

In theory, gcc should generate identical code with and without '-g'
but, last time I looked, adding '-g' causes non-trivial changes in the
gcc code paths so it's quite possible that different code is emitted.

>What is not different, is that both -g and other debugging options will
>generally cause compiling and linking to take longer, since these stages
>will have to process the additional debug information.

As well as being much larger - several times larger is not uncommon.
This further slows things down due to the additional I/O and reduced
cache effectiveness.

Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url :

More information about the freebsd-hackers mailing list