[Top] [All Lists]

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

To: Atsushi Nemoto <>
Subject: Re: [PATCH] dump_stack() based on prologue code analysis
From: Franck Bui-Huu <>
Date: Mon, 31 Jul 2006 16:32:52 +0200
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta;; h=received:message-id:date:reply-to:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:from; b=pdV3PF9u7xgH8hajhChmgndSGjjU29y9Dg5f9gg7gAHOKcDekvwmDmFCs2KmVRVpohTP1gb39wEojRl+ffGZvMNNZsrS1u9xwy5KsHhljNev39zN6cbJWaBmS57cLhBo5HQw8RriVsum6GhCoDilza0B7E3xCE/ew4gD2EJZL3k=
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <> <>
Reply-to: Franck <>
User-agent: Thunderbird (X11/20060614)
Atsushi Nemoto wrote:
> On Mon, 31 Jul 2006 11:15:50 +0200, Franck Bui-Huu <> 
> wrote:
>>> Yes, that is what I wanted.  Imagine if a exception happened on first
>>> place on non-leaf function.  In this case, we must assume the function
>>> is leaf since RA is not saved to the stack.
>> The only case I can imagine is when sp is corrupted which is unlikely.
> Modern gcc somtimes do amazing optimization ;-)
>> However an exception can occure just after a prologue of a nested
>> function which is more likely. In that case you will assume wrongly
>> that the function was a leaf one.
> Why?  get_frame_info() should detect frame_size and pc_offset for that
> case.
> Is your objection against "info->func_size / 4" part?  the "4" comes
> from size of a instruction.

OK. I missed that, sorry.

> Well, using "4" instead of "sizeof(union mips_instruction)" or
> "sizeof(*ip)" was my old fault...

Well could we use "sizeof(union mips_instruction)" so nobody won't
make the same mistake ?

                if (i >= info->func_size / sizeof(union mips_instruction))

BTW I omit the first condition "info->func_size != 0" because
normally a func has a no null size. If it has we should stop
right now.

We should also test this condition _before_ testing that "*ip" is
a jal instruction, shouldn't we ?


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