[Top] [All Lists]

Re: [PATCH] dump_stack() based on prologue code analysis

To: "Thiemo Seufer" <>
Subject: Re: [PATCH] dump_stack() based on prologue code analysis
From: "Franck Bui-Huu" <>
Date: Thu, 27 Jul 2006 20:51:17 +0200
Cc: "David Daney" <>, "Atsushi Nemoto" <>,,
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta;; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CIxcd9XT/SazVaR6EkmAbHR78T0PlIljlyg1dktNayWneg1eMOVOCClTbFWmy3i+svoyNm7cFbkvb49ETAXPupaPzid2ubJAk2MbrReqOYJIAspib7ppGIZPiQsvV8Qsw6+IloE3O+QhQTeuy6hTvmh+QsGxWx6hnfy+YQBw/Zs=
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <>
2006/7/27, Thiemo Seufer <>:
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 <>
> 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

That's no always true. Consider this simple example:

void foo_wrapper(int a, int b)
       /* doing some checkings */

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

But is it really needed to show that foo_wrapper() has been called
before foo() ? The backtrace given by oops is for the first debug
intervention. They don't give a very accurate backtrace but it's
enough to understand what's going on in most cases.

BTW, the same exists with inlined functions. Gcc can inlined function
that are not been marked inlined and these functions won't appear in
any traces...


<Prev in Thread] Current Thread [Next in Thread>