📄 libdwarf2.h
字号:
/* * Copyright (C) 1996-1998 by the Board of Trustees * of Leland Stanford Junior University. * * This file is part of the SimOS distribution. * See LICENSE file for terms of the license. * *//***************************************************************** * libdwarf.h * * * Author: $Author: bosch $ * Date: $Date: 1998/02/10 00:29:15 $ ****************************************************************/#ifndef _LIBDWARF_H#define _LIBDWARF_H#ifdef __cplusplusextern "C" {#endif/* libdwarf.h For libdwarf producers and consumers The interface is defined as having 8-byte signed and unsigned values so it can handle 64-or-32bit target on 64-or-32bit host. Addr is the native size: it represents pointers on the host machine (not the target!). This contains declarations for types and all producer and consumer functions. Function declarations are written on a single line each here so one can use grep to each declaration in its entirety. The declarations are a little harder to read this way, but...*/#if (_MIPS_SZLONG == 64)typedef int Dwarf_Bool; /* boolean type */typedef unsigned long Dwarf_Off; /* 4 or 8 byte file offset */typedef unsigned long Dwarf_Unsigned; /* 4 or 8 byte unsigned value */typedef unsigned short Dwarf_Half; /* 2 byte unsigned value */typedef unsigned char Dwarf_Small; /* 1 byte unsigned value */typedef signed long Dwarf_Signed; /* 4 or 8 byte signed value */typedef unsigned long Dwarf_Addr; /* target memory address */#else /* 32-bit */typedef int Dwarf_Bool; /* boolean type */typedef uint64 Dwarf_Off; /* 4 or 8 byte file offset */typedef uint64 Dwarf_Unsigned; /* 4 or 8 byte unsigned value*/typedef unsigned short Dwarf_Half; /* 2 byte unsigned value */typedef unsigned char Dwarf_Small; /* 1 byte unsigned value */typedef int64 Dwarf_Signed; /* 4 or 8 byte signed value */typedef uint64 Dwarf_Addr; /* target memory address */#endiftypedef void* Dwarf_Ptr; /* host machine pointer *//* uninterpreted block of data*/typedef struct { Dwarf_Unsigned bl_len; /* length of block */ Dwarf_Ptr bl_data; /* uninterpreted data */} Dwarf_Block;/* location record*/typedef struct { Dwarf_Small lr_atom; /* location operation */ Dwarf_Unsigned lr_number; /* operand */ Dwarf_Unsigned lr_number2; /* for OP_BREGx */ Dwarf_Unsigned lr_offset; /* offset in locexpr for OP_BRA etc */} Dwarf_Loc;/* location description*/typedef struct { Dwarf_Addr ld_lopc; /* beginning of active range */ Dwarf_Addr ld_hipc; /* end of active range */ Dwarf_Half ld_cents; /* count of location records */ Dwarf_Loc* ld_s; /* pointer to list of same */} Dwarf_Locdesc;/* Frame description instructions expanded.*/typedef struct { Dwarf_Small fp_base_op; Dwarf_Small fp_extended_op; Dwarf_Half fp_register; Dwarf_Unsigned fp_offset; Dwarf_Off fp_instr_offset;} Dwarf_Frame_Op;/* DW_REG_TABLE_SIZE must reflect the number of registers *(DW_FRAME_LAST_REG_NUM) as defined in dwarf.h */#define DW_REG_TABLE_SIZE 66typedef struct { struct { Dwarf_Small dw_offset_relevant; Dwarf_Half dw_regnum; Dwarf_Addr dw_offset; } rules[DW_REG_TABLE_SIZE];} Dwarf_Regtable;/* Opaque types for Consumer Library. */typedef struct Dwarf_Debug_s* Dwarf_Debug;typedef struct Dwarf_Die_s* Dwarf_Die;typedef struct Dwarf_Line_s* Dwarf_Line;typedef struct Dwarf_Global_s* Dwarf_Global;typedef struct Dwarf_Func_s* Dwarf_Func;typedef struct Dwarf_Type_s* Dwarf_Type;typedef struct Dwarf_Var_s* Dwarf_Var;typedef struct Dwarf_Weak_s* Dwarf_Weak;typedef struct Dwarf_Error_s* Dwarf_Error;typedef struct Dwarf_Attribute_s* Dwarf_Attribute;typedef struct Dwarf_Abbrev_s* Dwarf_Abbrev;typedef struct Dwarf_Fde_s* Dwarf_Fde;typedef struct Dwarf_Cie_s* Dwarf_Cie;typedef struct Dwarf_Arange_s* Dwarf_Arange;/* Opaque types for Producer Library. */typedef struct Dwarf_P_Debug_s* Dwarf_P_Debug;typedef struct Dwarf_P_Die_s* Dwarf_P_Die;typedef struct Dwarf_P_Attribute_s* Dwarf_P_Attribute;typedef struct Dwarf_P_Fde_s* Dwarf_P_Fde;typedef struct Dwarf_P_Expr_s* Dwarf_P_Expr;typedef Dwarf_Unsigned Dwarf_Tag;/* error handler function*/typedef void (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/); /* Dwarf_dealloc() alloc_type arguments. Argument points to:*/#define DW_DLA_STRING 0x01 /* char* */#define DW_DLA_LOC 0x02 /* Dwarf_Loc */#define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */#define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/#define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */#define DW_DLA_BLOCK 0x06 /* Dwarf_Block */#define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */#define DW_DLA_DIE 0x08 /* Dwarf_Die */#define DW_DLA_LINE 0x09 /* Dwarf_Line */#define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */#define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */#define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */#define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */#define DW_DLA_ERROR 0x0e /* Dwarf_Error */#define DW_DLA_LIST 0x0f /* a list */#define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */#define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */#define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */#define DW_DLA_FRAME_OP 0x13 /* Dwarf_Frame_Op */#define DW_DLA_CIE 0x14 /* Dwarf_Cie */#define DW_DLA_FDE 0x15 /* Dwarf_Fde */#define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc Block (not used) */#define DW_DLA_FRAME_BLOCK 0x17 /* Dwarf_Frame Block (not used) */#define DW_DLA_FUNC 0x18 /* Dwarf_Func */#define DW_DLA_TYPENAME 0x19 /* Dwarf_Type */#define DW_DLA_VAR 0x1a /* Dwarf_Var */#define DW_DLA_WEAK 0x1b /* Dwarf_Weak */#define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries *//* The augmenter string for CIE */#define DW_CIE_AUGMENTER_STRING_V0 "z"/* dwarf_init() access arguments*/#define DW_DLC_READ 0 /* read only access */#define DW_DLC_WRITE 1 /* write only access */#define DW_DLC_RDWR 2 /* read/write access NOT SUPPORTED*//* dwarf_init() access flag modifiers*/#define DW_DLC_SIZE_64 0x40000000 /* 32-bit target */#define DW_DLC_SIZE_32 0x20000000 /* 64-bit target *//* dwarf_pcline() slide arguments*/#define DW_DLS_BACKWARD -1 /* slide backward to find line */#define DW_DLS_NOSLIDE 0 /* match exactly without sliding */ #define DW_DLS_FORWARD 1 /* slide forward to find line *//* libdwarf error numbers*/#define DW_DLE_NE 0 /* no error */ #define DW_DLE_VMM 1 /* dwarf format/library version mismatch */#define DW_DLE_MAP 2 /* memory map failure */#define DW_DLE_LEE 3 /* libelf error */#define DW_DLE_NDS 4 /* no debug section */#define DW_DLE_NLS 5 /* no line section */#define DW_DLE_ID 6 /* invalid descriptor for query */#define DW_DLE_IOF 7 /* I/O failure */#define DW_DLE_MAF 8 /* memory allocation failure */#define DW_DLE_IA 9 /* invalid argument */ #define DW_DLE_MDE 10 /* mangled debugging entry */#define DW_DLE_MLE 11 /* mangled line number entry */#define DW_DLE_FNO 12 /* file not open */#define DW_DLE_FNR 13 /* file not a regular file */#define DW_DLE_FWA 14 /* file open with wrong access */#define DW_DLE_NOB 15 /* not an object file */#define DW_DLE_MOF 16 /* mangled object file header */#define DW_DLE_EOLL 17 /* end of location list entries */#define DW_DLE_NOLL 18 /* no location list section */#define DW_DLE_BADOFF 19 /* Invalid offset */#define DW_DLE_EOS 20 /* end of section */#define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/#define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad*/ /* It is not an allowed size (64 or 32) */ /* Error codes defined by the current Libdwarf Implementation. */#define DW_DLE_DBG_ALLOC 23#define DW_DLE_FSTAT_ERROR 24#define DW_DLE_FSTAT_MODE_ERROR 25#define DW_DLE_INIT_ACCESS_WRONG 26#define DW_DLE_ELF_BEGIN_ERROR 27#define DW_DLE_ELF_GETEHDR_ERROR 28#define DW_DLE_ELF_GETSHDR_ERROR 29#define DW_DLE_ELF_STRPTR_ERROR 30#define DW_DLE_DEBUG_INFO_DUPLICATE 31#define DW_DLE_DEBUG_INFO_NULL 32#define DW_DLE_DEBUG_ABBREV_DUPLICATE 33#define DW_DLE_DEBUG_ABBREV_NULL 34#define DW_DLE_DEBUG_ARANGES_DUPLICATE 35#define DW_DLE_DEBUG_ARANGES_NULL 36#define DW_DLE_DEBUG_LINE_DUPLICATE 37#define DW_DLE_DEBUG_LINE_NULL 38#define DW_DLE_DEBUG_LOC_DUPLICATE 39#define DW_DLE_DEBUG_LOC_NULL 40#define DW_DLE_DEBUG_MACINFO_DUPLICATE 41#define DW_DLE_DEBUG_MACINFO_NULL 42#define DW_DLE_DEBUG_PUBNAMES_DUPLICATE 43#define DW_DLE_DEBUG_PUBNAMES_NULL 44#define DW_DLE_DEBUG_STR_DUPLICATE 45#define DW_DLE_DEBUG_STR_NULL 46#define DW_DLE_CU_LENGTH_ERROR 47#define DW_DLE_VERSION_STAMP_ERROR 48#define DW_DLE_ABBREV_OFFSET_ERROR 49#define DW_DLE_ADDRESS_SIZE_ERROR 50#define DW_DLE_DEBUG_INFO_PTR_NULL 51#define DW_DLE_DIE_NULL 52#define DW_DLE_STRING_OFFSET_BAD 53#define DW_DLE_DEBUG_LINE_LENGTH_BAD 54#define DW_DLE_LINE_PROLOG_LENGTH_BAD 55#define DW_DLE_LINE_NUM_OPERANDS_BAD 56#define DW_DLE_LINE_SET_ADDR_ERROR 57#define DW_DLE_LINE_EXT_OPCODE_BAD 58#define DW_DLE_DWARF_LINE_NULL 59#define DW_DLE_INCL_DIR_NUM_BAD 60#define DW_DLE_LINE_FILE_NUM_BAD 61#define DW_DLE_ALLOC_FAIL 62#define DW_DLE_NO_CALLBACK_FUNC 63#define DW_DLE_SECT_ALLOC 64#define DW_DLE_FILE_ENTRY_ALLOC 65#define DW_DLE_LINE_ALLOC 66#define DW_DLE_FPGM_ALLOC 67#define DW_DLE_INCDIR_ALLOC 68#define DW_DLE_STRING_ALLOC 69#define DW_DLE_CHUNK_ALLOC 70#define DW_DLE_BYTEOFF_ERR 71#define DW_DLE_CIE_ALLOC 72#define DW_DLE_FDE_ALLOC 73#define DW_DLE_REGNO_OVFL 74#define DW_DLE_CIE_OFFS_ALLOC 75#define DW_DLE_WRONG_ADDRESS 76#define DW_DLE_EXTRA_NEIGHBORS 77#define DW_DLE_WRONG_TAG 78#define DW_DLE_DIE_ALLOC 79#define DW_DLE_PARENT_EXISTS 80#define DW_DLE_DBG_NULL 81#define DW_DLE_DEBUGLINE_ERROR 82#define DW_DLE_DEBUGFRAME_ERROR 83#define DW_DLE_DEBUGINFO_ERROR 84#define DW_DLE_ATTR_ALLOC 85#define DW_DLE_ABBREV_ALLOC 86#define DW_DLE_OFFSET_UFLW 87#define DW_DLE_ELF_SECT_ERR 88#define DW_DLE_DEBUG_FRAME_LENGTH_BAD 89#define DW_DLE_FRAME_VERSION_BAD 90#define DW_DLE_CIE_RET_ADDR_REG_ERROR 91#define DW_DLE_FDE_NULL 92#define DW_DLE_FDE_DBG_NULL 93#define DW_DLE_CIE_NULL 94#define DW_DLE_CIE_DBG_NULL 95#define DW_DLE_FRAME_TABLE_COL_BAD 96#define DW_DLE_PC_NOT_IN_FDE_RANGE 97#define DW_DLE_CIE_INSTR_EXEC_ERROR 98#define DW_DLE_FRAME_INSTR_EXEC_ERROR 99#define DW_DLE_FDE_PTR_NULL 100#define DW_DLE_RET_OP_LIST_NULL 101#define DW_DLE_LINE_CONTEXT_NULL 102#define DW_DLE_DBG_NO_CU_CONTEXT 103#define DW_DLE_DIE_NO_CU_CONTEXT 104#define DW_DLE_FIRST_DIE_NOT_CU 105#define DW_DLE_NEXT_DIE_PTR_NULL 106#define DW_DLE_DEBUG_FRAME_DUPLICATE 107#define DW_DLE_DEBUG_FRAME_NULL 108#define DW_DLE_ABBREV_DECODE_ERROR 109#define DW_DLE_DWARF_ABBREV_NULL 110#define DW_DLE_ATTR_NULL 111#define DW_DLE_DIE_BAD 112#define DW_DLE_DIE_ABBREV_BAD 113#define DW_DLE_ATTR_FORM_BAD 114#define DW_DLE_ATTR_NO_CU_CONTEXT 115#define DW_DLE_ATTR_FORM_SIZE_BAD 116#define DW_DLE_ATTR_DBG_NULL 117#define DW_DLE_BAD_REF_FORM 118#define DW_DLE_ATTR_FORM_OFFSET_BAD 119#define DW_DLE_LINE_OFFSET_BAD 120#define DW_DLE_DEBUG_STR_OFFSET_BAD 121#define DW_DLE_STRING_PTR_NULL 122#define DW_DLE_PUBNAMES_VERSION_ERROR 123#define DW_DLE_PUBNAMES_LENGTH_BAD 124#define DW_DLE_GLOBAL_NULL 125#define DW_DLE_GLOBAL_CONTEXT_NULL 126#define DW_DLE_DIR_INDEX_BAD 127#define DW_DLE_LOC_EXPR_BAD 128#define DW_DLE_DIE_LOC_EXPR_BAD 129#define DW_DLE_ADDR_ALLOC 130#define DW_DLE_OFFSET_BAD 131#define DW_DLE_MAKE_CU_CONTEXT_FAIL 132#define DW_DLE_REL_ALLOC 133#define DW_DLE_ARANGE_OFFSET_BAD 134#define DW_DLE_SEGMENT_SIZE_BAD 135#define DW_DLE_ARANGE_LENGTH_BAD 136#define DW_DLE_ARANGE_DECODE_ERROR 137#define DW_DLE_ARANGES_NULL 138#define DW_DLE_ARANGE_NULL 139#define DW_DLE_NO_FILE_NAME 140#define DW_DLE_NO_COMP_DIR 141#define DW_DLE_CU_ADDRESS_SIZE_BAD 142#define DW_DLE_INPUT_ATTR_BAD 143#define DW_DLE_EXPR_NULL 144#define DW_DLE_BAD_EXPR_OPCODE 145#define DW_DLE_EXPR_LENGTH_BAD 146#define DW_DLE_MULTIPLE_RELOC_IN_EXPR 147#define DW_DLE_ELF_GETIDENT_ERROR 148#define DW_DLE_NO_AT_MIPS_FDE 149#define DW_DLE_NO_CIE_FOR_FDE 150#define DW_DLE_DIE_ABBREV_LIST_NULL 151#define DW_DLE_DEBUG_FUNCNAMES_DUPLICATE 152#define DW_DLE_DEBUG_FUNCNAMES_NULL 153#define DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR 154#define DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD 155#define DW_DLE_FUNC_NULL 156#define DW_DLE_FUNC_CONTEXT_NULL 157#define DW_DLE_DEBUG_TYPENAMES_DUPLICATE 158#define DW_DLE_DEBUG_TYPENAMES_NULL 159#define DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR 160#define DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD 161#define DW_DLE_TYPE_NULL 162#define DW_DLE_TYPE_CONTEXT_NULL 163#define DW_DLE_DEBUG_VARNAMES_DUPLICATE 164#define DW_DLE_DEBUG_VARNAMES_NULL 165#define DW_DLE_DEBUG_VARNAMES_VERSION_ERROR 166#define DW_DLE_DEBUG_VARNAMES_LENGTH_BAD 167#define DW_DLE_VAR_NULL 168#define DW_DLE_VAR_CONTEXT_NULL 169#define DW_DLE_DEBUG_WEAKNAMES_DUPLICATE 170#define DW_DLE_DEBUG_WEAKNAMES_NULL 171#define DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR 172#define DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD 173#define DW_DLE_WEAK_NULL 174#define DW_DLE_WEAK_CONTEXT_NULL 175#define DW_DLE_LOCDESC_COUNT_WRONG 176#define DW_DLE_MACINFO_STRING_NULL 177#define DW_DLE_MACINFO_STRING_EMPTY 178#define DW_DLE_MACINFO_INTERNAL_ERROR_SPACE 179#define DW_DLE_MACINFO_MALLOC_FAIL 180#define DW_DLE_DEBUGMACINFO_ERROR 181#define DW_DLE_DEBUG_MACRO_LENGTH_BAD 182#define DW_DLE_DEBUG_MACRO_MAX_BAD 183#define DW_DLE_DEBUG_MACRO_INTERNAL_ERR 184#define DW_DLE_DEBUG_MACRO_MALLOC_SPACE 185#define DW_DLE_DEBUG_MACRO_INCONSISTENT 186#define DW_DLE_DF_NO_CIE_AUGMENTATION 187#define DW_DLE_DF_REG_NUM_TOO_HIGH 188 #define DW_DLE_DF_MAKE_INSTR_NO_INIT 189 #define DW_DLE_DF_NEW_LOC_LESS_OLD_LOC 190#define DW_DLE_DF_POP_EMPTY_STACK 191#define DW_DLE_DF_ALLOC_FAIL 192#define DW_DLE_DF_FRAME_DECODING_ERROR 193 /* DW_DLE_LAST MUST EQUAL LAST ERROR NUMBER */#define DW_DLE_LAST 193#define DW_DLE_LO_USER 0x10000 /* taken as meaning 'undefined value', this is not a column or register number. Only present at libdwarf runtime. Never on disk. DW_FRAME_* Values present on disk are in dwarf.h */#define DW_FRAME_UNDEFINED_VAL 1034 /* taken as meaning 'same value' as caller had, not a column or register number Only present at libdwarf runtime. Never on disk. DW_FRAME_* Values present on disk are in dwarf.h */#define DW_FRAME_SAME_VAL 1035/* error return values */#define DW_DLV_BADADDR (~(Dwarf_Addr)0) /* for functions returning target address */#define DW_DLV_NOCOUNT ((Dwarf_Signed)-1) /* for functions returning count */#define DW_DLV_BADOFFSET (~(Dwarf_Off)0) /* for functions returning offset *//* standard return values for functions */#define DW_DLV_NO_ENTRY -1#define DW_DLV_OK 0#define DW_DLV_ERROR 1/*===========================================================================*//* Dwarf consumer interface initialization and termination operations *//* non-elf initialization */int dwarf_init(int /*fd*/, Dwarf_Unsigned /*access*/, Dwarf_Handler /*errhand*/, Dwarf_Ptr /*errarg*/, Dwarf_Debug * /*dbg*/, Dwarf_Error* /*error*/);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -