LTP GCOV extension - code coverage report
Current view: directory - obj/include-elfutils/elfutils - libdw.h
Test: stap.info
Date: 2008-03-12 Instrumented lines: 1
Code covered: 100.0 % Executed lines: 1

       1                 : /* Interfaces for libdw.
       2                 :    Copyright (C) 2002, 2004, 2005, 2006, 2007 Red Hat, Inc.
       3                 :    This file is part of Red Hat elfutils.
       4                 : 
       5                 :    Red Hat elfutils is free software; you can redistribute it and/or modify
       6                 :    it under the terms of the GNU General Public License as published by the
       7                 :    Free Software Foundation; version 2 of the License.
       8                 : 
       9                 :    Red Hat elfutils is distributed in the hope that it will be useful, but
      10                 :    WITHOUT ANY WARRANTY; without even the implied warranty of
      11                 :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12                 :    General Public License for more details.
      13                 : 
      14                 :    You should have received a copy of the GNU General Public License along
      15                 :    with Red Hat elfutils; if not, write to the Free Software Foundation,
      16                 :    Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
      17                 : 
      18                 :    In addition, as a special exception, Red Hat, Inc. gives You the
      19                 :    additional right to link the code of Red Hat elfutils with code licensed
      20                 :    under any Open Source Initiative certified open source license
      21                 :    (http://www.opensource.org/licenses/index.php) which requires the
      22                 :    distribution of source code with any binary distribution and to
      23                 :    distribute linked combinations of the two.  Non-GPL Code permitted under
      24                 :    this exception must only link to the code of Red Hat elfutils through
      25                 :    those well defined interfaces identified in the file named EXCEPTION
      26                 :    found in the source code files (the "Approved Interfaces").  The files
      27                 :    of Non-GPL Code may instantiate templates or use macros or inline
      28                 :    functions from the Approved Interfaces without causing the resulting
      29                 :    work to be covered by the GNU General Public License.  Only Red Hat,
      30                 :    Inc. may make changes or additions to the list of Approved Interfaces.
      31                 :    Red Hat's grant of this exception is conditioned upon your not adding
      32                 :    any new exceptions.  If you wish to add a new Approved Interface or
      33                 :    exception, please contact Red Hat.  You must obey the GNU General Public
      34                 :    License in all respects for all of the Red Hat elfutils code and other
      35                 :    code used in conjunction with Red Hat elfutils except the Non-GPL Code
      36                 :    covered by this exception.  If you modify this file, you may extend this
      37                 :    exception to your version of the file, but you are not obligated to do
      38                 :    so.  If you do not wish to provide this exception without modification,
      39                 :    you must delete this exception statement from your version and license
      40                 :    this file solely under the GPL without exception.
      41                 : 
      42                 :    Red Hat elfutils is an included package of the Open Invention Network.
      43                 :    An included package of the Open Invention Network is a package for which
      44                 :    Open Invention Network licensees cross-license their patents.  No patent
      45                 :    license is granted, either expressly or impliedly, by designation as an
      46                 :    included package.  Should you wish to participate in the Open Invention
      47                 :    Network licensing program, please visit www.openinventionnetwork.com
      48                 :    <http://www.openinventionnetwork.com>.  */
      49                 : 
      50                 : #ifndef _LIBDW_H
      51                 : #define _LIBDW_H        1
      52                 : 
      53                 : #include <gelf.h>
      54                 : #include <stdbool.h>
      55                 : #include <stddef.h>
      56                 : 
      57                 : 
      58                 : #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
      59                 : # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
      60                 : # define __deprecated_attribute__ __attribute__ ((__deprecated__))
      61                 : #else
      62                 : # define __nonnull_attribute__(args...)
      63                 : # define __deprecated_attribute__
      64                 : #endif
      65                 : 
      66                 : 
      67                 : #ifdef __GNUC_STDC_INLINE__
      68                 : # define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__))
      69                 : #else
      70                 : # define __libdw_extern_inline extern __inline
      71                 : #endif
      72                 : 
      73                 : 
      74                 : /* Mode for the session.  */
      75                 : typedef enum
      76                 :   {
      77                 :     DWARF_C_READ,               /* Read .. */
      78                 :     DWARF_C_RDWR,               /* Read and write .. */
      79                 :     DWARF_C_WRITE,              /* Write .. */
      80                 :   }
      81                 : Dwarf_Cmd;
      82                 : 
      83                 : 
      84                 : /* Callback results.  */
      85                 : enum
      86                 : {
      87                 :   DWARF_CB_OK = 0,
      88                 :   DWARF_CB_ABORT
      89                 : };
      90                 : 
      91                 : 
      92                 : /* Error values.  */
      93                 : enum
      94                 :   {
      95                 :     DW_TAG_invalid = 0
      96                 : #define DW_TAG_invalid  DW_TAG_invalid
      97                 :   };
      98                 : 
      99                 : 
     100                 : /* Type for offset in DWARF file.  */
     101                 : typedef GElf_Off Dwarf_Off;
     102                 : 
     103                 : /* Type for address in DWARF file.  */
     104                 : typedef GElf_Addr Dwarf_Addr;
     105                 : 
     106                 : /* Integer types.  Big enough to hold any numeric value.  */
     107                 : typedef GElf_Xword Dwarf_Word;
     108                 : typedef GElf_Sxword Dwarf_Sword;
     109                 : /* For the times we know we do not need that much.  */
     110                 : typedef GElf_Half Dwarf_Half;
     111                 : 
     112                 : 
     113                 : /* DWARF abbreviation record.  */
     114                 : typedef struct Dwarf_Abbrev Dwarf_Abbrev;
     115                 : 
     116                 : /* Returned to show the last DIE has be returned.  */
     117                 : #define DWARF_END_ABBREV ((Dwarf_Abbrev *) -1l)
     118                 : 
     119                 : /* Source code line information for CU.  */
     120                 : typedef struct Dwarf_Lines_s Dwarf_Lines;
     121                 : 
     122                 : /* One source code line information.  */
     123                 : typedef struct Dwarf_Line_s Dwarf_Line;
     124                 : 
     125                 : /* Source file information.  */
     126                 : typedef struct Dwarf_Files_s Dwarf_Files;
     127                 : 
     128                 : /* One address range record.  */
     129                 : typedef struct Dwarf_Arange_s Dwarf_Arange;
     130                 : 
     131                 : /* Address ranges of a file.  */
     132                 : typedef struct Dwarf_Aranges_s Dwarf_Aranges;
     133                 : 
     134                 : /* CU representation.  */
     135                 : struct Dwarf_CU;
     136                 : 
     137                 : /* Macro information.  */
     138                 : typedef struct Dwarf_Macro_s Dwarf_Macro;
     139                 : 
     140                 : /* Attribute representation.  */
     141                 : typedef struct
     142                 : {
     143                 :   unsigned int code;
     144                 :   unsigned int form;
     145                 :   unsigned char *valp;
     146                 :   struct Dwarf_CU *cu;
     147                 : } Dwarf_Attribute;
     148                 : 
     149                 : 
     150                 : /* Data block representation.  */
     151                 : typedef struct
     152                 : {
     153                 :   Dwarf_Word length;
     154                 :   unsigned char *data;
     155                 : } Dwarf_Block;
     156                 : 
     157                 : 
     158                 : /* DIE information.  */
     159                 : typedef struct
     160                 : {
     161                 :   /* The offset can be computed from the address.  */
     162                 :   void *addr;
     163                 :   struct Dwarf_CU *cu;
     164                 :   Dwarf_Abbrev *abbrev;
     165                 :   // XXX We'll see what other information will be needed.
     166                 :   long int padding__;
     167         7431635 : } Dwarf_Die;
     168                 : 
     169                 : /* Returned to show the last DIE has be returned.  */
     170                 : #define DWARF_END_DIE ((Dwarf_Die *) -1l)
     171                 : 
     172                 : 
     173                 : /* Global symbol information.  */
     174                 : typedef struct
     175                 : {
     176                 :   Dwarf_Off cu_offset;
     177                 :   Dwarf_Off die_offset;
     178                 :   const char *name;
     179                 : } Dwarf_Global;
     180                 : 
     181                 : 
     182                 : /* One operation in a DWARF location expression.
     183                 :    A location expression is an array of these.  */
     184                 : typedef struct
     185                 : {
     186                 :   uint8_t atom;                 /* Operation */
     187                 :   Dwarf_Word number;            /* Operand */
     188                 :   Dwarf_Word number2;           /* Possible second operand */
     189                 :   Dwarf_Word offset;            /* Offset in location expression */
     190                 : } Dwarf_Op;
     191                 : 
     192                 : 
     193                 : /* Handle for debug sessions.  */
     194                 : typedef struct Dwarf Dwarf;
     195                 : 
     196                 : 
     197                 : /* Out-Of-Memory handler.  */
     198                 : #if __GNUC__ < 4
     199                 : typedef void (*Dwarf_OOM) (void);
     200                 : #else
     201                 : typedef void (*__attribute__ ((noreturn)) Dwarf_OOM) (void);
     202                 : #endif
     203                 : 
     204                 : 
     205                 : #ifdef __cplusplus
     206                 : extern "C" {
     207                 : #endif
     208                 : 
     209                 : /* Create a handle for a new debug session.  */
     210                 : extern Dwarf *dwarf_begin (int fildes, Dwarf_Cmd cmd);
     211                 : 
     212                 : /* Create a handle for a new debug session for an ELF file.  */
     213                 : extern Dwarf *dwarf_begin_elf (Elf *elf, Dwarf_Cmd cmd, Elf_Scn *scngrp);
     214                 : 
     215                 : /* Retrieve ELF descriptor used for DWARF access.  */
     216                 : extern Elf *dwarf_getelf (Dwarf *dwarf);
     217                 : 
     218                 : /* Release debugging handling context.  */
     219                 : extern int dwarf_end (Dwarf *dwarf);
     220                 : 
     221                 : 
     222                 : /* Get the data block for the .debug_info section.  */
     223                 : extern Elf_Data *dwarf_getscn_info (Dwarf *dwarf);
     224                 : 
     225                 : /* Read the header for the DWARF CU header.  */
     226                 : extern int dwarf_nextcu (Dwarf *dwarf, Dwarf_Off off, Dwarf_Off *next_off,
     227                 :                          size_t *header_sizep, Dwarf_Off *abbrev_offsetp,
     228                 :                          uint8_t *address_sizep, uint8_t *offset_sizep)
     229                 :      __nonnull_attribute__ (3);
     230                 : 
     231                 : 
     232                 : /* Return DIE at given offset.  */
     233                 : extern Dwarf_Die *dwarf_offdie (Dwarf *dbg, Dwarf_Off offset,
     234                 :                                 Dwarf_Die *result) __nonnull_attribute__ (3);
     235                 : 
     236                 : /* Return offset of DIE.  */
     237                 : extern Dwarf_Off dwarf_dieoffset (Dwarf_Die *die);
     238                 : 
     239                 : /* Return offset of DIE in CU.  */
     240                 : extern Dwarf_Off dwarf_cuoffset (Dwarf_Die *die);
     241                 : 
     242                 : /* Return CU DIE containing given DIE.  */
     243                 : extern Dwarf_Die *dwarf_diecu (Dwarf_Die *die, Dwarf_Die *result,
     244                 :                                uint8_t *address_sizep, uint8_t *offset_sizep)
     245                 :      __nonnull_attribute__ (2);
     246                 : 
     247                 : /* Return CU DIE containing given address.  */
     248                 : extern Dwarf_Die *dwarf_addrdie (Dwarf *dbg, Dwarf_Addr addr,
     249                 :                                  Dwarf_Die *result) __nonnull_attribute__ (3);
     250                 : 
     251                 : /* Return child of current DIE.  */
     252                 : extern int dwarf_child (Dwarf_Die *die, Dwarf_Die *result)
     253                 :      __nonnull_attribute__ (2);
     254                 : 
     255                 : /* Locates the first sibling of DIE and places it in RESULT.
     256                 :    Returns 0 if a sibling was found, -1 if something went wrong.
     257                 :    Returns 1 if no sibling could be found and, if RESULT is not
     258                 :    the same as DIE, it sets RESULT->addr to the address of the
     259                 :    (non-sibling) DIE that follows this one, or NULL if this DIE
     260                 :    was the last one in the cokmpilation unit.  */
     261                 : extern int dwarf_siblingof (Dwarf_Die *die, Dwarf_Die *result)
     262                 :      __nonnull_attribute__ (2);
     263                 : 
     264                 : /* Check whether the DIE has children.  */
     265                 : extern int dwarf_haschildren (Dwarf_Die *die) __nonnull_attribute__ (1);
     266                 : 
     267                 : /* Walks the attributes of DIE, starting at the one OFFSET bytes in,
     268                 :    calling the CALLBACK function for each one.  Stops if the callback
     269                 :    function ever returns a value other than DWARF_CB_OK and returns the
     270                 :    offset of the offending attribute.  If the end of the attributes
     271                 :    is reached 1 is returned.  If something goes wrong -1 is returned and
     272                 :    the dwarf error number is set.  */
     273                 : extern ptrdiff_t dwarf_getattrs (Dwarf_Die *die,
     274                 :                                  int (*callback) (Dwarf_Attribute *, void *),
     275                 :                                  void *arg, ptrdiff_t offset)
     276                 :      __nonnull_attribute__ (2);
     277                 : 
     278                 : /* Return tag of given DIE.  */
     279                 : extern int dwarf_tag (Dwarf_Die *die) __nonnull_attribute__ (1);
     280                 : 
     281                 : 
     282                 : /* Return specific attribute of DIE.  */
     283                 : extern Dwarf_Attribute *dwarf_attr (Dwarf_Die *die, unsigned int search_name,
     284                 :                                     Dwarf_Attribute *result)
     285                 :      __nonnull_attribute__ (3);
     286                 : 
     287                 : /* Check whether given DIE has specific attribute.  */
     288                 : extern int dwarf_hasattr (Dwarf_Die *die, unsigned int search_name);
     289                 : 
     290                 : /* These are the same as dwarf_attr and dwarf_hasattr, respectively,
     291                 :    but they resolve an indirect attribute through DW_AT_abstract_origin.  */
     292                 : extern Dwarf_Attribute *dwarf_attr_integrate (Dwarf_Die *die,
     293                 :                                               unsigned int search_name,
     294                 :                                               Dwarf_Attribute *result)
     295                 :      __nonnull_attribute__ (3);
     296                 : extern int dwarf_hasattr_integrate (Dwarf_Die *die, unsigned int search_name);
     297                 : 
     298                 : 
     299                 : 
     300                 : 
     301                 : /* Check whether given attribute has specific form.  */
     302                 : extern int dwarf_hasform (Dwarf_Attribute *attr, unsigned int search_form);
     303                 : 
     304                 : /* Return attribute code of given attribute.  */
     305                 : extern unsigned int dwarf_whatattr (Dwarf_Attribute *attr);
     306                 : 
     307                 : /* Return form code of given attribute.  */
     308                 : extern unsigned int dwarf_whatform (Dwarf_Attribute *attr);
     309                 : 
     310                 : 
     311                 : /* Return string associated with given attribute.  */
     312                 : extern const char *dwarf_formstring (Dwarf_Attribute *attrp);
     313                 : 
     314                 : /* Return unsigned constant represented by attribute.  */
     315                 : extern int dwarf_formudata (Dwarf_Attribute *attr, Dwarf_Word *return_uval)
     316                 :      __nonnull_attribute__ (2);
     317                 : 
     318                 : /* Return signed constant represented by attribute.  */
     319                 : extern int dwarf_formsdata (Dwarf_Attribute *attr, Dwarf_Sword *return_uval)
     320                 :      __nonnull_attribute__ (2);
     321                 : 
     322                 : /* Return address represented by attribute.  */
     323                 : extern int dwarf_formaddr (Dwarf_Attribute *attr, Dwarf_Addr *return_addr)
     324                 :      __nonnull_attribute__ (2);
     325                 : 
     326                 : /* This function is deprecated.  Always use dwarf_formref_die instead.
     327                 :    Return reference offset represented by attribute.  */
     328                 : extern int dwarf_formref (Dwarf_Attribute *attr, Dwarf_Off *return_offset)
     329                 :      __nonnull_attribute__ (2) __deprecated_attribute__;
     330                 : 
     331                 : /* Look up the DIE in a reference-form attribute.  */
     332                 : extern Dwarf_Die *dwarf_formref_die (Dwarf_Attribute *attr, Dwarf_Die *die_mem)
     333                 :      __nonnull_attribute__ (2);
     334                 : 
     335                 : /* Return block represented by attribute.  */
     336                 : extern int dwarf_formblock (Dwarf_Attribute *attr, Dwarf_Block *return_block)
     337                 :      __nonnull_attribute__ (2);
     338                 : 
     339                 : /* Return flag represented by attribute.  */
     340                 : extern int dwarf_formflag (Dwarf_Attribute *attr, bool *return_bool)
     341                 :      __nonnull_attribute__ (2);
     342                 : 
     343                 : 
     344                 : /* Simplified attribute value access functions.  */
     345                 : 
     346                 : /* Return string in name attribute of DIE.  */
     347                 : extern const char *dwarf_diename (Dwarf_Die *die);
     348                 : 
     349                 : /* Return high PC attribute of DIE.  */
     350                 : extern int dwarf_highpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
     351                 :      __nonnull_attribute__ (2);
     352                 : 
     353                 : /* Return low PC attribute of DIE.  */
     354                 : extern int dwarf_lowpc (Dwarf_Die *die, Dwarf_Addr *return_addr)
     355                 :      __nonnull_attribute__ (2);
     356                 : 
     357                 : /* Return entry_pc or low_pc attribute of DIE.  */
     358                 : extern int dwarf_entrypc (Dwarf_Die *die, Dwarf_Addr *return_addr)
     359                 :      __nonnull_attribute__ (2);
     360                 : 
     361                 : /* Return 1 if DIE's lowpc/highpc or ranges attributes match the PC address,
     362                 :    0 if not, or -1 for errors.  */
     363                 : extern int dwarf_haspc (Dwarf_Die *die, Dwarf_Addr pc);
     364                 : 
     365                 : /* Enumerate the PC address ranges covered by this DIE, covering all
     366                 :    addresses where dwarf_haspc returns true.  In the first call OFFSET
     367                 :    should be zero and *BASEP need not be initialized.  Returns -1 for
     368                 :    errors, zero when there are no more address ranges to report, or a
     369                 :    nonzero OFFSET value to pass to the next call.  Each subsequent call
     370                 :    must preserve *BASEP from the prior call.  Successful calls fill in
     371                 :    *STARTP and *ENDP with a contiguous address range.  */
     372                 : extern ptrdiff_t dwarf_ranges (Dwarf_Die *die,
     373                 :                                ptrdiff_t offset, Dwarf_Addr *basep,
     374                 :                                Dwarf_Addr *startp, Dwarf_Addr *endp);
     375                 : 
     376                 : 
     377                 : /* Return byte size attribute of DIE.  */
     378                 : extern int dwarf_bytesize (Dwarf_Die *die);
     379                 : 
     380                 : /* Return bit size attribute of DIE.  */
     381                 : extern int dwarf_bitsize (Dwarf_Die *die);
     382                 : 
     383                 : /* Return bit offset attribute of DIE.  */
     384                 : extern int dwarf_bitoffset (Dwarf_Die *die);
     385                 : 
     386                 : /* Return array order attribute of DIE.  */
     387                 : extern int dwarf_arrayorder (Dwarf_Die *die);
     388                 : 
     389                 : /* Return source language attribute of DIE.  */
     390                 : extern int dwarf_srclang (Dwarf_Die *die);
     391                 : 
     392                 : 
     393                 : /* Get abbreviation at given offset for given DIE.  */
     394                 : extern Dwarf_Abbrev *dwarf_getabbrev (Dwarf_Die *die, Dwarf_Off offset,
     395                 :                                       size_t *lengthp);
     396                 : 
     397                 : /* Get abbreviation at given offset in .debug_abbrev section.  */
     398                 : extern int dwarf_offabbrev (Dwarf *dbg, Dwarf_Off offset, size_t *lengthp,
     399                 :                             Dwarf_Abbrev *abbrevp)
     400                 :      __nonnull_attribute__ (4);
     401                 : 
     402                 : /* Get abbreviation code.  */
     403                 : extern unsigned int dwarf_getabbrevcode (Dwarf_Abbrev *abbrev);
     404                 : 
     405                 : /* Get abbreviation tag.  */
     406                 : extern unsigned int dwarf_getabbrevtag (Dwarf_Abbrev *abbrev);
     407                 : 
     408                 : /* Return true if abbreviation is children flag set.  */
     409                 : extern int dwarf_abbrevhaschildren (Dwarf_Abbrev *abbrev);
     410                 : 
     411                 : /* Get number of attributes of abbreviation.  */
     412                 : extern int dwarf_getattrcnt (Dwarf_Abbrev *abbrev, size_t *attrcntp)
     413                 :      __nonnull_attribute__ (2);
     414                 : 
     415                 : /* Get specific attribute of abbreviation.  */
     416                 : extern int dwarf_getabbrevattr (Dwarf_Abbrev *abbrev, size_t idx,
     417                 :                                 unsigned int *namep, unsigned int *formp,
     418                 :                                 Dwarf_Off *offset);
     419                 : 
     420                 : 
     421                 : /* Get string from-debug_str section.  */
     422                 : extern const char *dwarf_getstring (Dwarf *dbg, Dwarf_Off offset,
     423                 :                                     size_t *lenp);
     424                 : 
     425                 : 
     426                 : /* Get public symbol information.  */
     427                 : extern ptrdiff_t dwarf_getpubnames (Dwarf *dbg,
     428                 :                                     int (*callback) (Dwarf *, Dwarf_Global *,
     429                 :                                                      void *),
     430                 :                                     void *arg, ptrdiff_t offset)
     431                 :      __nonnull_attribute__ (2);
     432                 : 
     433                 : 
     434                 : /* Get source file information for CU.  */
     435                 : extern int dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines,
     436                 :                               size_t *nlines) __nonnull_attribute__ (2, 3);
     437                 : 
     438                 : /* Return one of the source lines of the CU.  */
     439                 : extern Dwarf_Line *dwarf_onesrcline (Dwarf_Lines *lines, size_t idx);
     440                 : 
     441                 : /* Get the file source files used in the CU.  */
     442                 : extern int dwarf_getsrcfiles (Dwarf_Die *cudie, Dwarf_Files **files,
     443                 :                               size_t *nfiles)
     444                 :      __nonnull_attribute__ (2);
     445                 : 
     446                 : 
     447                 : /* Get source for address in CU.  */
     448                 : extern Dwarf_Line *dwarf_getsrc_die (Dwarf_Die *cudie, Dwarf_Addr addr);
     449                 : 
     450                 : /* Get source for file and line number.  */
     451                 : extern int dwarf_getsrc_file (Dwarf *dbg, const char *fname, int line, int col,
     452                 :                               Dwarf_Line ***srcsp, size_t *nsrcs)
     453                 :      __nonnull_attribute__ (2, 5, 6);
     454                 : 
     455                 : 
     456                 : /* Return line address.  */
     457                 : extern int dwarf_lineaddr (Dwarf_Line *line, Dwarf_Addr *addrp);
     458                 : 
     459                 : /* Return line number.  */
     460                 : extern int dwarf_lineno (Dwarf_Line *line, int *linep)
     461                 :      __nonnull_attribute__ (2);
     462                 : 
     463                 : /* Return column in line.  */
     464                 : extern int dwarf_linecol (Dwarf_Line *line, int *colp)
     465                 :      __nonnull_attribute__ (2);
     466                 : 
     467                 : /* Return true if record is for beginning of a statement.  */
     468                 : extern int dwarf_linebeginstatement (Dwarf_Line *line, bool *flagp)
     469                 :      __nonnull_attribute__ (2);
     470                 : 
     471                 : /* Return true if record is for end of sequence.  */
     472                 : extern int dwarf_lineendsequence (Dwarf_Line *line, bool *flagp)
     473                 :      __nonnull_attribute__ (2);
     474                 : 
     475                 : /* Return true if record is for beginning of a basic block.  */
     476                 : extern int dwarf_lineblock (Dwarf_Line *line, bool *flagp)
     477                 :      __nonnull_attribute__ (2);
     478                 : 
     479                 : /* Return true if record is for end of prologue.  */
     480                 : extern int dwarf_lineprologueend (Dwarf_Line *line, bool *flagp)
     481                 :      __nonnull_attribute__ (2);
     482                 : 
     483                 : /* Return true if record is for beginning of epilogue.  */
     484                 : extern int dwarf_lineepiloguebegin (Dwarf_Line *line, bool *flagp)
     485                 :      __nonnull_attribute__ (2);
     486                 : 
     487                 : 
     488                 : /* Find line information for address.  */
     489                 : extern const char *dwarf_linesrc (Dwarf_Line *line,
     490                 :                                   Dwarf_Word *mtime, Dwarf_Word *length);
     491                 : 
     492                 : /* Return file information.  */
     493                 : extern const char *dwarf_filesrc (Dwarf_Files *file, size_t idx,
     494                 :                                   Dwarf_Word *mtime, Dwarf_Word *length);
     495                 : 
     496                 : /* Return the directory list used in the file information extracted.
     497                 :    (*RESULT)[0] is the CU's DW_AT_comp_dir value, and may be null.
     498                 :    (*RESULT)[0..*NDIRS-1] are the compile-time include directory path
     499                 :    encoded by the compiler.  */
     500                 : extern int dwarf_getsrcdirs (Dwarf_Files *files,
     501                 :                              const char *const **result, size_t *ndirs)
     502                 :   __nonnull_attribute__ (2, 3);
     503                 : 
     504                 : 
     505                 : /* Return location expression, decoded as a list of operations.  */
     506                 : extern int dwarf_getlocation (Dwarf_Attribute *attr, Dwarf_Op **expr,
     507                 :                               size_t *exprlen) __nonnull_attribute__ (2, 3);
     508                 : 
     509                 : /* Return location expressions.  If the attribute uses a location list,
     510                 :    ADDRESS selects the relevant location expressions from the list.
     511                 :    There can be multiple matches, resulting in multiple expressions to
     512                 :    return.  EXPRS and EXPRLENS are parallel arrays of NLOCS slots to
     513                 :    fill in.  Returns the number of locations filled in, or -1 for
     514                 :    errors.  If EXPRS is a null pointer, stores nothing and returns the
     515                 :    total number of locations.  A return value of zero means that the
     516                 :    location list indicated no value is accessible.  */
     517                 : extern int dwarf_getlocation_addr (Dwarf_Attribute *attr, Dwarf_Addr address,
     518                 :                                    Dwarf_Op **exprs, size_t *exprlens,
     519                 :                                    size_t nlocs);
     520                 : 
     521                 : 
     522                 : /* Return scope DIEs containing PC address.
     523                 :    Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
     524                 :    and returns the number of elements in the array.
     525                 :    (*SCOPES)[0] is the DIE for the innermost scope containing PC,
     526                 :    (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
     527                 :    Returns -1 for errors or 0 if no scopes match PC.  */
     528                 : extern int dwarf_getscopes (Dwarf_Die *cudie, Dwarf_Addr pc,
     529                 :                             Dwarf_Die **scopes);
     530                 : 
     531                 : /* Return scope DIEs containing the given DIE.
     532                 :    Sets *SCOPES to a malloc'd array of Dwarf_Die structures,
     533                 :    and returns the number of elements in the array.
     534                 :    (*SCOPES)[0] is a copy of DIE.
     535                 :    (*SCOPES)[1] is the DIE for the scope containing that scope, and so on.
     536                 :    Returns -1 for errors or 0 if DIE is not found in any scope entry.  */
     537                 : extern int dwarf_getscopes_die (Dwarf_Die *die, Dwarf_Die **scopes);
     538                 : 
     539                 : 
     540                 : /* Search SCOPES[0..NSCOPES-1] for a variable called NAME.
     541                 :    Ignore the first SKIP_SHADOWS scopes that match the name.
     542                 :    If MATCH_FILE is not null, accept only declaration in that source file;
     543                 :    if MATCH_LINENO or MATCH_LINECOL are also nonzero, accept only declaration
     544                 :    at that line and column.
     545                 : 
     546                 :    If successful, fill in *RESULT with the DIE of the variable found,
     547                 :    and return N where SCOPES[N] is the scope defining the variable.
     548                 :    Return -1 for errors or -2 for no matching variable found.  */
     549                 : extern int dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
     550                 :                               const char *name, int skip_shadows,
     551                 :                               const char *match_file,
     552                 :                               int match_lineno, int match_linecol,
     553                 :                               Dwarf_Die *result);
     554                 : 
     555                 : 
     556                 : 
     557                 : /* Return list address ranges.  */
     558                 : extern int dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges,
     559                 :                              size_t *naranges)
     560                 :      __nonnull_attribute__ (2);
     561                 : 
     562                 : /* Return one of the address range entries.  */
     563                 : extern Dwarf_Arange *dwarf_onearange (Dwarf_Aranges *aranges, size_t idx);
     564                 : 
     565                 : /* Return information in address range record.  */
     566                 : extern int dwarf_getarangeinfo (Dwarf_Arange *arange, Dwarf_Addr *addrp,
     567                 :                                 Dwarf_Word *lengthp, Dwarf_Off *offsetp);
     568                 : 
     569                 : /* Get address range which includes given address.  */
     570                 : extern Dwarf_Arange *dwarf_getarange_addr (Dwarf_Aranges *aranges,
     571                 :                                            Dwarf_Addr addr);
     572                 : 
     573                 : 
     574                 : 
     575                 : /* Get functions in CUDIE.  */
     576                 : extern ptrdiff_t dwarf_getfuncs (Dwarf_Die *cudie,
     577                 :                                  int (*callback) (Dwarf_Die *, void *),
     578                 :                                  void *arg, ptrdiff_t offset);
     579                 : 
     580                 : 
     581                 : /* Return file name containing definition of the given declaration.  */
     582                 : extern const char *dwarf_decl_file (Dwarf_Die *decl);
     583                 : 
     584                 : /* Get line number of beginning of given declaration.  */
     585                 : extern int dwarf_decl_line (Dwarf_Die *decl, int *linep)
     586                 :      __nonnull_attribute__ (2);
     587                 : 
     588                 : /* Get column number of beginning of given declaration.  */
     589                 : extern int dwarf_decl_column (Dwarf_Die *decl, int *colp)
     590                 :      __nonnull_attribute__ (2);
     591                 : 
     592                 : 
     593                 : /* Return nonzero if given function is an abstract inline definition.  */
     594                 : extern int dwarf_func_inline (Dwarf_Die *func);
     595                 : 
     596                 : /* Find each concrete inlined instance of the abstract inline definition.  */
     597                 : extern int dwarf_func_inline_instances (Dwarf_Die *func,
     598                 :                                         int (*callback) (Dwarf_Die *, void *),
     599                 :                                         void *arg);
     600                 : 
     601                 : 
     602                 : /* Find the appropriate PC location or locations for function entry
     603                 :    breakpoints for the given DW_TAG_subprogram DIE.  Returns -1 for errors.
     604                 :    On success, returns the number of breakpoint locations (never zero)
     605                 :    and sets *BKPTS to a malloc'd vector of addresses.  */
     606                 : extern int dwarf_entry_breakpoints (Dwarf_Die *die, Dwarf_Addr **bkpts);
     607                 : 
     608                 : 
     609                 : /* Call callback function for each of the macro information entry for
     610                 :    the CU.  */
     611                 : extern ptrdiff_t dwarf_getmacros (Dwarf_Die *cudie,
     612                 :                                   int (*callback) (Dwarf_Macro *, void *),
     613                 :                                   void *arg, ptrdiff_t offset)
     614                 :      __nonnull_attribute__ (2);
     615                 : 
     616                 : /* Return macro opcode.  */
     617                 : extern int dwarf_macro_opcode (Dwarf_Macro *macro, unsigned int *opcodep)
     618                 :      __nonnull_attribute__ (2);
     619                 : 
     620                 : /* Return first macro parameter.  */
     621                 : extern int dwarf_macro_param1 (Dwarf_Macro *macro, Dwarf_Word *paramp)
     622                 :      __nonnull_attribute__ (2);
     623                 : 
     624                 : /* Return second macro parameter.  */
     625                 : extern int dwarf_macro_param2 (Dwarf_Macro *macro, Dwarf_Word *paramp,
     626                 :                                const char **strp);
     627                 : 
     628                 : 
     629                 : /* Return error code of last failing function call.  This value is kept
     630                 :    separately for each thread.  */
     631                 : extern int dwarf_errno (void);
     632                 : 
     633                 : /* Return error string for ERROR.  If ERROR is zero, return error string
     634                 :    for most recent error or NULL is none occurred.  If ERROR is -1 the
     635                 :    behaviour is similar to the last case except that not NULL but a legal
     636                 :    string is returned.  */
     637                 : extern const char *dwarf_errmsg (int err);
     638                 : 
     639                 : 
     640                 : /* Register new Out-Of-Memory handler.  The old handler is returned.  */
     641                 : extern Dwarf_OOM dwarf_new_oom_handler (Dwarf *dbg, Dwarf_OOM handler);
     642                 : 
     643                 : 
     644                 : /* Inline optimizations.  */
     645                 : #ifdef __OPTIMIZE__
     646                 : /* Return attribute code of given attribute.  */
     647                 : __libdw_extern_inline unsigned int
     648                 : dwarf_whatattr (Dwarf_Attribute *attr)
     649                 : {
     650                 :   return attr == NULL ? 0 : attr->code;
     651                 : }
     652                 : 
     653                 : /* Return attribute code of given attribute.  */
     654                 : __libdw_extern_inline unsigned int
     655                 : dwarf_whatform (Dwarf_Attribute *attr)
     656                 : {
     657                 :   return attr == NULL ? 0 : attr->form;
     658                 : }
     659                 : #endif  /* Optimize.  */
     660                 : 
     661                 : #ifdef __cplusplus
     662                 : }
     663                 : #endif
     664                 : 
     665                 : #endif  /* libdw.h */

Generated by: LTP GCOV extension version 1.5