[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libunwind] Some basic questions about libunwind

From: Archie Cobbs
Subject: Re: [libunwind] Some basic questions about libunwind
Date: Mon, 06 Dec 2004 20:41:17 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

James E Wilson wrote:
It seems like with libunwind's longjmp(), variables in registers would
always be restored to the values they had when longjmp() is called,
because you can never pluck an "old" value off the stack (i.e., the
register values are never stored in more than one place).

It isn't safe to assume anything more than what the standard guarantees,
and the standard says that non-volatile automatics are indeterminate
after a longjmp.

Your reasoning is flawed, because you fail to consider compiler
effects.  You are assuming that automatic variables are objects
corresponding to a single storage location that is always updated when
the variable is written to.  This is far from true with an optimizing
compiler.  The compiler may use multiple locations for a variable, it
may use different locations in different code regions, it may defer
stores, it may optimize away the storage location, etc.

Thanks for the insights.. of course you are correct and that
explains the issue well.


Archie Cobbs      *        CTO, Awarix        *

reply via email to

[Prev in Thread] Current Thread [Next in Thread]