[Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo

Samuel Martin s.martin49 at gmail.com
Sat Jun 11 17:22:09 UTC 2016


On Sat, Jun 11, 2016 at 7:06 PM, Thomas Petazzoni
<thomas.petazzoni at free-electrons.com> wrote:
> Hello,
>
> On Sat, 11 Jun 2016 17:22:24 +0200, Samuel Martin wrote:
>
>> By default CMake sets the CFLAGS like this:
>> CMAKE_C_FLAGS_DEBUG=-g
>> CMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG
>
> Is -O2 -g really what we want for debugging? Optimized code very often
> doesn't play well with debugging.

To be honest, I don't have a strong opinion about it.

Note that this is the default flags CMake sets; if you add to the
configure opts:
  -DCMAKE_C_FLAGS_RELWITHDEBINFO=-g -O1 -UNDEBUG
then these flags are taken into account, not the default ones.

OTOH, applying no optimization at all in debug build may lead to some
size issues for (very) tiny targets... Who knows? though I don't
remember any bug report/complaint about such a situation.

Regards,

-- 
Samuel


More information about the buildroot mailing list