[Top][All Lists]

[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: Mon, 6 Dec 2004 14:24:33 -0800

>>>>> On Mon, 06 Dec 2004 10:00:19 -0600, Archie Cobbs <address@hidden> said:

  Archie> Another random/quick question...  Isn't it the case that
  Archie> libunwind's setjmp/longjmp implementation doesn't suffer
  Archie> from the "non-volatile variable foo may be clobbered by
  Archie> `setjmp'" problem that normal setjmp does? That is, all
  Archie> variables are restored, even non-volatile variables modified
  Archie> after setjmp().

Close, but no cigar: libunwind will restore the preserved registers,
but in general they won't have the same contents as of at the time of
the call to setjmp().  Consider something along the lines of:

bar() {

foo() {
  if (setjmp(&jbuf))

  do some other stuff...;


With the libunwind-based longjmp(), the preserved registers will be
restored as of the point at which bar() was called.  Fortunately, the
C standard allows for this.  Unfortunately, it still means that
variables allocated in registers will get clobbered by the longjmp(),
though the clobbering is somewhat controlled.


reply via email to

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