Re: kernel compiled with frame pointer

From: Robert Redelmeier (
Date: Mon Sep 25 2000 - 06:21:48 EST

Sushil wrote:
> I agree. Sitting in the front of desktop I can see if the source files are
> getting compiled with or without -fomit-frame-pointer. But, while writing
> a function in a kernel source file, I want to know whether the caller of
> this function was compiled with or without -fomit-frame-pointer because
> this will affect the location of return address to it on the stack.
> So, I assume that if CONFIG_FRAME_POINTER is defined then the kernel (and
> hopefully the caller function also) is being compiled without
> -fomit-frame-pointer and then look for the return address appropriately.

Ah -- I see, you are looking at some sort of kernel debugger. Well,
then one way would be to look at entry and exit points. i386 Frame
pointers are set up with `pushl %ebp / movl %esp, %ebp / subl $local, %esp`
or sometimes [not by gcc AFAIK with `enter`]. Exit points are similarly
`movl %ebp, %esp / popl %ebp / ret`. Some versions of gcc do generate
`leave / ret`.

You could look for these byte signatures. Should be quite reliable with
a good
-- Robert
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:14 EST