libunwind-devel
[Top][All Lists]
Advanced

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

Re: [libunwind] unwinding through dynamically modified code?


From: David Mosberger
Subject: Re: [libunwind] unwinding through dynamically modified code?
Date: Mon, 15 Mar 2004 14:06:04 -0800

>>>>> On Mon, 15 Mar 2004 13:41:30 -0800, "Young, Mark" <address@hidden> said:

  Mark> A disjoint code fragment that is jumped into can by described
  Mark> as performing a sequence of state save operations at
  Mark> instruction offset 0, as if the separate function entry state
  Mark> save instructions had immediately preceded the fragment. Given
  Mark> any possible ip in the fragment, the unwinder sees that the
  Mark> state save has already occurred and yet it has the complete
  Mark> recipe to reconstruct the previous frame state since it does
  Mark> so without looking at the code.

Ah, thanks for that comment, Mark!  I realize now what piece Todd was
missing: to setup the state for a disjoint piece of code, you can use
an empty prologue region (a region covering no instructions).  We do
this in the Linux kernel in several places and it has become second
nature to me, so I had forgotten that this is actually a bit of a
special case.

So, Todd, what you'd want to do is create a dummy region
(unw_dyn_region_info_t) whose "insn_count" member is zero.  This
region sets up all the state as it will be passed in by the caller.
This is can then be followed by a region that covers the actual code
(i.e., "insn_count" is non-zero).

(Note that just setting the "when" field to 0 doesn't work reliably
because then the unwind state will be in effect only _after_ the first
instruction has executed.)

        --david


reply via email to

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