LLVM  14.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::dwarf::UnwindLocation Class Reference

A class that represents a location for the Call Frame Address (CFA) or a register. More...

#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"

Public Types

enum  Location {
  Unspecified, Undefined, Same, CFAPlusOffset,
  RegPlusOffset, DWARFExpr, Constant
}
 

Public Member Functions

Location getLocation () const
 
uint32_t getRegister () const
 
int32_t getOffset () const
 
uint32_t getAddressSpace () const
 
int32_t getConstant () const
 
void setRegister (uint32_t NewRegNum)
 Some opcodes will modify the CFA location's register only, so we need to be able to modify the CFA register when evaluating DWARF Call Frame Information opcodes. More...
 
void setOffset (int32_t NewOffset)
 Some opcodes will modify the CFA location's offset only, so we need to be able to modify the CFA offset when evaluating DWARF Call Frame Information opcodes. More...
 
void setConstant (int32_t Value)
 Some opcodes modify a constant value and we need to be able to update the constant value (DW_CFA_GNU_window_save which is also known as. More...
 
Optional< DWARFExpressiongetDWARFExpressionBytes () const
 
void dump (raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH) const
 Dump a location expression as text and use the register information if some is provided. More...
 
bool operator== (const UnwindLocation &RHS) const
 

Static Public Member Functions

static UnwindLocation createUnspecified ()
 Create a location whose rule is set to Unspecified. More...
 
static UnwindLocation createUndefined ()
 Create a location where the value is undefined and not available. More...
 
static UnwindLocation createSame ()
 Create a location where the value is known to be in the register itself. More...
 
static UnwindLocation createIsCFAPlusOffset (int32_t Off)
 Create a location that is in (Deref == false) or at (Deref == true) the CFA plus an offset. More...
 
static UnwindLocation createAtCFAPlusOffset (int32_t Off)
 
static UnwindLocation createIsRegisterPlusOffset (uint32_t Reg, int32_t Off, Optional< uint32_t > AddrSpace=None)
 Create a location where the saved value is in (Deref == false) or at (Deref == true) a regiser plus an offset and, optionally, in the specified address space (used mostly for the CFA). More...
 
static UnwindLocation createAtRegisterPlusOffset (uint32_t Reg, int32_t Off, Optional< uint32_t > AddrSpace=None)
 
static UnwindLocation createIsDWARFExpression (DWARFExpression Expr)
 Create a location whose value is the result of evaluating a DWARF expression. More...
 
static UnwindLocation createAtDWARFExpression (DWARFExpression Expr)
 
static UnwindLocation createIsConstant (int32_t Value)
 

Detailed Description

A class that represents a location for the Call Frame Address (CFA) or a register.

This is decoded from the DWARF Call Frame Information instructions and put into an UnwindRow.

Definition at line 34 of file DWARFDebugFrame.h.

Member Enumeration Documentation

◆ Location

Enumerator
Unspecified 

Not specified.

Undefined 

Register is not available and can't be recovered.

Same 

Register value is in the register, nothing needs to be done to unwind it: reg = reg.

CFAPlusOffset 

Register is in or at the CFA plus an offset: reg = CFA + offset reg = defef(CFA + offset)

RegPlusOffset 

Register or CFA is in or at a register plus offset, optionally in an address space: reg = reg + offset [in addrspace] reg = deref(reg + offset [in addrspace])

DWARFExpr 

Register or CFA value is in or at a value found by evaluating a DWARF expression: reg = eval(dwarf_expr) reg = deref(eval(dwarf_expr))

Constant 

Value is a constant value contained in "Offset": reg = Offset.

Definition at line 36 of file DWARFDebugFrame.h.

Member Function Documentation

◆ createAtCFAPlusOffset()

UnwindLocation UnwindLocation::createAtCFAPlusOffset ( int32_t  Off)
static

Definition at line 58 of file DWARFDebugFrame.cpp.

References CFAPlusOffset, llvm::dwarf::InvalidRegisterNumber, and llvm::None.

◆ createAtDWARFExpression()

UnwindLocation UnwindLocation::createAtDWARFExpression ( DWARFExpression  Expr)
static

Definition at line 78 of file DWARFDebugFrame.cpp.

◆ createAtRegisterPlusOffset()

UnwindLocation UnwindLocation::createAtRegisterPlusOffset ( uint32_t  Reg,
int32_t  Off,
Optional< uint32_t AddrSpace = None 
)
static

Definition at line 69 of file DWARFDebugFrame.cpp.

References RegPlusOffset.

◆ createIsCFAPlusOffset()

UnwindLocation UnwindLocation::createIsCFAPlusOffset ( int32_t  Off)
static

Create a location that is in (Deref == false) or at (Deref == true) the CFA plus an offset.

Most registers that are spilled onto the stack use this rule. The rule for the register will use this rule and specify a unique offset from the CFA with Deref set to true. This value will be relative to a CFA value which is typically defined using the register plus offset location.

See also
createRegisterPlusOffset(...) for more information.

Definition at line 54 of file DWARFDebugFrame.cpp.

References CFAPlusOffset, llvm::dwarf::InvalidRegisterNumber, and llvm::None.

◆ createIsConstant()

UnwindLocation UnwindLocation::createIsConstant ( int32_t  Value)
static

Definition at line 50 of file DWARFDebugFrame.cpp.

References Constant, llvm::dwarf::InvalidRegisterNumber, and llvm::None.

◆ createIsDWARFExpression()

UnwindLocation UnwindLocation::createIsDWARFExpression ( DWARFExpression  Expr)
static

Create a location whose value is the result of evaluating a DWARF expression.

This allows complex expressions to be evaluated in order to unwind a register or CFA value.

Definition at line 74 of file DWARFDebugFrame.cpp.

◆ createIsRegisterPlusOffset()

UnwindLocation UnwindLocation::createIsRegisterPlusOffset ( uint32_t  Reg,
int32_t  Off,
Optional< uint32_t AddrSpace = None 
)
static

Create a location where the saved value is in (Deref == false) or at (Deref == true) a regiser plus an offset and, optionally, in the specified address space (used mostly for the CFA).

The CFA is usually defined using this rule by using the stack pointer or frame pointer as the register, with an offset that accounts for all spilled registers and all local variables in a function, and Deref == false.

Definition at line 63 of file DWARFDebugFrame.cpp.

References RegPlusOffset.

◆ createSame()

UnwindLocation UnwindLocation::createSame ( )
static

Create a location where the value is known to be in the register itself.

Definition at line 48 of file DWARFDebugFrame.cpp.

References Same.

◆ createUndefined()

UnwindLocation UnwindLocation::createUndefined ( )
static

Create a location where the value is undefined and not available.

This can happen when a register is volatile and can't be recovered.

Definition at line 46 of file DWARFDebugFrame.cpp.

References Undefined.

◆ createUnspecified()

UnwindLocation UnwindLocation::createUnspecified ( )
static

Create a location whose rule is set to Unspecified.

This means the register value might be in the same register but it wasn't specified in the unwind opcodes.

Definition at line 44 of file DWARFDebugFrame.cpp.

References Unspecified.

◆ dump()

void UnwindLocation::dump ( raw_ostream OS,
const MCRegisterInfo MRI,
bool  IsEH 
) const

Dump a location expression as text and use the register information if some is provided.

Parameters
OSthe stream to use for output.
MRIregister information that helps emit register names insteead of raw register numbers.
IsEHtrue if the DWARF Call Frame Information is from .eh_frame instead of from .debug_frame. This is needed for register number conversion because some register numbers differ between the two sections for certain architectures like x86.

Definition at line 82 of file DWARFDebugFrame.cpp.

References CFAPlusOffset, Constant, DWARFExpr, MRI, printRegister(), RegPlusOffset, Same, Undefined, and Unspecified.

Referenced by llvm::dwarf::UnwindRow::dump(), and llvm::dwarf::operator<<().

◆ getAddressSpace()

uint32_t llvm::dwarf::UnwindLocation::getAddressSpace ( ) const
inline

Definition at line 132 of file DWARFDebugFrame.h.

References assert(), llvm::Optional< T >::hasValue(), and RegPlusOffset.

◆ getConstant()

int32_t llvm::dwarf::UnwindLocation::getConstant ( ) const
inline

Definition at line 136 of file DWARFDebugFrame.h.

◆ getDWARFExpressionBytes()

Optional<DWARFExpression> llvm::dwarf::UnwindLocation::getDWARFExpressionBytes ( ) const
inline

Definition at line 150 of file DWARFDebugFrame.h.

◆ getLocation()

Location llvm::dwarf::UnwindLocation::getLocation ( ) const
inline

Definition at line 129 of file DWARFDebugFrame.h.

◆ getOffset()

int32_t llvm::dwarf::UnwindLocation::getOffset ( ) const
inline

Definition at line 131 of file DWARFDebugFrame.h.

◆ getRegister()

uint32_t llvm::dwarf::UnwindLocation::getRegister ( ) const
inline

Definition at line 130 of file DWARFDebugFrame.h.

◆ operator==()

bool UnwindLocation::operator== ( const UnwindLocation RHS) const

Definition at line 131 of file DWARFDebugFrame.cpp.

References CFAPlusOffset, Constant, DWARFExpr, RegPlusOffset, Same, Undefined, and Unspecified.

◆ setConstant()

void llvm::dwarf::UnwindLocation::setConstant ( int32_t  Value)
inline

Some opcodes modify a constant value and we need to be able to update the constant value (DW_CFA_GNU_window_save which is also known as.

Definition at line 148 of file DWARFDebugFrame.h.

◆ setOffset()

void llvm::dwarf::UnwindLocation::setOffset ( int32_t  NewOffset)
inline

Some opcodes will modify the CFA location's offset only, so we need to be able to modify the CFA offset when evaluating DWARF Call Frame Information opcodes.

Definition at line 144 of file DWARFDebugFrame.h.

◆ setRegister()

void llvm::dwarf::UnwindLocation::setRegister ( uint32_t  NewRegNum)
inline

Some opcodes will modify the CFA location's register only, so we need to be able to modify the CFA register when evaluating DWARF Call Frame Information opcodes.

Definition at line 140 of file DWARFDebugFrame.h.


The documentation for this class was generated from the following files: