LCOV - code coverage report
Current view: top level - libdw - libdw.h (source / functions) Hit Total Coverage
Test: lcov.out Lines: 2 2 100.0 %
Date: 2017-08-02 15:24:56 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* Interfaces for libdw.
       2             :    Copyright (C) 2002-2010, 2013, 2014, 2016 Red Hat, Inc.
       3             :    This file is part of elfutils.
       4             : 
       5             :    This file is free software; you can redistribute it and/or modify
       6             :    it under the terms of either
       7             : 
       8             :      * the GNU Lesser General Public License as published by the Free
       9             :        Software Foundation; either version 3 of the License, or (at
      10             :        your option) any later version
      11             : 
      12             :    or
      13             : 
      14             :      * the GNU General Public License as published by the Free
      15             :        Software Foundation; either version 2 of the License, or (at
      16             :        your option) any later version
      17             : 
      18             :    or both in parallel, as here.
      19             : 
      20             :    elfutils is distributed in the hope that it will be useful, but
      21             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      22             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      23             :    General Public License for more details.
      24             : 
      25             :    You should have received copies of the GNU General Public License and
      26             :    the GNU Lesser General Public License along with this program.  If
      27             :    not, see <http://www.gnu.org/licenses/>.  */
      28             : 
      29             : #ifndef _LIBDW_H
      30             : #define _LIBDW_H        1
      31             : 
      32             : #include <gelf.h>
      33             : #include <stdbool.h>
      34             : #include <stddef.h>
      35             : #include <stdint.h>
      36             : 
      37             : /* Mode for the session.  */
      38             : typedef enum
      39             :   {
      40             :     DWARF_C_READ,               /* Read .. */
      41             :     DWARF_C_RDWR,               /* Read and write .. */
      42             :     DWARF_C_WRITE,              /* Write .. */
      43             :   }
      44             : Dwarf_Cmd;
      45             : 
      46             : 
      47             : /* Callback results.  */
      48             : enum
      49             : {
      50             :   DWARF_CB_OK = 0,
      51             :   DWARF_CB_ABORT
      52             : };
      53             : 
      54             : 
      55             : /* Error values.  */
      56             : enum
      57             :   {
      58             :     DW_TAG_invalid = 0
      59             : #define DW_TAG_invalid  DW_TAG_invalid
      60             :   };
      61             : 
      62             : 
      63             : /* Type for offset in DWARF file.  */
      64             : typedef GElf_Off Dwarf_Off;
      65             : 
      66             : /* Type for address in DWARF file.  */
      67             : typedef GElf_Addr Dwarf_Addr;
      68             : 
      69             : /* Integer types.  Big enough to hold any numeric value.  */
      70             : typedef GElf_Xword Dwarf_Word;
      71             : typedef GElf_Sxword Dwarf_Sword;
      72             : /* For the times we know we do not need that much.  */
      73             : typedef GElf_Half Dwarf_Half;
      74             : 
      75             : 
      76             : /* DWARF abbreviation record.  */
      77             : typedef struct Dwarf_Abbrev Dwarf_Abbrev;
      78             : 
      79             : /* Returned to show the last DIE has be returned.  */
      80             : #define DWARF_END_ABBREV ((Dwarf_Abbrev *) -1l)
      81             : 
      82             : /* Source code line information for CU.  */
      83             : typedef struct Dwarf_Lines_s Dwarf_Lines;
      84             : 
      85             : /* One source code line information.  */
      86             : typedef struct Dwarf_Line_s Dwarf_Line;
      87             : 
      88             : /* Source file information.  */
      89             : typedef struct Dwarf_Files_s Dwarf_Files;
      90             : 
      91             : /* One address range record.  */
      92             : typedef struct Dwarf_Arange_s Dwarf_Arange;
      93             : 
      94             : /* Address ranges of a file.  */
      95             : typedef struct Dwarf_Aranges_s Dwarf_Aranges;
      96             : 
      97             : /* CU representation.  */
      98             : struct Dwarf_CU;
      99             : typedef struct Dwarf_CU Dwarf_CU;
     100             : 
     101             : /* Macro information.  */
     102             : typedef struct Dwarf_Macro_s Dwarf_Macro;
     103             : 
     104             : /* Attribute representation.  */
     105             : typedef struct
     106             : {
     107             :   unsigned int code;
     108             :   unsigned int form;
     109             :   unsigned char *valp;
     110             :   struct Dwarf_CU *cu;
     111             : } Dwarf_Attribute;
     112             : 
     113             : 
     114             : /* Data block representation.  */
     115             : typedef struct
     116             : {
     117             :   Dwarf_Word length;
     118             :   unsigned char *data;
     119             : } Dwarf_Block;
     120             : 
     121             : 
     122             : /* DIE information.  */
     123             : typedef struct
     124             : {
     125             :   /* The offset can be computed from the address.  */
     126             :   void *addr;
     127             :   struct Dwarf_CU *cu;
     128             :   Dwarf_Abbrev *abbrev;
     129             :   // XXX We'll see what other information will be needed.
     130             :   long int padding__;
     131             : } Dwarf_Die;
     132             : 
     133             : /* Returned to show the last DIE has be returned.  */
     134             : #define DWARF_END_DIE ((Dwarf_Die *) -1l)
     135             : 
     136             : 
     137             : /* Global symbol information.  */
     138             : typedef struct
     139             : {
     140             :   Dwarf_Off cu_offset;
     141             :   Dwarf_Off die_offset;
     142             :   const char *name;
     143             : } Dwarf_Global;
     144             : 
     145             : 
     146             : /* One operation in a DWARF location expression.
     147             :    A location expression is an array of these.  */
     148             : typedef struct
     149             : {
     150             :   uint8_t atom;                 /* Operation */
     151             :   Dwarf_Word number;            /* Operand */
     152             :   Dwarf_Word number2;           /* Possible second operand */
     153             :   Dwarf_Word offset;            /* Offset in location expression */
     154             : } Dwarf_Op;
     155             : 
     156             : 
     157             : /* This describes one Common Information Entry read from a CFI section.
     158             :    Pointers here point into the DATA->d_buf block passed to dwarf_next_cfi.  */
     159             : typedef struct
     160             : {
     161             :   Dwarf_Off CIE_id;      /* Always DW_CIE_ID_64 in Dwarf_CIE structures.  */
     162             : 
     163             :   /* Instruction stream describing initial state used by FDEs.  If
     164             :      we did not understand the whole augmentation string and it did
     165             :      not use 'z', then there might be more augmentation data here
     166             :      (and in FDEs) before the actual instructions.  */
     167             :   const uint8_t *initial_instructions;
     168             :   const uint8_t *initial_instructions_end;
     169             : 
     170             :   Dwarf_Word code_alignment_factor;
     171             :   Dwarf_Sword data_alignment_factor;
     172             :   Dwarf_Word return_address_register;
     173             : 
     174             :   const char *augmentation;     /* Augmentation string.  */
     175             : 
     176             :   /* Augmentation data, might be NULL.  The size is correct only if
     177             :      we understood the augmentation string sufficiently.  */
     178             :   const uint8_t *augmentation_data;
     179             :   size_t augmentation_data_size;
     180             :   size_t fde_augmentation_data_size;
     181             : } Dwarf_CIE;
     182             : 
     183             : /* This describes one Frame Description Entry read from a CFI section.
     184             :    Pointers here point into the DATA->d_buf block passed to dwarf_next_cfi.  */
     185             : typedef struct
     186             : {
     187             :   /* Section offset of CIE this FDE refers to.  This will never be
     188             :      DW_CIE_ID_64 in an FDE.  If this value is DW_CIE_ID_64, this is
     189             :      actually a Dwarf_CIE structure.  */
     190             :   Dwarf_Off CIE_pointer;
     191             : 
     192             :   /* We can't really decode anything further without looking up the CIE
     193             :      and checking its augmentation string.  Here follows the encoded
     194             :      initial_location and address_range, then any augmentation data,
     195             :      then the instruction stream.  This FDE describes PC locations in
     196             :      the byte range [initial_location, initial_location+address_range).
     197             :      When the CIE augmentation string uses 'z', the augmentation data is
     198             :      a DW_FORM_block (self-sized).  Otherwise, when we understand the
     199             :      augmentation string completely, fde_augmentation_data_size gives
     200             :      the number of bytes of augmentation data before the instructions.  */
     201             :   const uint8_t *start;
     202             :   const uint8_t *end;
     203             : } Dwarf_FDE;
     204             : 
     205             : /* Each entry in a CFI section is either a CIE described by Dwarf_CIE or
     206             :    an FDE described by Dward_FDE.  Check CIE_id to see which you have.  */
     207             : typedef union
     208             : {
     209             :   Dwarf_Off CIE_id;      /* Always DW_CIE_ID_64 in Dwarf_CIE structures.  */
     210             :   Dwarf_CIE cie;
     211             :   Dwarf_FDE fde;
     212             : } Dwarf_CFI_Entry;
     213             : 
     214             : #define dwarf_cfi_cie_p(entry)  ((entry)->cie.CIE_id == DW_CIE_ID_64)
     215             : 
     216             : /* Opaque type representing a frame state described by CFI.  */
     217             : typedef struct Dwarf_Frame_s Dwarf_Frame;
     218             : 
     219             : /* Opaque type representing a CFI section found in a DWARF or ELF file.  */
     220             : typedef struct Dwarf_CFI_s Dwarf_CFI;
     221             : 
     222             : 
     223             : /* Handle for debug sessions.  */
     224             : typedef struct Dwarf Dwarf;
     225             : 
     226             : 
     227             : /* Out-Of-Memory handler.  */
     228             : typedef void (*__noreturn_attribute__ Dwarf_OOM) (void);
     229             : 
     230             : 
     231             : #ifdef __cplusplus
     232             : extern "C" {
     233             : #endif
     234             : 
     235             : /* Create a handle for a new debug session.  */
     236             : extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd);
     237             : 
     238             : /* Create a handle for a new debug session for an ELF file.  */
     239             : extern Dwarf *dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp);
     240             : 
     241             : /* Retrieve ELF descriptor used for DWARF access.  */
     242             : extern Elf *dwarf_getelf (Dwarf *dwarf);
     243             : 
     244             : /* Retieve DWARF descriptor used for a Dwarf_Die or Dwarf_Attribute.
     245             :    A Dwarf_Die or a Dwarf_Attribute is associated with a particular
     246             :    Dwarf_CU handle.  This function returns the DWARF descriptor for
     247             :    that Dwarf_CU.  */
     248             : extern Dwarf *dwarf_cu_getdwarf (Dwarf_CU *cu);
     249             : 
     250             : /* Retrieves the DWARF descriptor for debugaltlink data.  Returns NULL
     251             :    if no alternate debug data has been supplied.  */
     252             : extern Dwarf *dwarf_getalt (Dwarf *main);
     253             : 
     254             : /* Provides the data referenced by the .gnu_debugaltlink section.  The
     255             :    caller should check that MAIN and ALT match (i.e., they have the
     256             :    same build ID).  It is the responsibility of the caller to ensure
     257             :    that the data referenced by ALT stays valid while it is used by
     258             :    MAIN, until dwarf_setalt is called on MAIN with a different
     259             :    descriptor, or dwarf_end.  */
     260             : extern void dwarf_setalt (Dwarf *main, Dwarf *alt);
     261             : 
     262             : /* Release debugging handling context.  */
     263             : extern int dwarf_end (Dwarf *dwarf);
     264             : 
     265             : 
     266             : /* Get the data block for the .debug_info section.  */
     267             : extern Elf_Data *dwarf_getscn_info (Dwarf *dwarf);
     268             : 
     269             : /* Read the header for the DWARF CU.  */
     270             : extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
     271             :                          size_t *header_sizep, Dwarf_Off *abbrev_offsetp,
     272             :                          uint8_t *address_sizep, uint8_t *offset_sizep)
     273             :      __nonnull_attribute__ (3);
     274             : 
     275             : /* Read the header of a DWARF CU or type unit.  If TYPE_SIGNATUREP is not
     276             :    null, this reads a type unit from the .debug_types section; otherwise
     277             :    this reads a CU from the .debug_info section.  */
     278             : extern int dwarf_next_unit (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
     279             :                             size_t *header_sizep, Dwarf_Half *versionp,
     280             :                             Dwarf_Off *abbrev_offsetp,
     281             :                             uint8_t *address_sizep, uint8_t *offset_sizep,
     282             :                             uint64_t *type_signaturep, Dwarf_Off *type_offsetp)
     283             :      __nonnull_attribute__ (3);
     284             : 
     285             : 
     286             : /* Decode one DWARF CFI entry (CIE or FDE) from the raw section data.
     287             :    The E_IDENT from the originating ELF file indicates the address
     288             :    size and byte order used in the CFI section contained in DATA;
     289             :    EH_FRAME_P should be true for .eh_frame format and false for
     290             :    .debug_frame format.  OFFSET is the byte position in the section
     291             :    to start at; on return *NEXT_OFFSET is filled in with the byte
     292             :    position immediately after this entry.
     293             : 
     294             :    On success, returns 0 and fills in *ENTRY; use dwarf_cfi_cie_p to
     295             :    see whether ENTRY->cie or ENTRY->fde is valid.
     296             : 
     297             :    On errors, returns -1.  Some format errors will permit safely
     298             :    skipping to the next CFI entry though the current one is unusable.
     299             :    In that case, *NEXT_OFF will be updated before a -1 return.
     300             : 
     301             :    If there are no more CFI entries left in the section,
     302             :    returns 1 and sets *NEXT_OFFSET to (Dwarf_Off) -1.  */
     303             : extern int dwarf_next_cfi (const unsigned char e_ident[],
     304             :                            Elf_Data *data, bool eh_frame_p,
     305             :                            Dwarf_Off offset, Dwarf_Off *next_offset,
     306             :                            Dwarf_CFI_Entry *entry)
     307             :   __nonnull_attribute__ (1, 2, 5, 6);
     308             : 
     309             : /* Use the CFI in the DWARF .debug_frame section.
     310             :    Returns NULL if there is no such section (not an error).
     311             :    The pointer returned can be used until dwarf_end is called on DWARF,
     312             :    and must not be passed to dwarf_cfi_end.
     313             :    Calling this more than once returns the same pointer.  */
     314             : extern Dwarf_CFI *dwarf_getcfi (Dwarf *dwarf);
     315             : 
     316             : /* Use the CFI in the ELF file's exception-handling data.
     317             :    Returns NULL if there is no such data.
     318             :    The pointer returned can be used until elf_end is called on ELF,
     319             :    and must be passed to dwarf_cfi_end before then.
     320             :    Calling this more than once allocates independent data structures.  */
     321             : extern Dwarf_CFI *dwarf_getcfi_elf (Elf *elf);
     322             : 
     323             : /* Release resources allocated by dwarf_getcfi_elf.  */
     324             : extern int dwarf_cfi_end (Dwarf_CFI *cache);
     325             : 
     326             : 
     327             : /* Return DIE at given offset in .debug_info section.  */
     328             : extern Dwarf_Die *dwarf_offdie (Dwarf *dbg, Dwarf_Off offset,
     329             :                                 Dwarf_Die *result) __nonnull_attribute__ (3);
     330             : 
     331             : /* Return DIE at given offset in .debug_types section.  */
     332             : extern Dwarf_Die *dwarf_offdie_types (Dwarf *dbg, Dwarf_Off offset,
     333             :                                       Dwarf_Die *result)
     334             :      __nonnull_attribute__ (3);
     335             : 
     336             : /* Return offset of DIE.  */
     337             : extern Dwarf_Off dwarf_dieoffset (Dwarf_Die *die);
     338             : 
     339             : /* Return offset of DIE in CU.  */
     340             : extern Dwarf_Off dwarf_cuoffset (Dwarf_Die *die);
     341             : 
     342             : /* Return CU DIE containing given DIE.  */
     343             : extern Dwarf_Die *dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result,
     344             :                                uint8_t *address_sizep, uint8_t *offset_sizep)
     345             :      __nonnull_attribute__ (2);
     346             : 
     347             : /* Return the CU DIE and the header info associated with a Dwarf_Die
     348             :    or Dwarf_Attribute.  A Dwarf_Die or a Dwarf_Attribute is associated
     349             :    with a particular Dwarf_CU handle.  This function returns the CU or
     350             :    type unit DIE and header information for that Dwarf_CU.  The
     351             :    returned DIE is either a compile_unit, partial_unit or type_unit.
     352             :    If it is a type_unit, then the type signature and type offset are
     353             :    also provided, otherwise type_offset will be set to zero.  See also
     354             :    dwarf_diecu and dwarf_next_unit.  */
     355             : extern Dwarf_Die *dwarf_cu_die (Dwarf_CU *cu, Dwarf_Die *result,
     356             :                                 Dwarf_Half *versionp,
     357             :                                 Dwarf_Off *abbrev_offsetp,
     358             :                                 uint8_t *address_sizep,
     359             :                                 uint8_t *offset_sizep,
     360             :                                 uint64_t *type_signaturep,
     361             :                                 Dwarf_Off *type_offsetp)
     362             :      __nonnull_attribute__ (2);
     363             : 
     364             : /* Return CU DIE containing given address.  */
     365             : extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr,
     366             :                                  Dwarf_Die *result) __nonnull_attribute__ (3);
     367             : 
     368             : /* Return child of current DIE.  */
     369             : extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
     370             :      __nonnull_attribute__ (2);
     371             : 
     372             : /* Locates the first sibling of DIE and places it in RESULT.
     373             :    Returns 0 if a sibling was found, -1 if something went wrong.
     374             :    Returns 1 if no sibling could be found and, if RESULT is not
     375             :    the same as DIE, it sets RESULT->addr to the address of the
     376             :    (non-sibling) DIE that follows this one, or NULL if this DIE
     377             :    was the last one in the compilation unit.  */
     378             : extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
     379             :      __nonnull_attribute__ (2);
     380             : 
     381             : /* For type aliases and qualifier type DIEs, which don't modify or
     382             :    change the structural layout of the underlying type, follow the
     383             :    DW_AT_type attribute (recursively) and return the underlying type
     384             :    Dwarf_Die.
     385             : 
     386             :    Returns 0 when RESULT contains a Dwarf_Die (possibly equal to the
     387             :    given DIE) that isn't a type alias or qualifier type.  Returns 1
     388             :    when RESULT contains a type alias or qualifier Dwarf_Die that
     389             :    couldn't be peeled further (it doesn't have a DW_TAG_type
     390             :    attribute).  Returns -1 when an error occured.
     391             : 
     392             :    The current DWARF specification defines one type alias tag
     393             :    (DW_TAG_typedef) and seven modifier/qualifier type tags
     394             :    (DW_TAG_const_type, DW_TAG_volatile_type, DW_TAG_restrict_type,
     395             :    DW_TAG_atomic_type, DW_TAG_immutable_type, DW_TAG_packed_type and
     396             :    DW_TAG_shared_type).  This function won't peel modifier type
     397             :    tags that change the way the underlying type is accessed such
     398             :    as the pointer or reference type tags (DW_TAG_pointer_type,
     399             :    DW_TAG_reference_type or DW_TAG_rvalue_reference_type).
     400             : 
     401             :    A future version of this function might peel other alias or
     402             :    qualifier type tags if a future DWARF version or GNU extension
     403             :    defines other type aliases or qualifier type tags that don't modify,
     404             :    change the structural layout or the way to access the underlying type.  */
     405             : extern int dwarf_peel_type (Dwarf_Die *die, Dwarf_Die *result)
     406             :     __nonnull_attribute__ (2);
     407             : 
     408             : /* Check whether the DIE has children.  */
     409             : extern int dwarf_haschildren (Dwarf_Die *die) __nonnull_attribute__ (1);
     410             : 
     411             : /* Walks the attributes of DIE, starting at the one OFFSET bytes in,
     412             :    calling the CALLBACK function for each one.  Stops if the callback
     413             :    function ever returns a value other than DWARF_CB_OK and returns the
     414             :    offset of the offending attribute.  If the end of the attributes
     415             :    is reached 1 is returned.  If something goes wrong -1 is returned and
     416             :    the dwarf error number is set.  */
     417             : extern ptrdiff_t dwarf_getattrs (Dwarf_Die *die,
     418             :                                  int (*callback) (Dwarf_Attribute *, void *),
     419             :                                  void *arg, ptrdiff_t offset)
     420             :      __nonnull_attribute__ (2);
     421             : 
     422             : /* Return tag of given DIE.  */
     423             : extern int dwarf_tag (Dwarf_Die *die) __nonnull_attribute__ (1);
     424             : 
     425             : 
     426             : /* Return specific attribute of DIE.  */
     427             : extern Dwarf_Attribute *dwarf_attr (Dwarf_Die *die, unsigned int search_name,
     428             :                                     Dwarf_Attribute *result)
     429             :      __nonnull_attribute__ (3);
     430             : 
     431             : /* Check whether given DIE has specific attribute.  */
     432             : extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name);
     433             : 
     434             : /* These are the same as dwarf_attr and dwarf_hasattr, respectively,
     435             :    but they resolve an indirect attribute through DW_AT_abstract_origin.  */
     436             : extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die,
     437             :                                               unsigned int search_name,
     438             :                                               Dwarf_Attribute *result)
     439             :      __nonnull_attribute__ (3);
     440             : extern int dwarf_hasattr_integrate (Dwarf_Die *die, unsigned int search_name);
     441             : 
     442             : 
     443             : 
     444             : 
     445             : /* Check whether given attribute has specific form.  */
     446             : extern int dwarf_hasform (Dwarf_Attribute *attr, unsigned int search_form);
     447             : 
     448             : /* Return attribute code of given attribute.  */
     449             : extern unsigned int dwarf_whatattr (Dwarf_Attribute *attr);
     450             : 
     451             : /* Return form code of given attribute.  */
     452             : extern unsigned int dwarf_whatform (Dwarf_Attribute *attr);
     453             : 
     454             : 
     455             : /* Return string associated with given attribute.  */
     456             : extern const char *dwarf_formstring (Dwarf_Attribute *attrp);
     457             : 
     458             : /* Return unsigned constant represented by attribute.  */
     459             : extern int dwarf_formudata (Dwarf_Attribute *attr, Dwarf_Word *return_uval)
     460             :      __nonnull_attribute__ (2);
     461             : 
     462             : /* Return signed constant represented by attribute.  */
     463             : extern int dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_uval)
     464             :      __nonnull_attribute__ (2);
     465             : 
     466             : /* Return address represented by attribute.  */
     467             : extern int dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr)
     468             :      __nonnull_attribute__ (2);
     469             : 
     470             : /* This function is deprecated.  Always use dwarf_formref_die instead.
     471             :    Return reference offset represented by attribute.  */
     472             : extern int dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
     473             :      __nonnull_attribute__ (2) __deprecated_attribute__;
     474             : 
     475             : /* Look up the DIE in a reference-form attribute.  */
     476             : extern Dwarf_Die *dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem)
     477             :      __nonnull_attribute__ (2);
     478             : 
     479             : /* Return block represented by attribute.  */
     480             : extern int dwarf_formblock (Dwarf_Attribute *attr, Dwarf_Block *return_block)
     481             :      __nonnull_attribute__ (2);
     482             : 
     483             : /* Return flag represented by attribute.  */
     484             : extern int dwarf_formflag (Dwarf_Attribute *attr, bool *return_bool)
     485             :      __nonnull_attribute__ (2);
     486             : 
     487             : 
     488             : /* Simplified attribute value access functions.  */
     489             : 
     490             : /* Return string in name attribute of DIE.  */
     491             : extern const char *dwarf_diename (Dwarf_Die *die);
     492             : 
     493             : /* Return high PC attribute of DIE.  */
     494             : extern int dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
     495             :      __nonnull_attribute__ (2);
     496             : 
     497             : /* Return low PC attribute of DIE.  */
     498             : extern int dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
     499             :      __nonnull_attribute__ (2);
     500             : 
     501             : /* Return entry_pc or low_pc attribute of DIE.  */
     502             : extern int dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr)
     503             :      __nonnull_attribute__ (2);
     504             : 
     505             : /* Return 1 if DIE's lowpc/highpc or ranges attributes match the PC address,
     506             :    0 if not, or -1 for errors.  */
     507             : extern int dwarf_haspc (Dwarf_Die *die, Dwarf_Addr pc);
     508             : 
     509             : /* Enumerate the PC address ranges covered by this DIE, covering all
     510             :    addresses where dwarf_haspc returns true.  In the first call OFFSET
     511             :    should be zero and *BASEP need not be initialized.  Returns -1 for
     512             :    errors, zero when there are no more address ranges to report, or a
     513             :    nonzero OFFSET value to pass to the next call.  Each subsequent call
     514             :    must preserve *BASEP from the prior call.  Successful calls fill in
     515             :    *STARTP and *ENDP with a contiguous address range.  */
     516             : extern ptrdiff_t dwarf_ranges (Dwarf_Die *die,
     517             :                                ptrdiff_t offset, Dwarf_Addr *basep,
     518             :                                Dwarf_Addr *startp, Dwarf_Addr *endp);
     519             : 
     520             : 
     521             : /* Return byte size attribute of DIE.  */
     522             : extern int dwarf_bytesize (Dwarf_Die *die);
     523             : 
     524             : /* Return bit size attribute of DIE.  */
     525             : extern int dwarf_bitsize (Dwarf_Die *die);
     526             : 
     527             : /* Return bit offset attribute of DIE.  */
     528             : extern int dwarf_bitoffset (Dwarf_Die *die);
     529             : 
     530             : /* Return array order attribute of DIE.  */
     531             : extern int dwarf_arrayorder (Dwarf_Die *die);
     532             : 
     533             : /* Return source language attribute of DIE.  */
     534             : extern int dwarf_srclang (Dwarf_Die *die);
     535             : 
     536             : 
     537             : /* Get abbreviation at given offset for given DIE.  */
     538             : extern Dwarf_Abbrev *dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset,
     539             :                                       size_t *lengthp);
     540             : 
     541             : /* Get abbreviation at given offset in .debug_abbrev section.  */
     542             : extern int dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp,
     543             :                             Dwarf_Abbrev *abbrevp)
     544             :      __nonnull_attribute__ (4);
     545             : 
     546             : /* Get abbreviation code.  */
     547             : extern unsigned int dwarf_getabbrevcode (Dwarf_Abbrev *abbrev);
     548             : 
     549             : /* Get abbreviation tag.  */
     550             : extern unsigned int dwarf_getabbrevtag (Dwarf_Abbrev *abbrev);
     551             : 
     552             : /* Return true if abbreviation is children flag set.  */
     553             : extern int dwarf_abbrevhaschildren (Dwarf_Abbrev *abbrev);
     554             : 
     555             : /* Get number of attributes of abbreviation.  */
     556             : extern int dwarf_getattrcnt (Dwarf_Abbrev *abbrev, size_t *attrcntp)
     557             :      __nonnull_attribute__ (2);
     558             : 
     559             : /* Get specific attribute of abbreviation.  */
     560             : extern int dwarf_getabbrevattr (Dwarf_Abbrev *abbrev, size_t idx,
     561             :                                 unsigned int *namep, unsigned int *formp,
     562             :                                 Dwarf_Off *offset);
     563             : 
     564             : 
     565             : /* Get string from-debug_str section.  */
     566             : extern const char *dwarf_getstring (Dwarf *dbg, Dwarf_Off offset,
     567             :                                     size_t *lenp);
     568             : 
     569             : 
     570             : /* Get public symbol information.  */
     571             : extern ptrdiff_t dwarf_getpubnames (Dwarf *dbg,
     572             :                                     int (*callback) (Dwarf *, Dwarf_Global *,
     573             :                                                      void *),
     574             :                                     void *arg, ptrdiff_t offset)
     575             :      __nonnull_attribute__ (2);
     576             : 
     577             : 
     578             : /* Get source file information for CU.  */
     579             : extern int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines,
     580             :                               size_t *nlines) __nonnull_attribute__ (2, 3);
     581             : 
     582             : /* Return one of the source lines of the CU.  */
     583             : extern Dwarf_Line *dwarf_onesrcline (Dwarf_Lines *lines, size_t idx);
     584             : 
     585             : /* Get the file source files used in the CU.  */
     586             : extern int dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files,
     587             :                               size_t *nfiles)
     588             :      __nonnull_attribute__ (2);
     589             : 
     590             : 
     591             : /* Get source for address in CU.  */
     592             : extern Dwarf_Line *dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr);
     593             : 
     594             : /* Get source for file and line number.  */
     595             : extern int dwarf_getsrc_file (Dwarf *dbg, const char *fname, int line, int col,
     596             :                               Dwarf_Line ***srcsp, size_t *nsrcs)
     597             :      __nonnull_attribute__ (2, 5, 6);
     598             : 
     599             : 
     600             : /* Return line address.  */
     601             : extern int dwarf_lineaddr (Dwarf_Line *line, Dwarf_Addr *addrp);
     602             : 
     603             : /* Return line VLIW operation index.  */
     604             : extern int dwarf_lineop_index (Dwarf_Line *line, unsigned int *op_indexp);
     605             : 
     606             : /* Return line number.  */
     607             : extern int dwarf_lineno (Dwarf_Line *line, int *linep)
     608             :      __nonnull_attribute__ (2);
     609             : 
     610             : /* Return column in line.  */
     611             : extern int dwarf_linecol (Dwarf_Line *line, int *colp)
     612             :      __nonnull_attribute__ (2);
     613             : 
     614             : /* Return true if record is for beginning of a statement.  */
     615             : extern int dwarf_linebeginstatement (Dwarf_Line *line, bool *flagp)
     616             :      __nonnull_attribute__ (2);
     617             : 
     618             : /* Return true if record is for end of sequence.  */
     619             : extern int dwarf_lineendsequence (Dwarf_Line *line, bool *flagp)
     620             :      __nonnull_attribute__ (2);
     621             : 
     622             : /* Return true if record is for beginning of a basic block.  */
     623             : extern int dwarf_lineblock (Dwarf_Line *line, bool *flagp)
     624             :      __nonnull_attribute__ (2);
     625             : 
     626             : /* Return true if record is for end of prologue.  */
     627             : extern int dwarf_lineprologueend (Dwarf_Line *line, bool *flagp)
     628             :      __nonnull_attribute__ (2);
     629             : 
     630             : /* Return true if record is for beginning of epilogue.  */
     631             : extern int dwarf_lineepiloguebegin (Dwarf_Line *line, bool *flagp)
     632             :      __nonnull_attribute__ (2);
     633             : 
     634             : /* Return instruction-set architecture in this record.  */
     635             : extern int dwarf_lineisa (Dwarf_Line *line, unsigned int *isap)
     636             :      __nonnull_attribute__ (2);
     637             : 
     638             : /* Return code path discriminator in this record.  */
     639             : extern int dwarf_linediscriminator (Dwarf_Line *line, unsigned int *discp)
     640             :      __nonnull_attribute__ (2);
     641             : 
     642             : 
     643             : /* Find line information for address.  */
     644             : extern const char *dwarf_linesrc (Dwarf_Line *line,
     645             :                                   Dwarf_Word *mtime, Dwarf_Word *length);
     646             : 
     647             : /* Return file information.  */
     648             : extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx,
     649             :                                   Dwarf_Word *mtime, Dwarf_Word *length);
     650             : 
     651             : /* Return the Dwarf_Files and index associated with the given Dwarf_Line.  */
     652             : extern int dwarf_line_file (Dwarf_Line *line,
     653             :                             Dwarf_Files **files, size_t *idx)
     654             :     __nonnull_attribute__ (2, 3);
     655             : 
     656             : /* Return the directory list used in the file information extracted.
     657             :    (*RESULT)[0] is the CU's DW_AT_comp_dir value, and may be null.
     658             :    (*RESULT)[0..*NDIRS-1] are the compile-time include directory path
     659             :    encoded by the compiler.  */
     660             : extern int dwarf_getsrcdirs (Dwarf_Files *files,
     661             :                              const char *const **result, size_t *ndirs)
     662             :   __nonnull_attribute__ (2, 3);
     663             : 
     664             : 
     665             : /* Return location expression, decoded as a list of operations.  */
     666             : extern int dwarf_getlocation (Dwarf_Attribute *attr, Dwarf_Op **expr,
     667             :                               size_t *exprlen) __nonnull_attribute__ (2, 3);
     668             : 
     669             : /* Return location expressions.  If the attribute uses a location list,
     670             :    ADDRESS selects the relevant location expressions from the list.
     671             :    There can be multiple matches, resulting in multiple expressions to
     672             :    return.  EXPRS and EXPRLENS are parallel arrays of NLOCS slots to
     673             :    fill in.  Returns the number of locations filled in, or -1 for
     674             :    errors.  If EXPRS is a null pointer, stores nothing and returns the
     675             :    total number of locations.  A return value of zero means that the
     676             :    location list indicated no value is accessible.  */
     677             : extern int dwarf_getlocation_addr (Dwarf_Attribute *attr, Dwarf_Addr address,
     678             :                                    Dwarf_Op **exprs, size_t *exprlens,
     679             :                                    size_t nlocs);
     680             : 
     681             : /* Enumerate the locations ranges and descriptions covered by the
     682             :    given attribute.  In the first call OFFSET should be zero and
     683             :    *BASEP need not be initialized.  Returns -1 for errors, zero when
     684             :    there are no more locations to report, or a nonzero OFFSET
     685             :    value to pass to the next call.  Each subsequent call must preserve
     686             :    *BASEP from the prior call.  Successful calls fill in *STARTP and
     687             :    *ENDP with a contiguous address range and *EXPR with a pointer to
     688             :    an array of operations with length *EXPRLEN.  If the attribute
     689             :    describes a single location description and not a location list the
     690             :    first call (with OFFSET zero) will return the location description
     691             :    in *EXPR with *STARTP set to zero and *ENDP set to minus one.  */
     692             : extern ptrdiff_t dwarf_getlocations (Dwarf_Attribute *attr,
     693             :                                      ptrdiff_t offset, Dwarf_Addr *basep,
     694             :                                      Dwarf_Addr *startp, Dwarf_Addr *endp,
     695             :                                      Dwarf_Op **expr, size_t *exprlen);
     696             : 
     697             : /* Return the block associated with a DW_OP_implicit_value operation.
     698             :    The OP pointer must point into an expression that dwarf_getlocation
     699             :    or dwarf_getlocation_addr has returned given the same ATTR.  */
     700             : extern int dwarf_getlocation_implicit_value (Dwarf_Attribute *attr,
     701             :                                              const Dwarf_Op *op,
     702             :                                              Dwarf_Block *return_block)
     703             :   __nonnull_attribute__ (2, 3);
     704             : 
     705             : /* Return the attribute indicated by a DW_OP_GNU_implicit_pointer operation.
     706             :    The OP pointer must point into an expression that dwarf_getlocation
     707             :    or dwarf_getlocation_addr has returned given the same ATTR.
     708             :    The result is the DW_AT_location or DW_AT_const_value attribute
     709             :    of the OP->number DIE.  */
     710             : extern int dwarf_getlocation_implicit_pointer (Dwarf_Attribute *attr,
     711             :                                                const Dwarf_Op *op,
     712             :                                                Dwarf_Attribute *result)
     713             :   __nonnull_attribute__ (2, 3);
     714             : 
     715             : /* Return the DIE associated with an operation such as
     716             :    DW_OP_GNU_implicit_pointer, DW_OP_GNU_parameter_ref, DW_OP_GNU_convert,
     717             :    DW_OP_GNU_reinterpret, DW_OP_GNU_const_type, DW_OP_GNU_regval_type or
     718             :    DW_OP_GNU_deref_type.  The OP pointer must point into an expression that
     719             :    dwarf_getlocation or dwarf_getlocation_addr has returned given the same
     720             :    ATTR.  The RESULT is a DIE that expresses a type or value needed by the
     721             :    given OP.  */
     722             : extern int dwarf_getlocation_die (Dwarf_Attribute *attr,
     723             :                                   const Dwarf_Op *op,
     724             :                                   Dwarf_Die *result)
     725             :   __nonnull_attribute__ (2, 3);
     726             : 
     727             : /* Return the attribute expressing a value associated with an operation such
     728             :    as DW_OP_implicit_value, DW_OP_GNU_entry_value or DW_OP_GNU_const_type.
     729             :    The OP pointer must point into an expression that dwarf_getlocation
     730             :    or dwarf_getlocation_addr has returned given the same ATTR.
     731             :    The RESULT is a value expressed by an attribute such as DW_AT_location
     732             :    or DW_AT_const_value.  */
     733             : extern int dwarf_getlocation_attr (Dwarf_Attribute *attr,
     734             :                                    const Dwarf_Op *op,
     735             :                                    Dwarf_Attribute *result)
     736             :   __nonnull_attribute__ (2, 3);
     737             : 
     738             : 
     739             : /* Compute the byte-size of a type DIE according to DWARF rules.
     740             :    For most types, this is just DW_AT_byte_size.
     741             :    For DW_TAG_array_type it can apply much more complex rules.  */
     742             : extern int dwarf_aggregate_size (Dwarf_Die *die, Dwarf_Word *size);
     743             : 
     744             : /* Given a language code, as returned by dwarf_srclan, get the default
     745             :    lower bound for a subrange type without a lower bound attribute.
     746             :    Returns zero on success or -1 on failure when the given language
     747             :    wasn't recognized.  */
     748             : extern int dwarf_default_lower_bound (int lang, Dwarf_Sword *result)
     749             :   __nonnull_attribute__ (2);
     750             : 
     751             : /* Return scope DIEs containing PC address.
     752             :    Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
     753             :    and returns the number of elements in the array.
     754             :    (*SCOPES)[0] is the DIE for the innermost scope containing PC,
     755             :    (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
     756             :    Returns -1 for errors or 0 if no scopes match PC.  */
     757             : extern int dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc,
     758             :                             Dwarf_Die **scopes);
     759             : 
     760             : /* Return scope DIEs containing the given DIE.
     761             :    Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
     762             :    and returns the number of elements in the array.
     763             :    (*SCOPES)[0] is a copy of DIE.
     764             :    (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
     765             :    Returns -1 for errors or 0 if DIE is not found in any scope entry.  */
     766             : extern int dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes);
     767             : 
     768             : 
     769             : /* Search SCOPES[0..NSCOPES-1] for a variable called NAME.
     770             :    Ignore the first SKIP_SHADOWS scopes that match the name.
     771             :    If MATCH_FILE is not null, accept only declaration in that source file;
     772             :    if MATCH_LINENO or MATCH_LINECOL are also nonzero, accept only declaration
     773             :    at that line and column.
     774             : 
     775             :    If successful, fill in *RESULT with the DIE of the variable found,
     776             :    and return N where SCOPES[N] is the scope defining the variable.
     777             :    Return -1 for errors or -2 for no matching variable found.  */
     778             : extern int dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
     779             :                               const char *name, int skip_shadows,
     780             :                               const char *match_file,
     781             :                               int match_lineno, int match_linecol,
     782             :                               Dwarf_Die *result);
     783             : 
     784             : 
     785             : 
     786             : /* Return list address ranges.  */
     787             : extern int dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges,
     788             :                              size_t *naranges)
     789             :      __nonnull_attribute__ (2);
     790             : 
     791             : /* Return one of the address range entries.  */
     792             : extern Dwarf_Arange *dwarf_onearange (Dwarf_Aranges *aranges, size_t idx);
     793             : 
     794             : /* Return information in address range record.  */
     795             : extern int dwarf_getarangeinfo (Dwarf_Arange *arange, Dwarf_Addr *addrp,
     796             :                                 Dwarf_Word *lengthp, Dwarf_Off *offsetp);
     797             : 
     798             : /* Get address range which includes given address.  */
     799             : extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges,
     800             :                                            Dwarf_Addr addr);
     801             : 
     802             : 
     803             : 
     804             : /* Get functions in CUDIE.  The given callback will be called for all
     805             :    defining DW_TAG_subprograms in the CU DIE tree.  If the callback
     806             :    returns DWARF_CB_ABORT the return value can be used as offset argument
     807             :    to resume the function to find all remaining functions (this is not
     808             :    really recommended, since it needs to rewalk the CU DIE tree first till
     809             :    that offset is found again).  If the callback returns DWARF_CB_OK
     810             :    dwarf_getfuncs will not return but keep calling the callback for each
     811             :    function DIE it finds.  Pass zero for offset on the first call to walk
     812             :    the full CU DIE tree.  If no more functions can be found and the callback
     813             :    returned DWARF_CB_OK then the function returns zero.  */
     814             : extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie,
     815             :                                  int (*callback) (Dwarf_Die *, void *),
     816             :                                  void *arg, ptrdiff_t offset);
     817             : 
     818             : 
     819             : /* Return file name containing definition of the given declaration.  */
     820             : extern const char *dwarf_decl_file (Dwarf_Die *decl);
     821             : 
     822             : /* Get line number of beginning of given declaration.  */
     823             : extern int dwarf_decl_line (Dwarf_Die *decl, int *linep)
     824             :      __nonnull_attribute__ (2);
     825             : 
     826             : /* Get column number of beginning of given declaration.  */
     827             : extern int dwarf_decl_column (Dwarf_Die *decl, int *colp)
     828             :      __nonnull_attribute__ (2);
     829             : 
     830             : 
     831             : /* Return nonzero if given function is an abstract inline definition.  */
     832             : extern int dwarf_func_inline (Dwarf_Die *func);
     833             : 
     834             : /* Find each concrete inlined instance of the abstract inline definition.  */
     835             : extern int dwarf_func_inline_instances (Dwarf_Die *func,
     836             :                                         int (*callback) (Dwarf_Die *, void *),
     837             :                                         void *arg);
     838             : 
     839             : 
     840             : /* Find the appropriate PC location or locations for function entry
     841             :    breakpoints for the given DW_TAG_subprogram DIE.  Returns -1 for errors.
     842             :    On success, returns the number of breakpoint locations (never zero)
     843             :    and sets *BKPTS to a malloc'd vector of addresses.  */
     844             : extern int dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts);
     845             : 
     846             : 
     847             : /* Iterate through the macro unit referenced by CUDIE and call
     848             :    CALLBACK for each macro information entry.  To start the iteration,
     849             :    one would pass DWARF_GETMACROS_START for TOKEN.
     850             : 
     851             :    The iteration continues while CALLBACK returns DWARF_CB_OK.  If the
     852             :    callback returns DWARF_CB_ABORT, the iteration stops and a
     853             :    continuation token is returned, which can be used to restart the
     854             :    iteration at the point where it ended.  Returns -1 for errors or 0
     855             :    if there are no more macro entries.
     856             : 
     857             :    Note that the Dwarf_Macro pointer passed to the callback is only
     858             :    valid for the duration of the callback invocation.
     859             : 
     860             :    For backward compatibility, a token of 0 is accepted for starting
     861             :    the iteration as well, but in that case this interface will refuse
     862             :    to serve opcode 0xff from .debug_macro sections.  Such opcode would
     863             :    be considered invalid and would cause dwarf_getmacros to return
     864             :    with error.  */
     865             : #define DWARF_GETMACROS_START PTRDIFF_MIN
     866             : extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie,
     867             :                                   int (*callback) (Dwarf_Macro *, void *),
     868             :                                   void *arg, ptrdiff_t token)
     869             :      __nonnull_attribute__ (2);
     870             : 
     871             : /* This is similar in operation to dwarf_getmacros, but selects the
     872             :    unit to iterate through by offset instead of by CU, and always
     873             :    iterates .debug_macro.  This can be used for handling
     874             :    DW_MACRO_GNU_transparent_include's or similar opcodes.
     875             : 
     876             :    TOKEN value of DWARF_GETMACROS_START can be used to start the
     877             :    iteration.
     878             : 
     879             :    It is not appropriate to obtain macro unit offset by hand from a CU
     880             :    DIE and then request iteration through this interface.  The reason
     881             :    for this is that if a dwarf_macro_getsrcfiles is later called,
     882             :    there would be no way to figure out what DW_AT_comp_dir was present
     883             :    on the CU DIE, and file names referenced in either the macro unit
     884             :    itself, or the .debug_line unit that it references, might be wrong.
     885             :    Use dwarf_getmacros.  */
     886             : extern ptrdiff_t dwarf_getmacros_off (Dwarf *dbg, Dwarf_Off macoff,
     887             :                                       int (*callback) (Dwarf_Macro *, void *),
     888             :                                       void *arg, ptrdiff_t token)
     889             :   __nonnull_attribute__ (3);
     890             : 
     891             : /* Get the source files used by the macro entry.  You shouldn't assume
     892             :    that Dwarf_Files references will remain valid after MACRO becomes
     893             :    invalid.  (Which is to say it's only valid within the
     894             :    dwarf_getmacros* callback.)  Returns 0 for success or a negative
     895             :    value in case of an error.  */
     896             : extern int dwarf_macro_getsrcfiles (Dwarf *dbg, Dwarf_Macro *macro,
     897             :                                     Dwarf_Files **files, size_t *nfiles)
     898             :   __nonnull_attribute__ (2, 3, 4);
     899             : 
     900             : /* Return macro opcode.  That's a constant that can be either from
     901             :    DW_MACINFO_* domain or DW_MACRO_GNU_* domain.  The two domains have
     902             :    compatible values, so it's OK to use either of them for
     903             :    comparisons.  The only differences is 0xff, which could be either
     904             :    DW_MACINFO_vendor_ext or a vendor-defined DW_MACRO_* constant.  One
     905             :    would need to look if the CU DIE which the iteration was requested
     906             :    for has attribute DW_AT_macro_info, or either of DW_AT_GNU_macros
     907             :    or DW_AT_macros to differentiate the two interpretations.  */
     908             : extern int dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep)
     909             :      __nonnull_attribute__ (2);
     910             : 
     911             : /* Get number of parameters of MACRO and store it to *PARAMCNTP.  */
     912             : extern int dwarf_macro_getparamcnt (Dwarf_Macro *macro, size_t *paramcntp);
     913             : 
     914             : /* Get IDX-th parameter of MACRO (numbered from zero), and stores it
     915             :    to *ATTRIBUTE.  Returns 0 on success or -1 for errors.
     916             : 
     917             :    After a successful call, you can query ATTRIBUTE by dwarf_whatform
     918             :    to determine which of the dwarf_formX calls to make to get actual
     919             :    value out of ATTRIBUTE.  Note that calling dwarf_whatattr is not
     920             :    meaningful for pseudo-attributes formed this way.  */
     921             : extern int dwarf_macro_param (Dwarf_Macro *macro, size_t idx,
     922             :                               Dwarf_Attribute *attribute);
     923             : 
     924             : /* Return macro parameter with index 0.  This will return -1 if the
     925             :    parameter is not an integral value.  Use dwarf_macro_param for more
     926             :    general access.  */
     927             : extern int dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp)
     928             :      __nonnull_attribute__ (2);
     929             : 
     930             : /* Return macro parameter with index 1.  This will return -1 if the
     931             :    parameter is not an integral or string value.  Use
     932             :    dwarf_macro_param for more general access.  */
     933             : extern int dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp,
     934             :                                const char **strp);
     935             : 
     936             : /* Compute what's known about a call frame when the PC is at ADDRESS.
     937             :    Returns 0 for success or -1 for errors.
     938             :    On success, *FRAME is a malloc'd pointer.  */
     939             : extern int dwarf_cfi_addrframe (Dwarf_CFI *cache,
     940             :                                 Dwarf_Addr address, Dwarf_Frame **frame)
     941             :   __nonnull_attribute__ (3);
     942             : 
     943             : /* Return the DWARF register number used in FRAME to denote
     944             :    the return address in FRAME's caller frame.  The remaining
     945             :    arguments can be non-null to fill in more information.
     946             : 
     947             :    Fill [*START, *END) with the PC range to which FRAME's information applies.
     948             :    Fill in *SIGNALP to indicate whether this is a signal-handling frame.
     949             :    If true, this is the implicit call frame that calls a signal handler.
     950             :    This frame's "caller" is actually the interrupted state, not a call;
     951             :    its return address is an exact PC, not a PC after a call instruction.  */
     952             : extern int dwarf_frame_info (Dwarf_Frame *frame,
     953             :                              Dwarf_Addr *start, Dwarf_Addr *end, bool *signalp);
     954             : 
     955             : /* Return a DWARF expression that yields the Canonical Frame Address at
     956             :    this frame state.  Returns -1 for errors, or zero for success, with
     957             :    *NOPS set to the number of operations stored at *OPS.  That pointer
     958             :    can be used only as long as FRAME is alive and unchanged.  *NOPS is
     959             :    zero if the CFA cannot be determined here.  Note that if nonempty,
     960             :    *OPS is a DWARF expression, not a location description--append
     961             :    DW_OP_stack_value to a get a location description for the CFA.  */
     962             : extern int dwarf_frame_cfa (Dwarf_Frame *frame, Dwarf_Op **ops, size_t *nops)
     963             :   __nonnull_attribute__ (2);
     964             : 
     965             : /* Deliver a DWARF location description that yields the location or
     966             :    value of DWARF register number REGNO in the state described by FRAME.
     967             : 
     968             :    Returns -1 for errors or zero for success, setting *NOPS to the
     969             :    number of operations in the array stored at *OPS.  Note the last
     970             :    operation is DW_OP_stack_value if there is no mutable location but
     971             :    only a computable value.
     972             : 
     973             :    *NOPS zero with *OPS set to OPS_MEM means CFI says the caller's
     974             :    REGNO is "undefined", i.e. it's call-clobbered and cannot be recovered.
     975             : 
     976             :    *NOPS zero with *OPS set to a null pointer means CFI says the
     977             :    caller's REGNO is "same_value", i.e. this frame did not change it;
     978             :    ask the caller frame where to find it.
     979             : 
     980             :    For common simple expressions *OPS is OPS_MEM.  For arbitrary DWARF
     981             :    expressions in the CFI, *OPS is an internal pointer that can be used as
     982             :    long as the Dwarf_CFI used to create FRAME remains alive.  */
     983             : extern int dwarf_frame_register (Dwarf_Frame *frame, int regno,
     984             :                                  Dwarf_Op ops_mem[3],
     985             :                                  Dwarf_Op **ops, size_t *nops)
     986             :   __nonnull_attribute__ (3, 4, 5);
     987             : 
     988             : 
     989             : /* Return error code of last failing function call.  This value is kept
     990             :    separately for each thread.  */
     991             : extern int dwarf_errno (void);
     992             : 
     993             : /* Return error string for ERROR.  If ERROR is zero, return error string
     994             :    for most recent error or NULL is none occurred.  If ERROR is -1 the
     995             :    behaviour is similar to the last case except that not NULL but a legal
     996             :    string is returned.  */
     997             : extern const char *dwarf_errmsg (int err);
     998             : 
     999             : 
    1000             : /* Register new Out-Of-Memory handler.  The old handler is returned.  */
    1001             : extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler);
    1002             : 
    1003             : 
    1004             : /* Inline optimizations.  */
    1005             : #ifdef __OPTIMIZE__
    1006             : /* Return attribute code of given attribute.  */
    1007             : __libdw_extern_inline unsigned int
    1008             : dwarf_whatattr (Dwarf_Attribute *attr)
    1009             : {
    1010     2782169 :   return attr == NULL ? 0 : attr->code;
    1011             : }
    1012             : 
    1013             : /* Return attribute code of given attribute.  */
    1014             : __libdw_extern_inline unsigned int
    1015             : dwarf_whatform (Dwarf_Attribute *attr)
    1016             : {
    1017     2782169 :   return attr == NULL ? 0 : attr->form;
    1018             : }
    1019             : #endif  /* Optimize.  */
    1020             : 
    1021             : #ifdef __cplusplus
    1022             : }
    1023             : #endif
    1024             : 
    1025             : #endif  /* libdw.h */

Generated by: LCOV version 1.12