[lldb-dev] Inconsistencies in CIE pointer in FDEs in .debug_frame

Martin Storsjö via lldb-dev lldb-dev at lists.llvm.org
Sun Nov 24 14:16:48 PST 2019


I'm looking into something that seems like an inconsistency in handling of 
the CIE pointer in FDEs in .debug_frame, between how debug info is 
generated in LLVM and consumed in LLDB.

For FDEs in .eh_frame, the CIE pointer/cie_id field is interpreted as an 
offset from the current FDE - this seems to be consistent.

But for cases in .debug_frame, they are treated differently. In LLDB, the 
cie_id field is assumed to be relative to the begin of the .debug_frame 

However, when this field is produced in LLVM, it can, depending on 
MCAsmInfo flags, end up written as a plain absolute address to the CIE: 

That code in MCDwarf.cpp hasn't been touched in many years, so I would 
expect that the info it generates actually has been used since and been 
found to be correct. Or are most cases built with -funwind-tables 
or similar, enabled by default?, so this is exercised in untested cases?

In the case where I'm running in this, LLDB reports "error: Invalid cie 
offset" when running executables with such .debug_frame sections.

By adding an ", true" to the end of the EmitSymbolValue call in 
MCDwarf.cpp, the symbol reference is made section relative and the code 
seems to do what LLDB expects. Is that correct, or should LLDB learn the 
cases (which?) where the cie_id is an absolute address instead of a 
section relative one?

// Martin

More information about the lldb-dev mailing list