From: Thiemo Seufer <ths@networkno.de>
To: Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: David Daney <ddaney@avtrex.com>,
Atsushi Nemoto <anemo@mba.ocn.ne.jp>,
linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] dump_stack() based on prologue code analysis
Date: Thu, 27 Jul 2006 20:12:45 +0100 [thread overview]
Message-ID: <20060727191245.GD4505@networkno.de> (raw)
In-Reply-To: <cda58cb80607271151n2dcfe64cn4cb1ecca3ece6b1e@mail.gmail.com>
Franck Bui-Huu wrote:
> 2006/7/27, Thiemo Seufer <ths@networkno.de>:
> >David Daney wrote:
> >> Atsushi Nemoto wrote:
> >> >Instead of dump all possible address in the stack, unwind the stack
> >> >frame based on prologue code analysis, as like as get_chan() does.
> >> >While the code analysis might fail for some reason, there is a new
> >> >kernel option "raw_show_trace" to disable this feature.
> >> >
> >> >Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> >>
> >> Let me start by saying I have not analyzed how all this code works, but
> >> I have done something similar in user space.
> >>
> >> Since the kernel ABI does not use gp, many functions may not have a
> >> prolog (especially when compiled with newer versions of GCC). In the
> >> user space case, most leaf functions have no prolog. For the kernel I
> >> would imagine that many non-leaf functions (simple non-leaf functions
> >> that do only a tail call) would also not have a prolog.
> >
> >Non-leaves have to save/restore $31 somewhere, so there should be a
> >prologue.
> >
>
> That's no always true. Consider this simple example:
>
> void foo_wrapper(int a, int b)
> {
> /* doing some checkings */
> [...];
> foo(a,b);
> }
>
> void foo(int a, intb)
> {
> [...];
> }
>
> In foo_wrapper(), gcc will generate a "j" instruction (well I guess)
> because once foo() is called and is finished, there's no needs to
> return back to foo_wrapper(). In that case, foo_wrapper() won't have a
> prologue.
Well, with tail call optimisation it isn't a true nested function any
more, the compiler can even reorder and/or combine functions in more
creative ways.
IOW, binary analysis can't be expected to provide full accuracy, but
we can live with a reasonable approximation, I think.
Thiemo
next prev parent reply other threads:[~2006-07-27 19:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-26 14:22 [PATCH] dump_stack() based on prologue code analysis Atsushi Nemoto
2006-07-27 14:33 ` Franck Bui-Huu
2006-07-27 19:03 ` Franck Bui-Huu
2006-07-28 8:16 ` Franck Bui-Huu
2006-07-28 16:08 ` Atsushi Nemoto
2006-07-28 16:01 ` Atsushi Nemoto
2006-07-31 9:15 ` Franck Bui-Huu
2006-07-31 13:39 ` Atsushi Nemoto
2006-07-31 14:32 ` Franck Bui-Huu
2006-07-31 15:33 ` Atsushi Nemoto
2006-07-31 15:51 ` Franck Bui-Huu
2006-07-31 15:59 ` Atsushi Nemoto
2006-07-28 15:44 ` Atsushi Nemoto
2006-07-31 8:45 ` Franck Bui-Huu
2006-07-27 16:54 ` David Daney
2006-07-27 17:03 ` Thiemo Seufer
2006-07-27 17:27 ` David Daney
2006-07-27 18:51 ` Franck Bui-Huu
2006-07-27 19:12 ` Thiemo Seufer [this message]
2006-07-28 14:38 ` Atsushi Nemoto
2006-07-28 17:05 ` David Daney
2006-07-28 17:34 ` Nigel Stephens
2006-07-28 18:32 ` David Daney
2006-07-28 19:31 ` Thiemo Seufer
2006-07-29 14:25 ` Atsushi Nemoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060727191245.GD4505@networkno.de \
--to=ths@networkno.de \
--cc=anemo@mba.ocn.ne.jp \
--cc=ddaney@avtrex.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=vagabon.xyz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.