[Top][All Lists]

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

[Libunwind-devel] Re: [patch] Implement _Unwind_GetIPInfo (GCC PR target

From: Jakub Jelinek
Subject: [Libunwind-devel] Re: [patch] Implement _Unwind_GetIPInfo (GCC PR target/27880)
Date: Wed, 1 Apr 2009 15:02:54 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Mar 31, 2009 at 11:14:31PM +0200, Jan Kratochvil wrote:
> there are various problems that libunwind implements the unwinding ABI but not
> completely - _Unwind_GetIPInfo() is missing there.

Well, _Unwind_GetIPInfo was a 2006-02 addition, that said, bad things happen
if exports all _Unwind_* routines but _Unwind_GetIPInfo, which
is picked from libgcc_s.

> +PROTECTED unsigned long
> +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
> +{
> +  unw_word_t val;
> +
> +  unw_get_reg (&context->cursor, UNW_REG_IP, &val);
> +  *ip_before_insn = unw_is_signal_frame (&context->cursor);
> +  return val;
> +}

I'm not sure if this setting of *ip_before_insn is right for ia64 though,
the ia64 unwind info is very different from DWARF2/3 unwind info.
*ip_before_insn = {0,1} tells the caller how to look for C++ unwind regions
in the exception table.


If *ip_before_insn is set to 0, it means _Unwind_GetIPInfo returned an IP
of INSN's end, so when looking if that INSN is or is not in the EH region
starting at .LSOMEEHREGION_START we need to subtract 1 from the returned
value.  If it is set to 1 (for DWARF3 only for signal frames where kernel
supplied ip value is before the next not yet fully executed insn), then
we shouldn't subtract anything, if IP is >= .LSOMEEHREGION_START (and <
.LSOMEEHERGION_END), the insn falls into that region, otherwise it doesn't.
This matches how we e.g. look up into which FDE a particular RA falls in,
for DWARF3 we subtract one, unless it is a signal context.

But I think on ia64 the unwinder never subtracts anything when looking up
FDEs (that would suggest maybe *ip_before_insn = 1 should be used), but I'm
not aware of any problems reported with the *ip_before_insn = 0 usage on ia64.
I guess this needs to be carefully investigated.


reply via email to

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