This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Stop condition for execute_cfa_program ?

Using trunk gcc sources to experiment with DWARF2 unwinding on PA-hpux, we
encountered an infinite loop while unwinding through optimized code in which
a stack frame allocation is scheduled in the delay slot of a function call.

This undesired behavior (infinite loop) seems related to the stop condition
in execute_cfa_program, more specifically the "fs->pc < context->ra" part.

Our real test case is in Ada, but the trivial C code below illustrates what
basically happens. An advice as to how this should be best addressed would be
greatly appreciated (should/could the condition be updated or is this more
likely a problem with the frame notes).

Thanks in advance for your help,



     void bar (void);

     foo (void)
       bar ();

     bar ()

yields (-O1 -fexceptions -dA) the assembly and FDE below for "foo" :
        ;# basic block 0
        stw %r2,-20(%r30)
        bl bar,%r2              <=== call to bar
        ldo 64(%r30),%r30       <=== stack frame allocation in delay slot
        ldw -84(%r30),%r2       
        bv %r0(%r2)
        ldo -64(%r30),%r30


        .word   L$EFDE0001-L$ASFDE0001  ;# FDE Length
        .word   L$ASFDE0001-__FRAME_BEGIN__     ;# FDE CIE offset
        .word   L$FB0001        ;# FDE initial location
        .word   L$FE0001-L$FB0001       ;# FDE address range
        .byte   0x4     ;# DW_CFA_advance_loc4
        .word   L$CFI0000-L$FB0001
        .byte   0x2f    ;# DW_CFA_GNU_negative_offset_extended
        .uleb128 0x2
        .uleb128 0x5

        .byte   0x4     ;# DW_CFA_advance_loc4
        .word   L$CFI0001-L$CFI0000
        .byte   0xe     ;# DW_CFA_def_cfa_offset
        .uleb128 0xffffffc0

 The CFA offset change is marked effective from the first ldw insn, at
 L$CFI0001, though it is actually already in effect from the call insn.

 When unwinding from bar, we would get to context->ra == fs->pc == L$CF0001,
 and miss the CFA offset update.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]