[Dwarf-Discuss] unwinding stack (CIE/FDE)

Jason Molenda jmolenda@apple.com
Wed Aug 4 00:37:08 GMT 2010


On Aug 3, 2010, at 5:31 PM, Frank Ch. Eigler wrote:

> Hi -
> 
> On Tue, Aug 03, 2010 at 04:55:23PM -0700, Jason Molenda wrote:
>> [...]
>> Looking at the debug_frame that my compiler (gcc-4.2 in this case) outputs,
>> [...]
>> There's nothing about that stack movement in the FDE.
> 
> Try again with CFLAGS+=-fasynchronous-unwind-tables.


I'm not making this stuff up. :)  And the next question you'll ask yourself is why -fasynchronous-unwind-tables isn't the default output style for the debug_frame section in the first place.  But as you can see, it doesn't make any difference - at least with gcc-4.2 with the Apple local patches.


[moleja2:/tmp] jmolenda% gcc-4.2 -fasynchronous-unwind-tables -arch i386 -g -save-temps a.c

[moleja2:/tmp] jmolenda% gdb -q a.out
(gdb) disass main
Dump of assembler code for function main:
0x00001f1e <main+0>:	push   %ebp
0x00001f1f <main+1>:	mov    %esp,%ebp
0x00001f21 <main+3>:	push   %ebx
0x00001f22 <main+4>:	sub    $0x14,%esp
0x00001f25 <main+7>:	call   0x1f2a <main+12>
0x00001f2a <main+12>:	pop    %ebx
0x00001f2b <main+13>:	lea    0x42(%ebx),%eax
0x00001f31 <main+19>:	mov    %eax,(%esp)
0x00001f34 <main+22>:	call   0x1f46 <dyld_stub_puts>
0x00001f39 <main+27>:	add    $0x14,%esp
0x00001f3c <main+30>:	pop    %ebx
0x00001f3d <main+31>:	leave  
0x00001f3e <main+32>:	ret    
End of assembler dump.
(gdb) 

[moleja2:/tmp] jmolenda% dwarfdump --debug-frame a.out.dSYM
----------------------------------------------------------------------
 File: a.out.dSYM/Contents/Resources/DWARF/a.out (i386)
----------------------------------------------------------------------
.debug_frame contents:
[...]

0x00000014: FDE
        length: 0x00000024
   CIE_pointer: 0x00000000
    start_addr: 0x00001f1e main
    range_size: 0x00000021 (end_addr = 0x00001f3f)
  Instructions: 0x00001f1e: CFA=esp+4     eip=[esp]
                DW_CFA_advance_loc4 (1)
                DW_CFA_def_cfa_offset (8)
                DW_CFA_offset (ebp, -8)
                0x00001f1f: CFA=esp+8     ebp=[esp]  eip=[esp+4]
                DW_CFA_advance_loc4 (2)
                DW_CFA_def_cfa_register (ebp)
                0x00001f21: CFA=ebp+8     ebp=[ebp]  eip=[ebp+4]
                DW_CFA_advance_loc4 (10)
                DW_CFA_offset (ebx, -12)
                DW_CFA_nop
                0x00001f2b: CFA=ebp+8     ebx=[ebp-4]  ebp=[ebp]  eip=[ebp+4]





More information about the Dwarf-discuss mailing list