linux-mips
[Top] [All Lists]

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

To: "Atsushi Nemoto" <anemo@mba.ocn.ne.jp>
Subject: Re: [PATCH] dump_stack() based on prologue code analysis
From: "Franck Bui-Huu" <vagabon.xyz@gmail.com>
Date: Thu, 27 Jul 2006 21:03:07 +0200
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=X6rTPwARg2edGpAAhLeq+Y3TGqOHqbN6X+SpcHjF0aR6W1kwIRmKReOZMStZj/0lfufYHpULzcv/oAfK9twJYUHxLinc8VjGaDRq9Qw+pFEjenrFJ4TGHf7kXQlt3BKE5UHpwuh8jStsfmqaj29K/NCdvbPALRwDbj2f8PwbghA=
In-reply-to: <44C8CEA4.20000@innova-card.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20060726.232231.59465336.anemo@mba.ocn.ne.jp> <44C8CEA4.20000@innova-card.com>
Sender: linux-mips-bounce@linux-mips.org
one more comment,

2006/7/27, Franck Bui-Huu <vagabon.xyz@gmail.com>:
Hi Atsushi ;)

Atsushi Nemoto wrote:
> +unsigned long unwind_stack(struct task_struct *task,
> +                        unsigned long **sp, unsigned long pc)
> +{
> +     unsigned long stack_page;
> +     struct mips_frame_info info;
> +     char *modname;
> +     char namebuf[KSYM_NAME_LEN + 1];
> +     unsigned long size, ofs;
> +
> +     stack_page = (unsigned long)task_stack_page(task);
> +     if (!stack_page)
> +             return 0;
> +
> +     if (!kallsyms_lookup(pc, &size, &ofs, &modname, namebuf))
> +             return 0;
> +     if (ofs == 0)
> +             return 0;
> +
> +     info.func = (void *)(pc - ofs);
> +     info.func_size = ofs;   /* analyze from start to ofs */

in get_frame_info(), there is the following condition to stop the
prologue analysis

                if (info->func_size && i >= info->func_size / 4)
                        break;

Setting info.func_size = ofs may trigger this stop condition very
early, specially if "ofs" is small...I would simply remove this
condition since it's very empirical and IMHO not very usefull.

> +     get_frame_info(&info);
> +     if (info.pc_offset < 0 || !info.frame_size) {
> +             /* leaf? */

for leaf case, can't we simply do this test:

        if (info.pc_offset < 0) {

--
              Franck

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