unwind info for epilogues

Paul Pluzhnikov ppluzhnikov@google.com
Mon Jun 1 07:24:00 GMT 2009


> From: Richard Henderson <rth@redhat.com>
> To: gcc-patches@gcc.gnu.org
> Date: Fri, 29 May 2009 17:42:12 -0700
...
>        * cfgcleanup.c (try_crossjump_to_edge): Only skip past
>        NOTE_INSN_BASIC_BLOCK.
>        * cfglayout.c (duplicate_insn_chain): Copy epilogue insn marks.
>        Duplicate NOTE_INSN_EPILOGUE_BEG notes.
>        * cfgrtl.c (can_delete_note_p): Allow NOTE_INSN_EPILOGUE_BEG
>        to be deleted.

AFAICT, above patch broke debug info: I get 1100+ failures in GDB test
suite with current trunk (@148029) on Linux/x86_64.

The problem appears to be that DW_AT_frame_base is no longer correctly
emitted (which then causes GDB to assign wrong addresses to all
locals). Given this code:

int foo(int x)
{
   return x+42;
}

trunk produces:

0000000000000000 <foo>:
  0:   55                      push   %rbp
  1:   48 89 e5                mov    %rsp,%rbp
  4:   89 7d fc                mov    %edi,-0x4(%rbp)
  7:   8b 45 fc                mov    -0x4(%rbp),%eax
  a:   83 c0 2a                add    $0x2a,%eax
  d:   c9                      leaveq
  e:   c3                      retq

and the following 'readelf -w':

<1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
 <2e>     DW_AT_external    : 1
 <2f>     DW_AT_name        : foo
 <33>     DW_AT_decl_file   : 1
 <34>     DW_AT_decl_line   : 1
 <35>     DW_AT_prototyped  : 1
 <36>     DW_AT_type        : <5e>
 <3a>     DW_AT_low_pc      : 0
 <42>     DW_AT_high_pc     : 0xf
 <4a>     DW_AT_frame_base  : 2 byte block: 77 8       (DW_OP_breg7: 8)

When I build gcc@147994 (just before Richard's commit), I get:

<1><2d>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2e>   DW_AT_external    : 1
    <2f>   DW_AT_name        : foo
    <33>   DW_AT_decl_file   : 1
    <34>   DW_AT_decl_line   : 1
    <35>   DW_AT_prototyped  : 1
    <36>   DW_AT_type        : <0x5f>
    <3a>   DW_AT_low_pc      : 0x0
    <42>   DW_AT_high_pc     : 0xf
    <4a>   DW_AT_frame_base  : 0x0      (location list)
...
Contents of the .debug_loc section:

    Offset   Begin    End      Expression
    00000000 0000000000000000 000000000000000f (DW_OP_breg6: 16)
    00000000 <End of list>

This itself also appears to be a regression (I get 535 failures
@147994): with gcc-4.3.1 location list is:

Contents of the .debug_loc section:

    Offset   Begin    End      Expression
    00000000 0000000000000000 0000000000000001 (DW_OP_breg7: 8)
    00000000 0000000000000001 0000000000000004 (DW_OP_breg7: 16)
    00000000 0000000000000004 000000000000000f (DW_OP_breg6: 16)
    00000000 <End of list>

and I get ~80 failures in GDB test suite.

-- 
Paul Pluzhnikov



More information about the Gcc-patches mailing list