DWARF-2 unwinder versus MIPS n32

David Daney ddaney@avtrex.com
Thu Jun 7 15:54:00 GMT 2007


Daniel Jacobowitz wrote:
> I'm trying to track down why unwinding through a signal frame crashes
> on MIPS n32.  David, I'm pretty sure you introduced the crash here:
> 
> 2006-11-20  David Daney  <ddaney@avtrex.com>
> 
>         * config/mips/linux-unwind.h (mips_fallback_frame_state): Adjust
>         PC to point to following instruction.
> 

I don't doubt that there are problems here.  I was going to clean up the 
compiler warnings that are now generated in that code, but it looks like 
more major work is needed.

> There's two problems with this patch.  One is that it's just broken
> for N64; you're loading the PC as a u_int32_t.  The other is that it
> triggers an assertion in the unwinder for n32.
> 
> _Unwind_SetGRValue does this:
> 
> 258       gcc_assert (dwarf_reg_size_table[index] == sizeof (_Unwind_Ptr));
> 259
> 260       context->by_value[index] = 1;
> 261       context->reg[index] = (void *) (_Unwind_Internal_Ptr) val;
> 
> context->reg[index] is a void *.  On N32, general registers are 64-bit
> but pointers are 32-bit.  So if we get here, the assertion is almost
> sure to trigger.  REG_SAVED_VAL_OFFSET brings us here.  Does anyone
> see a way to fix this that doesn't involve making context->reg big
> enough - and is _Unwind_Word always at least as large as _Unwind_Ptr
> (i.e. mode(word) always at least as large as mode(pointer))?
> 

The main problem I have is that when I wrote the original 
MD_FALLBACK_FRAME_STATE_FOR I only had a mipsel-linux machine for 
testing.  You added support for big-endian, but that it ever worked for 
n32 and n64 is pure luck.

I continue to have the limitation of only being able to test on 
mipsel-linux, so it is unlikely that I will be able to help here.

I have never tried running the qemu linux systems.  Do you know if it 
currently supports 64bit?  If so I will fix it, otherwise all I can do 
is wait for 64bit hardware to magically appear on my door step.

David Daney



More information about the Gcc mailing list