asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T libdw.h000064400000131330151030061700006010 0ustar00/* Interfaces for libdw. Copyright (C) 2002-2010, 2013, 2014, 2016, 2018 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify it under the terms of either * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version or both in parallel, as here. elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LIBDW_H #define _LIBDW_H 1 #include #include #include #include /* Mode for the session. */ typedef enum { DWARF_C_READ, /* Read .. */ DWARF_C_RDWR, /* Read and write .. */ DWARF_C_WRITE, /* Write .. */ } Dwarf_Cmd; /* Callback results. */ enum { DWARF_CB_OK = 0, DWARF_CB_ABORT }; /* Error values. */ enum { DW_TAG_invalid = 0 #define DW_TAG_invalid DW_TAG_invalid }; /* Type for offset in DWARF file. */ typedef GElf_Off Dwarf_Off; /* Type for address in DWARF file. */ typedef GElf_Addr Dwarf_Addr; /* Integer types. Big enough to hold any numeric value. */ typedef GElf_Xword Dwarf_Word; typedef GElf_Sxword Dwarf_Sword; /* For the times we know we do not need that much. */ typedef GElf_Half Dwarf_Half; /* DWARF abbreviation record. */ typedef struct Dwarf_Abbrev Dwarf_Abbrev; /* Returned to show the last DIE has be returned. */ #define DWARF_END_ABBREV ((Dwarf_Abbrev *) -1l) /* Source code line information for CU. */ typedef struct Dwarf_Lines_s Dwarf_Lines; /* One source code line information. */ typedef struct Dwarf_Line_s Dwarf_Line; /* Source file information. */ typedef struct Dwarf_Files_s Dwarf_Files; /* One address range record. */ typedef struct Dwarf_Arange_s Dwarf_Arange; /* Address ranges of a file. */ typedef struct Dwarf_Aranges_s Dwarf_Aranges; /* CU representation. */ struct Dwarf_CU; typedef struct Dwarf_CU Dwarf_CU; /* Macro information. */ typedef struct Dwarf_Macro_s Dwarf_Macro; /* Attribute representation. */ typedef struct { unsigned int code; unsigned int form; unsigned char *valp; struct Dwarf_CU *cu; } Dwarf_Attribute; /* Data block representation. */ typedef struct { Dwarf_Word length; unsigned char *data; } Dwarf_Block; /* DIE information. */ typedef struct { /* The offset can be computed from the address. */ void *addr; struct Dwarf_CU *cu; Dwarf_Abbrev *abbrev; // XXX We'll see what other information will be needed. long int padding__; } Dwarf_Die; /* Returned to show the last DIE has be returned. */ #define DWARF_END_DIE ((Dwarf_Die *) -1l) /* Global symbol information. */ typedef struct { Dwarf_Off cu_offset; Dwarf_Off die_offset; const char *name; } Dwarf_Global; /* One operation in a DWARF location expression. A location expression is an array of these. */ typedef struct { uint8_t atom; /* Operation */ Dwarf_Word number; /* Operand */ Dwarf_Word number2; /* Possible second operand */ Dwarf_Word offset; /* Offset in location expression */ } Dwarf_Op; /* This describes one Common Information Entry read from a CFI section. Pointers here point into the DATA->d_buf block passed to dwarf_next_cfi. */ typedef struct { Dwarf_Off CIE_id; /* Always DW_CIE_ID_64 in Dwarf_CIE structures. */ /* Instruction stream describing initial state used by FDEs. If we did not understand the whole augmentation string and it did not use 'z', then there might be more augmentation data here (and in FDEs) before the actual instructions. */ const uint8_t *initial_instructions; const uint8_t *initial_instructions_end; Dwarf_Word code_alignment_factor; Dwarf_Sword data_alignment_factor; Dwarf_Word return_address_register; const char *augmentation; /* Augmentation string. */ /* Augmentation data, might be NULL. The size is correct only if we understood the augmentation string sufficiently. */ const uint8_t *augmentation_data; size_t augmentation_data_size; size_t fde_augmentation_data_size; } Dwarf_CIE; /* This describes one Frame Description Entry read from a CFI section. Pointers here point into the DATA->d_buf block passed to dwarf_next_cfi. */ typedef struct { /* Section offset of CIE this FDE refers to. This will never be DW_CIE_ID_64 in an FDE. If this value is DW_CIE_ID_64, this is actually a Dwarf_CIE structure. */ Dwarf_Off CIE_pointer; /* We can't really decode anything further without looking up the CIE and checking its augmentation string. Here follows the encoded initial_location and address_range, then any augmentation data, then the instruction stream. This FDE describes PC locations in the byte range [initial_location, initial_location+address_range). When the CIE augmentation string uses 'z', the augmentation data is a DW_FORM_block (self-sized). Otherwise, when we understand the augmentation string completely, fde_augmentation_data_size gives the number of bytes of augmentation data before the instructions. */ const uint8_t *start; const uint8_t *end; } Dwarf_FDE; /* Each entry in a CFI section is either a CIE described by Dwarf_CIE or an FDE described by Dward_FDE. Check CIE_id to see which you have. */ typedef union { Dwarf_Off CIE_id; /* Always DW_CIE_ID_64 in Dwarf_CIE structures. */ Dwarf_CIE cie; Dwarf_FDE fde; } Dwarf_CFI_Entry; /* Same as DW_CIE_ID_64 from dwarf.h to keep libdw.h independent. */ #define LIBDW_CIE_ID 0xffffffffffffffffULL #define dwarf_cfi_cie_p(entry) ((entry)->cie.CIE_id == LIBDW_CIE_ID) /* Opaque type representing a frame state described by CFI. */ typedef struct Dwarf_Frame_s Dwarf_Frame; /* Opaque type representing a CFI section found in a DWARF or ELF file. */ typedef struct Dwarf_CFI_s Dwarf_CFI; /* Handle for debug sessions. */ typedef struct Dwarf Dwarf; /* Out-Of-Memory handler. */ typedef void (*__noreturn_attribute__ Dwarf_OOM) (void); #ifdef __cplusplus extern "C" { #endif /* Create a handle for a new debug session. */ extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd); /* Create a handle for a new debug session for an ELF file. */ extern Dwarf *dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp); /* Retrieve ELF descriptor used for DWARF access. */ extern Elf *dwarf_getelf (Dwarf *dwarf); /* Retrieve DWARF descriptor used for a Dwarf_Die or Dwarf_Attribute. A Dwarf_Die or a Dwarf_Attribute is associated with a particular Dwarf_CU handle. This function returns the DWARF descriptor for that Dwarf_CU. */ extern Dwarf *dwarf_cu_getdwarf (Dwarf_CU *cu); /* Retrieves the DWARF descriptor for debugaltlink data. Returns NULL if no alternate debug data has been supplied yet. libdw will try to set the alt file on first use of an alt FORM if not yet explicitly provided by dwarf_setalt. */ extern Dwarf *dwarf_getalt (Dwarf *main); /* Provides the data referenced by the .gnu_debugaltlink section. The caller should check that MAIN and ALT match (i.e., they have the same build ID). It is the responsibility of the caller to ensure that the data referenced by ALT stays valid while it is used by MAIN, until dwarf_setalt is called on MAIN with a different descriptor, or dwarf_end. Must be called before inspecting DIEs that might have alt FORMs. Otherwise libdw will try to set the alt file itself on first use. */ extern void dwarf_setalt (Dwarf *main, Dwarf *alt); /* Release debugging handling context. */ extern int dwarf_end (Dwarf *dwarf); /* Read the header for the DWARF CU. */ extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off, size_t *header_sizep, Dwarf_Off *abbrev_offsetp, uint8_t *address_sizep, uint8_t *offset_sizep) __nonnull_attribute__ (3); /* Read the header of a DWARF CU or type unit. If TYPE_SIGNATUREP is not null, this reads a type unit from the .debug_types section; otherwise this reads a CU from the .debug_info section. */ extern int dwarf_next_unit (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off, size_t *header_sizep, Dwarf_Half *versionp, Dwarf_Off *abbrev_offsetp, uint8_t *address_sizep, uint8_t *offset_sizep, uint64_t *type_signaturep, Dwarf_Off *type_offsetp) __nonnull_attribute__ (3); /* Gets the next Dwarf_CU (unit), version, unit type and if available the CU DIE and sub (type) DIE of the unit. Returns 0 on success, -1 on error or 1 if there are no more units. To start iterating provide NULL for CU. If version < 5 the unit type is set from the CU DIE if available (DW_UT_compile for DW_TAG_compile_unit, DW_UT_type for DW_TAG_type_unit or DW_UT_partial for DW_TAG_partial_unit), otherwise it is set to zero. If unavailable (the version or unit type is unknown) the CU DIE is cleared. Likewise if the sub DIE isn't isn't available (the unit type is not DW_UT_type or DW_UT_split_type) the sub DIE tag is cleared. */ extern int dwarf_get_units (Dwarf *dwarf, Dwarf_CU *cu, Dwarf_CU **next_cu, Dwarf_Half *version, uint8_t *unit_type, Dwarf_Die *cudie, Dwarf_Die *subdie) __nonnull_attribute__ (3); /* Provides information and DIEs associated with the given Dwarf_CU unit. Returns -1 on error, zero on success. Arguments not needed may be NULL. If they are NULL and aren't known yet, they won't be looked up. If the subdie doesn't exist for this unit_type it will be cleared. If there is no unit_id for this unit type it will be set to zero. */ extern int dwarf_cu_info (Dwarf_CU *cu, Dwarf_Half *version, uint8_t *unit_type, Dwarf_Die *cudie, Dwarf_Die *subdie, uint64_t *unit_id, uint8_t *address_size, uint8_t *offset_size); /* Decode one DWARF CFI entry (CIE or FDE) from the raw section data. The E_IDENT from the originating ELF file indicates the address size and byte order used in the CFI section contained in DATA; EH_FRAME_P should be true for .eh_frame format and false for .debug_frame format. OFFSET is the byte position in the section to start at; on return *NEXT_OFFSET is filled in with the byte position immediately after this entry. On success, returns 0 and fills in *ENTRY; use dwarf_cfi_cie_p to see whether ENTRY->cie or ENTRY->fde is valid. On errors, returns -1. Some format errors will permit safely skipping to the next CFI entry though the current one is unusable. In that case, *NEXT_OFF will be updated before a -1 return. If there are no more CFI entries left in the section, returns 1 and sets *NEXT_OFFSET to (Dwarf_Off) -1. */ extern int dwarf_next_cfi (const unsigned char e_ident[], Elf_Data *data, bool eh_frame_p, Dwarf_Off offset, Dwarf_Off *next_offset, Dwarf_CFI_Entry *entry) __nonnull_attribute__ (1, 2, 5, 6); /* Use the CFI in the DWARF .debug_frame section. Returns NULL if there is no such section (not an error). The pointer returned can be used until dwarf_end is called on DWARF, and must not be passed to dwarf_cfi_end. Calling this more than once returns the same pointer. */ extern Dwarf_CFI *dwarf_getcfi (Dwarf *dwarf); /* Use the CFI in the ELF file's exception-handling data. Returns NULL if there is no such data. The pointer returned can be used until elf_end is called on ELF, and must be passed to dwarf_cfi_end before then. Calling this more than once allocates independent data structures. */ extern Dwarf_CFI *dwarf_getcfi_elf (Elf *elf); /* Release resources allocated by dwarf_getcfi_elf. */ extern int dwarf_cfi_end (Dwarf_CFI *cache); /* Return DIE at given offset in .debug_info section. */ extern Dwarf_Die *dwarf_offdie (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result) __nonnull_attribute__ (3); /* Return DIE at given offset in .debug_types section. */ extern Dwarf_Die *dwarf_offdie_types (Dwarf *dbg, Dwarf_Off offset, Dwarf_Die *result) __nonnull_attribute__ (3); /* Return offset of DIE. */ extern Dwarf_Off dwarf_dieoffset (Dwarf_Die *die); /* Return offset of DIE in CU. */ extern Dwarf_Off dwarf_cuoffset (Dwarf_Die *die); /* Return CU DIE containing given DIE. */ extern Dwarf_Die *dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result, uint8_t *address_sizep, uint8_t *offset_sizep) __nonnull_attribute__ (2); /* Given a Dwarf_Die addr returns a (reconstructed) Dwarf_Die, or NULL if the given addr didn't come from a valid Dwarf_Die. In particular it will make sure that the correct Dwarf_CU pointer is set for the Dwarf_Die, the Dwarf_Abbrev pointer will not be set up yet (it will only be once the Dwarf_Die is used to read attributes, children or siblings). This functions can be used to keep a reference to a Dwarf_Die which you want to refer to later. The addr, and the result of this function, is only valid while the associated Dwarf is valid. */ extern Dwarf_Die *dwarf_die_addr_die (Dwarf *dbg, void *addr, Dwarf_Die *result) __nonnull_attribute__ (3); /* Return the CU DIE and the header info associated with a Dwarf_Die or Dwarf_Attribute. A Dwarf_Die or a Dwarf_Attribute is associated with a particular Dwarf_CU handle. This function returns the CU or type unit DIE and header information for that Dwarf_CU. The returned DIE is either a compile_unit, partial_unit or type_unit. If it is a type_unit, then the type signature and type offset are also provided, otherwise type_offset will be set to zero. See also dwarf_diecu and dwarf_next_unit. */ extern Dwarf_Die *dwarf_cu_die (Dwarf_CU *cu, Dwarf_Die *result, Dwarf_Half *versionp, Dwarf_Off *abbrev_offsetp, uint8_t *address_sizep, uint8_t *offset_sizep, uint64_t *type_signaturep, Dwarf_Off *type_offsetp) __nonnull_attribute__ (2); /* Return CU DIE containing given address. */ extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr, Dwarf_Die *result) __nonnull_attribute__ (3); /* Return child of current DIE. */ extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result) __nonnull_attribute__ (2); /* Locates the first sibling of DIE and places it in RESULT. Returns 0 if a sibling was found, -1 if something went wrong. Returns 1 if no sibling could be found and, if RESULT is not the same as DIE, it sets RESULT->addr to the address of the (non-sibling) DIE that follows this one, or NULL if this DIE was the last one in the compilation unit. */ extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result) __nonnull_attribute__ (2); /* For type aliases and qualifier type DIEs, which don't modify or change the structural layout of the underlying type, follow the DW_AT_type attribute (recursively) and return the underlying type Dwarf_Die. Returns 0 when RESULT contains a Dwarf_Die (possibly equal to the given DIE) that isn't a type alias or qualifier type. Returns 1 when RESULT contains a type alias or qualifier Dwarf_Die that couldn't be peeled further (it doesn't have a DW_TAG_type attribute). Returns -1 when an error occurred. The current DWARF specification defines one type alias tag (DW_TAG_typedef) and seven modifier/qualifier type tags (DW_TAG_const_type, DW_TAG_volatile_type, DW_TAG_restrict_type, DW_TAG_atomic_type, DW_TAG_immutable_type, DW_TAG_packed_type and DW_TAG_shared_type). This function won't peel modifier type tags that change the way the underlying type is accessed such as the pointer or reference type tags (DW_TAG_pointer_type, DW_TAG_reference_type or DW_TAG_rvalue_reference_type). A future version of this function might peel other alias or qualifier type tags if a future DWARF version or GNU extension defines other type aliases or qualifier type tags that don't modify, change the structural layout or the way to access the underlying type. */ extern int dwarf_peel_type (Dwarf_Die *die, Dwarf_Die *result) __nonnull_attribute__ (2); /* Check whether the DIE has children. */ extern int dwarf_haschildren (Dwarf_Die *die) __nonnull_attribute__ (1); /* Walks the attributes of DIE, starting at the one OFFSET bytes in, calling the CALLBACK function for each one. Stops if the callback function ever returns a value other than DWARF_CB_OK and returns the offset of the offending attribute. If the end of the attributes is reached 1 is returned. If something goes wrong -1 is returned and the dwarf error number is set. */ extern ptrdiff_t dwarf_getattrs (Dwarf_Die *die, int (*callback) (Dwarf_Attribute *, void *), void *arg, ptrdiff_t offset) __nonnull_attribute__ (2); /* Return tag of given DIE. */ extern int dwarf_tag (Dwarf_Die *die) __nonnull_attribute__ (1); /* Return specific attribute of DIE. */ extern Dwarf_Attribute *dwarf_attr (Dwarf_Die *die, unsigned int search_name, Dwarf_Attribute *result) __nonnull_attribute__ (3); /* Check whether given DIE has specific attribute. */ extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name); /* These are the same as dwarf_attr and dwarf_hasattr, respectively, but they resolve an indirect attribute through DW_AT_abstract_origin, DW_AT_specification or, if the DIE is a top-level split CU, the skeleton DIE. Note that the attribute might come from a DIE in a different CU (possibly from a different Dwarf file). In that case all attribute information needs to be resolved through the CU associated with the returned Dwarf_Attribute. The dwarf_form functions already do this automatically. */ extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die, unsigned int search_name, Dwarf_Attribute *result) __nonnull_attribute__ (3); extern int dwarf_hasattr_integrate (Dwarf_Die *die, unsigned int search_name); /* Check whether given attribute has specific form. */ extern int dwarf_hasform (Dwarf_Attribute *attr, unsigned int search_form); /* Return attribute code of given attribute. */ extern unsigned int dwarf_whatattr (Dwarf_Attribute *attr); /* Return form code of given attribute. */ extern unsigned int dwarf_whatform (Dwarf_Attribute *attr); /* Return string associated with given attribute. */ extern const char *dwarf_formstring (Dwarf_Attribute *attrp); /* Return unsigned constant represented by attribute. */ extern int dwarf_formudata (Dwarf_Attribute *attr, Dwarf_Word *return_uval) __nonnull_attribute__ (2); /* Return signed constant represented by attribute. */ extern int dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_uval) __nonnull_attribute__ (2); /* Return address represented by attribute. */ extern int dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr) __nonnull_attribute__ (2); /* This function is deprecated. Always use dwarf_formref_die instead. Return reference offset represented by attribute. */ extern int dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset) __nonnull_attribute__ (2) __deprecated_attribute__; /* Look up the DIE in a reference-form attribute. */ extern Dwarf_Die *dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem) __nonnull_attribute__ (2); /* Return block represented by attribute. */ extern int dwarf_formblock (Dwarf_Attribute *attr, Dwarf_Block *return_block) __nonnull_attribute__ (2); /* Return flag represented by attribute. */ extern int dwarf_formflag (Dwarf_Attribute *attr, bool *return_bool) __nonnull_attribute__ (2); /* Simplified attribute value access functions. */ /* Return string in name attribute of DIE. */ extern const char *dwarf_diename (Dwarf_Die *die); /* Return high PC attribute of DIE. */ extern int dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr) __nonnull_attribute__ (2); /* Return low PC attribute of DIE. */ extern int dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr) __nonnull_attribute__ (2); /* Return entry_pc or low_pc attribute of DIE. */ extern int dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr) __nonnull_attribute__ (2); /* Return 1 if DIE's lowpc/highpc or ranges attributes match the PC address, 0 if not, or -1 for errors. */ extern int dwarf_haspc (Dwarf_Die *die, Dwarf_Addr pc); /* Enumerate the PC address ranges covered by this DIE, covering all addresses where dwarf_haspc returns true. In the first call OFFSET should be zero and *BASEP need not be initialized. Returns -1 for errors, zero when there are no more address ranges to report, or a nonzero OFFSET value to pass to the next call. Each subsequent call must preserve *BASEP from the prior call. Successful calls fill in *STARTP and *ENDP with a contiguous address range. */ extern ptrdiff_t dwarf_ranges (Dwarf_Die *die, ptrdiff_t offset, Dwarf_Addr *basep, Dwarf_Addr *startp, Dwarf_Addr *endp); /* Return byte size attribute of DIE. */ extern int dwarf_bytesize (Dwarf_Die *die); /* Return bit size attribute of DIE. */ extern int dwarf_bitsize (Dwarf_Die *die); /* Return bit offset attribute of DIE. */ extern int dwarf_bitoffset (Dwarf_Die *die); /* Return array order attribute of DIE. */ extern int dwarf_arrayorder (Dwarf_Die *die); /* Return source language attribute of DIE. */ extern int dwarf_srclang (Dwarf_Die *die); /* Get abbreviation at given offset for given DIE. */ extern Dwarf_Abbrev *dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset, size_t *lengthp); /* Get abbreviation at given offset in .debug_abbrev section. */ extern int dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp, Dwarf_Abbrev *abbrevp) __nonnull_attribute__ (4); /* Get abbreviation code. */ extern unsigned int dwarf_getabbrevcode (Dwarf_Abbrev *abbrev); /* Get abbreviation tag. */ extern unsigned int dwarf_getabbrevtag (Dwarf_Abbrev *abbrev); /* Return true if abbreviation is children flag set. */ extern int dwarf_abbrevhaschildren (Dwarf_Abbrev *abbrev); /* Get number of attributes of abbreviation. */ extern int dwarf_getattrcnt (Dwarf_Abbrev *abbrev, size_t *attrcntp) __nonnull_attribute__ (2); /* Get specific attribute of abbreviation. */ extern int dwarf_getabbrevattr (Dwarf_Abbrev *abbrev, size_t idx, unsigned int *namep, unsigned int *formp, Dwarf_Off *offset); /* Get specific attribute of abbreviation and any data encoded with it. Specifically for DW_FORM_implicit_const data will be set to the constant value associated. */ extern int dwarf_getabbrevattr_data (Dwarf_Abbrev *abbrev, size_t idx, unsigned int *namep, unsigned int *formp, Dwarf_Sword *datap, Dwarf_Off *offset); /* Get string from-debug_str section. */ extern const char *dwarf_getstring (Dwarf *dbg, Dwarf_Off offset, size_t *lenp); /* Get public symbol information. */ extern ptrdiff_t dwarf_getpubnames (Dwarf *dbg, int (*callback) (Dwarf *, Dwarf_Global *, void *), void *arg, ptrdiff_t offset) __nonnull_attribute__ (2); /* Get source file information for CU. */ extern int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines) __nonnull_attribute__ (2, 3); /* Return one of the source lines of the CU. */ extern Dwarf_Line *dwarf_onesrcline (Dwarf_Lines *lines, size_t idx); /* Get the file source files used in the CU. */ extern int dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files, size_t *nfiles) __nonnull_attribute__ (2); /* Get source for address in CU. */ extern Dwarf_Line *dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr); /* Get source for file and line number. */ extern int dwarf_getsrc_file (Dwarf *dbg, const char *fname, int line, int col, Dwarf_Line ***srcsp, size_t *nsrcs) __nonnull_attribute__ (2, 5, 6); /* Return line address. */ extern int dwarf_lineaddr (Dwarf_Line *line, Dwarf_Addr *addrp); /* Return line VLIW operation index. */ extern int dwarf_lineop_index (Dwarf_Line *line, unsigned int *op_indexp); /* Return line number. */ extern int dwarf_lineno (Dwarf_Line *line, int *linep) __nonnull_attribute__ (2); /* Return column in line. */ extern int dwarf_linecol (Dwarf_Line *line, int *colp) __nonnull_attribute__ (2); /* Return true if record is for beginning of a statement. */ extern int dwarf_linebeginstatement (Dwarf_Line *line, bool *flagp) __nonnull_attribute__ (2); /* Return true if record is for end of sequence. */ extern int dwarf_lineendsequence (Dwarf_Line *line, bool *flagp) __nonnull_attribute__ (2); /* Return true if record is for beginning of a basic block. */ extern int dwarf_lineblock (Dwarf_Line *line, bool *flagp) __nonnull_attribute__ (2); /* Return true if record is for end of prologue. */ extern int dwarf_lineprologueend (Dwarf_Line *line, bool *flagp) __nonnull_attribute__ (2); /* Return true if record is for beginning of epilogue. */ extern int dwarf_lineepiloguebegin (Dwarf_Line *line, bool *flagp) __nonnull_attribute__ (2); /* Return instruction-set architecture in this record. */ extern int dwarf_lineisa (Dwarf_Line *line, unsigned int *isap) __nonnull_attribute__ (2); /* Return code path discriminator in this record. */ extern int dwarf_linediscriminator (Dwarf_Line *line, unsigned int *discp) __nonnull_attribute__ (2); /* Find line information for address. The returned string is NULL when an error occurred, or the file path. The file path is either absolute or relative to the compilation directory. See dwarf_decl_file. */ extern const char *dwarf_linesrc (Dwarf_Line *line, Dwarf_Word *mtime, Dwarf_Word *length); /* Return the caller of this line if inlined. If not inlined, return NULL. */ extern Dwarf_Line *dwarf_linecontext (Dwarf_Lines *lines, Dwarf_Line *line); /* Return the function name in this line record. If this line is inlined, this is the name of the function that was inlined. If this line is not inlined, return NULL. */ extern const char *dwarf_linefunctionname (Dwarf *dbg, Dwarf_Line *line); /* Return file information. The returned string is NULL when an error occurred, or the file path. The file path is either absolute or relative to the compilation directory. See dwarf_decl_file. */ extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx, Dwarf_Word *mtime, Dwarf_Word *length); /* Return the Dwarf_Files and index associated with the given Dwarf_Line. */ extern int dwarf_line_file (Dwarf_Line *line, Dwarf_Files **files, size_t *idx) __nonnull_attribute__ (2, 3); /* Return the directory list used in the file information extracted. (*RESULT)[0] is the CU's DW_AT_comp_dir value, and may be null. (*RESULT)[0..*NDIRS-1] are the compile-time include directory path encoded by the compiler. */ extern int dwarf_getsrcdirs (Dwarf_Files *files, const char *const **result, size_t *ndirs) __nonnull_attribute__ (2, 3); /* Iterates through the debug line units. Returns 0 on success, -1 on error or 1 if there are no more units. To start iterating use zero for OFF and set *CU to NULL. On success NEXT_OFF will be set to the next offset to use. The *CU will be set if this line table needed a specific CU and needs to be given when calling dwarf_next_lines again (to help dwarf_next_lines quickly find the next CU). *CU might be set to NULL when it couldn't be found (the compilation directory entry will be the empty string in that case) or for DWARF 5 or later tables, which are self contained. SRCFILES and SRCLINES may be NULL if the caller is not interested in the actual line or file table. On success and when not NULL, NFILES and NLINES will be set to the number of files in the file table and number of lines in the line table. */ extern int dwarf_next_lines (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off, Dwarf_CU **cu, Dwarf_Files **srcfiles, size_t *nfiles, Dwarf_Lines **srclines, size_t *nlines) __nonnull_attribute__ (3,4); /* Return location expression, decoded as a list of operations. */ extern int dwarf_getlocation (Dwarf_Attribute *attr, Dwarf_Op **expr, size_t *exprlen) __nonnull_attribute__ (2, 3); /* Return location expressions. If the attribute uses a location list, ADDRESS selects the relevant location expressions from the list. There can be multiple matches, resulting in multiple expressions to return. EXPRS and EXPRLENS are parallel arrays of NLOCS slots to fill in. Returns the number of locations filled in, or -1 for errors. If EXPRS is a null pointer, stores nothing and returns the total number of locations. A return value of zero means that the location list indicated no value is accessible. */ extern int dwarf_getlocation_addr (Dwarf_Attribute *attr, Dwarf_Addr address, Dwarf_Op **exprs, size_t *exprlens, size_t nlocs); /* Enumerate the locations ranges and descriptions covered by the given attribute. In the first call OFFSET should be zero and *BASEP need not be initialized. Returns -1 for errors, zero when there are no more locations to report, or a nonzero OFFSET value to pass to the next call. Each subsequent call must preserve *BASEP from the prior call. Successful calls fill in *STARTP and *ENDP with a contiguous address range and *EXPR with a pointer to an array of operations with length *EXPRLEN. If the attribute describes a single location description and not a location list the first call (with OFFSET zero) will return the location description in *EXPR with *STARTP set to zero and *ENDP set to minus one. */ extern ptrdiff_t dwarf_getlocations (Dwarf_Attribute *attr, ptrdiff_t offset, Dwarf_Addr *basep, Dwarf_Addr *startp, Dwarf_Addr *endp, Dwarf_Op **expr, size_t *exprlen); /* Return the block associated with a DW_OP_implicit_value operation. The OP pointer must point into an expression that dwarf_getlocation or dwarf_getlocation_addr has returned given the same ATTR. */ extern int dwarf_getlocation_implicit_value (Dwarf_Attribute *attr, const Dwarf_Op *op, Dwarf_Block *return_block) __nonnull_attribute__ (2, 3); /* Return the attribute indicated by a DW_OP_GNU_implicit_pointer operation. The OP pointer must point into an expression that dwarf_getlocation or dwarf_getlocation_addr has returned given the same ATTR. The result is the DW_AT_location or DW_AT_const_value attribute of the OP->number DIE. */ extern int dwarf_getlocation_implicit_pointer (Dwarf_Attribute *attr, const Dwarf_Op *op, Dwarf_Attribute *result) __nonnull_attribute__ (2, 3); /* Return the DIE associated with an operation such as DW_OP_GNU_implicit_pointer, DW_OP_GNU_parameter_ref, DW_OP_GNU_convert, DW_OP_GNU_reinterpret, DW_OP_GNU_const_type, DW_OP_GNU_regval_type or DW_OP_GNU_deref_type. The OP pointer must point into an expression that dwarf_getlocation or dwarf_getlocation_addr has returned given the same ATTR. The RESULT is a DIE that expresses a type or value needed by the given OP. */ extern int dwarf_getlocation_die (Dwarf_Attribute *attr, const Dwarf_Op *op, Dwarf_Die *result) __nonnull_attribute__ (2, 3); /* Return the attribute expressing a value associated with an operation such as DW_OP_implicit_value, DW_OP_GNU_entry_value or DW_OP_GNU_const_type. The OP pointer must point into an expression that dwarf_getlocation or dwarf_getlocation_addr has returned given the same ATTR. The RESULT is a value expressed by an attribute such as DW_AT_location or DW_AT_const_value. */ extern int dwarf_getlocation_attr (Dwarf_Attribute *attr, const Dwarf_Op *op, Dwarf_Attribute *result) __nonnull_attribute__ (2, 3); /* Compute the byte-size of a type DIE according to DWARF rules. For most types, this is just DW_AT_byte_size. For DW_TAG_array_type it can apply much more complex rules. */ extern int dwarf_aggregate_size (Dwarf_Die *die, Dwarf_Word *size); /* Given a language code, as returned by dwarf_srclan, get the default lower bound for a subrange type without a lower bound attribute. Returns zero on success or -1 on failure when the given language wasn't recognized. */ extern int dwarf_default_lower_bound (int lang, Dwarf_Sword *result) __nonnull_attribute__ (2); /* Return scope DIEs containing PC address. Sets *SCOPES to a malloc'd array of Dwarf_Die structures, and returns the number of elements in the array. (*SCOPES)[0] is the DIE for the innermost scope containing PC, (*SCOPES)[1] is the DIE for the scope containing that scope, and so on. Returns -1 for errors or 0 if no scopes match PC. */ extern int dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc, Dwarf_Die **scopes); /* Return scope DIEs containing the given DIE. Sets *SCOPES to a malloc'd array of Dwarf_Die structures, and returns the number of elements in the array. (*SCOPES)[0] is a copy of DIE. (*SCOPES)[1] is the DIE for the scope containing that scope, and so on. Returns -1 for errors or 0 if DIE is not found in any scope entry. */ extern int dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes); /* Search SCOPES[0..NSCOPES-1] for a variable called NAME. Ignore the first SKIP_SHADOWS scopes that match the name. If MATCH_FILE is not null, accept only declaration in that source file; if MATCH_LINENO or MATCH_LINECOL are also nonzero, accept only declaration at that line and column. If successful, fill in *RESULT with the DIE of the variable found, and return N where SCOPES[N] is the scope defining the variable. Return -1 for errors or -2 for no matching variable found. */ extern int dwarf_getscopevar (Dwarf_Die *scopes, int nscopes, const char *name, int skip_shadows, const char *match_file, int match_lineno, int match_linecol, Dwarf_Die *result); /* Return list address ranges. */ extern int dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges, size_t *naranges) __nonnull_attribute__ (2); /* Return one of the address range entries. */ extern Dwarf_Arange *dwarf_onearange (Dwarf_Aranges *aranges, size_t idx); /* Return information in address range record. */ extern int dwarf_getarangeinfo (Dwarf_Arange *arange, Dwarf_Addr *addrp, Dwarf_Word *lengthp, Dwarf_Off *offsetp); /* Get address range which includes given address. */ extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges, Dwarf_Addr addr); /* Get functions in CUDIE. The given callback will be called for all defining DW_TAG_subprograms in the CU DIE tree. If the callback returns DWARF_CB_ABORT the return value can be used as offset argument to resume the function to find all remaining functions (this is not really recommended, since it needs to rewalk the CU DIE tree first till that offset is found again). If the callback returns DWARF_CB_OK dwarf_getfuncs will not return but keep calling the callback for each function DIE it finds. Pass zero for offset on the first call to walk the full CU DIE tree. If no more functions can be found and the callback returned DWARF_CB_OK then the function returns zero. */ extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie, int (*callback) (Dwarf_Die *, void *), void *arg, ptrdiff_t offset); /* Return file name containing definition of the given declaration. Of the DECL has an (indirect, see dwarf_attr_integrate) decl_file attribute. The returned file path is either absolute, or relative to the compilation directory. Given the decl DIE, the compilation directory can be retrieved through: dwarf_formstring (dwarf_attr (dwarf_diecu (decl, &cudie, NULL, NULL), DW_AT_comp_dir, &attr)); Returns NULL if no decl_file could be found or an error occurred. */ extern const char *dwarf_decl_file (Dwarf_Die *decl); /* Get line number of beginning of given declaration. */ extern int dwarf_decl_line (Dwarf_Die *decl, int *linep) __nonnull_attribute__ (2); /* Get column number of beginning of given declaration. */ extern int dwarf_decl_column (Dwarf_Die *decl, int *colp) __nonnull_attribute__ (2); /* Return nonzero if given function is an abstract inline definition. */ extern int dwarf_func_inline (Dwarf_Die *func); /* Find each concrete inlined instance of the abstract inline definition. */ extern int dwarf_func_inline_instances (Dwarf_Die *func, int (*callback) (Dwarf_Die *, void *), void *arg); /* Find the appropriate PC location or locations for function entry breakpoints for the given DW_TAG_subprogram DIE. Returns -1 for errors. On success, returns the number of breakpoint locations (never zero) and sets *BKPTS to a malloc'd vector of addresses. */ extern int dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts); /* Iterate through the macro unit referenced by CUDIE and call CALLBACK for each macro information entry. To start the iteration, one would pass DWARF_GETMACROS_START for TOKEN. The iteration continues while CALLBACK returns DWARF_CB_OK. If the callback returns DWARF_CB_ABORT, the iteration stops and a continuation token is returned, which can be used to restart the iteration at the point where it ended. Returns -1 for errors or 0 if there are no more macro entries. Note that the Dwarf_Macro pointer passed to the callback is only valid for the duration of the callback invocation. For backward compatibility, a token of 0 is accepted for starting the iteration as well, but in that case this interface will refuse to serve opcode 0xff from .debug_macro sections. Such opcode would be considered invalid and would cause dwarf_getmacros to return with error. */ #define DWARF_GETMACROS_START PTRDIFF_MIN extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie, int (*callback) (Dwarf_Macro *, void *), void *arg, ptrdiff_t token) __nonnull_attribute__ (2); /* This is similar in operation to dwarf_getmacros, but selects the unit to iterate through by offset instead of by CU, and always iterates .debug_macro. This can be used for handling DW_MACRO_GNU_transparent_include's or similar opcodes. TOKEN value of DWARF_GETMACROS_START can be used to start the iteration. It is not appropriate to obtain macro unit offset by hand from a CU DIE and then request iteration through this interface. The reason for this is that if a dwarf_macro_getsrcfiles is later called, there would be no way to figure out what DW_AT_comp_dir was present on the CU DIE, and file names referenced in either the macro unit itself, or the .debug_line unit that it references, might be wrong. Use dwarf_getmacros. */ extern ptrdiff_t dwarf_getmacros_off (Dwarf *dbg, Dwarf_Off macoff, int (*callback) (Dwarf_Macro *, void *), void *arg, ptrdiff_t token) __nonnull_attribute__ (3); /* Get the source files used by the macro entry. You shouldn't assume that Dwarf_Files references will remain valid after MACRO becomes invalid. (Which is to say it's only valid within the dwarf_getmacros* callback.) Returns 0 for success or a negative value in case of an error. */ extern int dwarf_macro_getsrcfiles (Dwarf *dbg, Dwarf_Macro *macro, Dwarf_Files **files, size_t *nfiles) __nonnull_attribute__ (2, 3, 4); /* Return macro opcode. That's a constant that can be either from DW_MACINFO_* domain or DW_MACRO_GNU_* domain. The two domains have compatible values, so it's OK to use either of them for comparisons. The only differences is 0xff, which could be either DW_MACINFO_vendor_ext or a vendor-defined DW_MACRO_* constant. One would need to look if the CU DIE which the iteration was requested for has attribute DW_AT_macro_info, or either of DW_AT_GNU_macros or DW_AT_macros to differentiate the two interpretations. */ extern int dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep) __nonnull_attribute__ (2); /* Get number of parameters of MACRO and store it to *PARAMCNTP. */ extern int dwarf_macro_getparamcnt (Dwarf_Macro *macro, size_t *paramcntp); /* Get IDX-th parameter of MACRO (numbered from zero), and stores it to *ATTRIBUTE. Returns 0 on success or -1 for errors. After a successful call, you can query ATTRIBUTE by dwarf_whatform to determine which of the dwarf_formX calls to make to get actual value out of ATTRIBUTE. Note that calling dwarf_whatattr is not meaningful for pseudo-attributes formed this way. */ extern int dwarf_macro_param (Dwarf_Macro *macro, size_t idx, Dwarf_Attribute *attribute); /* Return macro parameter with index 0. This will return -1 if the parameter is not an integral value. Use dwarf_macro_param for more general access. */ extern int dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp) __nonnull_attribute__ (2); /* Return macro parameter with index 1. This will return -1 if the parameter is not an integral or string value. Use dwarf_macro_param for more general access. */ extern int dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp, const char **strp); /* Compute what's known about a call frame when the PC is at ADDRESS. Returns 0 for success or -1 for errors. On success, *FRAME is a malloc'd pointer. */ extern int dwarf_cfi_addrframe (Dwarf_CFI *cache, Dwarf_Addr address, Dwarf_Frame **frame) __nonnull_attribute__ (3); /* Return the DWARF register number used in FRAME to denote the return address in FRAME's caller frame. The remaining arguments can be non-null to fill in more information. Fill [*START, *END) with the PC range to which FRAME's information applies. Fill in *SIGNALP to indicate whether this is a signal-handling frame. If true, this is the implicit call frame that calls a signal handler. This frame's "caller" is actually the interrupted state, not a call; its return address is an exact PC, not a PC after a call instruction. */ extern int dwarf_frame_info (Dwarf_Frame *frame, Dwarf_Addr *start, Dwarf_Addr *end, bool *signalp); /* Return a DWARF expression that yields the Canonical Frame Address at this frame state. Returns -1 for errors, or zero for success, with *NOPS set to the number of operations stored at *OPS. That pointer can be used only as long as FRAME is alive and unchanged. *NOPS is zero if the CFA cannot be determined here. Note that if nonempty, *OPS is a DWARF expression, not a location description--append DW_OP_stack_value to a get a location description for the CFA. */ extern int dwarf_frame_cfa (Dwarf_Frame *frame, Dwarf_Op **ops, size_t *nops) __nonnull_attribute__ (2); /* Deliver a DWARF location description that yields the location or value of DWARF register number REGNO in the state described by FRAME. Returns -1 for errors or zero for success, setting *NOPS to the number of operations in the array stored at *OPS. Note the last operation is DW_OP_stack_value if there is no mutable location but only a computable value. *NOPS zero with *OPS set to OPS_MEM means CFI says the caller's REGNO is "undefined", i.e. it's call-clobbered and cannot be recovered. *NOPS zero with *OPS set to a null pointer means CFI says the caller's REGNO is "same_value", i.e. this frame did not change it; ask the caller frame where to find it. For common simple expressions *OPS is OPS_MEM (which is a caller owned array for at least 3 Dwarf_Ops). For arbitrary DWARF expressions in the CFI, *OPS is an internal pointer that can be used as long as the Dwarf_CFI used to create FRAME remains alive. */ extern int dwarf_frame_register (Dwarf_Frame *frame, int regno, Dwarf_Op ops_mem[3], Dwarf_Op **ops, size_t *nops) __nonnull_attribute__ (3, 4, 5); /* Return error code of last failing function call. This value is kept separately for each thread. */ extern int dwarf_errno (void); /* Return error string for ERROR. If ERROR is zero, return error string for most recent error or NULL is none occurred. If ERROR is -1 the behaviour is similar to the last case except that not NULL but a legal string is returned. */ extern const char *dwarf_errmsg (int err); /* Register new Out-Of-Memory handler. The old handler is returned. */ extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler); /* Inline optimizations. */ #ifdef __OPTIMIZE__ /* Return attribute code of given attribute. */ __libdw_extern_inline unsigned int dwarf_whatattr (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->code; } /* Return attribute code of given attribute. */ __libdw_extern_inline unsigned int dwarf_whatform (Dwarf_Attribute *attr) { return attr == NULL ? 0 : attr->form; } #endif /* Optimize. */ #ifdef __cplusplus } #endif #endif /* libdw.h */ libdwfl.h000064400000113330151030061700006332 0ustar00/* Interfaces for libdwfl. Copyright (C) 2005-2010, 2013 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify it under the terms of either * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version or both in parallel, as here. elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LIBDWFL_H #define _LIBDWFL_H 1 #include "libdw.h" #include /* Handle for a session using the library. */ typedef struct Dwfl Dwfl; /* Handle for a module. */ typedef struct Dwfl_Module Dwfl_Module; /* Handle describing a line record. */ typedef struct Dwfl_Line Dwfl_Line; /* This holds information common for all the frames of one backtrace for a particular thread/task/TID. Several threads belong to one Dwfl. */ typedef struct Dwfl_Thread Dwfl_Thread; /* This holds everything we know about the state of the frame at a particular PC location described by an FDE belonging to Dwfl_Thread. */ typedef struct Dwfl_Frame Dwfl_Frame; /* Handle for debuginfod-client connection. */ #ifndef _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF typedef struct debuginfod_client debuginfod_client; #define _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF 1 #endif /* Callbacks. */ typedef struct { int (*find_elf) (Dwfl_Module *mod, void **userdata, const char *modname, Dwarf_Addr base, char **file_name, Elf **elfp); int (*find_debuginfo) (Dwfl_Module *mod, void **userdata, const char *modname, Dwarf_Addr base, const char *file_name, const char *debuglink_file, GElf_Word debuglink_crc, char **debuginfo_file_name); /* Fill *ADDR with the loaded address of the section called SECNAME in the given module. Use (Dwarf_Addr) -1 if this section is omitted from accessible memory. This is called exactly once for each SHF_ALLOC section that relocations affecting DWARF data refer to, so it can easily be used to collect state about the sections referenced. */ int (*section_address) (Dwfl_Module *mod, void **userdata, const char *modname, Dwarf_Addr base, const char *secname, GElf_Word shndx, const GElf_Shdr *shdr, Dwarf_Addr *addr); char **debuginfo_path; /* See dwfl_standard_find_debuginfo. */ } Dwfl_Callbacks; #ifdef __cplusplus extern "C" { #endif /* Start a new session with the library. */ extern Dwfl *dwfl_begin (const Dwfl_Callbacks *callbacks) __nonnull_attribute__ (1); /* End a session. */ extern void dwfl_end (Dwfl *); /* Return implementation's version string suitable for printing. */ extern const char *dwfl_version (Dwfl *); /* Return error code of last failing function call. This value is kept separately for each thread. */ extern int dwfl_errno (void); /* Return error string for ERROR. If ERROR is zero, return error string for most recent error or NULL if none occurred. If ERROR is -1 the behaviour is similar to the last case except that not NULL but a legal string is returned. */ extern const char *dwfl_errmsg (int err); /* Start reporting the current set of segments and modules to the library. All existing segments are wiped. Existing modules are marked to be deleted, and will not be found via dwfl_addrmodule et al if they are not re-reported before dwfl_report_end is called. */ extern void dwfl_report_begin (Dwfl *dwfl); /* Report that segment NDX begins at PHDR->p_vaddr + BIAS. If NDX is < 0, the value succeeding the last call's NDX is used instead (zero on the first call). IDENT is ignored. If nonzero, the smallest PHDR->p_align value seen sets the effective page size for the address space DWFL describes. This is the granularity at which reported module boundary addresses will be considered to fall in or out of a segment. Returns -1 for errors, or NDX (or its assigned replacement) on success. Reporting segments at all is optional. Its only benefit to the caller is to offer this quick lookup via dwfl_addrsegment, or use other segment-based calls. */ extern int dwfl_report_segment (Dwfl *dwfl, int ndx, const GElf_Phdr *phdr, GElf_Addr bias, const void *ident); /* Report that a module called NAME spans addresses [START, END). Returns the module handle, either existing or newly allocated, or returns a null pointer for an allocation error. */ extern Dwfl_Module *dwfl_report_module (Dwfl *dwfl, const char *name, Dwarf_Addr start, Dwarf_Addr end); /* Report a module to address BASE with start and end addresses computed from the ELF program headers in the given file - see the table below. FD may be -1 to open FILE_NAME. On success, FD is consumed by the library, and the `find_elf' callback will not be used for this module. ADD_P_VADDR BASE ET_EXEC ignored ignored ET_DYN false absolute address where to place the file true start address relative to ELF's phdr p_vaddr ET_REL ignored absolute address where to place the file ET_CORE ignored ignored ET_DYN ELF phdr p_vaddr address can be non-zero if the shared library has been prelinked by tool prelink(8). */ extern Dwfl_Module *dwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, GElf_Addr base, bool add_p_vaddr); /* Similar, but report the module for offline use. All ET_EXEC files being reported must be reported before any relocatable objects. If this is used, dwfl_report_module and dwfl_report_elf may not be used in the same reporting session. */ extern Dwfl_Module *dwfl_report_offline (Dwfl *dwfl, const char *name, const char *file_name, int fd); /* Similar, but report ELF from memory region. */ extern Dwfl_Module *dwfl_report_offline_memory (Dwfl *dwfl, const char *name, const char *file_name, char *data, size_t size); /* Finish reporting the current set of modules to the library. If REMOVED is not null, it's called for each module that existed before but was not included in the current report. Returns a nonzero return value from the callback. The callback may call dwfl_report_module; doing so with the details of the module being removed prevents its removal. DWFL cannot be used until this function has returned zero. */ extern int dwfl_report_end (Dwfl *dwfl, int (*removed) (Dwfl_Module *, void *, const char *, Dwarf_Addr, void *arg), void *arg); /* Start reporting additional modules to the library. No calls but dwfl_report_* can be made on DWFL until dwfl_report_end is called. This is like dwfl_report_begin, but all the old modules are kept on. More dwfl_report_* calls can follow to add more modules. When dwfl_report_end is called, no old modules will be removed. */ extern void dwfl_report_begin_add (Dwfl *dwfl); /* Return the name of the module, and for each non-null argument store interesting details: *USERDATA is a location for storing your own pointer, **USERDATA is initially null; *START and *END give the address range covered by the module; *DWBIAS is the address bias for debugging information, and *SYMBIAS for symbol table entries (either is -1 if not yet accessed); *MAINFILE is the name of the ELF file, and *DEBUGFILE the name of the debuginfo file (might be equal to *MAINFILE; either is null if not yet accessed). */ extern const char *dwfl_module_info (Dwfl_Module *mod, void ***userdata, Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *dwbias, Dwarf_Addr *symbias, const char **mainfile, const char **debugfile); /* Iterate through the modules, starting the walk with OFFSET == 0. Calls *CALLBACK for each module as long as it returns DWARF_CB_OK. When *CALLBACK returns another value, the walk stops and the return value can be passed as OFFSET to resume it. Returns 0 when there are no more modules, or -1 for errors. */ extern ptrdiff_t dwfl_getmodules (Dwfl *dwfl, int (*callback) (Dwfl_Module *, void **, const char *, Dwarf_Addr, void *arg), void *arg, ptrdiff_t offset); /* Find the module containing the given address. */ extern Dwfl_Module *dwfl_addrmodule (Dwfl *dwfl, Dwarf_Addr address); /* Find the segment, if any, and module, if any, containing ADDRESS. Returns a segment index returned by dwfl_report_segment, or -1 if no segment matches the address. Regardless of the return value, *MOD is always set to the module containing ADDRESS, or to null. */ extern int dwfl_addrsegment (Dwfl *dwfl, Dwarf_Addr address, Dwfl_Module **mod); /* Report the known build ID bits associated with a module. If VADDR is nonzero, it gives the absolute address where those bits are found within the module. This can be called at any time, but is usually used immediately after dwfl_report_module. Once the module's main ELF file is opened, the ID note found there takes precedence and cannot be changed. */ extern int dwfl_module_report_build_id (Dwfl_Module *mod, const unsigned char *bits, size_t len, GElf_Addr vaddr) __nonnull_attribute__ (2); /* Extract the build ID bits associated with a module. Returns -1 for errors, 0 if no ID is known, or the number of ID bytes. When an ID is found, *BITS points to it; *VADDR is the absolute address at which the ID bits are found within the module, or 0 if unknown. This returns 0 when the module's main ELF file has not yet been loaded and its build ID bits were not reported. To ensure the ID is always returned when determinable, call dwfl_module_getelf first. */ extern int dwfl_module_build_id (Dwfl_Module *mod, const unsigned char **bits, GElf_Addr *vaddr) __nonnull_attribute__ (2, 3); /*** Standard callbacks ***/ /* These standard find_elf and find_debuginfo callbacks are controlled by a string specifying directories to look in. If `debuginfo_path' is set in the Dwfl_Callbacks structure and the char * it points to is not null, that supplies the string. Otherwise a default path is used. If the first character of the string is + or - that enables or disables CRC32 checksum validation when it's necessary. The remainder of the string is composed of elements separated by colons. Each element can start with + or - to override the global checksum behavior. This flag is never relevant when working with build IDs, but it's always parsed in the path string. The remainder of the element indicates a directory. Searches by build ID consult only the elements naming absolute directory paths. They look under those directories for a link named ".build-id/xx/yy" or ".build-id/xx/yy.debug", where "xxyy" is the lower-case hexadecimal representation of the ID bytes. In searches for debuginfo by name, if the remainder of the element is empty, the directory containing the main file is tried; if it's an absolute path name, the absolute directory path (and any subdirectory of that path) containing the main file is taken as a subdirectory of this path; a relative path name is taken as a subdirectory of the directory containing the main file. Hence for /usr/bin/ls, the default string ":.debug:/usr/lib/debug" says to look in /usr/bin, then /usr/bin/.debug, then the path subdirs under /usr/lib/debug, in the order /usr/lib/debug/usr/bin, then /usr/lib/debug/bin, and finally /usr/lib/debug, for the file name in the .gnu_debuglink section (or "ls.debug" if none was found). */ /* Standard find_elf callback function working solely on build ID. This can be tried first by any find_elf callback, to use the bits passed to dwfl_module_report_build_id, if any. */ extern int dwfl_build_id_find_elf (Dwfl_Module *, void **, const char *, Dwarf_Addr, char **, Elf **); /* Standard find_debuginfo callback function working solely on build ID. This can be tried first by any find_debuginfo callback, to use the build ID bits from the main file when present. */ extern int dwfl_build_id_find_debuginfo (Dwfl_Module *, void **, const char *, Dwarf_Addr, const char *, const char *, GElf_Word, char **); /* Standard find_debuginfo callback function. If a build ID is available, this tries first to use that. If there is no build ID or no valid debuginfo found by ID, it searches the debuginfo path by name, as described above. Any file found in the path is validated by build ID if possible, or else by CRC32 checksum if enabled, and skipped if it does not match. */ extern int dwfl_standard_find_debuginfo (Dwfl_Module *, void **, const char *, Dwarf_Addr, const char *, const char *, GElf_Word, char **); /* This callback must be used when using dwfl_offline_* to report modules, if ET_REL is to be supported. */ extern int dwfl_offline_section_address (Dwfl_Module *, void **, const char *, Dwarf_Addr, const char *, GElf_Word, const GElf_Shdr *, Dwarf_Addr *addr); /* Callbacks for working with kernel modules in the running Linux kernel. */ extern int dwfl_linux_kernel_find_elf (Dwfl_Module *, void **, const char *, Dwarf_Addr, char **, Elf **); extern int dwfl_linux_kernel_module_section_address (Dwfl_Module *, void **, const char *, Dwarf_Addr, const char *, GElf_Word, const GElf_Shdr *, Dwarf_Addr *addr); /* Call dwfl_report_elf for the running Linux kernel. Returns zero on success, -1 if dwfl_report_module failed, or an errno code if opening the kernel binary failed. */ extern int dwfl_linux_kernel_report_kernel (Dwfl *dwfl); /* Call dwfl_report_module for each kernel module in the running Linux kernel. Returns zero on success, -1 if dwfl_report_module failed, or an errno code if reading the list of modules failed. */ extern int dwfl_linux_kernel_report_modules (Dwfl *dwfl); /* Report a kernel and its modules found on disk, for offline use. If RELEASE starts with '/', it names a directory to look in; if not, it names a directory to find under /lib/modules/; if null, /lib/modules/`uname -r` is used. Returns zero on success, -1 if dwfl_report_module failed, or an errno code if finding the files on disk failed. If PREDICATE is not null, it is called with each module to be reported; its arguments are the module name, and the ELF file name or null if unknown, and its return value should be zero to skip the module, one to report it, or -1 to cause the call to fail and return errno. */ extern int dwfl_linux_kernel_report_offline (Dwfl *dwfl, const char *release, int (*predicate) (const char *, const char *)); /* Examine an ET_CORE file and report modules based on its contents. This can follow a dwfl_report_offline call to bootstrap the DT_DEBUG method of following the dynamic linker link_map chain, in case the core file does not contain enough of the executable's text segment to locate its PT_DYNAMIC in the dump. In such case you need to supply non-NULL EXECUTABLE, otherwise dynamic libraries will not be loaded into the DWFL map. This might call dwfl_report_elf on file names found in the dump if reading some link_map files is the only way to ascertain those modules' addresses. Returns the number of modules reported, or -1 for errors. */ extern int dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable); /* Call dwfl_report_module for each file mapped into the address space of PID. Returns zero on success, -1 if dwfl_report_module failed, or an errno code if opening the proc files failed. */ extern int dwfl_linux_proc_report (Dwfl *dwfl, pid_t pid); /* Similar, but reads an input stream in the format of Linux /proc/PID/maps files giving module layout, not the file for a live process. */ extern int dwfl_linux_proc_maps_report (Dwfl *dwfl, FILE *); /* Trivial find_elf callback for use with dwfl_linux_proc_report. This uses the module name as a file name directly and tries to open it if it begin with a slash, or handles the magic string "[vdso]". */ extern int dwfl_linux_proc_find_elf (Dwfl_Module *mod, void **userdata, const char *module_name, Dwarf_Addr base, char **file_name, Elf **); /* Standard argument parsing for using a standard callback set. */ struct argp; extern const struct argp *dwfl_standard_argp (void) __const_attribute__; /*** Relocation of addresses from Dwfl ***/ /* Return the number of relocatable bases associated with the module, which is zero for ET_EXEC and one for ET_DYN. Returns -1 for errors. */ extern int dwfl_module_relocations (Dwfl_Module *mod); /* Return the relocation base index associated with the *ADDRESS location, and adjust *ADDRESS to be an offset relative to that base. Returns -1 for errors. */ extern int dwfl_module_relocate_address (Dwfl_Module *mod, Dwarf_Addr *address); /* Return the ELF section name for the given relocation base index; if SHNDXP is not null, set *SHNDXP to the ELF section index. For ET_DYN, returns "" and sets *SHNDXP to SHN_ABS; the relocation base is the runtime start address reported for the module. Returns null for errors. */ extern const char *dwfl_module_relocation_info (Dwfl_Module *mod, unsigned int idx, GElf_Word *shndxp); /* Validate that ADDRESS and ADDRESS+OFFSET lie in a known module and both within the same contiguous region for relocation purposes. Returns zero for success and -1 for errors. */ extern int dwfl_validate_address (Dwfl *dwfl, Dwarf_Addr address, Dwarf_Sword offset); /*** ELF access functions ***/ /* Fetch the module main ELF file (where the allocated sections are found) for use with libelf. If successful, fills in *BIAS with the difference between addresses within the loaded module and those in symbol tables or Dwarf information referring to it. */ extern Elf *dwfl_module_getelf (Dwfl_Module *, GElf_Addr *bias) __nonnull_attribute__ (2); /* Return the number of symbols in the module's symbol table, or -1 for errors. */ extern int dwfl_module_getsymtab (Dwfl_Module *mod); /* Return the index of the first global symbol in the module's symbol table, or -1 for errors. In each symbol table, all symbols with STB_LOCAL binding precede the weak and global symbols. This function returns the symbol table index one greater than the last local symbol. */ extern int dwfl_module_getsymtab_first_global (Dwfl_Module *mod); /* Fetch one entry from the module's symbol table. On errors, returns NULL. If successful, fills in *SYM and returns the string for st_name. This works like gelf_getsym except that st_value is always adjusted to an absolute value based on the module's location, when the symbol is in an SHF_ALLOC section. If SHNDXP is non-null, it's set with the section index (whether from st_shndx or extended index table); in case of a symbol in a non-allocated section, *SHNDXP is instead set to -1. Note that since symbols can come from either the main, debug or auxiliary ELF symbol file (either dynsym or symtab) the section index can only be reliably used to compare against special section constants like SHN_UNDEF or SHN_ABS. It is recommended to use dwfl_module_getsym_info which doesn't have these deficiencies. */ extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym, GElf_Word *shndxp) __nonnull_attribute__ (3); /* Fetch one entry from the module's symbol table and the associated address value. On errors, returns NULL. If successful, fills in *SYM, *ADDR and returns the string for st_name. This works like gelf_getsym. *ADDR is set to the st_value adjusted to an absolute value based on the module's location, when the symbol is in an SHF_ALLOC section. For non-ET_REL files, if the arch uses function descriptors, and the st_value points to one, *ADDR will be resolved to the actual function entry address. The SYM->ST_VALUE itself isn't adjusted in any way. Fills in ELFP, if not NULL, with the ELF file the symbol originally came from. Note that symbols can come from either the main, debug or auxiliary ELF symbol file (either dynsym or symtab). If SHNDXP is non-null, it's set with the section index (whether from st_shndx or extended index table); in case of a symbol in a non-allocated section, *SHNDXP is instead set to -1. Fills in BIAS, if not NULL, with the difference between addresses within the loaded module and those in symbol table of the ELF file. Note that the address associated with the symbol might be in a different section than the returned symbol. The section in the main elf file in which returned ADDR falls can be found with dwfl_module_address_section. */ extern const char *dwfl_module_getsym_info (Dwfl_Module *mod, int ndx, GElf_Sym *sym, GElf_Addr *addr, GElf_Word *shndxp, Elf **elfp, Dwarf_Addr *bias) __nonnull_attribute__ (3, 4); /* Find the symbol that ADDRESS lies inside, and return its name. */ extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address); /* Find the symbol associated with ADDRESS. Return its name or NULL when nothing was found. If the architecture uses function descriptors, and symbol st_value points to one, ADDRESS will be matched against either the adjusted st_value or the associated function entry value as described in dwfl_module_getsym_info. OFFSET will be filled in with the difference from the start of the symbol (or function entry), OFFSET cannot be NULL. SYM is filled in with the symbol associated with the matched ADDRESS, SYM cannot be NULL. The SYM->ST_VALUE itself isn't adjusted in any way. Fills in ELFP, if not NULL, with the ELF file the symbol originally came from. Note that symbols can come from either the main, debug or auxiliary ELF symbol file (either dynsym or symtab). If SHNDXP is non-null, it's set with the section index (whether from st_shndx or extended index table). Fills in BIAS, if not NULL, with the difference between addresses within the loaded module and those in symbol table of the ELF file. Note that the address matched against the symbol might be in a different section than the returned symbol. The section in the main elf file in ADDRESS falls can be found with dwfl_module_address_section. */ extern const char *dwfl_module_addrinfo (Dwfl_Module *mod, GElf_Addr address, GElf_Off *offset, GElf_Sym *sym, GElf_Word *shndxp, Elf **elfp, Dwarf_Addr *bias) __nonnull_attribute__ (3, 4); /* Find the symbol that ADDRESS lies inside, and return detailed information as for dwfl_module_getsym (above). Note that like dwfl_module_getsym this function also adjusts SYM->ST_VALUE to an absolute value based on the module's location. ADDRESS is only matched against this adjusted SYM->ST_VALUE. This means that depending on architecture this might only match symbols that represent function descriptor addresses (and not function entry addresses). For these reasons it is recommended to use dwfl_module_addrinfo instead. */ extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address, GElf_Sym *sym, GElf_Word *shndxp) __nonnull_attribute__ (3); /* Find the ELF section that *ADDRESS lies inside and return it. On success, adjusts *ADDRESS to be relative to the section, and sets *BIAS to the difference between addresses used in the returned section's headers and run-time addresses. */ extern Elf_Scn *dwfl_module_address_section (Dwfl_Module *mod, Dwarf_Addr *address, Dwarf_Addr *bias) __nonnull_attribute__ (2, 3); /*** Dwarf access functions ***/ /* Fetch the module's debug information for use with libdw. If successful, fills in *BIAS with the difference between addresses within the loaded module and those to use with libdw. */ extern Dwarf *dwfl_module_getdwarf (Dwfl_Module *, Dwarf_Addr *bias) __nonnull_attribute__ (2); /* Get the libdw handle for each module. */ extern ptrdiff_t dwfl_getdwarf (Dwfl *, int (*callback) (Dwfl_Module *, void **, const char *, Dwarf_Addr, Dwarf *, Dwarf_Addr, void *), void *arg, ptrdiff_t offset); /* Look up the module containing ADDR and return its debugging information, loading it if necessary. */ extern Dwarf *dwfl_addrdwarf (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias) __nonnull_attribute__ (3); /* Find the CU containing ADDR and return its DIE. */ extern Dwarf_Die *dwfl_addrdie (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Addr *bias) __nonnull_attribute__ (3); extern Dwarf_Die *dwfl_module_addrdie (Dwfl_Module *mod, Dwarf_Addr addr, Dwarf_Addr *bias) __nonnull_attribute__ (3); /* Iterate through the CUs, start with null for LASTCU. */ extern Dwarf_Die *dwfl_nextcu (Dwfl *dwfl, Dwarf_Die *lastcu, Dwarf_Addr *bias) __nonnull_attribute__ (3); extern Dwarf_Die *dwfl_module_nextcu (Dwfl_Module *mod, Dwarf_Die *lastcu, Dwarf_Addr *bias) __nonnull_attribute__ (3); /* Return the module containing the CU DIE. */ extern Dwfl_Module *dwfl_cumodule (Dwarf_Die *cudie); /* Cache the source line information for the CU and return the number of Dwfl_Line entries it has. */ extern int dwfl_getsrclines (Dwarf_Die *cudie, size_t *nlines); /* Access one line number entry within the CU. */ extern Dwfl_Line *dwfl_onesrcline (Dwarf_Die *cudie, size_t idx); /* Get source for address. */ extern Dwfl_Line *dwfl_module_getsrc (Dwfl_Module *mod, Dwarf_Addr addr); extern Dwfl_Line *dwfl_getsrc (Dwfl *dwfl, Dwarf_Addr addr); /* Get address for source. */ extern int dwfl_module_getsrc_file (Dwfl_Module *mod, const char *fname, int lineno, int column, Dwfl_Line ***srcsp, size_t *nsrcs); /* Return the module containing this line record. */ extern Dwfl_Module *dwfl_linemodule (Dwfl_Line *line); /* Return the CU containing this line record. */ extern Dwarf_Die *dwfl_linecu (Dwfl_Line *line); /* Return the source file name and fill in other information. Arguments may be null for unneeded fields. */ extern const char *dwfl_lineinfo (Dwfl_Line *line, Dwarf_Addr *addr, int *linep, int *colp, Dwarf_Word *mtime, Dwarf_Word *length); /* Return the equivalent Dwarf_Line and the bias to apply to its address. */ extern Dwarf_Line *dwfl_dwarf_line (Dwfl_Line *line, Dwarf_Addr *bias); /* Return the compilation directory (AT_comp_dir) from this line's CU. */ extern const char *dwfl_line_comp_dir (Dwfl_Line *line); /*** Machine backend access functions ***/ /* Return location expression to find return value given a DW_TAG_subprogram, DW_TAG_subroutine_type, or similar DIE describing function itself (whose DW_AT_type attribute describes its return type). The given DIE must come from the given module. Returns -1 for errors. Returns zero if the function has no return value (e.g. "void" in C). Otherwise, *LOCOPS gets a location expression to find the return value, and returns the number of operations in the expression. The pointer is permanently allocated at least as long as the module is live. */ extern int dwfl_module_return_value_location (Dwfl_Module *mod, Dwarf_Die *functypedie, const Dwarf_Op **locops); /* Enumerate the DWARF register numbers and their names. For each register, CALLBACK gets its DWARF number, a string describing the register set (such as "integer" or "FPU"), a prefix used in assembler syntax (such as "%" or "$", may be ""), and the name for the register (contains identifier characters only, possibly all digits). The REGNAME string is valid only during the callback. */ extern int dwfl_module_register_names (Dwfl_Module *mod, int (*callback) (void *arg, int regno, const char *setname, const char *prefix, const char *regname, int bits, int type), void *arg); /* Find the CFI for this module. Returns NULL if there is no CFI. On success, fills in *BIAS with the difference between addresses within the loaded module and those in the CFI referring to it. The pointer returned can be used until the module is cleaned up. Calling these more than once returns the same pointers. dwfl_module_dwarf_cfi gets the '.debug_frame' information found with the rest of the DWARF information. dwfl_module_eh_cfi gets the '.eh_frame' information found linked into the text. A module might have either or both. */ extern Dwarf_CFI *dwfl_module_dwarf_cfi (Dwfl_Module *mod, Dwarf_Addr *bias); extern Dwarf_CFI *dwfl_module_eh_cfi (Dwfl_Module *mod, Dwarf_Addr *bias); typedef struct { /* Called to iterate through threads. Returns next TID (thread ID) on success, a negative number on failure and zero if there are no more threads. dwfl_errno () should be set if negative number has been returned. *THREAD_ARGP is NULL on first call, and may be optionally set by the implementation. The value set by the implementation will be passed in on the next call to NEXT_THREAD. THREAD_ARGP is never NULL. *THREAD_ARGP will be passed to set_initial_registers or thread_detach callbacks together with Dwfl_Thread *thread. This method must not be NULL. */ pid_t (*next_thread) (Dwfl *dwfl, void *dwfl_arg, void **thread_argp) __nonnull_attribute__ (1); /* Called to get a specific thread. Returns true if there is a thread with the given thread id number, returns false if no such thread exists and will set dwfl_errno in that case. THREAD_ARGP is never NULL. *THREAD_ARGP will be passed to set_initial_registers or thread_detach callbacks together with Dwfl_Thread *thread. This method may be NULL and will then be emulated using the next_thread callback. */ bool (*get_thread) (Dwfl *dwfl, pid_t tid, void *dwfl_arg, void **thread_argp) __nonnull_attribute__ (1); /* Called during unwinding to access memory (stack) state. Returns true for successfully read *RESULT or false and sets dwfl_errno () on failure. This method may be NULL - in such case dwfl_thread_getframes will return only the initial frame. */ bool (*memory_read) (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result, void *dwfl_arg) __nonnull_attribute__ (1, 3); /* Called on initial unwind to get the initial register state of the first frame. Should call dwfl_thread_state_registers, possibly multiple times for different ranges and possibly also dwfl_thread_state_register_pc, to fill in initial (DWARF) register values. After this call, till at least thread_detach is called, the thread is assumed to be frozen, so that it is safe to unwind. Returns true on success or false and sets dwfl_errno () on failure. In the case of a failure thread_detach will not be called. This method must not be NULL. */ bool (*set_initial_registers) (Dwfl_Thread *thread, void *thread_arg) __nonnull_attribute__ (1); /* Called by dwfl_end. All thread_detach method calls have been already done. This method may be NULL. */ void (*detach) (Dwfl *dwfl, void *dwfl_arg) __nonnull_attribute__ (1); /* Called when unwinding is done. No callback will be called after this method has been called. Iff set_initial_registers was called for a TID and it returned success thread_detach will be called before the detach method above. This method may be NULL. */ void (*thread_detach) (Dwfl_Thread *thread, void *thread_arg) __nonnull_attribute__ (1); } Dwfl_Thread_Callbacks; /* PID is the process id associated with the DWFL state. Architecture of DWFL modules is specified by ELF, ELF must remain valid during DWFL lifetime. Use NULL ELF to detect architecture from DWFL, the function will then detect it from arbitrary Dwfl_Module of DWFL. DWFL_ARG is the callback backend state. DWFL_ARG will be provided to the callbacks. *THREAD_CALLBACKS function pointers must remain valid during lifetime of DWFL. Function returns true on success, false otherwise. */ bool dwfl_attach_state (Dwfl *dwfl, Elf *elf, pid_t pid, const Dwfl_Thread_Callbacks *thread_callbacks, void *dwfl_arg) __nonnull_attribute__ (1, 4); /* Calls dwfl_attach_state with Dwfl_Thread_Callbacks setup for extracting thread state from the ELF core file. Returns the pid number extracted from the core file, or -1 for errors. */ extern int dwfl_core_file_attach (Dwfl *dwfl, Elf *elf); /* Calls dwfl_attach_state with Dwfl_Thread_Callbacks setup for extracting thread state from the proc file system. Uses ptrace to attach and stop the thread under inspection and detaches when thread_detach is called and unwinding for the thread is done, unless ASSUME_PTRACE_STOPPED is true. If ASSUME_PTRACE_STOPPED is true the caller should make sure that the thread is ptrace attached and stopped before unwinding by calling either dwfl_thread_getframes or dwfl_getthread_frames. Returns zero on success, -1 if dwfl_attach_state failed, or an errno code if opening the proc files failed. */ extern int dwfl_linux_proc_attach (Dwfl *dwfl, pid_t pid, bool assume_ptrace_stopped); /* Return PID for the process associated with DWFL. Function returns -1 if dwfl_attach_state was not called for DWFL. */ pid_t dwfl_pid (Dwfl *dwfl) __nonnull_attribute__ (1); /* Return DWFL from which THREAD was created using dwfl_getthreads. */ Dwfl *dwfl_thread_dwfl (Dwfl_Thread *thread) __nonnull_attribute__ (1); /* Return positive TID (thread ID) for THREAD. This function never fails. */ pid_t dwfl_thread_tid (Dwfl_Thread *thread) __nonnull_attribute__ (1); /* Return thread for frame STATE. This function never fails. */ Dwfl_Thread *dwfl_frame_thread (Dwfl_Frame *state) __nonnull_attribute__ (1); /* Called by Dwfl_Thread_Callbacks.set_initial_registers implementation. For every known continuous block of registers . */ #ifndef _DEBUGINFOD_CLIENT_H #define _DEBUGINFOD_CLIENT_H 1 /* Names of environment variables that control the client logic. */ #define DEBUGINFOD_URLS_ENV_VAR "DEBUGINFOD_URLS" #define DEBUGINFOD_CACHE_PATH_ENV_VAR "DEBUGINFOD_CACHE_PATH" #define DEBUGINFOD_TIMEOUT_ENV_VAR "DEBUGINFOD_TIMEOUT" #define DEBUGINFOD_PROGRESS_ENV_VAR "DEBUGINFOD_PROGRESS" #define DEBUGINFOD_VERBOSE_ENV_VAR "DEBUGINFOD_VERBOSE" #define DEBUGINFOD_RETRY_LIMIT_ENV_VAR "DEBUGINFOD_RETRY_LIMIT" #define DEBUGINFOD_MAXSIZE_ENV_VAR "DEBUGINFOD_MAXSIZE" #define DEBUGINFOD_MAXTIME_ENV_VAR "DEBUGINFOD_MAXTIME" #define DEBUGINFOD_HEADERS_FILE_ENV_VAR "DEBUGINFOD_HEADERS_FILE" /* The libdebuginfod soname. */ #define DEBUGINFOD_SONAME "libdebuginfod.so.1" /* Handle for debuginfod-client connection. */ #ifndef _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF typedef struct debuginfod_client debuginfod_client; #define _ELFUTILS_DEBUGINFOD_CLIENT_TYPEDEF 1 #endif #ifdef __cplusplus extern "C" { #endif /* Create a handle for a new debuginfod-client session. */ debuginfod_client *debuginfod_begin (void); /* Query the urls contained in $DEBUGINFOD_URLS for a file with the specified type and build id. If build_id_len == 0, the build_id is supplied as a lowercase hexadecimal string; otherwise it is a binary blob of given length. If successful, return a file descriptor to the target, otherwise return a posix error code. If successful, set *path to a strdup'd copy of the name of the same file in the cache. Caller must free() it later. */ int debuginfod_find_debuginfo (debuginfod_client *client, const unsigned char *build_id, int build_id_len, char **path); int debuginfod_find_executable (debuginfod_client *client, const unsigned char *build_id, int build_id_len, char **path); int debuginfod_find_source (debuginfod_client *client, const unsigned char *build_id, int build_id_len, const char *filename, char **path); int debuginfod_find_section (debuginfod_client *client, const unsigned char *build_id, int build_id_len, const char *section, char **path); typedef int (*debuginfod_progressfn_t)(debuginfod_client *c, long a, long b); void debuginfod_set_progressfn(debuginfod_client *c, debuginfod_progressfn_t fn); void debuginfod_set_verbose_fd(debuginfod_client *c, int fd); /* Set the user parameter. */ void debuginfod_set_user_data (debuginfod_client *client, void *value); /* Get the user parameter. */ void* debuginfod_get_user_data (debuginfod_client *client); /* Get the current or last active URL, if known. */ const char* debuginfod_get_url (debuginfod_client *client); /* Returns set of x-debuginfod* header lines received from current or last active transfer, \n separated, if known. */ const char* debuginfod_get_headers(debuginfod_client *client); /* Add an outgoing HTTP request "Header: Value". Copies string. */ int debuginfod_add_http_header (debuginfod_client *client, const char* header); /* Release debuginfod client connection context handle. */ void debuginfod_end (debuginfod_client *client); #ifdef __cplusplus } #endif #endif /* _DEBUGINFOD_CLIENT_H */ known-dwarf.h000064400000123153151030061700007150 0ustar00/* Generated by config/known-dwarf.awk from libdw/dwarf.h contents. */ #define DWARF_ALL_KNOWN_DW_ACCESS \ DWARF_ONE_KNOWN_DW_ACCESS (private, DW_ACCESS_private) \ DWARF_ONE_KNOWN_DW_ACCESS (protected, DW_ACCESS_protected) \ DWARF_ONE_KNOWN_DW_ACCESS (public, DW_ACCESS_public) \ /* End of DW_ACCESS_*. */ #define DWARF_ALL_KNOWN_DW_AT \ DWARF_ONE_KNOWN_DW_AT (GNU_addr_base, DW_AT_GNU_addr_base) \ DWARF_ONE_KNOWN_DW_AT (GNU_all_call_sites, DW_AT_GNU_all_call_sites) \ DWARF_ONE_KNOWN_DW_AT (GNU_all_source_call_sites, DW_AT_GNU_all_source_call_sites) \ DWARF_ONE_KNOWN_DW_AT (GNU_all_tail_call_sites, DW_AT_GNU_all_tail_call_sites) \ DWARF_ONE_KNOWN_DW_AT (GNU_bias, DW_AT_GNU_bias) \ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_data_value, DW_AT_GNU_call_site_data_value) \ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_target, DW_AT_GNU_call_site_target) \ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_target_clobbered, DW_AT_GNU_call_site_target_clobbered) \ DWARF_ONE_KNOWN_DW_AT (GNU_call_site_value, DW_AT_GNU_call_site_value) \ DWARF_ONE_KNOWN_DW_AT (GNU_deleted, DW_AT_GNU_deleted) \ DWARF_ONE_KNOWN_DW_AT (GNU_denominator, DW_AT_GNU_denominator) \ DWARF_ONE_KNOWN_DW_AT (GNU_dwo_id, DW_AT_GNU_dwo_id) \ DWARF_ONE_KNOWN_DW_AT (GNU_dwo_name, DW_AT_GNU_dwo_name) \ DWARF_ONE_KNOWN_DW_AT (GNU_entry_view, DW_AT_GNU_entry_view) \ DWARF_ONE_KNOWN_DW_AT (GNU_exclusive_locks_required, DW_AT_GNU_exclusive_locks_required) \ DWARF_ONE_KNOWN_DW_AT (GNU_guarded, DW_AT_GNU_guarded) \ DWARF_ONE_KNOWN_DW_AT (GNU_guarded_by, DW_AT_GNU_guarded_by) \ DWARF_ONE_KNOWN_DW_AT (GNU_locks_excluded, DW_AT_GNU_locks_excluded) \ DWARF_ONE_KNOWN_DW_AT (GNU_locviews, DW_AT_GNU_locviews) \ DWARF_ONE_KNOWN_DW_AT (GNU_macros, DW_AT_GNU_macros) \ DWARF_ONE_KNOWN_DW_AT (GNU_numerator, DW_AT_GNU_numerator) \ DWARF_ONE_KNOWN_DW_AT (GNU_odr_signature, DW_AT_GNU_odr_signature) \ DWARF_ONE_KNOWN_DW_AT (GNU_pt_guarded, DW_AT_GNU_pt_guarded) \ DWARF_ONE_KNOWN_DW_AT (GNU_pt_guarded_by, DW_AT_GNU_pt_guarded_by) \ DWARF_ONE_KNOWN_DW_AT (GNU_pubnames, DW_AT_GNU_pubnames) \ DWARF_ONE_KNOWN_DW_AT (GNU_pubtypes, DW_AT_GNU_pubtypes) \ DWARF_ONE_KNOWN_DW_AT (GNU_ranges_base, DW_AT_GNU_ranges_base) \ DWARF_ONE_KNOWN_DW_AT (GNU_shared_locks_required, DW_AT_GNU_shared_locks_required) \ DWARF_ONE_KNOWN_DW_AT (GNU_tail_call, DW_AT_GNU_tail_call) \ DWARF_ONE_KNOWN_DW_AT (GNU_template_name, DW_AT_GNU_template_name) \ DWARF_ONE_KNOWN_DW_AT (GNU_vector, DW_AT_GNU_vector) \ DWARF_ONE_KNOWN_DW_AT (MIPS_abstract_name, DW_AT_MIPS_abstract_name) \ DWARF_ONE_KNOWN_DW_AT (MIPS_allocatable_dopetype, DW_AT_MIPS_allocatable_dopetype) \ DWARF_ONE_KNOWN_DW_AT (MIPS_assumed_shape_dopetype, DW_AT_MIPS_assumed_shape_dopetype) \ DWARF_ONE_KNOWN_DW_AT (MIPS_assumed_size, DW_AT_MIPS_assumed_size) \ DWARF_ONE_KNOWN_DW_AT (MIPS_clone_origin, DW_AT_MIPS_clone_origin) \ DWARF_ONE_KNOWN_DW_AT (MIPS_epilog_begin, DW_AT_MIPS_epilog_begin) \ DWARF_ONE_KNOWN_DW_AT (MIPS_fde, DW_AT_MIPS_fde) \ DWARF_ONE_KNOWN_DW_AT (MIPS_has_inlines, DW_AT_MIPS_has_inlines) \ DWARF_ONE_KNOWN_DW_AT (MIPS_linkage_name, DW_AT_MIPS_linkage_name) \ DWARF_ONE_KNOWN_DW_AT (MIPS_loop_begin, DW_AT_MIPS_loop_begin) \ DWARF_ONE_KNOWN_DW_AT (MIPS_loop_unroll_factor, DW_AT_MIPS_loop_unroll_factor) \ DWARF_ONE_KNOWN_DW_AT (MIPS_ptr_dopetype, DW_AT_MIPS_ptr_dopetype) \ DWARF_ONE_KNOWN_DW_AT (MIPS_software_pipeline_depth, DW_AT_MIPS_software_pipeline_depth) \ DWARF_ONE_KNOWN_DW_AT (MIPS_stride, DW_AT_MIPS_stride) \ DWARF_ONE_KNOWN_DW_AT (MIPS_stride_byte, DW_AT_MIPS_stride_byte) \ DWARF_ONE_KNOWN_DW_AT (MIPS_stride_elem, DW_AT_MIPS_stride_elem) \ DWARF_ONE_KNOWN_DW_AT (MIPS_tail_loop_begin, DW_AT_MIPS_tail_loop_begin) \ DWARF_ONE_KNOWN_DW_AT (abstract_origin, DW_AT_abstract_origin) \ DWARF_ONE_KNOWN_DW_AT (accessibility, DW_AT_accessibility) \ DWARF_ONE_KNOWN_DW_AT (addr_base, DW_AT_addr_base) \ DWARF_ONE_KNOWN_DW_AT (address_class, DW_AT_address_class) \ DWARF_ONE_KNOWN_DW_AT (alignment, DW_AT_alignment) \ DWARF_ONE_KNOWN_DW_AT (allocated, DW_AT_allocated) \ DWARF_ONE_KNOWN_DW_AT (artificial, DW_AT_artificial) \ DWARF_ONE_KNOWN_DW_AT (associated, DW_AT_associated) \ DWARF_ONE_KNOWN_DW_AT (base_types, DW_AT_base_types) \ DWARF_ONE_KNOWN_DW_AT (binary_scale, DW_AT_binary_scale) \ DWARF_ONE_KNOWN_DW_AT (bit_offset, DW_AT_bit_offset) \ DWARF_ONE_KNOWN_DW_AT (bit_size, DW_AT_bit_size) \ DWARF_ONE_KNOWN_DW_AT (bit_stride, DW_AT_bit_stride) \ DWARF_ONE_KNOWN_DW_AT (body_begin, DW_AT_body_begin) \ DWARF_ONE_KNOWN_DW_AT (body_end, DW_AT_body_end) \ DWARF_ONE_KNOWN_DW_AT (byte_size, DW_AT_byte_size) \ DWARF_ONE_KNOWN_DW_AT (byte_stride, DW_AT_byte_stride) \ DWARF_ONE_KNOWN_DW_AT (call_all_calls, DW_AT_call_all_calls) \ DWARF_ONE_KNOWN_DW_AT (call_all_source_calls, DW_AT_call_all_source_calls) \ DWARF_ONE_KNOWN_DW_AT (call_all_tail_calls, DW_AT_call_all_tail_calls) \ DWARF_ONE_KNOWN_DW_AT (call_column, DW_AT_call_column) \ DWARF_ONE_KNOWN_DW_AT (call_data_location, DW_AT_call_data_location) \ DWARF_ONE_KNOWN_DW_AT (call_data_value, DW_AT_call_data_value) \ DWARF_ONE_KNOWN_DW_AT (call_file, DW_AT_call_file) \ DWARF_ONE_KNOWN_DW_AT (call_line, DW_AT_call_line) \ DWARF_ONE_KNOWN_DW_AT (call_origin, DW_AT_call_origin) \ DWARF_ONE_KNOWN_DW_AT (call_parameter, DW_AT_call_parameter) \ DWARF_ONE_KNOWN_DW_AT (call_pc, DW_AT_call_pc) \ DWARF_ONE_KNOWN_DW_AT (call_return_pc, DW_AT_call_return_pc) \ DWARF_ONE_KNOWN_DW_AT (call_tail_call, DW_AT_call_tail_call) \ DWARF_ONE_KNOWN_DW_AT (call_target, DW_AT_call_target) \ DWARF_ONE_KNOWN_DW_AT (call_target_clobbered, DW_AT_call_target_clobbered) \ DWARF_ONE_KNOWN_DW_AT (call_value, DW_AT_call_value) \ DWARF_ONE_KNOWN_DW_AT (calling_convention, DW_AT_calling_convention) \ DWARF_ONE_KNOWN_DW_AT (common_reference, DW_AT_common_reference) \ DWARF_ONE_KNOWN_DW_AT (comp_dir, DW_AT_comp_dir) \ DWARF_ONE_KNOWN_DW_AT (const_expr, DW_AT_const_expr) \ DWARF_ONE_KNOWN_DW_AT (const_value, DW_AT_const_value) \ DWARF_ONE_KNOWN_DW_AT (containing_type, DW_AT_containing_type) \ DWARF_ONE_KNOWN_DW_AT (count, DW_AT_count) \ DWARF_ONE_KNOWN_DW_AT (data_bit_offset, DW_AT_data_bit_offset) \ DWARF_ONE_KNOWN_DW_AT (data_location, DW_AT_data_location) \ DWARF_ONE_KNOWN_DW_AT (data_member_location, DW_AT_data_member_location) \ DWARF_ONE_KNOWN_DW_AT (decimal_scale, DW_AT_decimal_scale) \ DWARF_ONE_KNOWN_DW_AT (decimal_sign, DW_AT_decimal_sign) \ DWARF_ONE_KNOWN_DW_AT (decl_column, DW_AT_decl_column) \ DWARF_ONE_KNOWN_DW_AT (decl_file, DW_AT_decl_file) \ DWARF_ONE_KNOWN_DW_AT (decl_line, DW_AT_decl_line) \ DWARF_ONE_KNOWN_DW_AT (declaration, DW_AT_declaration) \ DWARF_ONE_KNOWN_DW_AT (default_value, DW_AT_default_value) \ DWARF_ONE_KNOWN_DW_AT (defaulted, DW_AT_defaulted) \ DWARF_ONE_KNOWN_DW_AT (deleted, DW_AT_deleted) \ DWARF_ONE_KNOWN_DW_AT (description, DW_AT_description) \ DWARF_ONE_KNOWN_DW_AT (digit_count, DW_AT_digit_count) \ DWARF_ONE_KNOWN_DW_AT (discr, DW_AT_discr) \ DWARF_ONE_KNOWN_DW_AT (discr_list, DW_AT_discr_list) \ DWARF_ONE_KNOWN_DW_AT (discr_value, DW_AT_discr_value) \ DWARF_ONE_KNOWN_DW_AT (dwo_name, DW_AT_dwo_name) \ DWARF_ONE_KNOWN_DW_AT (elemental, DW_AT_elemental) \ DWARF_ONE_KNOWN_DW_AT (encoding, DW_AT_encoding) \ DWARF_ONE_KNOWN_DW_AT (endianity, DW_AT_endianity) \ DWARF_ONE_KNOWN_DW_AT (entry_pc, DW_AT_entry_pc) \ DWARF_ONE_KNOWN_DW_AT (enum_class, DW_AT_enum_class) \ DWARF_ONE_KNOWN_DW_AT (explicit, DW_AT_explicit) \ DWARF_ONE_KNOWN_DW_AT (export_symbols, DW_AT_export_symbols) \ DWARF_ONE_KNOWN_DW_AT (extension, DW_AT_extension) \ DWARF_ONE_KNOWN_DW_AT (external, DW_AT_external) \ DWARF_ONE_KNOWN_DW_AT (frame_base, DW_AT_frame_base) \ DWARF_ONE_KNOWN_DW_AT (friend, DW_AT_friend) \ DWARF_ONE_KNOWN_DW_AT (high_pc, DW_AT_high_pc) \ DWARF_ONE_KNOWN_DW_AT (identifier_case, DW_AT_identifier_case) \ DWARF_ONE_KNOWN_DW_AT (import, DW_AT_import) \ DWARF_ONE_KNOWN_DW_AT (inline, DW_AT_inline) \ DWARF_ONE_KNOWN_DW_AT (is_optional, DW_AT_is_optional) \ DWARF_ONE_KNOWN_DW_AT (language, DW_AT_language) \ DWARF_ONE_KNOWN_DW_AT (linkage_name, DW_AT_linkage_name) \ DWARF_ONE_KNOWN_DW_AT (location, DW_AT_location) \ DWARF_ONE_KNOWN_DW_AT (loclists_base, DW_AT_loclists_base) \ DWARF_ONE_KNOWN_DW_AT (low_pc, DW_AT_low_pc) \ DWARF_ONE_KNOWN_DW_AT (lower_bound, DW_AT_lower_bound) \ DWARF_ONE_KNOWN_DW_AT (mac_info, DW_AT_mac_info) \ DWARF_ONE_KNOWN_DW_AT (macro_info, DW_AT_macro_info) \ DWARF_ONE_KNOWN_DW_AT (macros, DW_AT_macros) \ DWARF_ONE_KNOWN_DW_AT (main_subprogram, DW_AT_main_subprogram) \ DWARF_ONE_KNOWN_DW_AT (mutable, DW_AT_mutable) \ DWARF_ONE_KNOWN_DW_AT (name, DW_AT_name) \ DWARF_ONE_KNOWN_DW_AT (namelist_item, DW_AT_namelist_item) \ DWARF_ONE_KNOWN_DW_AT (noreturn, DW_AT_noreturn) \ DWARF_ONE_KNOWN_DW_AT (object_pointer, DW_AT_object_pointer) \ DWARF_ONE_KNOWN_DW_AT (ordering, DW_AT_ordering) \ DWARF_ONE_KNOWN_DW_AT (picture_string, DW_AT_picture_string) \ DWARF_ONE_KNOWN_DW_AT (priority, DW_AT_priority) \ DWARF_ONE_KNOWN_DW_AT (producer, DW_AT_producer) \ DWARF_ONE_KNOWN_DW_AT (prototyped, DW_AT_prototyped) \ DWARF_ONE_KNOWN_DW_AT (pure, DW_AT_pure) \ DWARF_ONE_KNOWN_DW_AT (ranges, DW_AT_ranges) \ DWARF_ONE_KNOWN_DW_AT (rank, DW_AT_rank) \ DWARF_ONE_KNOWN_DW_AT (recursive, DW_AT_recursive) \ DWARF_ONE_KNOWN_DW_AT (reference, DW_AT_reference) \ DWARF_ONE_KNOWN_DW_AT (return_addr, DW_AT_return_addr) \ DWARF_ONE_KNOWN_DW_AT (rnglists_base, DW_AT_rnglists_base) \ DWARF_ONE_KNOWN_DW_AT (rvalue_reference, DW_AT_rvalue_reference) \ DWARF_ONE_KNOWN_DW_AT (segment, DW_AT_segment) \ DWARF_ONE_KNOWN_DW_AT (sf_names, DW_AT_sf_names) \ DWARF_ONE_KNOWN_DW_AT (sibling, DW_AT_sibling) \ DWARF_ONE_KNOWN_DW_AT (signature, DW_AT_signature) \ DWARF_ONE_KNOWN_DW_AT (small, DW_AT_small) \ DWARF_ONE_KNOWN_DW_AT (specification, DW_AT_specification) \ DWARF_ONE_KNOWN_DW_AT (src_coords, DW_AT_src_coords) \ DWARF_ONE_KNOWN_DW_AT (src_info, DW_AT_src_info) \ DWARF_ONE_KNOWN_DW_AT (start_scope, DW_AT_start_scope) \ DWARF_ONE_KNOWN_DW_AT (static_link, DW_AT_static_link) \ DWARF_ONE_KNOWN_DW_AT (stmt_list, DW_AT_stmt_list) \ DWARF_ONE_KNOWN_DW_AT (str_offsets_base, DW_AT_str_offsets_base) \ DWARF_ONE_KNOWN_DW_AT (string_length, DW_AT_string_length) \ DWARF_ONE_KNOWN_DW_AT (string_length_bit_size, DW_AT_string_length_bit_size) \ DWARF_ONE_KNOWN_DW_AT (string_length_byte_size, DW_AT_string_length_byte_size) \ DWARF_ONE_KNOWN_DW_AT (threads_scaled, DW_AT_threads_scaled) \ DWARF_ONE_KNOWN_DW_AT (trampoline, DW_AT_trampoline) \ DWARF_ONE_KNOWN_DW_AT (type, DW_AT_type) \ DWARF_ONE_KNOWN_DW_AT (upper_bound, DW_AT_upper_bound) \ DWARF_ONE_KNOWN_DW_AT (use_UTF8, DW_AT_use_UTF8) \ DWARF_ONE_KNOWN_DW_AT (use_location, DW_AT_use_location) \ DWARF_ONE_KNOWN_DW_AT (variable_parameter, DW_AT_variable_parameter) \ DWARF_ONE_KNOWN_DW_AT (virtuality, DW_AT_virtuality) \ DWARF_ONE_KNOWN_DW_AT (visibility, DW_AT_visibility) \ DWARF_ONE_KNOWN_DW_AT (vtable_elem_location, DW_AT_vtable_elem_location) \ /* End of DW_AT_*. */ #define DWARF_ALL_KNOWN_DW_ATE \ DWARF_ONE_KNOWN_DW_ATE (ASCII, DW_ATE_ASCII) \ DWARF_ONE_KNOWN_DW_ATE (UCS, DW_ATE_UCS) \ DWARF_ONE_KNOWN_DW_ATE (UTF, DW_ATE_UTF) \ DWARF_ONE_KNOWN_DW_ATE (address, DW_ATE_address) \ DWARF_ONE_KNOWN_DW_ATE (boolean, DW_ATE_boolean) \ DWARF_ONE_KNOWN_DW_ATE (complex_float, DW_ATE_complex_float) \ DWARF_ONE_KNOWN_DW_ATE (decimal_float, DW_ATE_decimal_float) \ DWARF_ONE_KNOWN_DW_ATE (edited, DW_ATE_edited) \ DWARF_ONE_KNOWN_DW_ATE (float, DW_ATE_float) \ DWARF_ONE_KNOWN_DW_ATE (imaginary_float, DW_ATE_imaginary_float) \ DWARF_ONE_KNOWN_DW_ATE (numeric_string, DW_ATE_numeric_string) \ DWARF_ONE_KNOWN_DW_ATE (packed_decimal, DW_ATE_packed_decimal) \ DWARF_ONE_KNOWN_DW_ATE (signed, DW_ATE_signed) \ DWARF_ONE_KNOWN_DW_ATE (signed_char, DW_ATE_signed_char) \ DWARF_ONE_KNOWN_DW_ATE (signed_fixed, DW_ATE_signed_fixed) \ DWARF_ONE_KNOWN_DW_ATE (unsigned, DW_ATE_unsigned) \ DWARF_ONE_KNOWN_DW_ATE (unsigned_char, DW_ATE_unsigned_char) \ DWARF_ONE_KNOWN_DW_ATE (unsigned_fixed, DW_ATE_unsigned_fixed) \ DWARF_ONE_KNOWN_DW_ATE (void, DW_ATE_void) \ /* End of DW_ATE_*. */ #define DWARF_ALL_KNOWN_DW_CC \ DWARF_ONE_KNOWN_DW_CC (nocall, DW_CC_nocall) \ DWARF_ONE_KNOWN_DW_CC (normal, DW_CC_normal) \ DWARF_ONE_KNOWN_DW_CC (pass_by_reference, DW_CC_pass_by_reference) \ DWARF_ONE_KNOWN_DW_CC (pass_by_value, DW_CC_pass_by_value) \ DWARF_ONE_KNOWN_DW_CC (program, DW_CC_program) \ /* End of DW_CC_*. */ #define DWARF_ALL_KNOWN_DW_CFA \ DWARF_ONE_KNOWN_DW_CFA (AARCH64_negate_ra_state, DW_CFA_AARCH64_negate_ra_state) \ DWARF_ONE_KNOWN_DW_CFA (GNU_args_size, DW_CFA_GNU_args_size) \ DWARF_ONE_KNOWN_DW_CFA (GNU_negative_offset_extended, DW_CFA_GNU_negative_offset_extended) \ DWARF_ONE_KNOWN_DW_CFA (GNU_window_save, DW_CFA_GNU_window_save) \ DWARF_ONE_KNOWN_DW_CFA (MIPS_advance_loc8, DW_CFA_MIPS_advance_loc8) \ DWARF_ONE_KNOWN_DW_CFA (advance_loc, DW_CFA_advance_loc) \ DWARF_ONE_KNOWN_DW_CFA (advance_loc1, DW_CFA_advance_loc1) \ DWARF_ONE_KNOWN_DW_CFA (advance_loc2, DW_CFA_advance_loc2) \ DWARF_ONE_KNOWN_DW_CFA (advance_loc4, DW_CFA_advance_loc4) \ DWARF_ONE_KNOWN_DW_CFA (def_cfa, DW_CFA_def_cfa) \ DWARF_ONE_KNOWN_DW_CFA (def_cfa_expression, DW_CFA_def_cfa_expression) \ DWARF_ONE_KNOWN_DW_CFA (def_cfa_offset, DW_CFA_def_cfa_offset) \ DWARF_ONE_KNOWN_DW_CFA (def_cfa_offset_sf, DW_CFA_def_cfa_offset_sf) \ DWARF_ONE_KNOWN_DW_CFA (def_cfa_register, DW_CFA_def_cfa_register) \ DWARF_ONE_KNOWN_DW_CFA (def_cfa_sf, DW_CFA_def_cfa_sf) \ DWARF_ONE_KNOWN_DW_CFA (expression, DW_CFA_expression) \ DWARF_ONE_KNOWN_DW_CFA (extended, DW_CFA_extended) \ DWARF_ONE_KNOWN_DW_CFA (nop, DW_CFA_nop) \ DWARF_ONE_KNOWN_DW_CFA (offset, DW_CFA_offset) \ DWARF_ONE_KNOWN_DW_CFA (offset_extended, DW_CFA_offset_extended) \ DWARF_ONE_KNOWN_DW_CFA (offset_extended_sf, DW_CFA_offset_extended_sf) \ DWARF_ONE_KNOWN_DW_CFA (register, DW_CFA_register) \ DWARF_ONE_KNOWN_DW_CFA (remember_state, DW_CFA_remember_state) \ DWARF_ONE_KNOWN_DW_CFA (restore, DW_CFA_restore) \ DWARF_ONE_KNOWN_DW_CFA (restore_extended, DW_CFA_restore_extended) \ DWARF_ONE_KNOWN_DW_CFA (restore_state, DW_CFA_restore_state) \ DWARF_ONE_KNOWN_DW_CFA (same_value, DW_CFA_same_value) \ DWARF_ONE_KNOWN_DW_CFA (set_loc, DW_CFA_set_loc) \ DWARF_ONE_KNOWN_DW_CFA (undefined, DW_CFA_undefined) \ DWARF_ONE_KNOWN_DW_CFA (val_expression, DW_CFA_val_expression) \ DWARF_ONE_KNOWN_DW_CFA (val_offset, DW_CFA_val_offset) \ DWARF_ONE_KNOWN_DW_CFA (val_offset_sf, DW_CFA_val_offset_sf) \ /* End of DW_CFA_*. */ #define DWARF_ALL_KNOWN_DW_CHILDREN \ DWARF_ONE_KNOWN_DW_CHILDREN (no, DW_CHILDREN_no) \ DWARF_ONE_KNOWN_DW_CHILDREN (yes, DW_CHILDREN_yes) \ /* End of DW_CHILDREN_*. */ #define DWARF_ALL_KNOWN_DW_CIE_ID \ DWARF_ONE_KNOWN_DW_CIE_ID (32, DW_CIE_ID_32) \ DWARF_ONE_KNOWN_DW_CIE_ID (64, DW_CIE_ID_64) \ /* End of DW_CIE_ID_*. */ #define DWARF_ALL_KNOWN_DW_DEFAULTED \ DWARF_ONE_KNOWN_DW_DEFAULTED (in_class, DW_DEFAULTED_in_class) \ DWARF_ONE_KNOWN_DW_DEFAULTED (no, DW_DEFAULTED_no) \ DWARF_ONE_KNOWN_DW_DEFAULTED (out_of_class, DW_DEFAULTED_out_of_class) \ /* End of DW_DEFAULTED_*. */ #define DWARF_ALL_KNOWN_DW_DS \ DWARF_ONE_KNOWN_DW_DS (leading_overpunch, DW_DS_leading_overpunch) \ DWARF_ONE_KNOWN_DW_DS (leading_separate, DW_DS_leading_separate) \ DWARF_ONE_KNOWN_DW_DS (trailing_overpunch, DW_DS_trailing_overpunch) \ DWARF_ONE_KNOWN_DW_DS (trailing_separate, DW_DS_trailing_separate) \ DWARF_ONE_KNOWN_DW_DS (unsigned, DW_DS_unsigned) \ /* End of DW_DS_*. */ #define DWARF_ALL_KNOWN_DW_DSC \ DWARF_ONE_KNOWN_DW_DSC (label, DW_DSC_label) \ DWARF_ONE_KNOWN_DW_DSC (range, DW_DSC_range) \ /* End of DW_DSC_*. */ #define DWARF_ALL_KNOWN_DW_EH_PE \ DWARF_ONE_KNOWN_DW_EH_PE (absptr, DW_EH_PE_absptr) \ DWARF_ONE_KNOWN_DW_EH_PE (aligned, DW_EH_PE_aligned) \ DWARF_ONE_KNOWN_DW_EH_PE (datarel, DW_EH_PE_datarel) \ DWARF_ONE_KNOWN_DW_EH_PE (funcrel, DW_EH_PE_funcrel) \ DWARF_ONE_KNOWN_DW_EH_PE (indirect, DW_EH_PE_indirect) \ DWARF_ONE_KNOWN_DW_EH_PE (omit, DW_EH_PE_omit) \ DWARF_ONE_KNOWN_DW_EH_PE (pcrel, DW_EH_PE_pcrel) \ DWARF_ONE_KNOWN_DW_EH_PE (sdata2, DW_EH_PE_sdata2) \ DWARF_ONE_KNOWN_DW_EH_PE (sdata4, DW_EH_PE_sdata4) \ DWARF_ONE_KNOWN_DW_EH_PE (sdata8, DW_EH_PE_sdata8) \ DWARF_ONE_KNOWN_DW_EH_PE (signed, DW_EH_PE_signed) \ DWARF_ONE_KNOWN_DW_EH_PE (sleb128, DW_EH_PE_sleb128) \ DWARF_ONE_KNOWN_DW_EH_PE (textrel, DW_EH_PE_textrel) \ DWARF_ONE_KNOWN_DW_EH_PE (udata2, DW_EH_PE_udata2) \ DWARF_ONE_KNOWN_DW_EH_PE (udata4, DW_EH_PE_udata4) \ DWARF_ONE_KNOWN_DW_EH_PE (udata8, DW_EH_PE_udata8) \ DWARF_ONE_KNOWN_DW_EH_PE (uleb128, DW_EH_PE_uleb128) \ /* End of DW_EH_PE_*. */ #define DWARF_ALL_KNOWN_DW_END \ DWARF_ONE_KNOWN_DW_END (big, DW_END_big) \ DWARF_ONE_KNOWN_DW_END (default, DW_END_default) \ DWARF_ONE_KNOWN_DW_END (little, DW_END_little) \ /* End of DW_END_*. */ #define DWARF_ALL_KNOWN_DW_FORM \ DWARF_ONE_KNOWN_DW_FORM (GNU_addr_index, DW_FORM_GNU_addr_index) \ DWARF_ONE_KNOWN_DW_FORM (GNU_ref_alt, DW_FORM_GNU_ref_alt) \ DWARF_ONE_KNOWN_DW_FORM (GNU_str_index, DW_FORM_GNU_str_index) \ DWARF_ONE_KNOWN_DW_FORM (GNU_strp_alt, DW_FORM_GNU_strp_alt) \ DWARF_ONE_KNOWN_DW_FORM (addr, DW_FORM_addr) \ DWARF_ONE_KNOWN_DW_FORM (addrx, DW_FORM_addrx) \ DWARF_ONE_KNOWN_DW_FORM (addrx1, DW_FORM_addrx1) \ DWARF_ONE_KNOWN_DW_FORM (addrx2, DW_FORM_addrx2) \ DWARF_ONE_KNOWN_DW_FORM (addrx3, DW_FORM_addrx3) \ DWARF_ONE_KNOWN_DW_FORM (addrx4, DW_FORM_addrx4) \ DWARF_ONE_KNOWN_DW_FORM (block, DW_FORM_block) \ DWARF_ONE_KNOWN_DW_FORM (block1, DW_FORM_block1) \ DWARF_ONE_KNOWN_DW_FORM (block2, DW_FORM_block2) \ DWARF_ONE_KNOWN_DW_FORM (block4, DW_FORM_block4) \ DWARF_ONE_KNOWN_DW_FORM (data1, DW_FORM_data1) \ DWARF_ONE_KNOWN_DW_FORM (data16, DW_FORM_data16) \ DWARF_ONE_KNOWN_DW_FORM (data2, DW_FORM_data2) \ DWARF_ONE_KNOWN_DW_FORM (data4, DW_FORM_data4) \ DWARF_ONE_KNOWN_DW_FORM (data8, DW_FORM_data8) \ DWARF_ONE_KNOWN_DW_FORM (exprloc, DW_FORM_exprloc) \ DWARF_ONE_KNOWN_DW_FORM (flag, DW_FORM_flag) \ DWARF_ONE_KNOWN_DW_FORM (flag_present, DW_FORM_flag_present) \ DWARF_ONE_KNOWN_DW_FORM (implicit_const, DW_FORM_implicit_const) \ DWARF_ONE_KNOWN_DW_FORM (indirect, DW_FORM_indirect) \ DWARF_ONE_KNOWN_DW_FORM (line_strp, DW_FORM_line_strp) \ DWARF_ONE_KNOWN_DW_FORM (loclistx, DW_FORM_loclistx) \ DWARF_ONE_KNOWN_DW_FORM (ref1, DW_FORM_ref1) \ DWARF_ONE_KNOWN_DW_FORM (ref2, DW_FORM_ref2) \ DWARF_ONE_KNOWN_DW_FORM (ref4, DW_FORM_ref4) \ DWARF_ONE_KNOWN_DW_FORM (ref8, DW_FORM_ref8) \ DWARF_ONE_KNOWN_DW_FORM (ref_addr, DW_FORM_ref_addr) \ DWARF_ONE_KNOWN_DW_FORM (ref_sig8, DW_FORM_ref_sig8) \ DWARF_ONE_KNOWN_DW_FORM (ref_sup4, DW_FORM_ref_sup4) \ DWARF_ONE_KNOWN_DW_FORM (ref_sup8, DW_FORM_ref_sup8) \ DWARF_ONE_KNOWN_DW_FORM (ref_udata, DW_FORM_ref_udata) \ DWARF_ONE_KNOWN_DW_FORM (rnglistx, DW_FORM_rnglistx) \ DWARF_ONE_KNOWN_DW_FORM (sdata, DW_FORM_sdata) \ DWARF_ONE_KNOWN_DW_FORM (sec_offset, DW_FORM_sec_offset) \ DWARF_ONE_KNOWN_DW_FORM (string, DW_FORM_string) \ DWARF_ONE_KNOWN_DW_FORM (strp, DW_FORM_strp) \ DWARF_ONE_KNOWN_DW_FORM (strp_sup, DW_FORM_strp_sup) \ DWARF_ONE_KNOWN_DW_FORM (strx, DW_FORM_strx) \ DWARF_ONE_KNOWN_DW_FORM (strx1, DW_FORM_strx1) \ DWARF_ONE_KNOWN_DW_FORM (strx2, DW_FORM_strx2) \ DWARF_ONE_KNOWN_DW_FORM (strx3, DW_FORM_strx3) \ DWARF_ONE_KNOWN_DW_FORM (strx4, DW_FORM_strx4) \ DWARF_ONE_KNOWN_DW_FORM (udata, DW_FORM_udata) \ /* End of DW_FORM_*. */ #define DWARF_ALL_KNOWN_DW_ID \ DWARF_ONE_KNOWN_DW_ID (case_insensitive, DW_ID_case_insensitive) \ DWARF_ONE_KNOWN_DW_ID (case_sensitive, DW_ID_case_sensitive) \ DWARF_ONE_KNOWN_DW_ID (down_case, DW_ID_down_case) \ DWARF_ONE_KNOWN_DW_ID (up_case, DW_ID_up_case) \ /* End of DW_ID_*. */ #define DWARF_ALL_KNOWN_DW_INL \ DWARF_ONE_KNOWN_DW_INL (declared_inlined, DW_INL_declared_inlined) \ DWARF_ONE_KNOWN_DW_INL (declared_not_inlined, DW_INL_declared_not_inlined) \ DWARF_ONE_KNOWN_DW_INL (inlined, DW_INL_inlined) \ DWARF_ONE_KNOWN_DW_INL (not_inlined, DW_INL_not_inlined) \ /* End of DW_INL_*. */ #define DWARF_ALL_KNOWN_DW_LANG \ DWARF_ONE_KNOWN_DW_LANG (Ada83, DW_LANG_Ada83) \ DWARF_ONE_KNOWN_DW_LANG (Ada95, DW_LANG_Ada95) \ DWARF_ONE_KNOWN_DW_LANG (BLISS, DW_LANG_BLISS) \ DWARF_ONE_KNOWN_DW_LANG (C, DW_LANG_C) \ DWARF_ONE_KNOWN_DW_LANG (C11, DW_LANG_C11) \ DWARF_ONE_KNOWN_DW_LANG (C89, DW_LANG_C89) \ DWARF_ONE_KNOWN_DW_LANG (C99, DW_LANG_C99) \ DWARF_ONE_KNOWN_DW_LANG (C_plus_plus, DW_LANG_C_plus_plus) \ DWARF_ONE_KNOWN_DW_LANG (C_plus_plus_03, DW_LANG_C_plus_plus_03) \ DWARF_ONE_KNOWN_DW_LANG (C_plus_plus_11, DW_LANG_C_plus_plus_11) \ DWARF_ONE_KNOWN_DW_LANG (C_plus_plus_14, DW_LANG_C_plus_plus_14) \ DWARF_ONE_KNOWN_DW_LANG (Cobol74, DW_LANG_Cobol74) \ DWARF_ONE_KNOWN_DW_LANG (Cobol85, DW_LANG_Cobol85) \ DWARF_ONE_KNOWN_DW_LANG (D, DW_LANG_D) \ DWARF_ONE_KNOWN_DW_LANG (Dylan, DW_LANG_Dylan) \ DWARF_ONE_KNOWN_DW_LANG (Fortran03, DW_LANG_Fortran03) \ DWARF_ONE_KNOWN_DW_LANG (Fortran08, DW_LANG_Fortran08) \ DWARF_ONE_KNOWN_DW_LANG (Fortran77, DW_LANG_Fortran77) \ DWARF_ONE_KNOWN_DW_LANG (Fortran90, DW_LANG_Fortran90) \ DWARF_ONE_KNOWN_DW_LANG (Fortran95, DW_LANG_Fortran95) \ DWARF_ONE_KNOWN_DW_LANG (Go, DW_LANG_Go) \ DWARF_ONE_KNOWN_DW_LANG (Haskell, DW_LANG_Haskell) \ DWARF_ONE_KNOWN_DW_LANG (Java, DW_LANG_Java) \ DWARF_ONE_KNOWN_DW_LANG (Julia, DW_LANG_Julia) \ DWARF_ONE_KNOWN_DW_LANG (Mips_Assembler, DW_LANG_Mips_Assembler) \ DWARF_ONE_KNOWN_DW_LANG (Modula2, DW_LANG_Modula2) \ DWARF_ONE_KNOWN_DW_LANG (Modula3, DW_LANG_Modula3) \ DWARF_ONE_KNOWN_DW_LANG (OCaml, DW_LANG_OCaml) \ DWARF_ONE_KNOWN_DW_LANG (ObjC, DW_LANG_ObjC) \ DWARF_ONE_KNOWN_DW_LANG (ObjC_plus_plus, DW_LANG_ObjC_plus_plus) \ DWARF_ONE_KNOWN_DW_LANG (OpenCL, DW_LANG_OpenCL) \ DWARF_ONE_KNOWN_DW_LANG (PLI, DW_LANG_PLI) \ DWARF_ONE_KNOWN_DW_LANG (Pascal83, DW_LANG_Pascal83) \ DWARF_ONE_KNOWN_DW_LANG (Python, DW_LANG_Python) \ DWARF_ONE_KNOWN_DW_LANG (RenderScript, DW_LANG_RenderScript) \ DWARF_ONE_KNOWN_DW_LANG (Rust, DW_LANG_Rust) \ DWARF_ONE_KNOWN_DW_LANG (Swift, DW_LANG_Swift) \ DWARF_ONE_KNOWN_DW_LANG (UPC, DW_LANG_UPC) \ /* End of DW_LANG_*. */ #define DWARF_ALL_KNOWN_DW_LLE \ DWARF_ONE_KNOWN_DW_LLE (base_address, DW_LLE_base_address) \ DWARF_ONE_KNOWN_DW_LLE (base_addressx, DW_LLE_base_addressx) \ DWARF_ONE_KNOWN_DW_LLE (default_location, DW_LLE_default_location) \ DWARF_ONE_KNOWN_DW_LLE (end_of_list, DW_LLE_end_of_list) \ DWARF_ONE_KNOWN_DW_LLE (offset_pair, DW_LLE_offset_pair) \ DWARF_ONE_KNOWN_DW_LLE (start_end, DW_LLE_start_end) \ DWARF_ONE_KNOWN_DW_LLE (start_length, DW_LLE_start_length) \ DWARF_ONE_KNOWN_DW_LLE (startx_endx, DW_LLE_startx_endx) \ DWARF_ONE_KNOWN_DW_LLE (startx_length, DW_LLE_startx_length) \ /* End of DW_LLE_*. */ #define DWARF_ALL_KNOWN_DW_LLE_GNU \ DWARF_ONE_KNOWN_DW_LLE_GNU (base_address_selection_entry, DW_LLE_GNU_base_address_selection_entry) \ DWARF_ONE_KNOWN_DW_LLE_GNU (end_of_list_entry, DW_LLE_GNU_end_of_list_entry) \ DWARF_ONE_KNOWN_DW_LLE_GNU (start_end_entry, DW_LLE_GNU_start_end_entry) \ DWARF_ONE_KNOWN_DW_LLE_GNU (start_length_entry, DW_LLE_GNU_start_length_entry) \ DWARF_ONE_KNOWN_DW_LLE_GNU (view_pair, DW_LLE_GNU_view_pair) \ /* End of DW_LLE_GNU_*. */ #define DWARF_ALL_KNOWN_DW_LNCT \ DWARF_ONE_KNOWN_DW_LNCT (MD5, DW_LNCT_MD5) \ DWARF_ONE_KNOWN_DW_LNCT (directory_index, DW_LNCT_directory_index) \ DWARF_ONE_KNOWN_DW_LNCT (path, DW_LNCT_path) \ DWARF_ONE_KNOWN_DW_LNCT (size, DW_LNCT_size) \ DWARF_ONE_KNOWN_DW_LNCT (timestamp, DW_LNCT_timestamp) \ /* End of DW_LNCT_*. */ #define DWARF_ALL_KNOWN_DW_LNE \ DWARF_ONE_KNOWN_DW_LNE (NVIDIA_inlined_call, DW_LNE_NVIDIA_inlined_call) \ DWARF_ONE_KNOWN_DW_LNE (NVIDIA_set_function_name, DW_LNE_NVIDIA_set_function_name) \ DWARF_ONE_KNOWN_DW_LNE (define_file, DW_LNE_define_file) \ DWARF_ONE_KNOWN_DW_LNE (end_sequence, DW_LNE_end_sequence) \ DWARF_ONE_KNOWN_DW_LNE (set_address, DW_LNE_set_address) \ DWARF_ONE_KNOWN_DW_LNE (set_discriminator, DW_LNE_set_discriminator) \ /* End of DW_LNE_*. */ #define DWARF_ALL_KNOWN_DW_LNS \ DWARF_ONE_KNOWN_DW_LNS (advance_line, DW_LNS_advance_line) \ DWARF_ONE_KNOWN_DW_LNS (advance_pc, DW_LNS_advance_pc) \ DWARF_ONE_KNOWN_DW_LNS (const_add_pc, DW_LNS_const_add_pc) \ DWARF_ONE_KNOWN_DW_LNS (copy, DW_LNS_copy) \ DWARF_ONE_KNOWN_DW_LNS (fixed_advance_pc, DW_LNS_fixed_advance_pc) \ DWARF_ONE_KNOWN_DW_LNS (negate_stmt, DW_LNS_negate_stmt) \ DWARF_ONE_KNOWN_DW_LNS (set_basic_block, DW_LNS_set_basic_block) \ DWARF_ONE_KNOWN_DW_LNS (set_column, DW_LNS_set_column) \ DWARF_ONE_KNOWN_DW_LNS (set_epilogue_begin, DW_LNS_set_epilogue_begin) \ DWARF_ONE_KNOWN_DW_LNS (set_file, DW_LNS_set_file) \ DWARF_ONE_KNOWN_DW_LNS (set_isa, DW_LNS_set_isa) \ DWARF_ONE_KNOWN_DW_LNS (set_prologue_end, DW_LNS_set_prologue_end) \ /* End of DW_LNS_*. */ #define DWARF_ALL_KNOWN_DW_MACINFO \ DWARF_ONE_KNOWN_DW_MACINFO (define, DW_MACINFO_define) \ DWARF_ONE_KNOWN_DW_MACINFO (end_file, DW_MACINFO_end_file) \ DWARF_ONE_KNOWN_DW_MACINFO (start_file, DW_MACINFO_start_file) \ DWARF_ONE_KNOWN_DW_MACINFO (undef, DW_MACINFO_undef) \ DWARF_ONE_KNOWN_DW_MACINFO (vendor_ext, DW_MACINFO_vendor_ext) \ /* End of DW_MACINFO_*. */ #define DWARF_ALL_KNOWN_DW_MACRO \ DWARF_ONE_KNOWN_DW_MACRO (define, DW_MACRO_define) \ DWARF_ONE_KNOWN_DW_MACRO (define_strp, DW_MACRO_define_strp) \ DWARF_ONE_KNOWN_DW_MACRO (define_strx, DW_MACRO_define_strx) \ DWARF_ONE_KNOWN_DW_MACRO (define_sup, DW_MACRO_define_sup) \ DWARF_ONE_KNOWN_DW_MACRO (end_file, DW_MACRO_end_file) \ DWARF_ONE_KNOWN_DW_MACRO (import, DW_MACRO_import) \ DWARF_ONE_KNOWN_DW_MACRO (import_sup, DW_MACRO_import_sup) \ DWARF_ONE_KNOWN_DW_MACRO (start_file, DW_MACRO_start_file) \ DWARF_ONE_KNOWN_DW_MACRO (undef, DW_MACRO_undef) \ DWARF_ONE_KNOWN_DW_MACRO (undef_strp, DW_MACRO_undef_strp) \ DWARF_ONE_KNOWN_DW_MACRO (undef_strx, DW_MACRO_undef_strx) \ DWARF_ONE_KNOWN_DW_MACRO (undef_sup, DW_MACRO_undef_sup) \ /* End of DW_MACRO_*. */ #define DWARF_ALL_KNOWN_DW_OP \ DWARF_ONE_KNOWN_DW_OP (GNU_addr_index, DW_OP_GNU_addr_index) \ DWARF_ONE_KNOWN_DW_OP (GNU_const_index, DW_OP_GNU_const_index) \ DWARF_ONE_KNOWN_DW_OP (GNU_const_type, DW_OP_GNU_const_type) \ DWARF_ONE_KNOWN_DW_OP (GNU_convert, DW_OP_GNU_convert) \ DWARF_ONE_KNOWN_DW_OP (GNU_deref_type, DW_OP_GNU_deref_type) \ DWARF_ONE_KNOWN_DW_OP (GNU_encoded_addr, DW_OP_GNU_encoded_addr) \ DWARF_ONE_KNOWN_DW_OP (GNU_entry_value, DW_OP_GNU_entry_value) \ DWARF_ONE_KNOWN_DW_OP (GNU_implicit_pointer, DW_OP_GNU_implicit_pointer) \ DWARF_ONE_KNOWN_DW_OP (GNU_parameter_ref, DW_OP_GNU_parameter_ref) \ DWARF_ONE_KNOWN_DW_OP (GNU_push_tls_address, DW_OP_GNU_push_tls_address) \ DWARF_ONE_KNOWN_DW_OP (GNU_regval_type, DW_OP_GNU_regval_type) \ DWARF_ONE_KNOWN_DW_OP (GNU_reinterpret, DW_OP_GNU_reinterpret) \ DWARF_ONE_KNOWN_DW_OP (GNU_uninit, DW_OP_GNU_uninit) \ DWARF_ONE_KNOWN_DW_OP (GNU_variable_value, DW_OP_GNU_variable_value) \ DWARF_ONE_KNOWN_DW_OP (abs, DW_OP_abs) \ DWARF_ONE_KNOWN_DW_OP (addr, DW_OP_addr) \ DWARF_ONE_KNOWN_DW_OP (addrx, DW_OP_addrx) \ DWARF_ONE_KNOWN_DW_OP (and, DW_OP_and) \ DWARF_ONE_KNOWN_DW_OP (bit_piece, DW_OP_bit_piece) \ DWARF_ONE_KNOWN_DW_OP (bra, DW_OP_bra) \ DWARF_ONE_KNOWN_DW_OP (breg0, DW_OP_breg0) \ DWARF_ONE_KNOWN_DW_OP (breg1, DW_OP_breg1) \ DWARF_ONE_KNOWN_DW_OP (breg10, DW_OP_breg10) \ DWARF_ONE_KNOWN_DW_OP (breg11, DW_OP_breg11) \ DWARF_ONE_KNOWN_DW_OP (breg12, DW_OP_breg12) \ DWARF_ONE_KNOWN_DW_OP (breg13, DW_OP_breg13) \ DWARF_ONE_KNOWN_DW_OP (breg14, DW_OP_breg14) \ DWARF_ONE_KNOWN_DW_OP (breg15, DW_OP_breg15) \ DWARF_ONE_KNOWN_DW_OP (breg16, DW_OP_breg16) \ DWARF_ONE_KNOWN_DW_OP (breg17, DW_OP_breg17) \ DWARF_ONE_KNOWN_DW_OP (breg18, DW_OP_breg18) \ DWARF_ONE_KNOWN_DW_OP (breg19, DW_OP_breg19) \ DWARF_ONE_KNOWN_DW_OP (breg2, DW_OP_breg2) \ DWARF_ONE_KNOWN_DW_OP (breg20, DW_OP_breg20) \ DWARF_ONE_KNOWN_DW_OP (breg21, DW_OP_breg21) \ DWARF_ONE_KNOWN_DW_OP (breg22, DW_OP_breg22) \ DWARF_ONE_KNOWN_DW_OP (breg23, DW_OP_breg23) \ DWARF_ONE_KNOWN_DW_OP (breg24, DW_OP_breg24) \ DWARF_ONE_KNOWN_DW_OP (breg25, DW_OP_breg25) \ DWARF_ONE_KNOWN_DW_OP (breg26, DW_OP_breg26) \ DWARF_ONE_KNOWN_DW_OP (breg27, DW_OP_breg27) \ DWARF_ONE_KNOWN_DW_OP (breg28, DW_OP_breg28) \ DWARF_ONE_KNOWN_DW_OP (breg29, DW_OP_breg29) \ DWARF_ONE_KNOWN_DW_OP (breg3, DW_OP_breg3) \ DWARF_ONE_KNOWN_DW_OP (breg30, DW_OP_breg30) \ DWARF_ONE_KNOWN_DW_OP (breg31, DW_OP_breg31) \ DWARF_ONE_KNOWN_DW_OP (breg4, DW_OP_breg4) \ DWARF_ONE_KNOWN_DW_OP (breg5, DW_OP_breg5) \ DWARF_ONE_KNOWN_DW_OP (breg6, DW_OP_breg6) \ DWARF_ONE_KNOWN_DW_OP (breg7, DW_OP_breg7) \ DWARF_ONE_KNOWN_DW_OP (breg8, DW_OP_breg8) \ DWARF_ONE_KNOWN_DW_OP (breg9, DW_OP_breg9) \ DWARF_ONE_KNOWN_DW_OP (bregx, DW_OP_bregx) \ DWARF_ONE_KNOWN_DW_OP (call2, DW_OP_call2) \ DWARF_ONE_KNOWN_DW_OP (call4, DW_OP_call4) \ DWARF_ONE_KNOWN_DW_OP (call_frame_cfa, DW_OP_call_frame_cfa) \ DWARF_ONE_KNOWN_DW_OP (call_ref, DW_OP_call_ref) \ DWARF_ONE_KNOWN_DW_OP (const1s, DW_OP_const1s) \ DWARF_ONE_KNOWN_DW_OP (const1u, DW_OP_const1u) \ DWARF_ONE_KNOWN_DW_OP (const2s, DW_OP_const2s) \ DWARF_ONE_KNOWN_DW_OP (const2u, DW_OP_const2u) \ DWARF_ONE_KNOWN_DW_OP (const4s, DW_OP_const4s) \ DWARF_ONE_KNOWN_DW_OP (const4u, DW_OP_const4u) \ DWARF_ONE_KNOWN_DW_OP (const8s, DW_OP_const8s) \ DWARF_ONE_KNOWN_DW_OP (const8u, DW_OP_const8u) \ DWARF_ONE_KNOWN_DW_OP (const_type, DW_OP_const_type) \ DWARF_ONE_KNOWN_DW_OP (consts, DW_OP_consts) \ DWARF_ONE_KNOWN_DW_OP (constu, DW_OP_constu) \ DWARF_ONE_KNOWN_DW_OP (constx, DW_OP_constx) \ DWARF_ONE_KNOWN_DW_OP (convert, DW_OP_convert) \ DWARF_ONE_KNOWN_DW_OP (deref, DW_OP_deref) \ DWARF_ONE_KNOWN_DW_OP (deref_size, DW_OP_deref_size) \ DWARF_ONE_KNOWN_DW_OP (deref_type, DW_OP_deref_type) \ DWARF_ONE_KNOWN_DW_OP (div, DW_OP_div) \ DWARF_ONE_KNOWN_DW_OP (drop, DW_OP_drop) \ DWARF_ONE_KNOWN_DW_OP (dup, DW_OP_dup) \ DWARF_ONE_KNOWN_DW_OP (entry_value, DW_OP_entry_value) \ DWARF_ONE_KNOWN_DW_OP (eq, DW_OP_eq) \ DWARF_ONE_KNOWN_DW_OP (fbreg, DW_OP_fbreg) \ DWARF_ONE_KNOWN_DW_OP (form_tls_address, DW_OP_form_tls_address) \ DWARF_ONE_KNOWN_DW_OP (ge, DW_OP_ge) \ DWARF_ONE_KNOWN_DW_OP (gt, DW_OP_gt) \ DWARF_ONE_KNOWN_DW_OP (implicit_pointer, DW_OP_implicit_pointer) \ DWARF_ONE_KNOWN_DW_OP (implicit_value, DW_OP_implicit_value) \ DWARF_ONE_KNOWN_DW_OP (le, DW_OP_le) \ DWARF_ONE_KNOWN_DW_OP (lit0, DW_OP_lit0) \ DWARF_ONE_KNOWN_DW_OP (lit1, DW_OP_lit1) \ DWARF_ONE_KNOWN_DW_OP (lit10, DW_OP_lit10) \ DWARF_ONE_KNOWN_DW_OP (lit11, DW_OP_lit11) \ DWARF_ONE_KNOWN_DW_OP (lit12, DW_OP_lit12) \ DWARF_ONE_KNOWN_DW_OP (lit13, DW_OP_lit13) \ DWARF_ONE_KNOWN_DW_OP (lit14, DW_OP_lit14) \ DWARF_ONE_KNOWN_DW_OP (lit15, DW_OP_lit15) \ DWARF_ONE_KNOWN_DW_OP (lit16, DW_OP_lit16) \ DWARF_ONE_KNOWN_DW_OP (lit17, DW_OP_lit17) \ DWARF_ONE_KNOWN_DW_OP (lit18, DW_OP_lit18) \ DWARF_ONE_KNOWN_DW_OP (lit19, DW_OP_lit19) \ DWARF_ONE_KNOWN_DW_OP (lit2, DW_OP_lit2) \ DWARF_ONE_KNOWN_DW_OP (lit20, DW_OP_lit20) \ DWARF_ONE_KNOWN_DW_OP (lit21, DW_OP_lit21) \ DWARF_ONE_KNOWN_DW_OP (lit22, DW_OP_lit22) \ DWARF_ONE_KNOWN_DW_OP (lit23, DW_OP_lit23) \ DWARF_ONE_KNOWN_DW_OP (lit24, DW_OP_lit24) \ DWARF_ONE_KNOWN_DW_OP (lit25, DW_OP_lit25) \ DWARF_ONE_KNOWN_DW_OP (lit26, DW_OP_lit26) \ DWARF_ONE_KNOWN_DW_OP (lit27, DW_OP_lit27) \ DWARF_ONE_KNOWN_DW_OP (lit28, DW_OP_lit28) \ DWARF_ONE_KNOWN_DW_OP (lit29, DW_OP_lit29) \ DWARF_ONE_KNOWN_DW_OP (lit3, DW_OP_lit3) \ DWARF_ONE_KNOWN_DW_OP (lit30, DW_OP_lit30) \ DWARF_ONE_KNOWN_DW_OP (lit31, DW_OP_lit31) \ DWARF_ONE_KNOWN_DW_OP (lit4, DW_OP_lit4) \ DWARF_ONE_KNOWN_DW_OP (lit5, DW_OP_lit5) \ DWARF_ONE_KNOWN_DW_OP (lit6, DW_OP_lit6) \ DWARF_ONE_KNOWN_DW_OP (lit7, DW_OP_lit7) \ DWARF_ONE_KNOWN_DW_OP (lit8, DW_OP_lit8) \ DWARF_ONE_KNOWN_DW_OP (lit9, DW_OP_lit9) \ DWARF_ONE_KNOWN_DW_OP (lt, DW_OP_lt) \ DWARF_ONE_KNOWN_DW_OP (minus, DW_OP_minus) \ DWARF_ONE_KNOWN_DW_OP (mod, DW_OP_mod) \ DWARF_ONE_KNOWN_DW_OP (mul, DW_OP_mul) \ DWARF_ONE_KNOWN_DW_OP (ne, DW_OP_ne) \ DWARF_ONE_KNOWN_DW_OP (neg, DW_OP_neg) \ DWARF_ONE_KNOWN_DW_OP (nop, DW_OP_nop) \ DWARF_ONE_KNOWN_DW_OP (not, DW_OP_not) \ DWARF_ONE_KNOWN_DW_OP (or, DW_OP_or) \ DWARF_ONE_KNOWN_DW_OP (over, DW_OP_over) \ DWARF_ONE_KNOWN_DW_OP (pick, DW_OP_pick) \ DWARF_ONE_KNOWN_DW_OP (piece, DW_OP_piece) \ DWARF_ONE_KNOWN_DW_OP (plus, DW_OP_plus) \ DWARF_ONE_KNOWN_DW_OP (plus_uconst, DW_OP_plus_uconst) \ DWARF_ONE_KNOWN_DW_OP (push_object_address, DW_OP_push_object_address) \ DWARF_ONE_KNOWN_DW_OP (reg0, DW_OP_reg0) \ DWARF_ONE_KNOWN_DW_OP (reg1, DW_OP_reg1) \ DWARF_ONE_KNOWN_DW_OP (reg10, DW_OP_reg10) \ DWARF_ONE_KNOWN_DW_OP (reg11, DW_OP_reg11) \ DWARF_ONE_KNOWN_DW_OP (reg12, DW_OP_reg12) \ DWARF_ONE_KNOWN_DW_OP (reg13, DW_OP_reg13) \ DWARF_ONE_KNOWN_DW_OP (reg14, DW_OP_reg14) \ DWARF_ONE_KNOWN_DW_OP (reg15, DW_OP_reg15) \ DWARF_ONE_KNOWN_DW_OP (reg16, DW_OP_reg16) \ DWARF_ONE_KNOWN_DW_OP (reg17, DW_OP_reg17) \ DWARF_ONE_KNOWN_DW_OP (reg18, DW_OP_reg18) \ DWARF_ONE_KNOWN_DW_OP (reg19, DW_OP_reg19) \ DWARF_ONE_KNOWN_DW_OP (reg2, DW_OP_reg2) \ DWARF_ONE_KNOWN_DW_OP (reg20, DW_OP_reg20) \ DWARF_ONE_KNOWN_DW_OP (reg21, DW_OP_reg21) \ DWARF_ONE_KNOWN_DW_OP (reg22, DW_OP_reg22) \ DWARF_ONE_KNOWN_DW_OP (reg23, DW_OP_reg23) \ DWARF_ONE_KNOWN_DW_OP (reg24, DW_OP_reg24) \ DWARF_ONE_KNOWN_DW_OP (reg25, DW_OP_reg25) \ DWARF_ONE_KNOWN_DW_OP (reg26, DW_OP_reg26) \ DWARF_ONE_KNOWN_DW_OP (reg27, DW_OP_reg27) \ DWARF_ONE_KNOWN_DW_OP (reg28, DW_OP_reg28) \ DWARF_ONE_KNOWN_DW_OP (reg29, DW_OP_reg29) \ DWARF_ONE_KNOWN_DW_OP (reg3, DW_OP_reg3) \ DWARF_ONE_KNOWN_DW_OP (reg30, DW_OP_reg30) \ DWARF_ONE_KNOWN_DW_OP (reg31, DW_OP_reg31) \ DWARF_ONE_KNOWN_DW_OP (reg4, DW_OP_reg4) \ DWARF_ONE_KNOWN_DW_OP (reg5, DW_OP_reg5) \ DWARF_ONE_KNOWN_DW_OP (reg6, DW_OP_reg6) \ DWARF_ONE_KNOWN_DW_OP (reg7, DW_OP_reg7) \ DWARF_ONE_KNOWN_DW_OP (reg8, DW_OP_reg8) \ DWARF_ONE_KNOWN_DW_OP (reg9, DW_OP_reg9) \ DWARF_ONE_KNOWN_DW_OP (regval_type, DW_OP_regval_type) \ DWARF_ONE_KNOWN_DW_OP (regx, DW_OP_regx) \ DWARF_ONE_KNOWN_DW_OP (reinterpret, DW_OP_reinterpret) \ DWARF_ONE_KNOWN_DW_OP (rot, DW_OP_rot) \ DWARF_ONE_KNOWN_DW_OP (shl, DW_OP_shl) \ DWARF_ONE_KNOWN_DW_OP (shr, DW_OP_shr) \ DWARF_ONE_KNOWN_DW_OP (shra, DW_OP_shra) \ DWARF_ONE_KNOWN_DW_OP (skip, DW_OP_skip) \ DWARF_ONE_KNOWN_DW_OP (stack_value, DW_OP_stack_value) \ DWARF_ONE_KNOWN_DW_OP (swap, DW_OP_swap) \ DWARF_ONE_KNOWN_DW_OP (xderef, DW_OP_xderef) \ DWARF_ONE_KNOWN_DW_OP (xderef_size, DW_OP_xderef_size) \ DWARF_ONE_KNOWN_DW_OP (xderef_type, DW_OP_xderef_type) \ DWARF_ONE_KNOWN_DW_OP (xor, DW_OP_xor) \ /* End of DW_OP_*. */ #define DWARF_ALL_KNOWN_DW_ORD \ DWARF_ONE_KNOWN_DW_ORD (col_major, DW_ORD_col_major) \ DWARF_ONE_KNOWN_DW_ORD (row_major, DW_ORD_row_major) \ /* End of DW_ORD_*. */ #define DWARF_ALL_KNOWN_DW_RLE \ DWARF_ONE_KNOWN_DW_RLE (base_address, DW_RLE_base_address) \ DWARF_ONE_KNOWN_DW_RLE (base_addressx, DW_RLE_base_addressx) \ DWARF_ONE_KNOWN_DW_RLE (end_of_list, DW_RLE_end_of_list) \ DWARF_ONE_KNOWN_DW_RLE (offset_pair, DW_RLE_offset_pair) \ DWARF_ONE_KNOWN_DW_RLE (start_end, DW_RLE_start_end) \ DWARF_ONE_KNOWN_DW_RLE (start_length, DW_RLE_start_length) \ DWARF_ONE_KNOWN_DW_RLE (startx_endx, DW_RLE_startx_endx) \ DWARF_ONE_KNOWN_DW_RLE (startx_length, DW_RLE_startx_length) \ /* End of DW_RLE_*. */ #define DWARF_ALL_KNOWN_DW_SECT_INFO \ DWARF_ONE_KNOWN_DW_SECT_INFO (, DW_SECT_INFO_) \ DWARF_ONE_KNOWN_DW_SECT_INFO (, DW_SECT_INFO_) \ DWARF_ONE_KNOWN_DW_SECT_INFO (, DW_SECT_INFO_) \ DWARF_ONE_KNOWN_DW_SECT_INFO (, DW_SECT_INFO_) \ DWARF_ONE_KNOWN_DW_SECT_INFO (, DW_SECT_INFO_) \ DWARF_ONE_KNOWN_DW_SECT_INFO (, DW_SECT_INFO_) \ DWARF_ONE_KNOWN_DW_SECT_INFO (, DW_SECT_INFO_) \ /* End of DW_SECT_INFO_*. */ #define DWARF_ALL_KNOWN_DW_TAG \ DWARF_ONE_KNOWN_DW_TAG (GNU_BINCL, DW_TAG_GNU_BINCL) \ DWARF_ONE_KNOWN_DW_TAG (GNU_EINCL, DW_TAG_GNU_EINCL) \ DWARF_ONE_KNOWN_DW_TAG (GNU_call_site, DW_TAG_GNU_call_site) \ DWARF_ONE_KNOWN_DW_TAG (GNU_call_site_parameter, DW_TAG_GNU_call_site_parameter) \ DWARF_ONE_KNOWN_DW_TAG (GNU_formal_parameter_pack, DW_TAG_GNU_formal_parameter_pack) \ DWARF_ONE_KNOWN_DW_TAG (GNU_template_parameter_pack, DW_TAG_GNU_template_parameter_pack) \ DWARF_ONE_KNOWN_DW_TAG (GNU_template_template_param, DW_TAG_GNU_template_template_param) \ DWARF_ONE_KNOWN_DW_TAG (MIPS_loop, DW_TAG_MIPS_loop) \ DWARF_ONE_KNOWN_DW_TAG (access_declaration, DW_TAG_access_declaration) \ DWARF_ONE_KNOWN_DW_TAG (array_type, DW_TAG_array_type) \ DWARF_ONE_KNOWN_DW_TAG (atomic_type, DW_TAG_atomic_type) \ DWARF_ONE_KNOWN_DW_TAG (base_type, DW_TAG_base_type) \ DWARF_ONE_KNOWN_DW_TAG (call_site, DW_TAG_call_site) \ DWARF_ONE_KNOWN_DW_TAG (call_site_parameter, DW_TAG_call_site_parameter) \ DWARF_ONE_KNOWN_DW_TAG (catch_block, DW_TAG_catch_block) \ DWARF_ONE_KNOWN_DW_TAG (class_template, DW_TAG_class_template) \ DWARF_ONE_KNOWN_DW_TAG (class_type, DW_TAG_class_type) \ DWARF_ONE_KNOWN_DW_TAG (coarray_type, DW_TAG_coarray_type) \ DWARF_ONE_KNOWN_DW_TAG (common_block, DW_TAG_common_block) \ DWARF_ONE_KNOWN_DW_TAG (common_inclusion, DW_TAG_common_inclusion) \ DWARF_ONE_KNOWN_DW_TAG (compile_unit, DW_TAG_compile_unit) \ DWARF_ONE_KNOWN_DW_TAG (condition, DW_TAG_condition) \ DWARF_ONE_KNOWN_DW_TAG (const_type, DW_TAG_const_type) \ DWARF_ONE_KNOWN_DW_TAG (constant, DW_TAG_constant) \ DWARF_ONE_KNOWN_DW_TAG (dwarf_procedure, DW_TAG_dwarf_procedure) \ DWARF_ONE_KNOWN_DW_TAG (dynamic_type, DW_TAG_dynamic_type) \ DWARF_ONE_KNOWN_DW_TAG (entry_point, DW_TAG_entry_point) \ DWARF_ONE_KNOWN_DW_TAG (enumeration_type, DW_TAG_enumeration_type) \ DWARF_ONE_KNOWN_DW_TAG (enumerator, DW_TAG_enumerator) \ DWARF_ONE_KNOWN_DW_TAG (file_type, DW_TAG_file_type) \ DWARF_ONE_KNOWN_DW_TAG (formal_parameter, DW_TAG_formal_parameter) \ DWARF_ONE_KNOWN_DW_TAG (format_label, DW_TAG_format_label) \ DWARF_ONE_KNOWN_DW_TAG (friend, DW_TAG_friend) \ DWARF_ONE_KNOWN_DW_TAG (function_template, DW_TAG_function_template) \ DWARF_ONE_KNOWN_DW_TAG (generic_subrange, DW_TAG_generic_subrange) \ DWARF_ONE_KNOWN_DW_TAG (immutable_type, DW_TAG_immutable_type) \ DWARF_ONE_KNOWN_DW_TAG (imported_declaration, DW_TAG_imported_declaration) \ DWARF_ONE_KNOWN_DW_TAG (imported_module, DW_TAG_imported_module) \ DWARF_ONE_KNOWN_DW_TAG (imported_unit, DW_TAG_imported_unit) \ DWARF_ONE_KNOWN_DW_TAG (inheritance, DW_TAG_inheritance) \ DWARF_ONE_KNOWN_DW_TAG (inlined_subroutine, DW_TAG_inlined_subroutine) \ DWARF_ONE_KNOWN_DW_TAG (interface_type, DW_TAG_interface_type) \ DWARF_ONE_KNOWN_DW_TAG (label, DW_TAG_label) \ DWARF_ONE_KNOWN_DW_TAG (lexical_block, DW_TAG_lexical_block) \ DWARF_ONE_KNOWN_DW_TAG (member, DW_TAG_member) \ DWARF_ONE_KNOWN_DW_TAG (module, DW_TAG_module) \ DWARF_ONE_KNOWN_DW_TAG (namelist, DW_TAG_namelist) \ DWARF_ONE_KNOWN_DW_TAG (namelist_item, DW_TAG_namelist_item) \ DWARF_ONE_KNOWN_DW_TAG (namespace, DW_TAG_namespace) \ DWARF_ONE_KNOWN_DW_TAG (packed_type, DW_TAG_packed_type) \ DWARF_ONE_KNOWN_DW_TAG (partial_unit, DW_TAG_partial_unit) \ DWARF_ONE_KNOWN_DW_TAG (pointer_type, DW_TAG_pointer_type) \ DWARF_ONE_KNOWN_DW_TAG (ptr_to_member_type, DW_TAG_ptr_to_member_type) \ DWARF_ONE_KNOWN_DW_TAG (reference_type, DW_TAG_reference_type) \ DWARF_ONE_KNOWN_DW_TAG (restrict_type, DW_TAG_restrict_type) \ DWARF_ONE_KNOWN_DW_TAG (rvalue_reference_type, DW_TAG_rvalue_reference_type) \ DWARF_ONE_KNOWN_DW_TAG (set_type, DW_TAG_set_type) \ DWARF_ONE_KNOWN_DW_TAG (shared_type, DW_TAG_shared_type) \ DWARF_ONE_KNOWN_DW_TAG (skeleton_unit, DW_TAG_skeleton_unit) \ DWARF_ONE_KNOWN_DW_TAG (string_type, DW_TAG_string_type) \ DWARF_ONE_KNOWN_DW_TAG (structure_type, DW_TAG_structure_type) \ DWARF_ONE_KNOWN_DW_TAG (subprogram, DW_TAG_subprogram) \ DWARF_ONE_KNOWN_DW_TAG (subrange_type, DW_TAG_subrange_type) \ DWARF_ONE_KNOWN_DW_TAG (subroutine_type, DW_TAG_subroutine_type) \ DWARF_ONE_KNOWN_DW_TAG (template_alias, DW_TAG_template_alias) \ DWARF_ONE_KNOWN_DW_TAG (template_type_parameter, DW_TAG_template_type_parameter) \ DWARF_ONE_KNOWN_DW_TAG (template_value_parameter, DW_TAG_template_value_parameter) \ DWARF_ONE_KNOWN_DW_TAG (thrown_type, DW_TAG_thrown_type) \ DWARF_ONE_KNOWN_DW_TAG (try_block, DW_TAG_try_block) \ DWARF_ONE_KNOWN_DW_TAG (type_unit, DW_TAG_type_unit) \ DWARF_ONE_KNOWN_DW_TAG (typedef, DW_TAG_typedef) \ DWARF_ONE_KNOWN_DW_TAG (union_type, DW_TAG_union_type) \ DWARF_ONE_KNOWN_DW_TAG (unspecified_parameters, DW_TAG_unspecified_parameters) \ DWARF_ONE_KNOWN_DW_TAG (unspecified_type, DW_TAG_unspecified_type) \ DWARF_ONE_KNOWN_DW_TAG (variable, DW_TAG_variable) \ DWARF_ONE_KNOWN_DW_TAG (variant, DW_TAG_variant) \ DWARF_ONE_KNOWN_DW_TAG (variant_part, DW_TAG_variant_part) \ DWARF_ONE_KNOWN_DW_TAG (volatile_type, DW_TAG_volatile_type) \ DWARF_ONE_KNOWN_DW_TAG (with_stmt, DW_TAG_with_stmt) \ /* End of DW_TAG_*. */ #define DWARF_ALL_KNOWN_DW_UT \ DWARF_ONE_KNOWN_DW_UT (compile, DW_UT_compile) \ DWARF_ONE_KNOWN_DW_UT (partial, DW_UT_partial) \ DWARF_ONE_KNOWN_DW_UT (skeleton, DW_UT_skeleton) \ DWARF_ONE_KNOWN_DW_UT (split_compile, DW_UT_split_compile) \ DWARF_ONE_KNOWN_DW_UT (split_type, DW_UT_split_type) \ DWARF_ONE_KNOWN_DW_UT (type, DW_UT_type) \ /* End of DW_UT_*. */ #define DWARF_ALL_KNOWN_DW_VIRTUALITY \ DWARF_ONE_KNOWN_DW_VIRTUALITY (none, DW_VIRTUALITY_none) \ DWARF_ONE_KNOWN_DW_VIRTUALITY (pure_virtual, DW_VIRTUALITY_pure_virtual) \ DWARF_ONE_KNOWN_DW_VIRTUALITY (virtual, DW_VIRTUALITY_virtual) \ /* End of DW_VIRTUALITY_*. */ #define DWARF_ALL_KNOWN_DW_VIS \ DWARF_ONE_KNOWN_DW_VIS (exported, DW_VIS_exported) \ DWARF_ONE_KNOWN_DW_VIS (local, DW_VIS_local) \ DWARF_ONE_KNOWN_DW_VIS (qualified, DW_VIS_qualified) \ /* End of DW_VIS_*. */ elf-knowledge.h000064400000007527151030061700007444 0ustar00/* Accumulation of various pieces of knowledge about ELF. Copyright (C) 2000-2012, 2014, 2016 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper , 2000. This file is free software; you can redistribute it and/or modify it under the terms of either * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version or both in parallel, as here. elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _ELF_KNOWLEDGE_H #define _ELF_KNOWLEDGE_H 1 #include /* Test whether a section can be stripped or not. */ #define SECTION_STRIP_P(shdr, name, remove_comment) \ /* Sections which are allocated are not removed. */ \ (((shdr)->sh_flags & SHF_ALLOC) == 0 \ /* We never remove .note sections. */ \ && (shdr)->sh_type != SHT_NOTE \ && (((shdr)->sh_type) != SHT_PROGBITS \ /* Never remove .gnu.warning.* sections. */ \ || (name != NULL \ && strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) != 0\ /* We remove .comment sections only if explicitly told to do so. */\ && (remove_comment \ || strcmp (name, ".comment") != 0)))) /* Test whether `sh_info' field in section header contains a section index. There are two kinds of sections doing this: - the sections containing relocation information reference in this field the section to which the relocations apply; - section with the SHF_INFO_LINK flag set to signal that `sh_info' references a section. This allows correct handling of unknown sections. */ #define SH_INFO_LINK_P(Shdr) \ ((Shdr)->sh_type == SHT_REL || (Shdr)->sh_type == SHT_RELA \ || ((Shdr)->sh_flags & SHF_INFO_LINK) != 0) /* Size of an entry in the hash table. The ELF specification says all entries are regardless of platform 32-bits in size. Early 64-bit ports (namely Alpha for Linux) got this wrong. The wording was not clear. Several years later the ABI for the 64-bit S390s was developed. Many things were copied from the IA-64 ABI (which uses the correct 32-bit entry size) but it does get the SHT_HASH entry size wrong by using a 64-bit entry size. So now we need this macro to special case both the alpha and s390x ABIs. */ #define SH_ENTSIZE_HASH(Ehdr) \ ((Ehdr)->e_machine == EM_ALPHA \ || ((Ehdr)->e_machine == EM_S390 \ && (Ehdr)->e_ident[EI_CLASS] == ELFCLASS64) ? 8 : 4) /* GNU Annobin notes are not fully standardized and abuses the owner name. */ #define ELF_NOTE_GNU_BUILD_ATTRIBUTE_PREFIX "GA" #define NT_GNU_BUILD_ATTRIBUTE_OPEN 0x100 #define NT_GNU_BUILD_ATTRIBUTE_FUNC 0x101 #define GNU_BUILD_ATTRIBUTE_TYPE_NUMERIC '*' #define GNU_BUILD_ATTRIBUTE_TYPE_STRING '$' #define GNU_BUILD_ATTRIBUTE_TYPE_BOOL_TRUE '+' #define GNU_BUILD_ATTRIBUTE_TYPE_BOOL_FALSE '!' #define GNU_BUILD_ATTRIBUTE_VERSION 1 #define GNU_BUILD_ATTRIBUTE_STACK_PROT 2 #define GNU_BUILD_ATTRIBUTE_RELRO 3 #define GNU_BUILD_ATTRIBUTE_STACK_SIZE 4 #define GNU_BUILD_ATTRIBUTE_TOOL 5 #define GNU_BUILD_ATTRIBUTE_ABI 6 #define GNU_BUILD_ATTRIBUTE_PIC 7 #define GNU_BUILD_ATTRIBUTE_SHORT_ENUM 8 #endif /* elf-knowledge.h */ libasm.h000064400000015714151030061700006165 0ustar00/* Interface for libasm. Copyright (C) 2002, 2005, 2008 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify it under the terms of either * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version or both in parallel, as here. elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LIBASM_H #define _LIBASM_H 1 #include #include #include typedef struct ebl Ebl; /* Opaque type for the assembler context descriptor. */ typedef struct AsmCtx AsmCtx_t; /* Opaque type for a section. */ typedef struct AsmScn AsmScn_t; /* Opaque type for a section group. */ typedef struct AsmScnGrp AsmScnGrp_t; /* Opaque type for a symbol. */ typedef struct AsmSym AsmSym_t; /* Opaque type for the disassembler context descriptor. */ typedef struct DisasmCtx DisasmCtx_t; /* Type used for callback functions to retrieve symbol name. The symbol reference is in the section designated by the second parameter at an offset described by the first parameter. The value is the third parameter. */ typedef int (*DisasmGetSymCB_t) (GElf_Addr, Elf32_Word, GElf_Addr, char **, size_t *, void *); /* Output function callback. */ typedef int (*DisasmOutputCB_t) (char *, size_t, void *); #ifdef __cplusplus extern "C" { #endif /* Create output file and return descriptor for assembler context. If TEXTP is true the output is an assembler format text file. Otherwise an object file is created. The MACHINE parameter corresponds to an EM_ constant from , KLASS specifies the class (32- or 64-bit), and DATA specifies the byte order (little or big endian). */ extern AsmCtx_t *asm_begin (const char *fname, Ebl *ebl, bool textp); /* Abort the operation on the assembler context and free all resources. */ extern int asm_abort (AsmCtx_t *ctx); /* Finalize output file and free all resources. */ extern int asm_end (AsmCtx_t *ctx); /* Return handle for the named section. If it was not used before create it. */ extern AsmScn_t *asm_newscn (AsmCtx_t *ctx, const char *scnname, GElf_Word type, GElf_Xword flags); /* Similar to 'asm_newscn', but make it part of section group GRP. */ extern AsmScn_t *asm_newscn_ingrp (AsmCtx_t *ctx, const char *scnname, GElf_Word type, GElf_Xword flags, AsmScnGrp_t *grp); /* Create new subsection NR in the given section. */ extern AsmScn_t *asm_newsubscn (AsmScn_t *asmscn, unsigned int nr); /* Return handle for new section group. The signature symbol can be set later. */ extern AsmScnGrp_t *asm_newscngrp (AsmCtx_t *ctx, const char *grpname, AsmSym_t *signature, Elf32_Word flags); /* Set or overwrite signature symbol for group. */ extern int asm_scngrp_newsignature (AsmScnGrp_t *grp, AsmSym_t *signature); /* Add zero terminated string STR of size LEN to (sub)section ASMSCN. */ extern int asm_addstrz (AsmScn_t *asmscn, const char *str, size_t len); /* Add 8-bit signed integer NUM to (sub)section ASMSCN. */ extern int asm_addint8 (AsmScn_t *asmscn, int8_t num); /* Add 8-bit unsigned integer NUM to (sub)section ASMSCN. */ extern int asm_adduint8 (AsmScn_t *asmscn, uint8_t num); /* Add 16-bit signed integer NUM to (sub)section ASMSCN. */ extern int asm_addint16 (AsmScn_t *asmscn, int16_t num); /* Add 16-bit unsigned integer NUM to (sub)section ASMSCN. */ extern int asm_adduint16 (AsmScn_t *asmscn, uint16_t num); /* Add 32-bit signed integer NUM to (sub)section ASMSCN. */ extern int asm_addint32 (AsmScn_t *asmscn, int32_t num); /* Add 32-bit unsigned integer NUM to (sub)section ASMSCN. */ extern int asm_adduint32 (AsmScn_t *asmscn, uint32_t num); /* Add 64-bit signed integer NUM to (sub)section ASMSCN. */ extern int asm_addint64 (AsmScn_t *asmscn, int64_t num); /* Add 64-bit unsigned integer NUM to (sub)section ASMSCN. */ extern int asm_adduint64 (AsmScn_t *asmscn, uint64_t num); /* Add signed little endian base 128 integer NUM to (sub)section ASMSCN. */ extern int asm_addsleb128 (AsmScn_t *asmscn, int32_t num); /* Add unsigned little endian base 128 integer NUM to (sub)section ASMSCN. */ extern int asm_adduleb128 (AsmScn_t *asmscn, uint32_t num); /* Define new symbol NAME for current position in given section ASMSCN. */ extern AsmSym_t *asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size, int type, int binding); /* Define new common symbol NAME with given SIZE and alignment. */ extern AsmSym_t *asm_newcomsym (AsmCtx_t *ctx, const char *name, GElf_Xword size, GElf_Addr align); /* Define new common symbol NAME with given SIZE, VALUE, TYPE, and BINDING. */ extern AsmSym_t *asm_newabssym (AsmCtx_t *ctx, const char *name, GElf_Xword size, GElf_Addr value, int type, int binding); /* Align (sub)section offset according to VALUE. */ extern int asm_align (AsmScn_t *asmscn, GElf_Word value); /* Set the byte pattern used to fill gaps created by alignment. */ extern int asm_fill (AsmScn_t *asmscn, void *bytes, size_t len); /* Return ELF descriptor created for the output file of the given context. */ extern Elf *asm_getelf (AsmCtx_t *ctx); /* Return error code of last failing function call. This value is kept separately for each thread. */ extern int asm_errno (void); /* Return error string for ERROR. If ERROR is zero, return error string for most recent error or NULL is none occurred. If ERROR is -1 the behaviour is similar to the last case except that not NULL but a legal string is returned. */ extern const char *asm_errmsg (int __error); /* Create context descriptor for disassembler. */ extern DisasmCtx_t *disasm_begin (Ebl *ebl, Elf *elf, DisasmGetSymCB_t symcb); /* Release descriptor for disassembler. */ extern int disasm_end (DisasmCtx_t *ctx); /* Produce of disassembly output for given memory, store text in provided buffer. */ extern int disasm_str (DisasmCtx_t *ctx, const uint8_t **startp, const uint8_t *end, GElf_Addr addr, const char *fmt, char **bufp, size_t len, void *symcbarg); /* Produce disassembly output for given memory and output it using the given callback functions. */ extern int disasm_cb (DisasmCtx_t *ctx, const uint8_t **startp, const uint8_t *end, GElf_Addr addr, const char *fmt, DisasmOutputCB_t outcb, void *outcbarg, void *symcbarg); #ifdef __cplusplus } #endif #endif /* libasm.h */ version.h000064400000002372151030061700006377 0ustar00/* Version information about elfutils development libraries. Copyright (C) 2008 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify it under the terms of either * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version or both in parallel, as here. elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _ELFUTILS_VERSION_H #define _ELFUTILS_VERSION_H 1 #define _ELFUTILS_VERSION 190 #define _ELFUTILS_PREREQ(major, minor) \ (_ELFUTILS_VERSION >= ((major) * 1000 + (minor))) #endif /* elfutils/version.h */ libdwelf.h000064400000014466151030061700006511 0ustar00/* Interfaces for libdwelf. DWARF ELF Low-level Functions. Copyright (C) 2014, 2015, 2016, 2018 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify it under the terms of either * the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version or * the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version or both in parallel, as here. elfutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received copies of the GNU General Public License and the GNU Lesser General Public License along with this program. If not, see . */ #ifndef _LIBDWELF_H #define _LIBDWELF_H 1 #include "libdw.h" #ifdef __cplusplus extern "C" { #endif /* DWARF ELF Low-level Functions (dwelf). Functions starting with dwelf_elf will take a (libelf) Elf object as first argument and might set elf_errno on error. Functions starting with dwelf_dwarf will take a (libdw) Dwarf object as first argument and might set dwarf_errno on error. */ /* Returns the name and the CRC32 of the separate debug file from the .gnu_debuglink section if found in the ELF. Return NULL if the ELF file didn't have a .gnu_debuglink section, had malformed data in the section or some other error occurred. */ extern const char *dwelf_elf_gnu_debuglink (Elf *elf, GElf_Word *crc); /* Returns the name and build ID from the .gnu_debugaltlink section if found in the ELF. On success, pointers to the name and build ID are written to *NAMEP and *BUILDID_P, and the positive length of the build ID is returned. Returns 0 if the ELF lacks a .gnu_debugaltlink section. Returns -1 in case of malformed data or other errors. */ extern ssize_t dwelf_dwarf_gnu_debugaltlink (Dwarf *dwarf, const char **namep, const void **build_idp); /* Returns the build ID as found in a NT_GNU_BUILD_ID note from either a SHT_NOTE section or from a PT_NOTE segment if the ELF file doesn't contain any section headers. On success a pointer to the build ID is written to *BUILDID_P, and the positive length of the build ID is returned. Returns 0 if the ELF lacks a NT_GNU_BUILD_ID note. Returns -1 in case of malformed data or other errors. */ extern ssize_t dwelf_elf_gnu_build_id (Elf *elf, const void **build_idp); /* Returns the size of the uncompressed data of a GNU compressed section. The section name should start with .zdebug (but this isn't checked by this function). If the section isn't compressed (the section data doesn't start with ZLIB) -1 is returned. If an error occurred -1 is returned and elf_errno is set. */ extern ssize_t dwelf_scn_gnu_compressed_size (Elf_Scn *scn); /* ELF/DWARF string table handling. */ typedef struct Dwelf_Strtab Dwelf_Strtab; typedef struct Dwelf_Strent Dwelf_Strent; /* Create a new ELF/DWARF string table object in memory. ELF string tables have a required zero length null string at offset zero. DWARF string tables don't require such a null entry (unless they are shared with an ELF string table). If NULLSTR is true then a null entry is always created (even if the string table is empty otherwise). */ extern Dwelf_Strtab *dwelf_strtab_init (bool nullstr); /* Add string STR to string table ST. Returns NULL if no memory could be allocated. The given STR is owned by the called and must be valid till dwelf_strtab_free is called. dwelf_strtab_finalize might copy the string into the final table and dwelf_strent_str might return it, or a reference to an identical copy/substring added to the string table. */ extern Dwelf_Strent *dwelf_strtab_add (Dwelf_Strtab *st, const char *str) __nonnull_attribute__ (1, 2); /* This is an optimized version of dwelf_strtab_add if the length of the string is already known. LEN is the length of STR including zero terminator. Calling dwelf_strtab_add (st, str) is similar to calling dwelf_strtab_len (st, str, strlen (str) + 1). */ extern Dwelf_Strent *dwelf_strtab_add_len (Dwelf_Strtab *st, const char *str, size_t len) __nonnull_attribute__ (1, 2); /* Finalize string table ST and store size and memory location information in DATA d_size and d_buf. DATA d_type will be set to ELF_T_BYTE, d_off will be zero, d_align will be 1 and d_version will be set to EV_CURRENT. If no memory could be allocated NULL is returned and DATA->d_buf will be set to NULL. Otherwise DATA will be returned. */ extern Elf_Data *dwelf_strtab_finalize (Dwelf_Strtab *st, Elf_Data *data) __nonnull_attribute__ (1, 2); /* Get offset in string table for string associated with entry. Only valid after dwelf_strtab_finalize has been called. */ extern size_t dwelf_strent_off (Dwelf_Strent *se) __nonnull_attribute__ (1); /* Return the string associated with the entry. */ extern const char *dwelf_strent_str (Dwelf_Strent *se) __nonnull_attribute__ (1); /* Free resources allocated for the string table. This invalidates any Dwelf_Strent references returned earlier. */ extern void dwelf_strtab_free (Dwelf_Strtab *st) __nonnull_attribute__ (1); /* Creates a read-only Elf handle from the given file handle. The file may be compressed and/or contain a linux kernel image header, in which case it is eagerly decompressed in full and the Elf handle is created as if created with elf_memory (). On decompression or file errors NULL is returned (and elf_errno will be set). If there was no error, but the file is not an ELF file, then an ELF_K_NONE Elf handle is returned (just like with elf_begin). The Elf handle should be closed with elf_end (). The file handle will not be closed. */ extern Elf *dwelf_elf_begin (int fd); /* Returns a human readable string for the given ELF header e_machine value, or NULL if the given number isn't currently known. */ extern const char *dwelf_elf_e_machine_string (int machine); #ifdef __cplusplus } #endif #endif /* libdwelf.h */