Re: kernel compiled with frame pointer

From: Keith Owens (kaos@ocs.com.au)
Date: Mon Sep 25 2000 - 06:33:42 EST


On Mon, 25 Sep 2000 06:21:48 -0500,
Robert Redelmeier <redelm@ev1.net> wrote:
>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.

Until you go to gcc 2.96 when the prologue code changes dramatically.
Interleaved instructions, plus "nice" constructs like

void foo(int bar)
{
        if (!bar)
                return;
        ....
        return;
}

Could generate the test before doing anything on stack.

foo: cmpl 4(%esp),$0
     be 1f
     pushl %ebp
     movl %esp,%ebp
     ...
     movl %ebp,%esp
     popl %ebp
1: ret

-
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:14 EST