How can I disable compile optimization in kernel for friendly debugging, Thanks

valdis.kletnieks at vt.edu valdis.kletnieks at vt.edu
Thu Apr 19 13:28:13 EDT 2018


On Thu, 19 Apr 2018 16:58:40 +0800, sizel said:
>  How can I disable compile optimization in kernel for friendly  debugging, Thanks

First off, there are parts of the kernel that *WILL* explode if you try to build
with -O0 - in particular, any code that expects static inlines to be treated as
part of the unit they are inlined into for the purposes of __builtin_return_address()
and similar.

Second, modern gdb is perfectly able to deal with -O2 optimization,
especially if you build with -g.  (In the kernel build, CONFIG_DEBUG_INFO=y
will do the right thing for this).

What specific problems were you hitting in debugging that made you want to
disable optimization?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180419/57946860/attachment.sig>


More information about the Kernelnewbies mailing list