libunwind-devel
[Top][All Lists]
Advanced

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

Re: [libunwind] Several function exit code paths


From: David Mosberger
Subject: Re: [libunwind] Several function exit code paths
Date: Thu, 11 Dec 2003 07:43:05 -0800

>>>>> On Thu, 11 Dec 2003 12:06:16 +0100, Johan Walles <address@hidden> said:

  Johan> Now, let's say I correctly register the frame entry code with
  Johan> libunwind.  I also register the two frame exits with
  Johan> libunwind.  In this situation, how does libunwind know that
  Johan> on line 10, the user stack pointer has the same value it had
  Johan> on line 4?

There are multiple options, but a good approach may be to use
label_state and copy_state: after the frame-state is setup, use
"label_state" to assign the current frame-state an (arbitrary) unique
number.  After the first return, re-establish the original state with
"copy_state".

  Johan> Should I register with libunwind that the br.ret at line 9
  Johan> does the same thing as both line 2 and line 3?

The br.ret isn't explicitly marked, though you'll need to use two
separate regions to cover the code and need to mark the point at which
"sp" gets restored with "pop_frames".

  Johan> If this is the way to go, can I use the same "when" parameter
  Johan> to several calls to _U_dyn_op()?

Specifying multiple directives with the same "when" parameter is legal
too.  It's often useful in conjunction with empty regions, which can
be used to setup a particular frame-state.  That would be an
alternative solution to the above problem, but I think you'll find
copy_state/label state to be easier to use and it should result in
fewer unwind directives.

        --david


reply via email to

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