Richard Henderson <r...@redhat.com> writes:
> On 02/15/2012 11:53 AM, Richard Sandiford wrote:
>> We then trip:
>> 
>>       /* Don't let us unwind past the handler context.  */
>>       gcc_assert (!match_handler);
>> 
>> in _Unwind_RaiseException_Phase2.  What's the right thing to do here?
>> 
>
> Ug.  The Right Thing is to fix the unwinder so that it identifies
> frames by pc+cfa, like gdb does, rather than by cfa alone.  The
> assumption has been that a function without a frame can't perform
> a call, and can only by unwound to via signals.
>
> As a workaround for 4.7, you can try this hack:
>
>       .cfi_startproc simple
>       .cfi_def_cfa    29, -1          # fake cfa one byte below sp
>       .cfi_register   29, 29          # "save" sp in itself so we don't use 
> the fake cfa
>       move    $18,$31
>       .cfi_register 31, 18
>       ...

Ooh, nice (if that's the word).  It certainly fixes the testcase,
although I had to use -4 rather than -1 in order to defeat
DWARF2_CIE_DATA_ALIGNMENT.  That should still be OK, since the
stack is 8-byte aligned.

GDB doesn't seem to be able to backtrace through this, but that
has to come second to correctness.  I'll aim to get a tested fix
in this weekend.

Thanks,
Richard

Reply via email to