Issue
The .debug_frame
section seems to contain stack unwinding information and is defined by the dwarf standard.
The .eh_frame
section seems to basically contain the same information with some subtle differences and is defined by the linux foundation
Why are there two very similar standards for the same thing?
When is one section used over the other?
Solution
The
.eh_frame
section seems to basically contain the same information
The .eh_frame
is required for exceptions to work. It must contain sufficient info to unwind from all the places where exception may be raised, but doesn't have to include anything beyond that. For example, it does not need to contain info needed to unwind through function prologue or epilogue, since no exception can be raised there.
The .debug_frame
(and other .debug_*
sections) is only needed for debugging (and also for "self-aware" programs which unwind their own stack on e.g. crashes). It should contain sufficient info for debugger to unwind the stack from arbitrary place in the program, though in practice it may not (e.g. LLVM currently doesn't emit accurate info for function epilogues).
Answered By - Employed Russian Answer Checked By - David Goodson (WPSolving Volunteer)