Re: kernel compiled with frame pointer

From: Sushil (sushil@veritas.com)
Date: Sun Sep 24 2000 - 14:41:08 EST


On Sun, 24 Sep 2000, Robert Redelmeier wrote:

> > I am trying to get the call trace of a process by tracing the return
> > addresses on the stack. To get the correct location of the return
> > address I need to know whether the kernel is being compiled with
> > frame pointer because this will affect the offset of return address
> > on the stack.
>
> Of course. But when your kernel was compiling, did you notice the
> `gcc` options as the files flew by? `-fomit-frame-pointer` is standard
> on i386 and perhaps other arch's.

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.

Although this assumption is not correct (see Keith's mail in this thread)
but works in the case I am looking at (the function __dump_save_panic_regs
in the arch/i386/kernel/vmdump.c from the LKCD patch) because there the
caller and the callee are part of one code and either both or none is
compiled with frame pointer.

> But when you say "process", that sounds like userland. Then it
> would depend on whether you compiled with `-fomit-frame-pointer`
> or not.

I am looking at crash dump utilities for Linux and in that context if the
kernel crashes then I am only interested in the kernel functions which the
process was executing at the time of the crash and not worried about the
user land call trace before the process entered the kernel. Therefore,
whether the user level program (which the process is executing) is
compiled with or without -fomit-frame-pointer is irrelevent in this case.

Regards,
Sushil.

-
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/



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