Reputation: 956
I am going to setup kgdb
to debug Ubuntu
debian
kernel.
By default, the kernel compiled by make-kpkg
has been optimized (-O2
) so I am not able to debug the variables.
Is there a way to disable the kernel compilation optimization (for example, -O0
)?
thanks!
Currently, gdb reports the variable has been optimized:
(gdb) p pb
$5 = <optimized out>
Upvotes: 0
Views: 182
Reputation:
The Linux kernel depends on -O2. It will not compile with any lower optimization levels. It uses several GCC "tricks" that only work when certain optimizations are turned on, such as inline functions that are supposed to act like macros.
Upvotes: 1