lkml.org 
[lkml]   [2000]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kernel compiled with frame pointer
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 System.map.

-- Robert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.067 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site