Richard Henderson <r...@redhat.com> writes:
> On 02/16/2012 10:58 AM, Richard Sandiford wrote:
>>> 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.
>
> Hmm.  I wonder if GDB would be happier with a val_expression,
> rather than the "odd" .cfi_register:
>
>       // DW_CFA_val_expression r29, { DW_OP_reg29 }
>       .cfi_escape     0x16,29,1,0x6d

Seems to be the same:

#0  0x00400ae2 in foo() ()
#1  0x77d793fc in __mips16_call_stub_df_0 () at ...
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

(this is a gdb built from 7.4 branch FWIW).

Richard

Reply via email to