Bug 14416 - .eh_frame section not copied correctly by --only-keep-debug
Summary: .eh_frame section not copied correctly by --only-keep-debug
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-29 11:30 UTC by Rene Gollent
Modified: 2012-07-29 23:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rene Gollent 2012-07-29 11:30:34 UTC
When using objcopy --only-keep-debug to generate a separate symbolic debugging information file (as specified at http://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html ), .eh_frame doesn't appear to be copied correctly. The section is present and is the same size as that of the originating file, but doesn't contain valid CIE/FDEs, instead showing only:

Contents of the .eh_frame section:

00000000 ZERO terminator
00000004 ZERO terminator
00000008 ZERO terminator
[...etc.]

This problem doesn't seem to be exhibited for .debug_frame though. However, since some newer versions of gcc only output .eh_frame by default, this can be a bit troublesome for debugging.
Comment 1 Andreas Schwab 2012-07-29 11:56:31 UTC
.eh_frame is not a debug section.  It is a loaded section so it will never be stripped from the original object.
Comment 2 Rene Gollent 2012-07-29 12:01:31 UTC
(In reply to comment #1)
> .eh_frame is not a debug section.  It is a loaded section so it will never be
> stripped from the original object.

1) Then why does it appear in the resulting .debug file at all?

and

2) This still leaves the problem that on e.g. gcc 4.6.2, -g only outputs .eh_frame. I've looked through the bug database and this appears to be deliberate since the contents carry so much overlap with .debug_frame. Therefore, if .debug_frame isn't going to be output, then .eh_frame needs to be correctly copied, else there is no way for the debugger to unwind the call frame.
Comment 3 Andreas Schwab 2012-07-29 13:10:21 UTC
.eh_frame is handled like all other non-debug sections.
Comment 4 Alan Modra 2012-07-29 23:49:34 UTC
Not a bug