Documentation ¶
Overview ¶
Package frame contains data structures and related functions for parsing and searching through Dwarf .debug_frame data.
Index ¶
Constants ¶
const ( DW_CFA_nop = 0x0 // No ops DW_CFA_set_loc = 0x01 // op1: address DW_CFA_advance_loc1 = iota // op1: 1-bytes delta DW_CFA_advance_loc2 // op1: 2-byte delta DW_CFA_advance_loc4 // op1: 4-byte delta DW_CFA_offset_extended // op1: ULEB128 register, op2: ULEB128 offset DW_CFA_restore_extended // op1: ULEB128 register DW_CFA_undefined // op1: ULEB128 register DW_CFA_same_value // op1: ULEB128 register DW_CFA_register // op1: ULEB128 register, op2: ULEB128 register DW_CFA_remember_state // No ops DW_CFA_restore_state // No ops DW_CFA_def_cfa // op1: ULEB128 register, op2: ULEB128 offset DW_CFA_def_cfa_register // op1: ULEB128 register DW_CFA_def_cfa_offset // op1: ULEB128 offset DW_CFA_def_cfa_expression // op1: BLOCK DW_CFA_expression // op1: ULEB128 register, op2: BLOCK DW_CFA_offset_extended_sf // op1: ULEB128 register, op2: SLEB128 BLOCK DW_CFA_def_cfa_sf // op1: ULEB128 register, op2: SLEB128 offset DW_CFA_def_cfa_offset_sf // op1: SLEB128 offset DW_CFA_val_offset // op1: ULEB128, op2: ULEB128 DW_CFA_val_offset_sf // op1: ULEB128, op2: SLEB128 DW_CFA_val_expression // op1: ULEB128, op2: BLOCK DW_CFA_lo_user = 0x1c // op1: BLOCK DW_CFA_hi_user = 0x3f // op1: ULEB128 register, op2: BLOCK DW_CFA_advance_loc = (0x1 << 6) // High 2 bits: 0x1, low 6: delta DW_CFA_offset = (0x2 << 6) // High 2 bits: 0x2, low 6: register DW_CFA_restore = (0x3 << 6) // High 2 bits: 0x3, low 6: register )
Instructions used to recreate the table from the .debug_frame data.
Variables ¶
This section is empty.
Functions ¶
func DwarfEndian ¶
DwarfEndian determines the endianness of the DWARF by using the version number field in the debug_info section Trick borrowed from "debug/dwarf".New()
Types ¶
type CommonInformationEntry ¶
type CommonInformationEntry struct { Length uint32 CIE_id uint32 Version uint8 Augmentation string CodeAlignmentFactor uint64 DataAlignmentFactor int64 ReturnAddressRegister uint64 InitialInstructions []byte // contains filtered or unexported fields }
CommonInformationEntry represents a Common Information Entry in the Dwarf .debug_frame section.
type ErrNoFDEForPC ¶ added in v1.2.0
type ErrNoFDEForPC struct {
PC uint64
}
ErrNoFDEForPC FDE for PC not found error
func (*ErrNoFDEForPC) Error ¶ added in v1.2.0
func (err *ErrNoFDEForPC) Error() string
type FrameContext ¶
type FrameContext struct { CFA DWRule Regs map[uint64]DWRule RetAddrReg uint64 // contains filtered or unexported fields }
FrameContext wrapper of FDE context
func (*FrameContext) ExecuteUntilPC ¶
func (frame *FrameContext) ExecuteUntilPC(instructions []byte)
ExecuteUntilPC execute dwarf instructions.
type FrameDescriptionEntries ¶
type FrameDescriptionEntries []*FrameDescriptionEntry
func Parse ¶
func Parse(data []byte, order binary.ByteOrder, staticBase uint64, ptrSize int, ehFrameAddr uint64) (FrameDescriptionEntries, error)
Parse takes in data (a byte slice) and returns FrameDescriptionEntries, which is a slice of FrameDescriptionEntry. Each FrameDescriptionEntry has a pointer to CommonInformationEntry. If ehFrameAddr is not zero the .eh_frame format will be used, a minor variant of DWARF described at https://www.airs.com/blog/archives/460. The value of ehFrameAddr will be used as the address at which eh_frame will be mapped into memory
func (FrameDescriptionEntries) Append ¶ added in v1.3.0
func (fdes FrameDescriptionEntries) Append(otherFDEs FrameDescriptionEntries) FrameDescriptionEntries
Append appends otherFDEs to fdes and returns the result.
func (FrameDescriptionEntries) FDEForPC ¶
func (fdes FrameDescriptionEntries) FDEForPC(pc uint64) (*FrameDescriptionEntry, error)
FDEForPC returns the Frame Description Entry for the given PC.
type FrameDescriptionEntry ¶
type FrameDescriptionEntry struct { Length uint32 CIE *CommonInformationEntry Instructions []byte // contains filtered or unexported fields }
FrameDescriptionEntry represents a Frame Descriptor Entry in the Dwarf .debug_frame section.
func (*FrameDescriptionEntry) Begin ¶
func (fde *FrameDescriptionEntry) Begin() uint64
Begin returns address of first location for this frame.
func (*FrameDescriptionEntry) Cover ¶
func (fde *FrameDescriptionEntry) Cover(addr uint64) bool
Cover returns whether or not the given address is within the bounds of this frame.
func (*FrameDescriptionEntry) End ¶
func (fde *FrameDescriptionEntry) End() uint64
End returns address of last location for this frame.
func (*FrameDescriptionEntry) EstablishFrame ¶
func (fde *FrameDescriptionEntry) EstablishFrame(pc uint64) *FrameContext
EstablishFrame set up frame for the given PC.
func (*FrameDescriptionEntry) Translate ¶ added in v1.6.1
func (fde *FrameDescriptionEntry) Translate(delta uint64)
Translate moves the beginning of fde forward by delta.
type Rule ¶ added in v1.0.0
type Rule byte
Rule rule defined for register values.
const ( RuleUndefined Rule = iota RuleSameVal RuleOffset RuleValOffset RuleRegister RuleExpression RuleValExpression RuleArchitectural RuleCFA // Value is rule.Reg + rule.Offset RuleFramePointer // Value is stored at address rule.Reg + rule.Offset, but only if it's less than the current CFA, otherwise same value )