How to build the kernel without any optimization?

Shawn Jin shawnxjin at gmail.com
Sat Aug 21 16:59:30 EST 2010


Hi,

I'm tracing the execution of ds1307_probe() and find that some of
variables or function arguments cannot be printed in gdb because they
are optimized out or not in the current context. This really gives
some headache. Is there a way to build the kernel without any
optimization? What gcc option shall I disable or add?

I already added the following to arch/powerpc/Makefile.

# Prevent GDB from jumping around in the code when trying to single step
ifeq ($(CONFIG_DEBUG_KERNEL),y)
KBUILD_CFLAGS           += -fno-schedule-insns -fno-schedule-insns2
endif

Thanks,
-Shawn.


More information about the Linuxppc-dev mailing list