libunwind-devel
[Top][All Lists]
Advanced

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

Re: [libunwind] Some basic questions about libunwind


From: David Mosberger
Subject: Re: [libunwind] Some basic questions about libunwind
Date: Tue, 7 Dec 2004 17:23:36 -0800

>>>>> On Mon, 06 Dec 2004 16:37:47 -0600, Archie Cobbs <address@hidden> said:

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

You're assuming automatic variables are always stored in memory.
That's not true.  In factK, your example:

  Archie> bar()
  Archie> {
  Archie> longjmp();
  Archie> }

  Archie> foo()
  Archie> {
  Archie> int x = 1;
  Archie> setjmp();
  Archie> x = 2;
  Archie> bar();
  Archie> printf("%d\n", x);
  Archie> }

The printf would print "2" because "x" would normally be allocated to
a stacked register.

        --david

reply via email to

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