April 19, 2018
5:28 p.m.
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?