How to compile Linux kernel with -O0 flag

Aleksander Alekseev afiskon at devzen.ru
Sat Aug 13 14:15:16 EDT 2016


Hello

I'm currently exploring different ways of debugging Linux kernel. And I
noticed that for many variables gdb displays <optimized out>. Also from
experience of debugging ring3 code I know that sometimes debugger may
act crazy unless -O0 was used.

Apparently there is no corresponding option in `make menuconfig`. So
how do you solve this problem? Just `CFLAGS=-O0 make ...` or somehow
else? I wonder what is the "right" way of doing it because you know,
it's a kernel, it can accidentally break something unless you are
careful :)

-- 
Best regards,
Aleksander Alekseev



More information about the Kernelnewbies mailing list