1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib/DebugInfo/DWARF
Greg Clayton 4dc036b075 Add the ability to extract the unwind rows from DWARF Call Frame Information.
This patch adds the ability to evaluate the state machine for CIE and FDE unwind objects and produce a UnwindTable with all UnwindRow objects needed to unwind registers. It will also dump the UnwindTable for each CIE and FDE when dumping DWARF .debug_frame or .eh_frame sections in llvm-dwarfdump or llvm-objdump. This allows users to see what the unwind rows actually look like for a given CIE or FDE instead of just seeing a list of opcodes.

This patch adds new classes: UnwindLocation, RegisterLocations, UnwindRow, and UnwindTable.

UnwindLocation is a class that describes how to unwind a register or Call Frame Address (CFA).

RegisterLocations is a class that tracks registers and their UnwindLocations. It gets populated when parsing the DWARF call frame instruction opcodes for a unwind row. The registers are mapped from their register numbers to the UnwindLocation in a map.

UnwindRow contains the result of evaluating a row of DWARF call frame instructions for the CIE, or a row from a FDE. The CIE can produce a set of initial instructions that each FDE that points to that CIE will use as the seed for the state machine when parsing FDE opcodes. A UnwindRow for a CIE will not have a valid address, whille a UnwindRow for a FDE will have a valid address.

The UnwindTable is a class that contains a sorted (by address) vector of UnwindRow objects and is the result of parsing all opcodes in a CIE, or FDE. Parsing a CIE should produce a UnwindTable with a single row. Parsing a FDE will produce a UnwindTable with one or more UnwindRow objects where all UnwindRow objects have valid addresses. The rows in the UnwindTable will be sorted from lowest Address to highest after parsing the state machine, or an error will be returned if the table isn't sorted. To parse a UnwindTable clients can use the following methods:

    static Expected<UnwindTable> UnwindTable::create(const CIE *Cie);
    static Expected<UnwindTable> UnwindTable::create(const FDE *Fde);

A valid table will be returned if the DWARF call frame instruction opcodes have no encoding errors. There are a few things that can go wrong during the evaluation of the state machine and these create functions will catch and return them.

Differential Revision: https://reviews.llvm.org/D89845
2021-01-28 13:39:17 -08:00
..
CMakeLists.txt llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
DWARFAbbreviationDeclaration.cpp
DWARFAcceleratorTable.cpp
DWARFAddressRange.cpp llvm-dwarfdump: Dump address forms in their encoded length rather than always in 64 bits 2020-10-04 15:48:57 -07:00
DWARFCompileUnit.cpp
DWARFContext.cpp [llvm] Use append_range (NFC) 2021-01-27 23:25:41 -08:00
DWARFDataExtractor.cpp [lib/Object] - Generalize the RelocationResolver API. 2020-11-20 10:32:49 +03:00
DWARFDebugAbbrev.cpp
DWARFDebugAddr.cpp
DWARFDebugAranges.cpp [DebugInfo] Remove some unused includes. NFCI. 2021-01-28 11:21:35 +00:00
DWARFDebugArangeSet.cpp llvm-dwarfdump: Dump address forms in their encoded length rather than always in 64 bits 2020-10-04 15:48:57 -07:00
DWARFDebugFrame.cpp Add the ability to extract the unwind rows from DWARF Call Frame Information. 2021-01-28 13:39:17 -08:00
DWARFDebugInfoEntry.cpp
DWARFDebugLine.cpp llvm-dwarfdump: Print addresses in debug_line to the parsed address size 2020-10-04 16:05:49 -07:00
DWARFDebugLoc.cpp [DWARF] DWARFDebugLoc::dumpRawEntry - remove dead stores. NFCI. 2021-01-07 12:53:28 +00:00
DWARFDebugMacro.cpp DebugInfo: Filter DWARFv5 TUs out of the debug_info unit list when CUs requested 2020-09-23 22:15:53 -07:00
DWARFDebugPubTable.cpp
DWARFDebugRangeList.cpp llvm-dwarfdump: Skip tombstoned address ranges 2020-10-04 13:43:29 -07:00
DWARFDebugRnglists.cpp llvm-dwarfdump: Add support for DW_RLE_startx_endx 2020-10-04 17:50:43 -07:00
DWARFDie.cpp [llvm] Use pop_back_val (NFC) 2021-01-24 12:18:57 -08:00
DWARFExpression.cpp Add the ability to extract the unwind rows from DWARF Call Frame Information. 2021-01-28 13:39:17 -08:00
DWARFFormValue.cpp DebugInfo: Add a DWARF FORM extension for addrx+offset references to reduce relocations 2021-01-28 10:20:02 -08:00
DWARFGdbIndex.cpp [CodeGen, DebugInfo] Use llvm::find_if (NFC) 2021-01-10 09:24:53 -08:00
DWARFListTable.cpp
DWARFLocationExpression.cpp
DWARFTypeUnit.cpp
DWARFUnit.cpp [llvm] Use hasSingleElement (NFC) 2021-01-20 21:35:55 -08:00
DWARFUnitIndex.cpp Fix crash after looking up dwo_id=0 in CU index. 2020-11-19 11:15:01 -08:00
DWARFVerifier.cpp [dwarfdump] Warn for tags with DW_CHILDREN_yes but no children. 2020-09-23 22:12:04 -07:00