xref: /illumos-gate/usr/src/lib/libdwarf/common/generated_libdwarf.h.in (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1/*
2
3  Copyright (C) 2000-2010 Silicon Graphics, Inc.  All Rights Reserved.
4  Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
5  Portions Copyright 2008-2018 David Anderson. All rights reserved.
6  Portions Copyright 2008-2010 Arxan Technologies, Inc. All rights reserved.
7  Portions Copyright 2010-2012 SN Systems Ltd. All rights reserved.
8
9  This program is free software; you can redistribute it
10  and/or modify it under the terms of version 2.1 of the
11  GNU Lesser General Public License as published by the Free
12  Software Foundation.
13
14  This program is distributed in the hope that it would be
15  useful, but WITHOUT ANY WARRANTY; without even the implied
16  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17  PURPOSE.
18
19  Further, this software is distributed without any warranty
20  that it is free of the rightful claim of any third person
21  regarding infringement or the like.  Any license provided
22  herein, whether implied or otherwise, applies only to this
23  software file.  Patent licenses, if any, provided herein
24  do not apply to combinations of this program with other
25  software, or any other product whatsoever.
26
27  You should have received a copy of the GNU Lesser General
28  Public License along with this program; if not, write the
29  Free Software Foundation, Inc., 51 Franklin Street - Fifth
30  Floor, Boston MA 02110-1301, USA.
31
32*/
33
34
35#ifndef _LIBDWARF_H
36#define _LIBDWARF_H
37#ifdef __cplusplus
38extern "C" {
39#endif
40/*
41    libdwarf.h
42    $Revision: #9 $ $Date: 2008/01/17 $
43
44    For libdwarf producers and consumers
45
46    The interface is defined as having 8-byte signed and unsigned
47    values so it can handle 64-or-32bit target on 64-or-32bit host.
48    Dwarf_Ptr is the native size: it represents pointers on
49    the host machine (not the target!).
50
51    This contains declarations for types and all producer
52    and consumer functions.
53
54    Function declarations are written on a single line each here
55    so one can use grep  to each declaration in its entirety.
56    The declarations are a little harder to read this way, but...
57
58    The seeming duplication of the Elf typedef allows
59    both verification we have the right struct name (when
60    libelf.h included before this) and
61    creation of a local handle so we have the struct pointer
62    here (if libelf.h is not included before this file).
63
64*/
65
66typedef struct _Elf Elf;
67typedef struct _Elf* dwarf_elf_handle;
68
69/* To enable printing with printf regardless of the
70   actual underlying data type, we define the DW_PR_xxx macros.
71   To ensure uses of DW_PR_DUx or DW_PR_DSx look the way you want
72   ensure the right DW_PR_XZEROS define is uncommented.
73*/
74/*#define DW_PR_XZEROS "" */
75#define DW_PR_XZEROS "08"
76
77typedef unsigned long long Dwarf_Unsigned;
78typedef signed   long long Dwarf_Signed;
79typedef unsigned long long Dwarf_Off;
80typedef unsigned long long Dwarf_Addr;
81typedef int                Dwarf_Bool;   /* boolean type */
82typedef unsigned short     Dwarf_Half;   /* 2 byte unsigned value */
83typedef unsigned char      Dwarf_Small;  /* 1 byte unsigned value */
84/*  If sizeof(Dwarf_Half) is greater than 2
85    we believe libdwarf still works properly. */
86
87#if defined(_WIN32) && defined(HAVE_NONSTANDARD_PRINTF_64_FORMAT)
88#define DW_PR_DUx "I64x"
89#define DW_PR_DSx "I64x"
90#define DW_PR_DUu "I64u"
91#define DW_PR_DSd "I64d"
92#else
93#define DW_PR_DUx "llx"
94#define DW_PR_DSx "llx"
95#define DW_PR_DUu "llu"
96#define DW_PR_DSd "lld"
97#endif /* DW_PR defines */
98
99typedef void*        Dwarf_Ptr;          /* host machine pointer */
100
101/*  DWARF5: a container for a DW_FORM_data16 data item.
102    We have no integer types suitable so this special
103    struct is used instead.  It is up to consumers/producers
104    to deal with the contents.
105    New October 18, 2017 .  */
106typedef struct Dwarf_Form_Data16_s {
107    unsigned char fd_data[16];
108} Dwarf_Form_Data16;
109
110
111
112/* Used for signatures where ever they appear.
113   It is not a string, it
114   is 8 bytes of a signature one would use to find
115   a type unit. See dwarf_formsig8()
116
117   Sometimes it is used in calculations as
118   Dwarf_Unsigned, but that is done inside libdwarf
119   and the endianness question makes it a bit sketchy.
120*/
121struct Dwarf_Sig8_s  {
122    char signature[8];
123};
124typedef struct Dwarf_Sig8_s Dwarf_Sig8;
125
126/* Contains info on an uninterpreted block of data
127   Used with certain frame information functions and
128   also used with DW_FORM_block<>.
129*/
130typedef struct {
131    Dwarf_Unsigned  bl_len;         /* length of block bl_data points at */
132    Dwarf_Ptr       bl_data;        /* uninterpreted data */
133
134    /*  See libdwarf.h DW_LKIND*  */
135    Dwarf_Small     bl_from_loclist;
136
137    /* Section (not CU) offset which 'data' comes from. */
138    Dwarf_Unsigned  bl_section_offset;
139} Dwarf_Block;
140
141
142/*  NEW October 2015.  */
143/*  This provides access to Dwarf_Locdesc_c, a single
144    location description */
145struct  Dwarf_Locdesc_c_s;
146typedef struct Dwarf_Locdesc_c_s * Dwarf_Locdesc_c;
147
148/*  NEW October 2015.  */
149/*  This provides access to Dwarf_Locdesc_c, a single
150    location list entry (or for a locexpr, the fake
151    Loc_Head for the locexpr) */
152struct Dwarf_Loc_Head_c_s;
153typedef struct Dwarf_Loc_Head_c_s * Dwarf_Loc_Head_c;
154
155/* NEW November 2015. For DWARF5 .debug_macro section */
156struct Dwarf_Macro_Context_s;
157typedef struct Dwarf_Macro_Context_s * Dwarf_Loc_Macro_Context;
158
159/*  NEW September 2016. Allows easy access to DW_AT_discr_list
160    array of discriminant values. Input in blockpointer
161    is a block with a list of uleb or sleb numbers
162    (all one or the other, lebunsignedflag instructs
163    how to read the leb values properly) */
164typedef struct Dwarf_Dsc_Head_s * Dwarf_Dsc_Head;
165
166/*  Location record. Records up to 2 operand values.
167    Not usable with DWARF5 or DWARF4 with location
168    operator  extensions. */
169typedef struct {
170    Dwarf_Small     lr_atom;        /* location operation */
171    Dwarf_Unsigned  lr_number;      /* operand */
172    Dwarf_Unsigned  lr_number2;     /* for OP_BREGx  and DW_OP_GNU_const_type*/
173    Dwarf_Unsigned  lr_offset;      /* offset in locexpr for OP_BRA etc */
174} Dwarf_Loc;
175
176
177/* Location description. DWARF 2,3,4.
178   When this is from a split-dwarf loclist (.debug_loc.dwo)
179   and no tied object is present
180   then ld_lowpc and ld_highpc are actually indices in
181   the .debug_addr section of the tied object).
182   If there is a tied object then these fields are actuall
183   addresses and DW_AT_addr_base in the skeleton CU DIE applies to
184   that .debug_addr.
185
186   Location record. Records up to 2 operand values.
187   Not usable with DWARF5 or DWARF4 with extensions.
188
189   If from DWARF2,3,4 non-split dwarf then things operate as
190   in DWARF2.
191   See dwarf_get_loclist_b() and the other related
192   new functions that
193   avoid using public structures Dwarf_Loc and Dwarf_Locdesc.
194*/
195typedef struct {
196    /*  Beginning of active range. This is actually an offset
197        of an applicable base address, not a pc value.  */
198    Dwarf_Addr      ld_lopc;
199
200    /*  End of active range. This is actually an offset
201        of an applicable base address, not a pc value.  */
202    Dwarf_Addr      ld_hipc;
203
204    Dwarf_Half      ld_cents;       /* count of location records */
205    Dwarf_Loc*      ld_s;           /* pointer to list of same */
206
207    /*  non-0 if loclist, 1 if non-split (dwarf 2,3,4) */
208    Dwarf_Small     ld_from_loclist;
209
210    Dwarf_Unsigned  ld_section_offset; /* Section (not CU) offset
211        where loc-expr begins*/
212} Dwarf_Locdesc;
213
214/*  First appears in DWARF3, and only ranges entries exist.
215    The dwr_addr1/addr2 data is either an offset (DW_RANGES_ENTRY)
216    or an address (dwr_addr2 in DW_RANGES_ADDRESS_SELECTION) or
217    both are zero (DW_RANGES_END).
218    For DWARF5 each table starts with a header
219    followed by range list entries defined
220    as here.
221*/
222enum Dwarf_Ranges_Entry_Type { DW_RANGES_ENTRY,
223    DW_RANGES_ADDRESS_SELECTION,
224    DW_RANGES_END
225};
226typedef struct {
227    Dwarf_Addr dwr_addr1;
228    Dwarf_Addr dwr_addr2;
229    enum Dwarf_Ranges_Entry_Type  dwr_type;
230} Dwarf_Ranges;
231
232/* Frame description instructions expanded.
233*/
234typedef struct {
235    Dwarf_Small     fp_base_op;
236    Dwarf_Small     fp_extended_op;
237    Dwarf_Half      fp_register;
238
239    /*  Value may be signed, depends on op.
240        Any applicable data_alignment_factor has
241        not been applied, this is the  raw offset. */
242    Dwarf_Unsigned  fp_offset;
243    Dwarf_Off       fp_instr_offset;
244} Dwarf_Frame_Op; /* DWARF2 */
245
246/*  ***IMPORTANT NOTE, TARGET DEPENDENCY ****
247    DW_REG_TABLE_SIZE must be at least as large as
248    the number of registers
249    (DW_FRAME_LAST_REG_NUM) as defined in dwarf.h
250    Preferably identical to DW_FRAME_LAST_REG_NUM.
251    Ensure [0-DW_REG_TABLE_SIZE] does not overlap
252    DW_FRAME_UNDEFINED_VAL or DW_FRAME_SAME_VAL.
253    Also ensure DW_FRAME_REG_INITIAL_VALUE is set to what
254    is appropriate to your cpu.
255    For various CPUs  DW_FRAME_UNDEFINED_VAL is correct
256    as the value for DW_FRAME_REG_INITIAL_VALUE.
257
258    For consumer apps, this can be set dynamically: see
259    dwarf_set_frame_rule_table_size(); */
260#ifndef DW_REG_TABLE_SIZE
261#define DW_REG_TABLE_SIZE  66
262#endif
263
264/* For MIPS, DW_FRAME_SAME_VAL is the correct default value
265   for a frame register value. For other CPUS another value
266   may be better, such as DW_FRAME_UNDEFINED_VAL.
267   See dwarf_set_frame_rule_table_size
268*/
269#ifndef DW_FRAME_REG_INITIAL_VALUE
270#define DW_FRAME_REG_INITIAL_VALUE DW_FRAME_SAME_VAL
271#endif
272
273/* Taken as meaning 'undefined value', this is not
274   a column or register number.
275   Only present at libdwarf runtime in the consumer
276   interfaces. Never on disk.
277   DW_FRAME_* Values present on disk are in dwarf.h
278   Ensure this is > DW_REG_TABLE_SIZE (the reg table
279   size is changeable at runtime with the *reg3() interfaces,
280   and this value must be greater than the reg table size).
281*/
282#define DW_FRAME_UNDEFINED_VAL          1034
283
284/* Taken as meaning 'same value' as caller had, not a column
285   or register number.
286   Only present at libdwarf runtime in the consumer
287   interfaces. Never on disk.
288   DW_FRAME_* Values present on disk are in dwarf.h
289   Ensure this is > DW_REG_TABLE_SIZE (the reg table
290   size is changeable at runtime with the *reg3() interfaces,
291   and this value must be greater than the reg table size).
292*/
293#define DW_FRAME_SAME_VAL               1035
294
295/* For DWARF3 consumer interfaces, make the CFA a column with no
296   real table number.  This is what should have been done
297   for the DWARF2 interfaces.  This actually works for
298   both DWARF2 and DWARF3, but see the libdwarf documentation
299   on Dwarf_Regtable3 and  dwarf_get_fde_info_for_reg3()
300   and  dwarf_get_fde_info_for_all_regs3()
301   Do NOT use this with the older dwarf_get_fde_info_for_reg()
302   or dwarf_get_fde_info_for_all_regs() consumer interfaces.
303   Must be higher than any register count for *any* ABI
304   (ensures maximum applicability with minimum effort).
305   Ensure this is > DW_REG_TABLE_SIZE (the reg table
306   size is changeable at runtime with the *reg3() interfaces,
307   and this value must be greater than the reg table size).
308   Only present at libdwarf runtime in the consumer
309   interfaces. Never on disk.
310*/
311#define DW_FRAME_CFA_COL3               1436
312
313/* The following are all needed to evaluate DWARF3 register rules.
314*/
315#define DW_EXPR_OFFSET 0  /* DWARF2 only sees this. */
316#define DW_EXPR_VAL_OFFSET 1
317#define DW_EXPR_EXPRESSION 2
318#define DW_EXPR_VAL_EXPRESSION 3
319
320typedef struct Dwarf_Regtable_Entry_s {
321    /*  For each index i (naming a hardware register with dwarf number
322        i) the following is true and defines the value of that register:
323
324        If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
325            it is not DWARF register number but
326            a place holder indicating the register has no defined value.
327        If dw_regnum is Register DW_FRAME_SAME_VAL
328            it  is not DWARF register number but
329            a place holder indicating the register has the same
330            value in the previous frame.
331
332            DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL are
333            only present at libdwarf runtime. Never on disk.
334            DW_FRAME_* Values present on disk are in dwarf.h
335
336        Otherwise: the register number is a DWARF register number
337            (see ABI documents for how this translates to hardware/
338            software register numbers in the machine hardware)
339            and the following applies:
340
341            if dw_value_type == DW_EXPR_OFFSET (the only case for dwarf2):
342                If dw_offset_relevant is non-zero, then
343                    the value is stored at at the address CFA+N where
344                    N is a signed offset.
345                    Rule: Offset(N)
346                If dw_offset_relevant is zero, then the value of the register
347                    is the value of (DWARF) register number dw_regnum.
348                    Rule: register(F)
349            Other values of dw_value_type are an error.
350    */
351    Dwarf_Small         dw_offset_relevant;
352
353    /* For DWARF2, always 0 */
354    Dwarf_Small         dw_value_type;
355
356    Dwarf_Half          dw_regnum;
357
358    /*  The data type here should  the larger of Dwarf_Addr
359        and Dwarf_Unsigned and Dwarf_Signed. */
360    Dwarf_Addr          dw_offset;
361} Dwarf_Regtable_Entry;
362
363typedef struct Dwarf_Regtable_s {
364    struct Dwarf_Regtable_Entry_s rules[DW_REG_TABLE_SIZE];
365} Dwarf_Regtable;
366
367/* opaque type. Functional interface shown later. */
368struct Dwarf_Reg_value3_s;
369typedef struct Dwarf_Reg_value3_s Dwarf_Reg_Value3;
370
371typedef struct Dwarf_Regtable_Entry3_s {
372/*  For each index i (naming a hardware register with dwarf number
373    i) the following is true and defines the value of that register:
374
375        If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
376            it is not DWARF register number but
377            a place holder indicating the register has no defined value.
378        If dw_regnum is Register DW_FRAME_SAME_VAL
379            it  is not DWARF register number but
380            a place holder indicating the register has the same
381            value in the previous frame.
382
383            DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL and
384            DW_FRAME_CFA_COL3 are only present at libdwarf runtime.
385            Never on disk.
386            DW_FRAME_* Values present on disk are in dwarf.h
387            Because DW_FRAME_SAME_VAL and DW_FRAME_UNDEFINED_VAL
388            and DW_FRAME_CFA_COL3 are definable at runtime
389            consider the names symbolic in this comment, not absolute.
390
391        Otherwise: the register number is a DWARF register number
392            (see ABI documents for how this translates to hardware/
393            software register numbers in the machine hardware)
394            and the following applies:
395
396        In a cfa-defining entry (rt3_cfa_rule) the regnum is the
397        CFA 'register number'. Which is some 'normal' register,
398        not DW_FRAME_CFA_COL3, nor DW_FRAME_SAME_VAL, nor
399        DW_FRAME_UNDEFINED_VAL.
400
401        If dw_value_type == DW_EXPR_OFFSET (the only  possible case for
402        dwarf2):
403            If dw_offset_relevant is non-zero, then
404                the value is stored at at the address
405                CFA+N where N is a signed offset.
406                dw_regnum is the cfa register rule which means
407                one ignores dw_regnum and uses the CFA appropriately.
408                So dw_offset_or_block_len is a signed value, really,
409                and must be printed/evaluated as such.
410                Rule: Offset(N)
411            If dw_offset_relevant is zero, then the value of the register
412                is the value of (DWARF) register number dw_regnum.
413                Rule: register(R)
414        If dw_value_type  == DW_EXPR_VAL_OFFSET
415            the  value of this register is CFA +N where N is a signed offset.
416            dw_regnum is the cfa register rule which means
417            one ignores dw_regnum and uses the CFA appropriately.
418            Rule: val_offset(N)
419        If dw_value_type  == DW_EXPR_EXPRESSION
420            The value of the register is the value at the address
421            computed by evaluating the DWARF expression E.
422            Rule: expression(E)
423            The expression E byte stream is pointed to by dw_block_ptr.
424            The expression length in bytes is given by
425            dw_offset_or_block_len.
426        If dw_value_type  == DW_EXPR_VAL_EXPRESSION
427            The value of the register is the value
428            computed by evaluating the DWARF expression E.
429            Rule: val_expression(E)
430            The expression E byte stream is pointed to by dw_block_ptr.
431            The expression length in bytes is given by
432            dw_offset_or_block_len.
433        Other values of dw_value_type are an error.
434*/
435    Dwarf_Small         dw_offset_relevant;
436    Dwarf_Small         dw_value_type;
437    Dwarf_Half          dw_regnum;
438    Dwarf_Unsigned      dw_offset_or_block_len;
439    Dwarf_Ptr           dw_block_ptr;
440
441}Dwarf_Regtable_Entry3;
442
443/*  For the DWARF3 version, moved the DW_FRAME_CFA_COL
444    out of the array and into its own struct.
445    Having it part of the array is not very easy to work
446    with from a portability point of view: changing
447    the number for every architecture is a pain (if one fails
448    to set it correctly a register rule gets clobbered when
449    setting CFA).  With MIPS it just happened to be easy to use
450    DW_FRAME_CFA_COL (it was wrong conceptually but it was easy...).
451
452    rt3_rules and rt3_reg_table_size must be filled in before
453    calling libdwarf.  Filled in with a pointer to an array
454    (pointer and array  set up by the calling application)
455    of rt3_reg_table_size Dwarf_Regtable_Entry3_s structs.
456    libdwarf does not allocate or deallocate space for the
457    rules, you must do so.   libdwarf will initialize the
458    contents rules array, you do not need to do so (though
459    if you choose to initialize the array somehow that is ok:
460    libdwarf will overwrite your initializations with its own).
461
462*/
463typedef struct Dwarf_Regtable3_s {
464    struct Dwarf_Regtable_Entry3_s   rt3_cfa_rule;
465
466    Dwarf_Half                       rt3_reg_table_size;
467    struct Dwarf_Regtable_Entry3_s * rt3_rules;
468} Dwarf_Regtable3;
469
470
471/*  Use for DW_EPXR_STANDARD., DW_EXPR_VAL_OFFSET.
472    Returns DW_DLV_OK if the value is available.
473    If DW_DLV_OK returns the regnum and offset thru the pointers
474    (which the consumer must use appropriately).
475*/
476int dwarf_frame_get_reg_register(struct Dwarf_Regtable_Entry3_s *reg_in,
477    Dwarf_Small *offset_relevant,
478    Dwarf_Half *regnum_out,
479    Dwarf_Signed *offset_out);
480
481/*  Use for DW_EXPR_EXPRESSION, DW_EXPR_VAL_EXPRESSION.
482    Returns DW_DLV_OK if the value is available.
483    The caller must pass in the address of a valid
484    Dwarf_Block (the caller need not initialize it).
485*/
486int dwarf_frame_get_reg_expression(struct Dwarf_Regtable_Entry3_s *reg_in,
487    Dwarf_Block *block_out);
488
489
490/*  For DW_DLC_SYMBOLIC_RELOCATIONS output to caller
491    v2, adding drd_length: some relocations are 4 and
492    some 8 bytes (pointers are 8, section offsets 4) in
493    some dwarf environments. (MIPS relocations are all one
494    size in any given ABI.) Changing drd_type to an unsigned char
495    to keep struct size down.
496*/
497enum Dwarf_Rel_Type {
498    dwarf_drt_none,        /* Should not get to caller */
499    dwarf_drt_data_reloc,  /* Simple normal relocation. */
500    dwarf_drt_segment_rel, /* Special reloc, exceptions. */
501    /* dwarf_drt_first_of_length_pair  and drt_second
502        are for for the  .word end - begin case. */
503    dwarf_drt_first_of_length_pair,
504    dwarf_drt_second_of_length_pair
505};
506
507typedef struct Dwarf_P_Marker_s * Dwarf_P_Marker;
508struct Dwarf_P_Marker_s {
509    Dwarf_Unsigned ma_marker;
510    Dwarf_Unsigned ma_offset;
511};
512
513typedef struct Dwarf_Relocation_Data_s  * Dwarf_Relocation_Data;
514struct Dwarf_Relocation_Data_s {
515    unsigned char drd_type;   /* Cast to/from Dwarf_Rel_Type
516        to keep size small in struct. */
517    unsigned char drd_length; /* Length in bytes of data being
518        relocated. 4 for 32bit data,
519        8 for 64bit data. */
520    Dwarf_Unsigned       drd_offset; /* Where the data to reloc is. */
521    Dwarf_Unsigned       drd_symbol_index;
522};
523
524typedef struct Dwarf_P_String_Attr_s  * Dwarf_P_String_Attr;
525struct Dwarf_P_String_Attr_s {
526    Dwarf_Unsigned        sa_offset;  /* Offset of string attribute data */
527    Dwarf_Unsigned        sa_nbytes;
528};
529
530
531/* Opaque types for Consumer Library. */
532typedef struct Dwarf_Debug_s*      Dwarf_Debug;
533typedef struct Dwarf_Die_s*        Dwarf_Die;
534typedef struct Dwarf_Line_s*       Dwarf_Line;
535typedef struct Dwarf_Global_s*     Dwarf_Global;
536typedef struct Dwarf_Func_s*       Dwarf_Func;
537typedef struct Dwarf_Type_s*       Dwarf_Type;
538typedef struct Dwarf_Var_s*        Dwarf_Var;
539typedef struct Dwarf_Weak_s*       Dwarf_Weak;
540typedef struct Dwarf_Error_s*      Dwarf_Error;
541typedef struct Dwarf_Attribute_s*  Dwarf_Attribute;
542typedef struct Dwarf_Abbrev_s*     Dwarf_Abbrev;
543typedef struct Dwarf_Fde_s*        Dwarf_Fde;
544typedef struct Dwarf_Cie_s*        Dwarf_Cie;
545typedef struct Dwarf_Arange_s*     Dwarf_Arange;
546typedef struct Dwarf_Gdbindex_s*   Dwarf_Gdbindex;
547struct Dwarf_Xu_Index_Header_s;
548typedef struct Dwarf_Xu_Index_Header_s  *Dwarf_Xu_Index_Header;
549struct Dwarf_Line_Context_s;
550typedef struct Dwarf_Line_Context_s     *Dwarf_Line_Context;
551struct Dwarf_Macro_Context_s;
552typedef struct Dwarf_Macro_Context_s    *Dwarf_Macro_Context;
553struct Dwarf_Dnames_Head_s;
554typedef struct Dwarf_Dnames_Head_s      *Dwarf_Dnames_Head;
555
556
557/* Opaque types for Producer Library. */
558typedef struct Dwarf_P_Debug_s*       Dwarf_P_Debug;
559typedef struct Dwarf_P_Die_s*         Dwarf_P_Die;
560typedef struct Dwarf_P_Attribute_s*   Dwarf_P_Attribute;
561typedef struct Dwarf_P_Fde_s*         Dwarf_P_Fde;
562typedef struct Dwarf_P_Expr_s*        Dwarf_P_Expr;
563typedef Dwarf_Unsigned                Dwarf_Tag;
564
565
566/* error handler function
567*/
568typedef void  (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/);
569
570
571/* Begin libdwarf Object File Interface declarations.
572
573As of February 2008 there are multiple dwarf_reader object access
574initialization methods available:
575The traditional dwarf_elf_init() and dwarf_init()  and dwarf_finish()
576    which assume libelf and POSIX file access.
577An object-file and library agnostic dwarf_object_init() and dwarf_object_finish()
578    which allow the coder to provide object access routines
579    abstracting away the elf interface.  So there is no dependence in the
580    reader code on the object format and no dependence on libelf.
581    See the code in dwarf_elf_access.c  and dwarf_original_elf_init.c
582    to see an example of initializing the structures mentioned below.
583
584Projects using dwarf_elf_init() or dwarf_init() can ignore
585the Dwarf_Obj_Access* structures entirely as all these details
586are completed for you.
587
588As of March 2017 additional
589functions dwarf_elf_init_b
590and dwarf_init_b
591and dwarf_object_init_b
592add a groupnumber argument so DWARF5
593split-dwarf sections can be accessed.
594*/
595
596typedef struct Dwarf_Obj_Access_Interface_s   Dwarf_Obj_Access_Interface;
597typedef struct Dwarf_Obj_Access_Methods_s     Dwarf_Obj_Access_Methods;
598typedef struct Dwarf_Obj_Access_Section_s     Dwarf_Obj_Access_Section;
599
600
601/*  Used in the get_section interface function
602    in Dwarf_Obj_Access_Section_s.  Since libdwarf
603    depends on standard DWARF section names an object
604    format that has no such names (but has some
605    method of setting up 'sections equivalents')
606    must arrange to return standard DWARF section
607    names in the 'name' field.  libdwarf does
608    not free the strings in 'name'. */
609struct Dwarf_Obj_Access_Section_s {
610    /*  addr is the virtual address of the first byte of
611        the section data.  Usually zero when the address
612        makes no sense for a given section. */
613    Dwarf_Addr     addr;
614
615    /* Section type. */
616    Dwarf_Unsigned type;
617
618    /* Size in bytes of the section. */
619    Dwarf_Unsigned size;
620
621    /*  Having an accurate section name makes debugging of libdwarf easier.
622        and is essential to find the .debug_ sections.  */
623    const char*    name;
624    /*  Set link to zero if it is meaningless.  If non-zero
625        it should be a link to a rela section or from symtab
626        to strtab.  In Elf it is sh_link. */
627    Dwarf_Unsigned link;
628
629    /*  The section header index of the section to which the
630        relocation applies. In Elf it is sh_info. */
631    Dwarf_Unsigned info;
632
633    /*  Elf sections that are tables have a non-zero entrysize so
634        the count of entries can be calculated even without
635        the right structure definition. If your object format
636        does not have this data leave this zero. */
637    Dwarf_Unsigned entrysize;
638};
639
640/*  Returned by the get_endianness function in
641    Dwarf_Obj_Access_Methods_s. */
642typedef enum {
643    DW_OBJECT_MSB,
644    DW_OBJECT_LSB
645} Dwarf_Endianness;
646
647/*  The functions we need to access object data from libdwarf are declared here.
648
649    In these function pointer declarations
650    'void *obj' is intended to be a pointer (the object field in
651    Dwarf_Obj_Access_Interface_s)
652    that hides the library-specific and object-specific data that makes
653    it possible to handle multiple object formats and multiple libraries.
654    It's not required that one handles multiple such in a single libdwarf
655    archive/shared-library (but not ruled out either).
656    See  dwarf_elf_object_access_internals_t and dwarf_elf_access.c
657    for an example.
658
659*/
660struct Dwarf_Obj_Access_Methods_s {
661    /*
662        get_section_info
663
664        Get address, size, and name info about a section.
665
666        Parameters
667        section_index - Zero-based index.
668        return_section - Pointer to a structure in which section info
669            will be placed.   Caller must provide a valid pointer to a
670            structure area.  The structure's contents will be overwritten
671            by the call to get_section_info.
672        error - A pointer to an integer in which an error code may be stored.
673
674        Return
675        DW_DLV_OK - Everything ok.
676        DW_DLV_ERROR - Error occurred. Use 'error' to determine the
677            libdwarf defined error.
678        DW_DLV_NO_ENTRY - No such section.  */
679    int    (*get_section_info)(void* obj, Dwarf_Half section_index,
680        Dwarf_Obj_Access_Section* return_section, int* error);
681    /*
682        get_byte_order
683
684        Get whether the object file represented by this interface is big-endian
685        (DW_OBJECT_MSB) or little endian (DW_OBJECT_LSB).
686
687        Parameters
688        obj - Equivalent to 'this' in OO languages.
689
690        Return
691        Endianness of object. Cannot fail.  */
692    Dwarf_Endianness  (*get_byte_order)(void* obj);
693    /*
694        get_length_size
695
696        Get the size of a length field in the underlying object file.
697        libdwarf currently supports * 4 and 8 byte sizes, but may
698        support larger in the future.
699        Perhaps the return type should be an enumeration?
700
701        Parameters
702        obj - Equivalent to 'this' in OO languages.
703
704        Return
705        Size of length. Cannot fail.  */
706    Dwarf_Small   (*get_length_size)(void* obj);
707    /*
708        get_pointer_size
709
710        Get the size of a pointer field in the underlying object file.
711        libdwarf currently supports  4 and 8 byte sizes.
712        Perhaps the return type should be an enumeration?
713
714        Return
715        Size of pointer. Cannot fail.  */
716    Dwarf_Small   (*get_pointer_size)(void* obj);
717    /*
718        get_section_count
719
720        Get the number of sections in the object file.
721
722        Parameters
723
724        Return
725        Number of sections */
726    Dwarf_Unsigned  (*get_section_count)(void* obj);
727    /*
728        load_section
729
730        Get a pointer to an array of bytes that represent the section.
731
732        Parameters
733        section_index - Zero-based index.
734        return_data - The address of a pointer to which the section data block
735            will be assigned.
736        error - Pointer to an integer for returning libdwarf-defined
737            error numbers.
738
739        Return
740        DW_DLV_OK - No error.
741        DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
742            error number.
743        DW_DLV_NO_ENTRY - No such section.  */
744    int    (*load_section)(void* obj, Dwarf_Half section_index,
745        Dwarf_Small** return_data, int* error);
746
747    /**
748        relocate_a_section
749        If relocations are not supported leave this pointer NULL.
750
751        Get a pointer to an array of bytes that represent the section.
752
753        Parameters
754        section_index - Zero-based index of the section to be relocated.
755        error - Pointer to an integer for returning libdwarf-defined
756            error numbers.
757
758        Return
759        DW_DLV_OK - No error.
760        DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
761            error number.
762        DW_DLV_NO_ENTRY - No such section.  */
763    int    (*relocate_a_section)(void* obj, Dwarf_Half section_index,
764        Dwarf_Debug dbg,
765        int* error);
766
767};
768
769
770
771/*  These structures are allocated and deallocated by your code
772    when you are using the libdwarf Object File Interface
773    [dwarf_object_init and dwarf_object_finish)] directly.
774    dwarf_object_finish) does not free
775    struct Dwarf_Obj_Access_Interface_s or its content.
776    (libdwarf does record a pointer to this struct: you must
777    ensure that pointer remains valid for as long as
778    a libdwarf instance is open (meaning
779    after dwarf_init) and before dwarf_finish)).
780
781    If you are reading Elf objects and libelf use dwarf_init()
782    or dwarf_elf_init() which take care of these details.
783*/
784struct Dwarf_Obj_Access_Interface_s {
785    /*  object is a void* as it hides the data the object access routines
786        need (which varies by library in use and object format).
787    */
788    void* object;
789    const Dwarf_Obj_Access_Methods * methods;
790};
791
792/* End libdwarf Object File Interface */
793
794/*
795    Dwarf_dealloc() alloc_type arguments.
796    Argument points to:
797*/
798#define DW_DLA_STRING          0x01     /* char* */
799#define DW_DLA_LOC             0x02     /* Dwarf_Loc */
800#define DW_DLA_LOCDESC         0x03     /* Dwarf_Locdesc */
801#define DW_DLA_ELLIST          0x04     /* Dwarf_Ellist (not used)*/
802#define DW_DLA_BOUNDS          0x05     /* Dwarf_Bounds (not used) */
803#define DW_DLA_BLOCK           0x06     /* Dwarf_Block */
804#define DW_DLA_DEBUG           0x07     /* Dwarf_Debug */
805#define DW_DLA_DIE             0x08     /* Dwarf_Die */
806#define DW_DLA_LINE            0x09     /* Dwarf_Line */
807#define DW_DLA_ATTR            0x0a     /* Dwarf_Attribute */
808#define DW_DLA_TYPE            0x0b     /* Dwarf_Type  (not used) */
809#define DW_DLA_SUBSCR          0x0c     /* Dwarf_Subscr (not used) */
810#define DW_DLA_GLOBAL          0x0d     /* Dwarf_Global */
811#define DW_DLA_ERROR           0x0e     /* Dwarf_Error */
812#define DW_DLA_LIST            0x0f     /* a list */
813#define DW_DLA_LINEBUF         0x10     /* Dwarf_Line* (not used) */
814#define DW_DLA_ARANGE          0x11     /* Dwarf_Arange */
815#define DW_DLA_ABBREV          0x12     /* Dwarf_Abbrev */
816#define DW_DLA_FRAME_OP        0x13     /* Dwarf_Frame_Op */
817#define DW_DLA_CIE             0x14     /* Dwarf_Cie */
818#define DW_DLA_FDE             0x15     /* Dwarf_Fde */
819#define DW_DLA_LOC_BLOCK       0x16     /* Dwarf_Loc */
820#define DW_DLA_FRAME_BLOCK     0x17     /* Dwarf_Frame Block (not used) */
821#define DW_DLA_FUNC            0x18     /* Dwarf_Func */
822#define DW_DLA_TYPENAME        0x19     /* Dwarf_Type */
823#define DW_DLA_VAR             0x1a     /* Dwarf_Var */
824#define DW_DLA_WEAK            0x1b     /* Dwarf_Weak */
825#define DW_DLA_ADDR            0x1c     /* Dwarf_Addr sized entries */
826#define DW_DLA_RANGES          0x1d     /* Dwarf_Ranges */
827/* 0x1e (30) to 0x34 (52) reserved for internal to libdwarf types. */
828#define DW_DLA_LOCLISTS_HEAD   0x35     /* .debug_loclists DW5 */
829#define DW_DLA_RNGLISTS_HEAD   0x36     /* .debug_rnglists DW5 */
830#define DW_DLA_GDBINDEX        0x37     /* Dwarf_Gdbindex */
831#define DW_DLA_XU_INDEX        0x38     /* Dwarf_Xu_Index_Header */
832#define DW_DLA_LOC_BLOCK_C     0x39     /* Dwarf_Loc_c*/
833#define DW_DLA_LOCDESC_C       0x3a     /* Dwarf_Locdesc_c */
834#define DW_DLA_LOC_HEAD_C      0x3b     /* Dwarf_Loc_Head_c */
835#define DW_DLA_MACRO_CONTEXT   0x3c     /* Dwarf_Macro_Context */
836/*  0x3d (61) is for libdwarf internal use.               */
837#define DW_DLA_DSC_HEAD        0x3e     /* Dwarf_Dsc_Head */
838#define DW_DLA_DNAMES_HEAD     0x3f     /* Dwarf_Dnames_Head */
839#define DW_DLA_STR_OFFSETS     0x40     /* struct Dwarf_Str_Offsets_Table_s */
840
841/* The augmenter string for CIE */
842#define DW_CIE_AUGMENTER_STRING_V0              "z"
843
844/* dwarf_init() access arguments
845*/
846#define DW_DLC_READ        0        /* read only access */
847#define DW_DLC_WRITE       1        /* write only access */
848#define DW_DLC_RDWR        2        /* read/write access NOT SUPPORTED*/
849
850/* dwarf_producer_init* access flag modifiers
851   No longer depends on compile-time settings for
852   how to produce 64bit offset. See DW_DLC_IRIX_OFFSET64.
853   Historic  versions. One of
854   If DW_DLC_POINTER64 is not set DW_DLC_POINTER32 is assumed.
855   If DW_DLC_OFFSET64 or DW_DLC_IRIX_OFFSET64 is not
856   set 32bit offset DWARF is assumed.
857   Non-MIPS Non IA64 should use DW_DLC_SYMBOLIC_RELOCATIONS
858   and handle the relocation creation for the target
859   itself using the symbolic relocations to do so, those
860   use the Dwarf_Rel_Type enum relocation indicators.
861
862*/
863/*  The first three are traditional dwarf producer names.
864    These names still work.
865    Newer names below.
866*/
867/* 64-bit address-size target */
868#define DW_DLC_SIZE_64              0x40000000
869
870/* 32-bit address-size target */
871#define DW_DLC_SIZE_32              0x20000000
872
873/* 64-bit offset-size DWARF offsets (else 32bit) */
874#define DW_DLC_OFFSET_SIZE_64       0x10000000
875
876/* 32-bit offset-size ELF object (ELFCLASS32) */
877#define DW_DLC_ELF_OFFSET_SIZE_32   0x00400000
878
879/* 64-bit offset-size ELF object (ELFCLASS64)  */
880#define DW_DLC_ELF_OFFSET_SIZE_64   0x00020000
881
882/* dwarf_producer_init* access flag modifiers
883   Some new April 2014.
884   If DW_DLC_STREAM_RELOCATIONS is set the
885   DW_DLC_ISA_* flags are ignored. See the Dwarf_Rel_Type enum.
886*/
887
888/* Old style Elf binary relocation (.rel) records. The default. */
889#define DW_DLC_STREAM_RELOCATIONS   0x02000000
890
891/* use 32-bit  sec  offsets */
892#define DW_DLC_OFFSET32             0x00010000
893
894/* The following 3 are new sensible names.
895Old names above with same values. */
896/* use 64-bit sec offsets in ELF */
897#define DW_DLC_OFFSET64             0x10000000
898
899/* use 4 for address_size */
900#define DW_DLC_POINTER32            0x20000000
901
902/* use 8 for address_size */
903#define DW_DLC_POINTER64            0x40000000
904
905/* Special for IRIX only */
906/* use Elf 64bit offset headers and non-std IRIX 64bitoffset headers */
907#define DW_DLC_IRIX_OFFSET64        0x00200000
908
909/*  Usable with assembly output because it is up to the producer to
910    deal with locations in whatever manner the calling producer
911    code wishes.  For example, when the libdwarf caller wishes
912    to produce relocations differently than the binary
913    relocation bits that libdwarf Stream Relocations generate.
914    */
915#define DW_DLC_SYMBOLIC_RELOCATIONS 0x04000000
916
917
918#define DW_DLC_TARGET_BIGENDIAN     0x08000000 /* Big    endian target */
919#define DW_DLC_TARGET_LITTLEENDIAN  0x00100000 /* Little endian target */
920
921
922/* dwarf_pcline function, slide arguments
923*/
924#define DW_DLS_BACKWARD   -1       /* slide backward to find line */
925#define DW_DLS_NOSLIDE     0       /* match exactly without sliding */
926#define DW_DLS_FORWARD     1       /* slide forward to find line */
927
928/* libdwarf error numbers
929*/
930#define DW_DLE_NE          0     /* no error */
931#define DW_DLE_VMM         1     /* dwarf format/library version mismatch */
932#define DW_DLE_MAP         2     /* memory map failure */
933#define DW_DLE_LEE         3     /* libelf error */
934#define DW_DLE_NDS         4     /* no debug section */
935#define DW_DLE_NLS         5     /* no line section */
936#define DW_DLE_ID          6     /* invalid descriptor for query */
937#define DW_DLE_IOF         7     /* I/O failure */
938#define DW_DLE_MAF         8     /* memory allocation failure */
939#define DW_DLE_IA          9     /* invalid argument */
940#define DW_DLE_MDE         10     /* mangled debugging entry */
941#define DW_DLE_MLE         11     /* mangled line number entry */
942#define DW_DLE_FNO         12     /* file not open */
943#define DW_DLE_FNR         13     /* file not a regular file */
944#define DW_DLE_FWA         14     /* file open with wrong access */
945#define DW_DLE_NOB         15     /* not an object file */
946#define DW_DLE_MOF         16     /* mangled object file header */
947#define DW_DLE_EOLL        17     /* end of location list entries */
948#define DW_DLE_NOLL        18     /* no location list section */
949#define DW_DLE_BADOFF      19     /* Invalid offset */
950#define DW_DLE_EOS         20     /* end of section  */
951#define DW_DLE_ATRUNC      21     /* abbreviations section appears truncated*/
952#define DW_DLE_BADBITC     22     /* Address size passed to dwarf bad*/
953                    /* It is not an allowed size (64 or 32) */
954    /* Error codes defined by the current Libdwarf Implementation. */
955#define DW_DLE_DBG_ALLOC                        23
956#define DW_DLE_FSTAT_ERROR                      24
957#define DW_DLE_FSTAT_MODE_ERROR                 25
958#define DW_DLE_INIT_ACCESS_WRONG                26
959#define DW_DLE_ELF_BEGIN_ERROR                  27
960#define DW_DLE_ELF_GETEHDR_ERROR                28
961#define DW_DLE_ELF_GETSHDR_ERROR                29
962#define DW_DLE_ELF_STRPTR_ERROR                 30
963#define DW_DLE_DEBUG_INFO_DUPLICATE             31
964#define DW_DLE_DEBUG_INFO_NULL                  32
965#define DW_DLE_DEBUG_ABBREV_DUPLICATE           33
966#define DW_DLE_DEBUG_ABBREV_NULL                34
967#define DW_DLE_DEBUG_ARANGES_DUPLICATE          35
968#define DW_DLE_DEBUG_ARANGES_NULL               36
969#define DW_DLE_DEBUG_LINE_DUPLICATE             37
970#define DW_DLE_DEBUG_LINE_NULL                  38
971#define DW_DLE_DEBUG_LOC_DUPLICATE              39
972#define DW_DLE_DEBUG_LOC_NULL                   40
973#define DW_DLE_DEBUG_MACINFO_DUPLICATE          41
974#define DW_DLE_DEBUG_MACINFO_NULL               42
975#define DW_DLE_DEBUG_PUBNAMES_DUPLICATE         43
976#define DW_DLE_DEBUG_PUBNAMES_NULL              44
977#define DW_DLE_DEBUG_STR_DUPLICATE              45
978#define DW_DLE_DEBUG_STR_NULL                   46
979#define DW_DLE_CU_LENGTH_ERROR                  47
980#define DW_DLE_VERSION_STAMP_ERROR              48
981#define DW_DLE_ABBREV_OFFSET_ERROR              49
982#define DW_DLE_ADDRESS_SIZE_ERROR               50
983#define DW_DLE_DEBUG_INFO_PTR_NULL              51
984#define DW_DLE_DIE_NULL                         52
985#define DW_DLE_STRING_OFFSET_BAD                53
986#define DW_DLE_DEBUG_LINE_LENGTH_BAD            54
987#define DW_DLE_LINE_PROLOG_LENGTH_BAD           55
988#define DW_DLE_LINE_NUM_OPERANDS_BAD            56
989#define DW_DLE_LINE_SET_ADDR_ERROR              57 /* No longer used. */
990#define DW_DLE_LINE_EXT_OPCODE_BAD              58
991#define DW_DLE_DWARF_LINE_NULL                  59
992#define DW_DLE_INCL_DIR_NUM_BAD                 60
993#define DW_DLE_LINE_FILE_NUM_BAD                61
994#define DW_DLE_ALLOC_FAIL                       62
995#define DW_DLE_NO_CALLBACK_FUNC                 63
996#define DW_DLE_SECT_ALLOC                       64
997#define DW_DLE_FILE_ENTRY_ALLOC                 65
998#define DW_DLE_LINE_ALLOC                       66
999#define DW_DLE_FPGM_ALLOC                       67
1000#define DW_DLE_INCDIR_ALLOC                     68
1001#define DW_DLE_STRING_ALLOC                     69
1002#define DW_DLE_CHUNK_ALLOC                      70
1003#define DW_DLE_BYTEOFF_ERR                      71
1004#define DW_DLE_CIE_ALLOC                        72
1005#define DW_DLE_FDE_ALLOC                        73
1006#define DW_DLE_REGNO_OVFL                       74
1007#define DW_DLE_CIE_OFFS_ALLOC                   75
1008#define DW_DLE_WRONG_ADDRESS                    76
1009#define DW_DLE_EXTRA_NEIGHBORS                  77
1010#define DW_DLE_WRONG_TAG                        78
1011#define DW_DLE_DIE_ALLOC                        79
1012#define DW_DLE_PARENT_EXISTS                    80
1013#define DW_DLE_DBG_NULL                         81
1014#define DW_DLE_DEBUGLINE_ERROR                  82
1015#define DW_DLE_DEBUGFRAME_ERROR                 83
1016#define DW_DLE_DEBUGINFO_ERROR                  84
1017#define DW_DLE_ATTR_ALLOC                       85
1018#define DW_DLE_ABBREV_ALLOC                     86
1019#define DW_DLE_OFFSET_UFLW                      87
1020#define DW_DLE_ELF_SECT_ERR                     88
1021#define DW_DLE_DEBUG_FRAME_LENGTH_BAD           89
1022#define DW_DLE_FRAME_VERSION_BAD                90
1023#define DW_DLE_CIE_RET_ADDR_REG_ERROR           91
1024#define DW_DLE_FDE_NULL                         92
1025#define DW_DLE_FDE_DBG_NULL                     93
1026#define DW_DLE_CIE_NULL                         94
1027#define DW_DLE_CIE_DBG_NULL                     95
1028#define DW_DLE_FRAME_TABLE_COL_BAD              96
1029#define DW_DLE_PC_NOT_IN_FDE_RANGE              97
1030#define DW_DLE_CIE_INSTR_EXEC_ERROR             98
1031#define DW_DLE_FRAME_INSTR_EXEC_ERROR           99
1032#define DW_DLE_FDE_PTR_NULL                    100
1033#define DW_DLE_RET_OP_LIST_NULL                101
1034#define DW_DLE_LINE_CONTEXT_NULL               102
1035#define DW_DLE_DBG_NO_CU_CONTEXT               103
1036#define DW_DLE_DIE_NO_CU_CONTEXT               104
1037#define DW_DLE_FIRST_DIE_NOT_CU                105
1038#define DW_DLE_NEXT_DIE_PTR_NULL               106
1039#define DW_DLE_DEBUG_FRAME_DUPLICATE           107
1040#define DW_DLE_DEBUG_FRAME_NULL                108
1041#define DW_DLE_ABBREV_DECODE_ERROR             109
1042#define DW_DLE_DWARF_ABBREV_NULL               110
1043#define DW_DLE_ATTR_NULL                       111
1044#define DW_DLE_DIE_BAD                         112
1045#define DW_DLE_DIE_ABBREV_BAD                  113
1046#define DW_DLE_ATTR_FORM_BAD                   114
1047#define DW_DLE_ATTR_NO_CU_CONTEXT              115
1048#define DW_DLE_ATTR_FORM_SIZE_BAD              116
1049#define DW_DLE_ATTR_DBG_NULL                   117
1050#define DW_DLE_BAD_REF_FORM                    118
1051#define DW_DLE_ATTR_FORM_OFFSET_BAD            119
1052#define DW_DLE_LINE_OFFSET_BAD                 120
1053#define DW_DLE_DEBUG_STR_OFFSET_BAD            121
1054#define DW_DLE_STRING_PTR_NULL                 122
1055#define DW_DLE_PUBNAMES_VERSION_ERROR          123
1056#define DW_DLE_PUBNAMES_LENGTH_BAD             124
1057#define DW_DLE_GLOBAL_NULL                     125
1058#define DW_DLE_GLOBAL_CONTEXT_NULL             126
1059#define DW_DLE_DIR_INDEX_BAD                   127
1060#define DW_DLE_LOC_EXPR_BAD                    128
1061#define DW_DLE_DIE_LOC_EXPR_BAD                129
1062#define DW_DLE_ADDR_ALLOC                      130
1063#define DW_DLE_OFFSET_BAD                      131
1064#define DW_DLE_MAKE_CU_CONTEXT_FAIL            132
1065#define DW_DLE_REL_ALLOC                       133
1066#define DW_DLE_ARANGE_OFFSET_BAD               134
1067#define DW_DLE_SEGMENT_SIZE_BAD                135
1068#define DW_DLE_ARANGE_LENGTH_BAD               136
1069#define DW_DLE_ARANGE_DECODE_ERROR             137
1070#define DW_DLE_ARANGES_NULL                    138
1071#define DW_DLE_ARANGE_NULL                     139
1072#define DW_DLE_NO_FILE_NAME                    140
1073#define DW_DLE_NO_COMP_DIR                     141
1074#define DW_DLE_CU_ADDRESS_SIZE_BAD             142
1075#define DW_DLE_INPUT_ATTR_BAD                  143
1076#define DW_DLE_EXPR_NULL                       144
1077#define DW_DLE_BAD_EXPR_OPCODE                 145
1078#define DW_DLE_EXPR_LENGTH_BAD                 146
1079#define DW_DLE_MULTIPLE_RELOC_IN_EXPR          147
1080#define DW_DLE_ELF_GETIDENT_ERROR              148
1081#define DW_DLE_NO_AT_MIPS_FDE                  149
1082#define DW_DLE_NO_CIE_FOR_FDE                  150
1083#define DW_DLE_DIE_ABBREV_LIST_NULL            151
1084#define DW_DLE_DEBUG_FUNCNAMES_DUPLICATE       152
1085#define DW_DLE_DEBUG_FUNCNAMES_NULL            153
1086#define DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR   154
1087#define DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD      155
1088#define DW_DLE_FUNC_NULL                       156
1089#define DW_DLE_FUNC_CONTEXT_NULL               157
1090#define DW_DLE_DEBUG_TYPENAMES_DUPLICATE       158
1091#define DW_DLE_DEBUG_TYPENAMES_NULL            159
1092#define DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR   160
1093#define DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD      161
1094#define DW_DLE_TYPE_NULL                       162
1095#define DW_DLE_TYPE_CONTEXT_NULL               163
1096#define DW_DLE_DEBUG_VARNAMES_DUPLICATE        164
1097#define DW_DLE_DEBUG_VARNAMES_NULL             165
1098#define DW_DLE_DEBUG_VARNAMES_VERSION_ERROR    166
1099#define DW_DLE_DEBUG_VARNAMES_LENGTH_BAD       167
1100#define DW_DLE_VAR_NULL                        168
1101#define DW_DLE_VAR_CONTEXT_NULL                169
1102#define DW_DLE_DEBUG_WEAKNAMES_DUPLICATE       170
1103#define DW_DLE_DEBUG_WEAKNAMES_NULL            171
1104#define DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR   172
1105#define DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD      173
1106#define DW_DLE_WEAK_NULL                       174
1107#define DW_DLE_WEAK_CONTEXT_NULL               175
1108#define DW_DLE_LOCDESC_COUNT_WRONG             176
1109#define DW_DLE_MACINFO_STRING_NULL             177
1110#define DW_DLE_MACINFO_STRING_EMPTY            178
1111#define DW_DLE_MACINFO_INTERNAL_ERROR_SPACE    179
1112#define DW_DLE_MACINFO_MALLOC_FAIL             180
1113#define DW_DLE_DEBUGMACINFO_ERROR              181
1114#define DW_DLE_DEBUG_MACRO_LENGTH_BAD          182
1115#define DW_DLE_DEBUG_MACRO_MAX_BAD             183
1116#define DW_DLE_DEBUG_MACRO_INTERNAL_ERR        184
1117#define DW_DLE_DEBUG_MACRO_MALLOC_SPACE        185
1118#define DW_DLE_DEBUG_MACRO_INCONSISTENT        186
1119#define DW_DLE_DF_NO_CIE_AUGMENTATION          187
1120#define DW_DLE_DF_REG_NUM_TOO_HIGH             188
1121#define DW_DLE_DF_MAKE_INSTR_NO_INIT           189
1122#define DW_DLE_DF_NEW_LOC_LESS_OLD_LOC         190
1123#define DW_DLE_DF_POP_EMPTY_STACK              191
1124#define DW_DLE_DF_ALLOC_FAIL                   192
1125#define DW_DLE_DF_FRAME_DECODING_ERROR         193
1126#define DW_DLE_DEBUG_LOC_SECTION_SHORT         194
1127#define DW_DLE_FRAME_AUGMENTATION_UNKNOWN      195
1128#define DW_DLE_PUBTYPE_CONTEXT                 196 /* Unused. */
1129#define DW_DLE_DEBUG_PUBTYPES_LENGTH_BAD       197
1130#define DW_DLE_DEBUG_PUBTYPES_VERSION_ERROR    198
1131#define DW_DLE_DEBUG_PUBTYPES_DUPLICATE        199
1132#define DW_DLE_FRAME_CIE_DECODE_ERROR          200
1133#define DW_DLE_FRAME_REGISTER_UNREPRESENTABLE  201
1134#define DW_DLE_FRAME_REGISTER_COUNT_MISMATCH   202
1135#define DW_DLE_LINK_LOOP                       203
1136#define DW_DLE_STRP_OFFSET_BAD                 204
1137#define DW_DLE_DEBUG_RANGES_DUPLICATE          205
1138#define DW_DLE_DEBUG_RANGES_OFFSET_BAD         206
1139#define DW_DLE_DEBUG_RANGES_MISSING_END        207
1140#define DW_DLE_DEBUG_RANGES_OUT_OF_MEM         208
1141#define DW_DLE_DEBUG_SYMTAB_ERR                209
1142#define DW_DLE_DEBUG_STRTAB_ERR                210
1143#define DW_DLE_RELOC_MISMATCH_INDEX            211
1144#define DW_DLE_RELOC_MISMATCH_RELOC_INDEX      212
1145#define DW_DLE_RELOC_MISMATCH_STRTAB_INDEX     213
1146#define DW_DLE_RELOC_SECTION_MISMATCH          214
1147#define DW_DLE_RELOC_SECTION_MISSING_INDEX     215
1148#define DW_DLE_RELOC_SECTION_LENGTH_ODD        216
1149#define DW_DLE_RELOC_SECTION_PTR_NULL          217
1150#define DW_DLE_RELOC_SECTION_MALLOC_FAIL       218
1151#define DW_DLE_NO_ELF64_SUPPORT                219
1152#define DW_DLE_MISSING_ELF64_SUPPORT           220
1153#define DW_DLE_ORPHAN_FDE                      221
1154#define DW_DLE_DUPLICATE_INST_BLOCK            222
1155#define DW_DLE_BAD_REF_SIG8_FORM               223
1156#define DW_DLE_ATTR_EXPRLOC_FORM_BAD           224
1157#define DW_DLE_FORM_SEC_OFFSET_LENGTH_BAD      225
1158#define DW_DLE_NOT_REF_FORM                    226
1159#define DW_DLE_DEBUG_FRAME_LENGTH_NOT_MULTIPLE 227
1160#define DW_DLE_REF_SIG8_NOT_HANDLED            228
1161#define DW_DLE_DEBUG_FRAME_POSSIBLE_ADDRESS_BOTCH 229
1162#define DW_DLE_LOC_BAD_TERMINATION             230
1163#define DW_DLE_SYMTAB_SECTION_LENGTH_ODD       231
1164#define DW_DLE_RELOC_SECTION_SYMBOL_INDEX_BAD  232
1165#define DW_DLE_RELOC_SECTION_RELOC_TARGET_SIZE_UNKNOWN  233
1166#define DW_DLE_SYMTAB_SECTION_ENTRYSIZE_ZERO   234
1167#define DW_DLE_LINE_NUMBER_HEADER_ERROR        235
1168#define DW_DLE_DEBUG_TYPES_NULL                236
1169#define DW_DLE_DEBUG_TYPES_DUPLICATE           237
1170#define DW_DLE_DEBUG_TYPES_ONLY_DWARF4         238
1171#define DW_DLE_DEBUG_TYPEOFFSET_BAD            239
1172#define DW_DLE_GNU_OPCODE_ERROR                240
1173#define DW_DLE_DEBUGPUBTYPES_ERROR             241
1174#define DW_DLE_AT_FIXUP_NULL                   242
1175#define DW_DLE_AT_FIXUP_DUP                    243
1176#define DW_DLE_BAD_ABINAME                     244
1177#define DW_DLE_TOO_MANY_DEBUG                  245
1178#define DW_DLE_DEBUG_STR_OFFSETS_DUPLICATE     246
1179#define DW_DLE_SECTION_DUPLICATION             247
1180#define DW_DLE_SECTION_ERROR                   248
1181#define DW_DLE_DEBUG_ADDR_DUPLICATE            249
1182#define DW_DLE_DEBUG_CU_UNAVAILABLE_FOR_FORM   250
1183#define DW_DLE_DEBUG_FORM_HANDLING_INCOMPLETE  251
1184#define DW_DLE_NEXT_DIE_PAST_END               252
1185#define DW_DLE_NEXT_DIE_WRONG_FORM             253
1186#define DW_DLE_NEXT_DIE_NO_ABBREV_LIST         254
1187#define DW_DLE_NESTED_FORM_INDIRECT_ERROR      255
1188#define DW_DLE_CU_DIE_NO_ABBREV_LIST           256
1189#define DW_DLE_MISSING_NEEDED_DEBUG_ADDR_SECTION 257
1190#define DW_DLE_ATTR_FORM_NOT_ADDR_INDEX        258
1191#define DW_DLE_ATTR_FORM_NOT_STR_INDEX         259
1192#define DW_DLE_DUPLICATE_GDB_INDEX             260
1193#define DW_DLE_ERRONEOUS_GDB_INDEX_SECTION     261
1194#define DW_DLE_GDB_INDEX_COUNT_ERROR           262
1195#define DW_DLE_GDB_INDEX_COUNT_ADDR_ERROR      263
1196#define DW_DLE_GDB_INDEX_INDEX_ERROR           264
1197#define DW_DLE_GDB_INDEX_CUVEC_ERROR           265
1198#define DW_DLE_DUPLICATE_CU_INDEX              266
1199#define DW_DLE_DUPLICATE_TU_INDEX              267
1200#define DW_DLE_XU_TYPE_ARG_ERROR               268
1201#define DW_DLE_XU_IMPOSSIBLE_ERROR             269
1202#define DW_DLE_XU_NAME_COL_ERROR               270
1203#define DW_DLE_XU_HASH_ROW_ERROR               271
1204#define DW_DLE_XU_HASH_INDEX_ERROR             272
1205/* ..._FAILSAFE_ERRVAL is an aid when out of memory. */
1206#define DW_DLE_FAILSAFE_ERRVAL                 273
1207#define DW_DLE_ARANGE_ERROR                    274
1208#define DW_DLE_PUBNAMES_ERROR                  275
1209#define DW_DLE_FUNCNAMES_ERROR                 276
1210#define DW_DLE_TYPENAMES_ERROR                 277
1211#define DW_DLE_VARNAMES_ERROR                  278
1212#define DW_DLE_WEAKNAMES_ERROR                 279
1213#define DW_DLE_RELOCS_ERROR                    280
1214#define DW_DLE_ATTR_OUTSIDE_SECTION            281
1215#define DW_DLE_FISSION_INDEX_WRONG             282
1216#define DW_DLE_FISSION_VERSION_ERROR           283
1217#define DW_DLE_NEXT_DIE_LOW_ERROR              284
1218#define DW_DLE_CU_UT_TYPE_ERROR                285
1219#define DW_DLE_NO_SUCH_SIGNATURE_FOUND         286
1220#define DW_DLE_SIGNATURE_SECTION_NUMBER_WRONG  287
1221#define DW_DLE_ATTR_FORM_NOT_DATA8             288
1222#define DW_DLE_SIG_TYPE_WRONG_STRING           289
1223#define DW_DLE_MISSING_REQUIRED_TU_OFFSET_HASH 290
1224#define DW_DLE_MISSING_REQUIRED_CU_OFFSET_HASH 291
1225#define DW_DLE_DWP_MISSING_DWO_ID              292
1226#define DW_DLE_DWP_SIBLING_ERROR               293
1227#define DW_DLE_DEBUG_FISSION_INCOMPLETE        294
1228#define DW_DLE_FISSION_SECNUM_ERR              295
1229#define DW_DLE_DEBUG_MACRO_DUPLICATE           296
1230#define DW_DLE_DEBUG_NAMES_DUPLICATE           297
1231#define DW_DLE_DEBUG_LINE_STR_DUPLICATE        298
1232#define DW_DLE_DEBUG_SUP_DUPLICATE             299
1233#define DW_DLE_NO_SIGNATURE_TO_LOOKUP          300
1234#define DW_DLE_NO_TIED_ADDR_AVAILABLE          301
1235#define DW_DLE_NO_TIED_SIG_AVAILABLE           302
1236#define DW_DLE_STRING_NOT_TERMINATED           303
1237#define DW_DLE_BAD_LINE_TABLE_OPERATION        304
1238#define DW_DLE_LINE_CONTEXT_BOTCH              305
1239#define DW_DLE_LINE_CONTEXT_INDEX_WRONG        306
1240#define DW_DLE_NO_TIED_STRING_AVAILABLE        307
1241#define DW_DLE_NO_TIED_FILE_AVAILABLE          308
1242#define DW_DLE_CU_TYPE_MISSING                 309
1243#define DW_DLE_LLE_CODE_UNKNOWN                310
1244#define DW_DLE_LOCLIST_INTERFACE_ERROR         311
1245#define DW_DLE_LOCLIST_INDEX_ERROR             312
1246#define DW_DLE_INTERFACE_NOT_SUPPORTED         313
1247#define DW_DLE_ZDEBUG_REQUIRES_ZLIB            314
1248#define DW_DLE_ZDEBUG_INPUT_FORMAT_ODD         315
1249#define DW_DLE_ZLIB_BUF_ERROR                  316
1250#define DW_DLE_ZLIB_DATA_ERROR                 317
1251#define DW_DLE_MACRO_OFFSET_BAD                318
1252#define DW_DLE_MACRO_OPCODE_BAD                319
1253#define DW_DLE_MACRO_OPCODE_FORM_BAD           320
1254#define DW_DLE_UNKNOWN_FORM                    321
1255#define DW_DLE_BAD_MACRO_HEADER_POINTER        322
1256#define DW_DLE_BAD_MACRO_INDEX                 323
1257#define DW_DLE_MACRO_OP_UNHANDLED              324
1258#define DW_DLE_MACRO_PAST_END                  325
1259#define DW_DLE_LINE_STRP_OFFSET_BAD            326
1260#define DW_DLE_STRING_FORM_IMPROPER            327
1261#define DW_DLE_ELF_FLAGS_NOT_AVAILABLE         328
1262#define DW_DLE_LEB_IMPROPER                    329
1263#define DW_DLE_DEBUG_LINE_RANGE_ZERO           330
1264#define DW_DLE_READ_LITTLEENDIAN_ERROR         331
1265#define DW_DLE_READ_BIGENDIAN_ERROR            332
1266#define DW_DLE_RELOC_INVALID                   333
1267#define DW_DLE_INFO_HEADER_ERROR               334
1268#define DW_DLE_ARANGES_HEADER_ERROR            335
1269#define DW_DLE_LINE_OFFSET_WRONG_FORM          336
1270#define DW_DLE_FORM_BLOCK_LENGTH_ERROR         337
1271#define DW_DLE_ZLIB_SECTION_SHORT              338
1272#define DW_DLE_CIE_INSTR_PTR_ERROR             339
1273#define DW_DLE_FDE_INSTR_PTR_ERROR             340
1274#define DW_DLE_FISSION_ADDITION_ERROR          341
1275#define DW_DLE_HEADER_LEN_BIGGER_THAN_SECSIZE  342
1276#define DW_DLE_LOCEXPR_OFF_SECTION_END         343
1277#define DW_DLE_POINTER_SECTION_UNKNOWN         344
1278#define DW_DLE_ERRONEOUS_XU_INDEX_SECTION      345
1279#define DW_DLE_DIRECTORY_FORMAT_COUNT_VS_DIRECTORIES_MISMATCH 346
1280#define DW_DLE_COMPRESSED_EMPTY_SECTION        347
1281#define DW_DLE_SIZE_WRAPAROUND                 348
1282#define DW_DLE_ILLOGICAL_TSEARCH               349
1283#define DW_DLE_BAD_STRING_FORM                 350
1284#define DW_DLE_DEBUGSTR_ERROR                  351
1285#define DW_DLE_DEBUGSTR_UNEXPECTED_REL         352
1286#define DW_DLE_DISCR_ARRAY_ERROR               353
1287#define DW_DLE_LEB_OUT_ERROR                   354
1288#define DW_DLE_SIBLING_LIST_IMPROPER           355
1289#define DW_DLE_LOCLIST_OFFSET_BAD              356
1290#define DW_DLE_LINE_TABLE_BAD                  357
1291#define DW_DLE_DEBUG_LOClISTS_DUPLICATE        358
1292#define DW_DLE_DEBUG_RNGLISTS_DUPLICATE        359
1293#define DW_DLE_ABBREV_OFF_END                  360
1294#define DW_DLE_FORM_STRING_BAD_STRING          361
1295#define DW_DLE_AUGMENTATION_STRING_OFF_END     362
1296#define DW_DLE_STRING_OFF_END_PUBNAMES_LIKE    363
1297#define DW_DLE_LINE_STRING_BAD                 364
1298#define DW_DLE_DEFINE_FILE_STRING_BAD          365
1299#define DW_DLE_MACRO_STRING_BAD                366
1300#define DW_DLE_MACINFO_STRING_BAD              367
1301#define DW_DLE_ZLIB_UNCOMPRESS_ERROR           368
1302#define DW_DLE_IMPROPER_DWO_ID                 369
1303#define DW_DLE_GROUPNUMBER_ERROR               370
1304#define DW_DLE_ADDRESS_SIZE_ZERO               371
1305#define DW_DLE_DEBUG_NAMES_HEADER_ERROR        372
1306#define DW_DLE_DEBUG_NAMES_AUG_STRING_ERROR    373
1307#define DW_DLE_DEBUG_NAMES_PAD_NON_ZERO        374
1308#define DW_DLE_DEBUG_NAMES_OFF_END             375
1309#define DW_DLE_DEBUG_NAMES_ABBREV_OVERFLOW     376
1310#define DW_DLE_DEBUG_NAMES_ABBREV_CORRUPTION   377
1311#define DW_DLE_DEBUG_NAMES_NULL_POINTER        378
1312#define DW_DLE_DEBUG_NAMES_BAD_INDEX_ARG       379
1313#define DW_DLE_DEBUG_NAMES_ENTRYPOOL_OFFSET    380
1314#define DW_DLE_DEBUG_NAMES_UNHANDLED_FORM      381
1315#define DW_DLE_LNCT_CODE_UNKNOWN               382
1316#define DW_DLE_LNCT_FORM_CODE_NOT_HANDLED      383
1317#define DW_DLE_LINE_HEADER_LENGTH_BOTCH        384
1318#define DW_DLE_STRING_HASHTAB_IDENTITY_ERROR   385
1319#define DW_DLE_UNIT_TYPE_NOT_HANDLED           386
1320#define DW_DLE_GROUP_MAP_ALLOC                 387
1321#define DW_DLE_GROUP_MAP_DUPLICATE             388
1322#define DW_DLE_GROUP_COUNT_ERROR               389
1323#define DW_DLE_GROUP_INTERNAL_ERROR            390
1324#define DW_DLE_GROUP_LOAD_ERROR                391
1325#define DW_DLE_GROUP_LOAD_READ_ERROR           392
1326#define DW_DLE_AUG_DATA_LENGTH_BAD             393
1327#define DW_DLE_ABBREV_MISSING                  394
1328#define DW_DLE_NO_TAG_FOR_DIE                  395
1329#define DW_DLE_LOWPC_WRONG_CLASS               396
1330#define DW_DLE_HIGHPC_WRONG_FORM               397
1331#define DW_DLE_STR_OFFSETS_BASE_WRONG_FORM     398
1332#define DW_DLE_DATA16_OUTSIDE_SECTION          399
1333#define DW_DLE_LNCT_MD5_WRONG_FORM             400
1334#define DW_DLE_LINE_HEADER_CORRUPT             401
1335#define DW_DLE_STR_OFFSETS_NULLARGUMENT        402
1336#define DW_DLE_STR_OFFSETS_NULL_DBG            403
1337#define DW_DLE_STR_OFFSETS_NO_MAGIC            404
1338#define DW_DLE_STR_OFFSETS_ARRAY_SIZE          405
1339#define DW_DLE_STR_OFFSETS_VERSION_WRONG       406
1340#define DW_DLE_STR_OFFSETS_ARRAY_INDEX_WRONG   407
1341#define DW_DLE_STR_OFFSETS_EXTRA_BYTES         408
1342#define DW_DLE_DUP_ATTR_ON_DIE                 409
1343#define DW_DLE_SECTION_NAME_BIG                410
1344#define DW_DLE_FILE_UNAVAILABLE                411
1345#define DW_DLE_FILE_WRONG_TYPE                 412
1346#define DW_DLE_SIBLING_OFFSET_WRONG            413
1347#define DW_DLE_OPEN_FAIL                       414
1348#define DW_DLE_OFFSET_SIZE                     415
1349#define DW_DLE_MACH_O_SEGOFFSET_BAD            416
1350#define DW_DLE_FILE_OFFSET_BAD                 417
1351#define DW_DLE_SEEK_ERROR                      418
1352#define DW_DLE_READ_ERROR                      419
1353#define DW_DLE_ELF_CLASS_BAD                   420
1354#define DW_DLE_ELF_ENDIAN_BAD                  421
1355#define DW_DLE_ELF_VERSION_BAD                 422
1356#define DW_DLE_FILE_TOO_SMALL                  423
1357#define DW_DLE_PATH_SIZE_TOO_SMALL             424
1358#define DW_DLE_BAD_TYPE_SIZE                   425
1359#define DW_DLE_PE_SIZE_SMALL                   426
1360#define DW_DLE_PE_OFFSET_BAD                   427
1361#define DW_DLE_PE_STRING_TOO_LONG              428
1362#define DW_DLE_IMAGE_FILE_UNKNOWN_TYPE         429
1363#define DW_DLE_LINE_TABLE_LINENO_ERROR         430
1364#define DW_DLE_PRODUCER_CODE_NOT_AVAILABLE     431
1365#define DW_DLE_NO_ELF_SUPPORT                  432
1366#define DW_DLE_NO_STREAM_RELOC_SUPPORT         433
1367#define DW_DLE_RETURN_EMPTY_PUBNAMES_ERROR     434
1368#define DW_DLE_SECTION_SIZE_ERROR              435
1369#define DW_DLE_INTERNAL_NULL_POINTER           436
1370#define DW_DLE_SECTION_STRING_OFFSET_BAD       437
1371#define DW_DLE_SECTION_INDEX_BAD               438
1372#define DW_DLE_INTEGER_TOO_SMALL               439
1373#define DW_DLE_ELF_SECTION_LINK_ERROR          440
1374#define DW_DLE_ELF_SECTION_GROUP_ERROR         441
1375#define DW_DLE_ELF_SECTION_COUNT_MISMATCH      442
1376#define DW_DLE_ELF_STRING_SECTION_MISSING      443
1377#define DW_DLE_SEEK_OFF_END                    444
1378#define DW_DLE_READ_OFF_END                    445
1379#define DW_DLE_ELF_SECTION_ERROR               446
1380#define DW_DLE_ELF_STRING_SECTION_ERROR        447
1381#define DW_DLE_MIXING_SPLIT_DWARF_VERSIONS     448
1382#define DW_DLE_TAG_CORRUPT                     449
1383#define DW_DLE_FORM_CORRUPT                    450
1384#define DW_DLE_ATTR_CORRUPT                    451
1385#define DW_DLE_ABBREV_ATTR_DUPLICATION         452
1386#define DW_DLE_DWP_SIGNATURE_MISMATCH          453
1387#define DW_DLE_CU_UT_TYPE_VALUE                454
1388#define DW_DLE_DUPLICATE_GNU_DEBUGLINK         455
1389#define DW_DLE_CORRUPT_GNU_DEBUGLINK           456
1390#define DW_DLE_CORRUPT_NOTE_GNU_DEBUGID        457
1391#define DW_DLE_CORRUPT_GNU_DEBUGID_SIZE        458
1392#define DW_DLE_CORRUPT_GNU_DEBUGID_STRING      459
1393#define DW_DLE_HEX_STRING_ERROR                460
1394#define DW_DLE_DECIMAL_STRING_ERROR            461
1395#define DW_DLE_PRO_INIT_EXTRAS_UNKNOWN         462
1396#define DW_DLE_PRO_INIT_EXTRAS_ERR             463
1397#define DW_DLE_NULL_ARGS_DWARF_ADD_PATH        464
1398#define DW_DLE_DWARF_INIT_DBG_NULL             465
1399#define DW_DLE_ELF_RELOC_SECTION_ERROR         466
1400#define DW_DLE_USER_DECLARED_ERROR             467
1401#define DW_DLE_RNGLISTS_ERROR                  468
1402#define DW_DLE_LOCLISTS_ERROR                  469
1403
1404    /* LAST MUST EQUAL LAST ERROR NUMBER */
1405#define DW_DLE_LAST        469
1406
1407#define DW_DLE_LO_USER     0x10000
1408
1409    /*  Taken as meaning 'undefined value', this is not
1410        a column or register number.
1411        Only present at libdwarf runtime. Never on disk.
1412        DW_FRAME_* Values present on disk are in dwarf.h
1413    */
1414#define DW_FRAME_UNDEFINED_VAL          1034
1415
1416    /*  Taken as meaning 'same value' as caller had, not a column
1417        or register number
1418        Only present at libdwarf runtime. Never on disk.
1419        DW_FRAME_* Values present on disk are in dwarf.h
1420    */
1421#define DW_FRAME_SAME_VAL               1035
1422
1423
1424
1425/* error return values
1426*/
1427#define DW_DLV_BADADDR     (~(Dwarf_Addr)0)
1428    /* for functions returning target address */
1429
1430#define DW_DLV_NOCOUNT     ((Dwarf_Signed)-1)
1431    /* for functions returning count */
1432
1433#define DW_DLV_BADOFFSET   (~(Dwarf_Off)0)
1434    /* for functions returning offset */
1435
1436/* standard return values for functions */
1437#define DW_DLV_NO_ENTRY -1
1438#define DW_DLV_OK        0
1439#define DW_DLV_ERROR     1
1440
1441/* Special values for offset_into_exception_table field of dwarf fde's. */
1442/* The following value indicates that there is no Exception table offset
1443   associated with a dwarf frame. */
1444#define DW_DLX_NO_EH_OFFSET         (-1LL)
1445/* The following value indicates that the producer was unable to analyse the
1446   source file to generate Exception tables for this function. */
1447#define DW_DLX_EH_OFFSET_UNAVAILABLE  (-2LL)
1448
1449/* The dwarf specification separates FORMs into
1450different classes.  To do the seperation properly
1451requires 4 pieces of data as of DWARF4 (thus the
1452function arguments listed here).
1453The DWARF4 specification class definition suffices to
1454describe all DWARF versions.
1455See section 7.5.4, Attribute Encodings.
1456A return of DW_FORM_CLASS_UNKNOWN means we could not properly figure
1457out what form-class it is.
1458
1459    DW_FORM_CLASS_FRAMEPTR is MIPS/IRIX only, and refers
1460    to the DW_AT_MIPS_fde attribute (a reference to the
1461    .debug_frame section).
1462
1463    DWARF5:
1464    DW_FORM_CLASS_LOCLISTSPTR  is like DW_FORM_CLASS_LOCLIST
1465    except that LOCLISTSPTR is aways a section offset,
1466    never an index, and LOCLISTSPTR is only referenced
1467    by DW_AT_loclists_base.
1468    Note DW_FORM_CLASS_LOCLISTSPTR spelling to distinguish
1469    from DW_FORM_CLASS_LOCLISTPTR.
1470
1471    DWARF5:
1472    DW_FORM_CLASS_RNGLISTSPTR  is like DW_FORM_CLASS_RNGLIST
1473    except that RNGLISTSPTR is aways a section offset,
1474    never an index. DW_FORM_CLASS_RNGLISTSPTR is only
1475    referenced by DW_AT_rnglists_base.
1476*/
1477enum Dwarf_Form_Class {
1478    DW_FORM_CLASS_UNKNOWN,   DW_FORM_CLASS_ADDRESS,
1479    DW_FORM_CLASS_BLOCK,     DW_FORM_CLASS_CONSTANT,
1480    DW_FORM_CLASS_EXPRLOC,   DW_FORM_CLASS_FLAG,
1481    DW_FORM_CLASS_LINEPTR,
1482    DW_FORM_CLASS_LOCLISTPTR,   /* DWARF2,3,4 only */
1483    DW_FORM_CLASS_MACPTR,       /* DWARF2,3,4 only */
1484    DW_FORM_CLASS_RANGELISTPTR, /* DWARF2,3,4 only */
1485    DW_FORM_CLASS_REFERENCE,
1486    DW_FORM_CLASS_STRING,
1487    DW_FORM_CLASS_FRAMEPTR,      /* MIPS/IRIX DWARF2 only */
1488    DW_FORM_CLASS_MACROPTR,      /* DWARF5 */
1489    DW_FORM_CLASS_ADDRPTR,       /* DWARF5 */
1490    DW_FORM_CLASS_LOCLIST,       /* DWARF5 */
1491    DW_FORM_CLASS_LOCLISTSPTR,   /* DWARF5 */
1492    DW_FORM_CLASS_RNGLIST,       /* DWARF5 */
1493    DW_FORM_CLASS_RNGLISTSPTR,   /* DWARF5 */
1494    DW_FORM_CLASS_STROFFSETSPTR  /* DWARF5 */
1495};
1496
1497/*  These support opening DWARF5 split dwarf objects. */
1498#define DW_GROUPNUMBER_ANY  0
1499#define DW_GROUPNUMBER_BASE 1
1500#define DW_GROUPNUMBER_DWO  2
1501
1502/*===========================================================================*/
1503/*  Dwarf consumer interface initialization and termination operations */
1504
1505/*  Initialization based on path. This is new October 2018.
1506    The path actually used is copied to true_path_out
1507    and in the case of MacOS dSYM may not match path.
1508    So consider the value put in true_path_out the
1509    actual file name. reserved1,2,3 should all be passed
1510    as zero. */
1511int dwarf_init_path(const char * /*path*/,
1512    char *            /*true_path_out_buffer*/,
1513    unsigned int      /*true_path_bufferlen*/,
1514    Dwarf_Unsigned    /*access*/,
1515    unsigned int      /*groupnumber*/,
1516    Dwarf_Handler     /*errhand*/,
1517    Dwarf_Ptr         /*errarg*/,
1518    Dwarf_Debug*      /*dbg*/,
1519    const char *      /* reserved1 */,
1520    Dwarf_Unsigned    /* reserved2 */,
1521    Dwarf_Unsigned  * /* reserved3 */,
1522    Dwarf_Error*      /*error*/);
1523
1524/*  Initialization based on Unix(etc) open fd */
1525/*  New March 2017 */
1526int dwarf_init_b(int    /*fd*/,
1527    Dwarf_Unsigned    /*access*/,
1528    unsigned int      /*groupnumber*/,
1529    Dwarf_Handler     /*errhand*/,
1530    Dwarf_Ptr         /*errarg*/,
1531    Dwarf_Debug*      /*dbg*/,
1532    Dwarf_Error*      /*error*/);
1533
1534int dwarf_init(int    /*fd*/,
1535    Dwarf_Unsigned    /*access*/,
1536    Dwarf_Handler     /*errhand*/,
1537    Dwarf_Ptr         /*errarg*/,
1538    Dwarf_Debug*      /*dbg*/,
1539    Dwarf_Error*      /*error*/);
1540
1541/*  The dwarf_elf_init* functions continue to be supported,
1542    but should be considered deprecated as they can ONLY
1543    be used on Elf files. */
1544/*  Initialization based on libelf/sgi-fastlibelf open pointer. */
1545/*  New March 2017 */
1546int dwarf_elf_init_b(dwarf_elf_handle /*elf*/,
1547    Dwarf_Unsigned    /*access*/,
1548    unsigned int      /*group_number*/,
1549    Dwarf_Handler     /*errhand*/,
1550    Dwarf_Ptr         /*errarg*/,
1551    Dwarf_Debug*      /*dbg*/,
1552    Dwarf_Error*      /*error*/);
1553int dwarf_elf_init(dwarf_elf_handle /*elf*/,
1554    Dwarf_Unsigned    /*access*/,
1555    Dwarf_Handler     /*errhand*/,
1556    Dwarf_Ptr         /*errarg*/,
1557    Dwarf_Debug*      /*dbg*/,
1558    Dwarf_Error*      /*error*/);
1559
1560/*  New September 2019.
1561    When using dwarf_elf_init[_b]() we still want the file path
1562    in the record. So we add it after the init phase.
1563    Path is needed for buildid and debuglink to fully work.
1564*/
1565int  dwarf_add_file_path(Dwarf_Debug /*dbg*/,
1566    const char * /*file_name*/,
1567    Dwarf_Error*      /*error*/);
1568
1569/* Undocumented function for memory allocator. */
1570void dwarf_print_memory_stats(Dwarf_Debug  /*dbg*/);
1571
1572int dwarf_get_elf(Dwarf_Debug /*dbg*/,
1573    dwarf_elf_handle* /*return_elfptr*/,
1574    Dwarf_Error*      /*error*/);
1575
1576int dwarf_finish(Dwarf_Debug /*dbg*/, Dwarf_Error* /*error*/);
1577
1578
1579/*  NEW March 2017. */
1580int dwarf_object_init_b(Dwarf_Obj_Access_Interface* /*obj*/,
1581    Dwarf_Handler /*errhand*/,
1582    Dwarf_Ptr     /*errarg*/,
1583    unsigned int  /*groupnumber*/,
1584    Dwarf_Debug*  /*dbg*/,
1585    Dwarf_Error*  /*error*/);
1586
1587int dwarf_object_init(Dwarf_Obj_Access_Interface* /*obj*/,
1588    Dwarf_Handler /*errhand*/,
1589    Dwarf_Ptr     /*errarg*/,
1590    Dwarf_Debug*  /*dbg*/,
1591    Dwarf_Error*  /*error*/);
1592
1593int dwarf_set_tied_dbg(Dwarf_Debug /*basedbg*/,
1594    Dwarf_Debug /*tied_dbg*/,
1595    Dwarf_Error*  /*error*/);
1596
1597/*  Likely not very useful.? */
1598int dwarf_get_tied_dbg(Dwarf_Debug /*dbg*/,
1599    Dwarf_Debug * /*tieddbg_out*/,
1600    Dwarf_Error * /*error*/);
1601
1602int dwarf_object_finish(Dwarf_Debug /*dbg*/,
1603    Dwarf_Error* /*error*/);
1604
1605/*  Returns the version string. Example: "20190922"
1606    which is in ISO date format. */
1607const char * dwarf_package_version(void);
1608
1609/*  Section name access.  Because sections might
1610    now end with .dwo or be .zdebug  or might not.
1611*/
1612int dwarf_get_die_section_name(Dwarf_Debug /*dbg*/,
1613    Dwarf_Bool    /*is_info*/,
1614    const char ** /*sec_name*/,
1615    Dwarf_Error * /*error*/);
1616
1617int dwarf_get_die_section_name_b(Dwarf_Die /*die*/,
1618    const char ** /*sec_name*/,
1619    Dwarf_Error * /*error*/);
1620
1621int dwarf_get_real_section_name(Dwarf_Debug /*dbg*/,
1622    const char * /*std_section_name*/,
1623    const char ** /*actual_sec_name_out*/,
1624    Dwarf_Small * /*marked_compressed*/,  /* .zdebug... */
1625    Dwarf_Small * /*marked_zlib_compressed */, /* ZLIB string */
1626    Dwarf_Small * /*marked_shf_compressed*/, /* SHF_COMPRESSED */
1627    Dwarf_Unsigned * /*compressed_length*/,
1628    Dwarf_Unsigned * /*uncompressed_length*/,
1629    Dwarf_Error * /*error*/);
1630
1631
1632
1633/*  dwarf_next_cu_header_d traverses debug_types CU headers.
1634    New in May, 2015.
1635    */
1636int dwarf_next_cu_header_d(Dwarf_Debug /*dbg*/,
1637    Dwarf_Bool      /*is_info*/,
1638    Dwarf_Unsigned* /*cu_header_length*/,
1639    Dwarf_Half*     /*version_stamp*/,
1640    Dwarf_Off*      /*abbrev_offset*/,
1641    Dwarf_Half*     /*address_size*/,
1642    Dwarf_Half*     /*length_size*/,
1643    Dwarf_Half*     /*extension_size*/,
1644    Dwarf_Sig8*     /*type signature*/,
1645    Dwarf_Unsigned* /*typeoffset*/,
1646    Dwarf_Unsigned* /*next_cu_header_offset*/,
1647    Dwarf_Half    * /*header_cu_type*/,
1648    Dwarf_Error*    /*error*/);
1649
1650/*  Die traversal operations.
1651    dwarf_next_cu_header_b traverses debug_info CU headers.
1652    Obsolete but supported.
1653    */
1654int dwarf_next_cu_header_b(Dwarf_Debug /*dbg*/,
1655    Dwarf_Unsigned* /*cu_header_length*/,
1656    Dwarf_Half*     /*version_stamp*/,
1657    Dwarf_Off*      /*abbrev_offset*/,
1658    Dwarf_Half*     /*address_size*/,
1659    Dwarf_Half*     /*length_size*/,
1660    Dwarf_Half*     /*extension_size*/,
1661    Dwarf_Unsigned* /*next_cu_header_offset*/,
1662    Dwarf_Error*    /*error*/);
1663
1664/*  dwarf_next_cu_header_types traverses debug_types CU headers.
1665    New in October, 2011. Obsolete but supported May 2015.
1666    */
1667int dwarf_next_cu_header_c(Dwarf_Debug /*dbg*/,
1668    Dwarf_Bool      /*is_info*/,
1669    Dwarf_Unsigned* /*cu_header_length*/,
1670    Dwarf_Half*     /*version_stamp*/,
1671    Dwarf_Off*      /*abbrev_offset*/,
1672    Dwarf_Half*     /*address_size*/,
1673    Dwarf_Half*     /*length_size*/,
1674    Dwarf_Half*     /*extension_size*/,
1675    Dwarf_Sig8*     /*type signature*/,
1676    Dwarf_Unsigned* /*typeoffset*/,
1677    Dwarf_Unsigned* /*next_cu_header_offset*/,
1678    Dwarf_Error*    /*error*/);
1679/* The following is obsolete, though supported. November 2009. */
1680int dwarf_next_cu_header(Dwarf_Debug /*dbg*/,
1681    Dwarf_Unsigned* /*cu_header_length*/,
1682    Dwarf_Half*     /*version_stamp*/,
1683    Dwarf_Off*      /*abbrev_offset*/,
1684    Dwarf_Half*     /*address_size*/,
1685    Dwarf_Unsigned* /*next_cu_header_offset*/,
1686    Dwarf_Error*    /*error*/);
1687
1688int dwarf_siblingof(Dwarf_Debug /*dbg*/,
1689    Dwarf_Die        /*die*/,
1690    Dwarf_Die*       /*return_siblingdie*/,
1691    Dwarf_Error*     /*error*/);
1692/* dwarf_siblingof_b new October 2011. */
1693int dwarf_siblingof_b(Dwarf_Debug /*dbg*/,
1694    Dwarf_Die        /*die*/,
1695    Dwarf_Bool       /*is_info*/,
1696    Dwarf_Die*       /*return_siblingdie*/,
1697    Dwarf_Error*     /*error*/);
1698
1699/* New 27 April 2015. */
1700int dwarf_die_from_hash_signature(Dwarf_Debug /*dbg*/,
1701    Dwarf_Sig8 *     /*hash_sig*/,
1702    const char *     /*sig_type: "tu" or "cu"*/,
1703    Dwarf_Die*       /*returned_CU_die */,
1704    Dwarf_Error*     /*error*/);
1705
1706int dwarf_child(Dwarf_Die /*die*/,
1707    Dwarf_Die*       /*return_childdie*/,
1708    Dwarf_Error*     /*error*/);
1709
1710/*  Finding die given global (not CU-relative) offset.
1711    Applies only to debug_info. */
1712int dwarf_offdie(Dwarf_Debug /*dbg*/,
1713    Dwarf_Off        /*offset*/,
1714    Dwarf_Die*       /*return_die*/,
1715    Dwarf_Error*     /*error*/);
1716
1717/*  dwarf_offdie_b new October 2011 */
1718/*  Finding die given global (not CU-relative) offset.
1719    Applies to debug_info (is_info true) or debug_types (is_info false). */
1720int dwarf_offdie_b(Dwarf_Debug /*dbg*/,
1721    Dwarf_Off        /*offset*/,
1722    Dwarf_Bool       /*is_info*/,
1723    Dwarf_Die*       /*return_die*/,
1724    Dwarf_Error*     /*error*/);
1725
1726/*  Returns the is_info flag through the pointer if the function returns
1727    DW_DLV_OK. Needed so client software knows if a DIE is in debug_info
1728    or debug_types.
1729    New October 2011. */
1730Dwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die /*die*/);
1731
1732/*  New March 2016.
1733    So we can associate a DIE's abbreviations with the contents
1734    the abbreviations section. */
1735int dwarf_die_abbrev_global_offset(Dwarf_Die /*die*/,
1736    Dwarf_Off       * /*abbrev_offset*/,
1737    Dwarf_Unsigned  * /*abbrev_count*/,
1738    Dwarf_Error*      /*error*/);
1739
1740/*  operations on DIEs */
1741int dwarf_tag(Dwarf_Die /*die*/,
1742    Dwarf_Half*      /*return_tag*/,
1743    Dwarf_Error*     /*error*/);
1744
1745/*  dwarf_dieoffset returns the global debug_info
1746    section offset, not the CU relative offset. */
1747int dwarf_dieoffset(Dwarf_Die /*die*/,
1748    Dwarf_Off*       /*return_offset*/,
1749    Dwarf_Error*     /*error*/);
1750
1751/*  NEW October 2015. DWARF5.
1752    The DIE here can be any DIE in the relevant CU.
1753    index is an index into .debug_addr.
1754    This will look first for .debug_addr
1755    in the dbg object DIE
1756    and if not there (because the dbg object is
1757    a dwo or dwp split dwarf object)
1758    will look in the tied object if tied is available. */
1759int dwarf_debug_addr_index_to_addr(Dwarf_Die /*die*/,
1760    Dwarf_Unsigned  /*index*/,
1761    Dwarf_Addr    * /*return_addr*/,
1762    Dwarf_Error   * /*error*/);
1763/*  Reading a CU DIE with DW_AT_low_pc an indexed value
1764    can be problematic as that interacts with DW_AT_addr_base
1765    in that DIE. Here is a test readers may find useful */
1766Dwarf_Bool dwarf_addr_form_is_indexed(int form);
1767
1768
1769/*  dwarf_CU_dieoffset_given_die returns
1770    the global debug_info section offset of the CU die
1771    that is the CU containing the given_die
1772    (the passed in DIE can be any DIE).
1773    This information makes it possible for a consumer to
1774    find and print CU context information for any die.
1775    See also dwarf_get_cu_die_offset_given_cu_header_offset. */
1776int dwarf_CU_dieoffset_given_die(Dwarf_Die /*given_die*/,
1777    Dwarf_Off*       /*return_offset*/,
1778    Dwarf_Error*     /*error*/);
1779
1780/*  dwarf_die_CU_offset returns the CU relative offset
1781    not the global debug_info section offset, given
1782    any DIE in the CU.  See also dwarf_CU_dieoffset_given_die.
1783    */
1784int dwarf_die_CU_offset(Dwarf_Die /*die*/,
1785    Dwarf_Off*       /*return_offset*/,
1786    Dwarf_Error*     /*error*/);
1787
1788int dwarf_die_CU_offset_range(Dwarf_Die /*die*/,
1789    Dwarf_Off*       /*return_CU_header_offset*/,
1790    Dwarf_Off*       /*return_CU_length_bytes*/,
1791    Dwarf_Error*     /*error*/);
1792
1793int dwarf_attr (Dwarf_Die /*die*/,
1794    Dwarf_Half        /*attr*/,
1795    Dwarf_Attribute * /*returned_attr*/,
1796    Dwarf_Error*      /*error*/);
1797
1798int dwarf_die_text(Dwarf_Die /*die*/,
1799    Dwarf_Half    /*attr*/,
1800    char       ** /*ret_name*/,
1801    Dwarf_Error * /*error*/);
1802
1803int dwarf_diename(Dwarf_Die /*die*/,
1804    char   **        /*diename*/,
1805    Dwarf_Error*     /*error*/);
1806
1807/* Returns the  abbrev code of the die. Cannot fail. */
1808int dwarf_die_abbrev_code(Dwarf_Die /*die */);
1809
1810/*  Returns a flag through ab_has_child. Non-zero if
1811    the DIE has children, zero if it does not.   */
1812int dwarf_die_abbrev_children_flag(Dwarf_Die /*die*/,
1813    Dwarf_Half * /*ab_has_child*/);
1814
1815/* Validate the sibling DIE. This only makes sense to call
1816   if the sibling's DIEs have been travsersed and
1817   dwarf_child called on each,
1818   so that the last DIE dwarf_child saw was the last.
1819   Essentially ensuring that (after such traversal) that we
1820   are in the same place a sibling attribute would identify.
1821   In case we return DW_DLV_ERROR, the global offset of the last
1822   DIE traversed by dwarf_child is returned through *offset */
1823int dwarf_validate_die_sibling(Dwarf_Die /*sibling*/,Dwarf_Off* /*offset*/);
1824
1825/* convenience functions, alternative to using dwarf_attrlist */
1826int dwarf_hasattr(Dwarf_Die /*die*/,
1827    Dwarf_Half   /*attr*/,
1828    Dwarf_Bool * /*returned_bool*/,
1829    Dwarf_Error* /*error*/);
1830
1831/* Returns the children offsets for the given offset */
1832int dwarf_offset_list(Dwarf_Debug /*dbg*/,
1833    Dwarf_Off         /*offset*/,
1834    Dwarf_Bool        /*is_info*/,
1835    Dwarf_Off      ** /*offbuf*/,
1836    Dwarf_Unsigned *  /*offcnt*/,
1837    Dwarf_Error    *  /*error*/);
1838
1839/*  BEGIN: loclist_c interfaces
1840    NEW October 2015.
1841    This works for any attribute that identifies
1842    a loclist or a locexpr. When the attribute is a locexpr
1843    a single loclist (created by libdwarf)
1844    is attached to loclist_head. */
1845int dwarf_get_loclist_c (Dwarf_Attribute /*attr*/,
1846   Dwarf_Loc_Head_c * /*loclist_head*/,
1847   Dwarf_Unsigned   * /*locCount*/,
1848   Dwarf_Error      * /*error*/);
1849
1850#define DW_LKIND_expression   0 /* DWARF2,3,4*/
1851#define DW_LKIND_loclist      1 /* DWARF 2,3,4 */
1852#define DW_LKIND_GNU_exp_list 2 /* GNU DWARF4 .dwo extension */
1853#define DW_LKIND_loclists     5 /* DWARF5 loclists */
1854#define DW_LKIND_unknown     99
1855
1856/* DWARF2 kind is 2. DWARF3/4 kind is 3, DWARF5 kind is 5 */
1857int
1858dwarf_get_loclist_head_kind(Dwarf_Loc_Head_c /*ll_header*/,
1859    unsigned int  * /*lkind*/,
1860    Dwarf_Error   * /*error*/);
1861
1862int dwarf_get_locdesc_entry_d(Dwarf_Loc_Head_c /*loclist_head*/,
1863   Dwarf_Unsigned    /*index*/,
1864   /* identifies type of locdesc entry*/
1865   Dwarf_Small    *  /*lle_value_out*/,
1866   Dwarf_Unsigned *  /*rawlowpc*/,
1867   Dwarf_Unsigned *  /*rawhipc*/,
1868   Dwarf_Bool     *  /*debug_addr_unavailable*/,
1869   Dwarf_Addr     *  /*lowpc_out*/,
1870   Dwarf_Addr     *  /*hipc_out*/,
1871   Dwarf_Unsigned *  /*loclist_count_out*/,
1872   Dwarf_Locdesc_c * /*locentry_out*/,
1873   Dwarf_Small    *  /*loclist_source_out*/, /* 0,1, or 2 */
1874   Dwarf_Unsigned *  /*expression_offset_out*/,
1875   Dwarf_Unsigned *  /*locdesc_offset_out*/,
1876   Dwarf_Error    *  /*error*/);
1877
1878int dwarf_get_locdesc_entry_c(Dwarf_Loc_Head_c /*loclist_head*/,
1879   Dwarf_Unsigned    /*index*/,
1880   /* identifies type of locdesc entry*/
1881   Dwarf_Small    *  /*lle_value_out*/,
1882   Dwarf_Addr     *  /*lowpc_out*/,
1883   Dwarf_Addr     *  /*hipc_out*/,
1884   Dwarf_Unsigned *  /*loclist_count_out*/,
1885   Dwarf_Locdesc_c * /*locentry_out*/,
1886   Dwarf_Small    *  /*loclist_source_out*/, /* 0,1, or 2 */
1887   Dwarf_Unsigned *  /*expression_offset_out*/,
1888   Dwarf_Unsigned *  /*locdesc_offset_out*/,
1889   Dwarf_Error    *  /*error*/);
1890
1891/* New June 2020 for DWARF5 (and all earlier). */
1892int
1893dwarf_get_location_op_value_d(Dwarf_Locdesc_c /*locdesc*/,
1894    Dwarf_Unsigned   /*index*/,
1895    Dwarf_Small    * /*atom_out*/,
1896    Dwarf_Unsigned * /*operand1*/,
1897    Dwarf_Unsigned * /*operand2*/,
1898    Dwarf_Unsigned * /*operand3*/,
1899    Dwarf_Unsigned * /*rawop1*/,
1900    Dwarf_Unsigned * /*rawop2*/,
1901    Dwarf_Unsigned * /*rawop3*/,
1902    Dwarf_Unsigned * /*offset_for_branch*/,
1903    Dwarf_Error*     /*error*/);
1904
1905int dwarf_get_location_op_value_c(Dwarf_Locdesc_c /*locdesc*/,
1906   Dwarf_Unsigned   /*index*/,
1907   Dwarf_Small    * /*atom_out*/,
1908   Dwarf_Unsigned * /*operand1*/,
1909   Dwarf_Unsigned * /*operand2*/,
1910   Dwarf_Unsigned * /*operand3*/,
1911   Dwarf_Unsigned * /*offset_for_branch*/,
1912   Dwarf_Error*     /*error*/);
1913
1914int dwarf_loclist_from_expr_c(Dwarf_Debug /*dbg*/,
1915    Dwarf_Ptr      /*expression_in*/,
1916    Dwarf_Unsigned /*expression_length*/,
1917    Dwarf_Half     /*address_size*/,
1918    Dwarf_Half     /*offset_size*/,
1919    Dwarf_Small    /*dwarf_version*/,
1920    Dwarf_Loc_Head_c* /*loc_head*/,
1921    Dwarf_Unsigned  * /*listlen*/,
1922    Dwarf_Error     * /*error*/);
1923
1924/* This frees all memory allocated by the applicable
1925    dwarf_get_loclist_c */
1926void dwarf_loc_head_c_dealloc(Dwarf_Loc_Head_c /*loclist_head*/);
1927
1928/* END: loclist_c interfaces */
1929
1930
1931/*  As of 2015 the preferred interface
1932    is dwarf_get_loclist_c
1933    and only dwarf_get_loclist_c will work
1934    for DWARF5 (and also all earlier versions).  */
1935int dwarf_loclist_n(Dwarf_Attribute /*attr*/,
1936    Dwarf_Locdesc*** /*llbuf*/,
1937    Dwarf_Signed *   /*locCount*/,
1938    Dwarf_Error*     /*error*/);
1939
1940/*  The original interfaces.  Please do not use this. */
1941int dwarf_loclist(Dwarf_Attribute /*attr*/,  /* inflexible! */
1942    Dwarf_Locdesc**  /*llbuf*/,
1943    Dwarf_Signed *   /*locCount*/,
1944    Dwarf_Error*     /*error*/);
1945
1946/* Extracts a dwarf expression from an expression byte stream.
1947   Useful to get expressions from DW_CFA_def_cfa_expression
1948   DW_CFA_expression DW_CFA_val_expression expression bytes.
1949   27 April 2009: dwarf_loclist_from_expr interface with
1950   no addr_size is obsolete but supported,
1951   use dwarf_loclist_from_expr_a instead.
1952*/
1953int dwarf_loclist_from_expr(Dwarf_Debug /*dbg*/,
1954    Dwarf_Ptr      /* expression_in*/,
1955    Dwarf_Unsigned /* expression_length*/,
1956    Dwarf_Locdesc ** /* llbuf*/,
1957    Dwarf_Signed * /*listlen*/,
1958    Dwarf_Error *  /* error*/ );
1959
1960/*  dwarf_loclist_from_expr_a new 27 Apr 2009:
1961    added addr_size argument. */
1962int dwarf_loclist_from_expr_a(Dwarf_Debug /*dbg*/,
1963    Dwarf_Ptr      /*expression_in*/,
1964    Dwarf_Unsigned /*expression_length*/,
1965    Dwarf_Half     /*addr_size*/,
1966    Dwarf_Locdesc ** /*llbuf*/,
1967    Dwarf_Signed * /*listlen*/,
1968    Dwarf_Error *  /*error*/);
1969
1970/*  dwarf_loclist_from_expr_b new 13 Nov 2012:
1971    added dwarf_version (DWARF version number
1972    of the applicable compilation unit)
1973    and offset_size arguments. Added for
1974    DW_OP_GNU_implicit_pointer. */
1975int dwarf_loclist_from_expr_b(Dwarf_Debug /*dbg*/,
1976    Dwarf_Ptr      /*expression_in*/ ,
1977    Dwarf_Unsigned /*expression_length*/ ,
1978    Dwarf_Half     /*addr_size*/ ,
1979    Dwarf_Half     /*offset_size*/ ,
1980    Dwarf_Small    /*dwarf_version*/ ,
1981    Dwarf_Locdesc ** /*llbuf*/ ,
1982    Dwarf_Signed * /*listlen*/ ,
1983    Dwarf_Error *  /*error*/ );
1984
1985int dwarf_lowpc(Dwarf_Die /*die*/,
1986    Dwarf_Addr  *    /*returned_addr*/,
1987    Dwarf_Error*     /*error*/);
1988
1989/*  When the highpc attribute is of class  'constant'
1990    it is not an address, it is an offset from the
1991    base address (such as lowpc) of the function.
1992    This is therefore a required interface for DWARF4
1993    style DW_AT_highpc.  */
1994int dwarf_highpc_b(Dwarf_Die /*die*/,
1995    Dwarf_Addr  *           /*return_value*/,
1996    Dwarf_Half  *           /*return_form*/,
1997    enum Dwarf_Form_Class * /*return_class*/,
1998    Dwarf_Error *           /*error*/);
1999
2000/*  This works for DWARF2 and DWARF3 styles of DW_AT_highpc,
2001    but not for the DWARF4 class constant forms.
2002    If the FORM is of class constant this returns an error */
2003int dwarf_highpc(Dwarf_Die /*die*/,
2004    Dwarf_Addr  *    /*returned_addr*/,
2005    Dwarf_Error*     /*error*/);
2006
2007/*  New January 2016. */
2008int dwarf_dietype_offset(Dwarf_Die /*die*/,
2009    Dwarf_Off   * /*return_off*/,
2010    Dwarf_Error * /*error*/);
2011
2012int dwarf_bytesize(Dwarf_Die /*die*/,
2013    Dwarf_Unsigned * /*returned_size*/,
2014    Dwarf_Error*     /*error*/);
2015
2016int dwarf_bitsize(Dwarf_Die /*die*/,
2017    Dwarf_Unsigned * /*returned_size*/,
2018    Dwarf_Error*     /*error*/);
2019
2020int dwarf_bitoffset(Dwarf_Die /*die*/,
2021    Dwarf_Unsigned * /*returned_offset*/,
2022    Dwarf_Error*     /*error*/);
2023
2024int dwarf_srclang(Dwarf_Die /*die*/,
2025    Dwarf_Unsigned * /*returned_lang*/,
2026    Dwarf_Error*     /*error*/);
2027
2028int dwarf_arrayorder(Dwarf_Die /*die*/,
2029    Dwarf_Unsigned * /*returned_order*/,
2030    Dwarf_Error*     /*error*/);
2031
2032/* end of convenience function list */
2033
2034/* this is the main interface to attributes of a DIE */
2035int dwarf_attrlist(Dwarf_Die /*die*/,
2036    Dwarf_Attribute** /*attrbuf*/,
2037    Dwarf_Signed   * /*attrcount*/,
2038    Dwarf_Error*     /*error*/);
2039
2040/* query operations for attributes */
2041int dwarf_hasform(Dwarf_Attribute /*attr*/,
2042    Dwarf_Half       /*form*/,
2043    Dwarf_Bool *     /*returned_bool*/,
2044    Dwarf_Error*     /*error*/);
2045
2046int dwarf_whatform(Dwarf_Attribute /*attr*/,
2047    Dwarf_Half *     /*returned_final_form*/,
2048    Dwarf_Error*     /*error*/);
2049
2050int dwarf_whatform_direct(Dwarf_Attribute /*attr*/,
2051    Dwarf_Half *     /*returned_initial_form*/,
2052    Dwarf_Error*     /*error*/);
2053int dwarf_whatattr(Dwarf_Attribute /*attr*/,
2054    Dwarf_Half *     /*returned_attr_num*/,
2055    Dwarf_Error*     /*error*/);
2056
2057/*
2058    The following are concerned with the Primary Interface: getting
2059    the actual data values. One function per 'kind' of FORM.
2060*/
2061/*  dwarf_formref returns, thru return_offset, a CU-relative offset
2062    and does not allow DW_FORM_ref_addr*/
2063int dwarf_formref(Dwarf_Attribute /*attr*/,
2064    Dwarf_Off*       /*return_offset*/,
2065    Dwarf_Error*     /*error*/);
2066/*  dwarf_global_formref returns, thru return_offset,
2067    a debug_info-relative offset and does allow all reference forms*/
2068int dwarf_global_formref(Dwarf_Attribute /*attr*/,
2069    Dwarf_Off*       /*return_offset*/,
2070    Dwarf_Error*     /*error*/);
2071
2072/*  dwarf_formsig8 returns in the caller-provided 8 byte area
2073    the 8 bytes of a DW_FORM_ref_sig8.  Not a string.  */
2074int dwarf_formsig8(Dwarf_Attribute /*attr*/,
2075    Dwarf_Sig8 * /*returned sig bytes*/,
2076    Dwarf_Error*     /*error*/);
2077/*  dwarf_formsig8_const returns in the caller-provided 8 byte area
2078    the 8 bytes of a form const (DW_FORM_data8).  Not a string.  */
2079int dwarf_formsig8_const(Dwarf_Attribute /*attr*/,
2080    Dwarf_Sig8 * /*returned sig bytes*/,
2081    Dwarf_Error*     /*error*/);
2082
2083int dwarf_formaddr(Dwarf_Attribute /*attr*/,
2084    Dwarf_Addr   *   /*returned_addr*/,
2085    Dwarf_Error*     /*error*/);
2086
2087/*  Part of DebugFission.  So a consumer can get the index when
2088    the object with the actual .debug_addr section is
2089    elsewhere. And so a print application can
2090    print the index.  New May 2014*/
2091int dwarf_get_debug_addr_index(Dwarf_Attribute /*attr*/,
2092    Dwarf_Unsigned * /*return_index*/,
2093    Dwarf_Error * /*error*/);
2094
2095int dwarf_formflag(Dwarf_Attribute /*attr*/,
2096    Dwarf_Bool *     /*returned_bool*/,
2097    Dwarf_Error*     /*error*/);
2098
2099int dwarf_formdata16(Dwarf_Attribute /*attr*/,
2100    Dwarf_Form_Data16  * /*returned_val*/,
2101    Dwarf_Error*     /*error*/);
2102
2103int dwarf_formudata(Dwarf_Attribute /*attr*/,
2104    Dwarf_Unsigned  * /*returned_val*/,
2105    Dwarf_Error*     /*error*/);
2106
2107int dwarf_formsdata(Dwarf_Attribute     /*attr*/,
2108    Dwarf_Signed  *  /*returned_val*/,
2109    Dwarf_Error*     /*error*/);
2110
2111int dwarf_formblock(Dwarf_Attribute /*attr*/,
2112    Dwarf_Block    ** /*returned_block*/,
2113    Dwarf_Error*     /*error*/);
2114
2115int dwarf_formstring(Dwarf_Attribute /*attr*/,
2116    char   **        /*returned_string*/,
2117    Dwarf_Error*     /*error*/);
2118
2119/* DebugFission.  So a DWARF print application can
2120   get the string index (DW_FORM_strx) and print it.
2121   A convenience function.
2122   New May 2014. */
2123int dwarf_get_debug_str_index(Dwarf_Attribute /*attr*/,
2124    Dwarf_Unsigned * /*return_index*/,
2125    Dwarf_Error * /*error*/);
2126
2127
2128int dwarf_formexprloc(Dwarf_Attribute /*attr*/,
2129    Dwarf_Unsigned * /*return_exprlen*/,
2130    Dwarf_Ptr  * /*block_ptr*/,
2131    Dwarf_Error * /*error*/);
2132
2133
2134/* end attribute query operations. */
2135
2136/* Start line number operations */
2137/* dwarf_srclines  is the original interface from 1993. */
2138int dwarf_srclines(Dwarf_Die /*die*/,
2139    Dwarf_Line**     /*linebuf*/,
2140    Dwarf_Signed *   /*linecount*/,
2141    Dwarf_Error*     /*error*/);
2142
2143
2144/* If we have two-level line tables, this will return the
2145   logicals table in linebuf and the actuals table in
2146   linebuf_actuals. For old-style (one-level) tables, it
2147   will return the single table through linebuf, and the
2148   value returned through linecount_actuals will be 0.
2149   The actual version number is returned through version.
2150   For two-level line tables, the version returned will
2151   be 0xf006. This interface can return data from two-level
2152   line tables, which are experimental.
2153   Most users will not wish to use dwarf_srclines_two_level */
2154int dwarf_srclines_two_level(Dwarf_Die /*die*/,
2155    Dwarf_Unsigned * /*version*/,
2156    Dwarf_Line**     /*linebuf*/,
2157    Dwarf_Signed *   /*linecount*/,
2158    Dwarf_Line**     /*linebuf_actuals*/,
2159    Dwarf_Signed *   /*linecount_actuals*/,
2160    Dwarf_Error*     /*error*/);
2161
2162/* dwarf_srclines_dealloc, created July 2005, is the
2163   appropriate method for deallocating what dwarf_srclines
2164   and dwarf_srclines_two_level return.
2165   More complete free than using dwarf_dealloc directly.
2166
2167   When dwarf_srclines_two_level returns two line tables
2168   user code should call dwarf_srclines_dealloc
2169   once on each linebuf returned by dwarf_srclines_two_level
2170   first on linebuf_actuals and then on linebuf{_logicals}.   */
2171
2172void dwarf_srclines_dealloc(Dwarf_Debug /*dbg*/,
2173    Dwarf_Line*       /*linebuf*/,
2174    Dwarf_Signed      /*count */);
2175
2176
2177/*  New October 2015, must be used to deallocating
2178    what is allocated by dwarf_srclines_b and
2179    dwarf_srclines_from_linecontext  use.
2180    Works for DWARF2,3,4,5 and for experimental line tables.
2181    New work should use the new Dwarf_Line_Context
2182    interface.
2183    This interface only reads the line table header, so
2184    it takes relatively little time.
2185    *is_single_table will be set non-zero for all standard dwarf line sections.
2186    *is_single_table will be set zero for line sections with the
2187    two_level line table extension (which will have *version_out 0xf006).  */
2188int dwarf_srclines_b(Dwarf_Die /*die*/,
2189    Dwarf_Unsigned     * /* version_out*/,
2190    Dwarf_Small        * /* table_count */,
2191    Dwarf_Line_Context * /* linecontext*/,
2192    Dwarf_Error        * /* error*/);
2193
2194/*  Functions passing in a Dwarf_Line_Context  are only
2195    available if dwarf_srclines_b() was used to access
2196    line table information.  */
2197/*  New October 2015.  Returns line details.
2198    Works for DWARF2,3,4,5.  If linecount
2199    returned is zero this is a line table with no lines.*/
2200int dwarf_srclines_from_linecontext(
2201    Dwarf_Line_Context /*line_context*/,
2202    Dwarf_Line  **   /*linebuf*/,
2203    Dwarf_Signed *   /*linecount*/,
2204    Dwarf_Error  *   /* error*/);
2205
2206/*  New October 2015.  Returns line details.
2207    Works for DWARF2,3,4,5 and for experimental
2208    two-level line tables. A single level table will
2209    have *linebuf_actuals and *linecount_actuals set
2210    to 0. */
2211int dwarf_srclines_two_level_from_linecontext(
2212    Dwarf_Line_Context /*line_context*/,
2213    Dwarf_Line  **   /*linebuf */,
2214    Dwarf_Signed *   /*linecount*/,
2215    Dwarf_Line  **   /*linebuf_actuals*/,
2216    Dwarf_Signed *   /*linecount_actuals*/,
2217    Dwarf_Error  *   /* error*/);
2218
2219/* dwarf_srclines_dealloc_b(), created October 2015, is the
2220   appropriate method for deallocating everything
2221   and dwarf_srclines_from_linecontext(),
2222   dwarf_srclines_twolevel_from_linecontext(),
2223   and dwarf_srclines_b()  allocate.  */
2224void dwarf_srclines_dealloc_b(Dwarf_Line_Context /*line_context*/);
2225
2226/*  New October 2015. */
2227/*    The offset is in the relevent .debug_line or .debug_line.dwo
2228    section (and in a split dwarf package file includes)
2229    the base line table offset). */
2230int dwarf_srclines_table_offset(Dwarf_Line_Context /*line_context*/,
2231    Dwarf_Unsigned * /*offset*/,
2232    Dwarf_Error  * /* error*/);
2233
2234/*  New October 2015. */
2235/*  Compilation Directory name for the current CU.
2236    section (and in a split dwarf package file includes)
2237    the base line table offset).  Do not free() the string,
2238    it is in a dwarf section. */
2239int dwarf_srclines_comp_dir(Dwarf_Line_Context /*line_context*/,
2240    const char ** /*compilation_directory*/,
2241    Dwarf_Error  *  /*error*/);
2242
2243/*  New October 2015.  Part of the two-level line table extension. */
2244/*  Count is the real count of suprogram array entries. */
2245int dwarf_srclines_subprog_count(Dwarf_Line_Context /*line_context*/,
2246    Dwarf_Signed * /*count*/,
2247    Dwarf_Error  * /*error*/);
2248
2249/*  New October 2015. */
2250/*  Index starts with 1, last is 'count' */
2251int dwarf_srclines_subprog_data(Dwarf_Line_Context /*line_context*/,
2252    Dwarf_Signed     /*index*/,
2253    const char **    /*name*/,
2254    Dwarf_Unsigned * /*decl_file*/,
2255    Dwarf_Unsigned * /*decl_line*/,
2256    Dwarf_Error   *  /*error*/);
2257
2258/*  New October 2015. */
2259/*  Count is the real count of files array entries.
2260    This remains supported though it is pretty useless for
2261    DWARF5.  To process DWARF5 as well
2262    as DWARF 2,3,4 (in a uniform fashion)
2263    use dwarf_srclines_files_indexes() instead.
2264*/
2265int dwarf_srclines_files_count(Dwarf_Line_Context /*line_context*/,
2266    Dwarf_Signed  *  /*count*/,
2267    Dwarf_Error   *  /*error*/);
2268
2269/*  New March 2018. */
2270/*  Count is the real count of files array entries.
2271    Since DWARF 2,3,4 are zero origin indexes and
2272    DWARF5 and later are one origin, this function
2273    replaces dwarf_srclines_files_count(). */
2274int dwarf_srclines_files_indexes(Dwarf_Line_Context /*line_context*/,
2275    Dwarf_Signed  *  /*baseindex*/,
2276    Dwarf_Signed  *  /*count*/,
2277    Dwarf_Signed  *  /*endindex*/,
2278    Dwarf_Error   *  /*error*/);
2279
2280
2281/*  New March 2018. Same as dwarf_srclines_files_data,
2282    but adds the md5ptr field so cases where DW_LNCT_MD5
2283    is present can return pointer to the MD5 value.
2284    With DWARF 5 index starts with 0.
2285    See dwarf_srclines_files_indexes() which makes
2286    indexing through the files easy. */
2287int dwarf_srclines_files_data_b(Dwarf_Line_Context line_context,
2288    Dwarf_Signed     index_in,
2289    const char **    name,
2290    Dwarf_Unsigned * directory_index,
2291    Dwarf_Unsigned * last_mod_time,
2292    Dwarf_Unsigned * file_length,
2293    Dwarf_Form_Data16 ** md5ptr,
2294    Dwarf_Error    * error);
2295
2296/*  New October 2015. */
2297/*  Unlike dwarf_srcfiles() this returns the raw file table
2298    strings without the directory being prefixed.
2299    Index starts with 1, last is 'count' */
2300int dwarf_srclines_files_data(Dwarf_Line_Context /*line_context*/,
2301    Dwarf_Signed     /*index*/,
2302    const char **    /*name*/,
2303    Dwarf_Unsigned * /*directory_index*/,
2304    Dwarf_Unsigned * /*last_mod_time*/,
2305    Dwarf_Unsigned * /*file_length*/,
2306    Dwarf_Error    * /* error*/);
2307
2308/*  New October 2015. */
2309/*  Count is the real count of include array entries. */
2310int dwarf_srclines_include_dir_count(Dwarf_Line_Context /*line_context*/,
2311    Dwarf_Signed *  /*count*/,
2312    Dwarf_Error  * /* error*/);
2313
2314/*  New October 2015. */
2315/*  Index starts with 1, last is 'count' */
2316int dwarf_srclines_include_dir_data(Dwarf_Line_Context /*line_context*/,
2317    Dwarf_Signed    /*index*/,
2318    const char **   /*name*/,
2319    Dwarf_Error   * /* error*/);
2320
2321/*  New October 2015. */
2322/*  The DWARF version number of this compile-unit
2323    in the .debug_lines section and the number of
2324    actual tables:0 (header with no lines),
2325    1 (standard table), or 2 (experimental). */
2326int dwarf_srclines_version(Dwarf_Line_Context /*line_context*/,
2327    Dwarf_Unsigned * /*version*/,
2328    Dwarf_Small    * /*table_count*/,
2329    Dwarf_Error    * /*error*/);
2330
2331
2332int dwarf_get_line_section_name_from_die(Dwarf_Die /*die*/,
2333    const char ** /*section_name_out*/,
2334    Dwarf_Error * /*error*/);
2335
2336
2337/*  While 'filecount' is signed, the value
2338    returned through the pointer is never negative.
2339    Original libdwarf from 199x.  */
2340int dwarf_srcfiles(Dwarf_Die /*die*/,
2341    char***          /*srcfiles*/,
2342    Dwarf_Signed *   /*filecount*/,
2343    Dwarf_Error*     /*error*/);
2344
2345int dwarf_linebeginstatement(Dwarf_Line /*line*/,
2346    Dwarf_Bool  *    /*returned_bool*/,
2347    Dwarf_Error*     /*error*/);
2348
2349int dwarf_lineendsequence(Dwarf_Line /*line*/,
2350    Dwarf_Bool  *    /*returned_bool*/,
2351    Dwarf_Error*     /*error*/);
2352
2353int dwarf_lineno(Dwarf_Line /*line*/,
2354    Dwarf_Unsigned * /*returned_lineno*/,
2355    Dwarf_Error*     /*error*/);
2356
2357int dwarf_line_srcfileno(Dwarf_Line /*line*/,
2358    Dwarf_Unsigned * /*ret_fileno*/,
2359    Dwarf_Error *    /*error*/);
2360
2361/* Is the line address from DW_LNS_set_address? */
2362int dwarf_line_is_addr_set(Dwarf_Line /*line*/,
2363    Dwarf_Bool *     /*is_addr_set*/,
2364    Dwarf_Error *    /*error*/);
2365
2366int dwarf_lineaddr(Dwarf_Line /*line*/,
2367    Dwarf_Addr *     /*returned_addr*/,
2368    Dwarf_Error*     /*error*/);
2369
2370/* dwarf_lineoff is OBSOLETE as of December 2011. Do not use. */
2371int dwarf_lineoff(Dwarf_Line /*line*/,
2372    Dwarf_Signed  *  /*returned_lineoffset*/,
2373    Dwarf_Error*     /*error*/);
2374
2375/*  dwarf_lineoff_b correctly returns an unsigned column number
2376    through the pointer returned_lineoffset.
2377    dwarf_lineoff_b() is new in December 2011.  */
2378int dwarf_lineoff_b(Dwarf_Line /*line*/,
2379    Dwarf_Unsigned * /*returned_lineoffset*/,
2380    Dwarf_Error*     /*error*/);
2381
2382int dwarf_linesrc(Dwarf_Line /*line*/,
2383    char   **        /*returned_name*/,
2384    Dwarf_Error*     /*error*/);
2385
2386int dwarf_lineblock(Dwarf_Line /*line*/,
2387    Dwarf_Bool  *    /*returned_bool*/,
2388    Dwarf_Error*     /*error*/);
2389
2390/* We gather these into one call as it's likely one
2391   will want all or none of them.  */
2392int dwarf_prologue_end_etc(Dwarf_Line /* line */,
2393    Dwarf_Bool  *    /*prologue_end*/,
2394    Dwarf_Bool  *    /*eplogue_begin*/,
2395    Dwarf_Unsigned * /* isa */,
2396    Dwarf_Unsigned * /* discriminator */,
2397    Dwarf_Error *    /*error*/);
2398/* End line table operations */
2399
2400/* Two-level line tables:
2401   When reading from an actuals table, dwarf_line_logical()
2402   returns the logical row number for the line. */
2403int dwarf_linelogical(Dwarf_Line /*line*/,
2404    Dwarf_Unsigned * /*returned_logical*/,
2405    Dwarf_Error*     /*error*/);
2406
2407/* Two-level line tables:
2408   When reading from a logicals table, dwarf_linecontext()
2409   returns the logical row number corresponding the the
2410   calling context for an inlined call. */
2411int dwarf_linecontext(Dwarf_Line /*line*/,
2412    Dwarf_Unsigned * /*returned_context*/,
2413    Dwarf_Error*     /*error*/);
2414
2415/* Two-level line tables:
2416   When reading from a logicals table, dwarf_linesubprogno()
2417   returns the index in the subprograms table of the inlined
2418   subprogram. */
2419int dwarf_line_subprogno(Dwarf_Line /*line*/,
2420    Dwarf_Unsigned * /*ret_subprogno*/,
2421    Dwarf_Error *    /*error*/);
2422
2423/* Two-level line tables:
2424   When reading from a logicals table, dwarf_linesubprog()
2425   returns the name of the inlined subprogram, its declaration
2426   filename, and its declaration line number, if available. */
2427int dwarf_line_subprog(Dwarf_Line /*line*/,
2428    char   **        /*returned_subprog_name*/,
2429    char   **        /*returned_filename*/,
2430    Dwarf_Unsigned * /*returned_lineno*/,
2431    Dwarf_Error *    /*error*/);
2432/* End of line table interfaces. */
2433
2434/* .debug_names names table interfaces. DWARF5 */
2435/*  New April 2017 */
2436int dwarf_debugnames_header(Dwarf_Debug /*dbg*/,
2437    Dwarf_Dnames_Head * /*dn_out*/,
2438
2439    /* *dn_count_out returns the number of name indexes
2440        in the .debug_names section */
2441    Dwarf_Unsigned    * /*dn_index_count_out*/,
2442    Dwarf_Error *       /*error*/);
2443
2444/*  Since there may be multiple name indexes in a .debug_names
2445    section we use index_number starting at 0 through
2446    dn_index_count_out-1. */
2447int dwarf_debugnames_sizes(Dwarf_Dnames_Head /*dn*/,
2448    Dwarf_Unsigned      /*index_number*/,
2449
2450    Dwarf_Unsigned * /*section_offset*/,
2451    Dwarf_Unsigned * /*version*/,
2452    Dwarf_Unsigned * /*offset_size*/, /* 4 or 8 */
2453
2454    /* The counts are entry counts, not byte sizes. */
2455    Dwarf_Unsigned * /*comp_unit_count*/,
2456    Dwarf_Unsigned * /*local_type_unit_count*/,
2457    Dwarf_Unsigned * /*foreign_type_unit_count*/,
2458    Dwarf_Unsigned * /*bucket_count*/,
2459    Dwarf_Unsigned * /*name_count*/,
2460
2461    /* The following are counted in bytes */
2462    Dwarf_Unsigned * /*indextable_overall_length*/,
2463    Dwarf_Unsigned * /*abbrev_table_size*/,
2464    Dwarf_Unsigned * /*entry_pool_size*/,
2465    Dwarf_Unsigned * /*augmentation_string_size*/,
2466
2467    Dwarf_Error *       /*error*/);
2468
2469int dwarf_debugnames_cu_entry(Dwarf_Dnames_Head /*dn*/,
2470    Dwarf_Unsigned      /*index_number*/,
2471    Dwarf_Unsigned      /*offset_number*/,
2472    Dwarf_Unsigned    * /*offset_count*/,
2473    Dwarf_Unsigned    * /*offset*/,
2474    Dwarf_Error *       /*error*/);
2475int dwarf_debugnames_local_tu_entry(Dwarf_Dnames_Head /*dn*/,
2476    Dwarf_Unsigned      /*index_number*/,
2477    Dwarf_Unsigned      /*offset_number*/,
2478    Dwarf_Unsigned    * /*offset_count*/,
2479    Dwarf_Unsigned    * /*offset*/,
2480    Dwarf_Error *       /*error*/);
2481int dwarf_debugnames_foreign_tu_entry(Dwarf_Dnames_Head /*dn*/,
2482    Dwarf_Unsigned      /*index_number*/,
2483    Dwarf_Unsigned      /*sig_number*/,
2484    Dwarf_Unsigned    * /*sig_mininum*/,
2485    Dwarf_Unsigned    * /*sig_count*/,
2486    Dwarf_Sig8        * /*signature*/,
2487    Dwarf_Error *       /*error*/);
2488int dwarf_debugnames_bucket(Dwarf_Dnames_Head /*dn*/,
2489    Dwarf_Unsigned      /*index_number*/,
2490    Dwarf_Unsigned      /*bucket_number*/,
2491    Dwarf_Unsigned    * /*bucket_count*/,
2492    Dwarf_Unsigned    * /*index_of_name_entry*/,
2493    Dwarf_Error *       /*error*/);
2494
2495int dwarf_debugnames_name(Dwarf_Dnames_Head /*dn*/,
2496    Dwarf_Unsigned      /*index_number*/,
2497    Dwarf_Unsigned      /*name_entry*/,
2498    Dwarf_Unsigned    * /*names_count*/,
2499    Dwarf_Sig8        * /*signature*/,
2500    Dwarf_Unsigned    * /*offset_to_debug_str*/,
2501    Dwarf_Unsigned    * /*offset_in_entrypool*/,
2502    Dwarf_Error *       /*error*/);
2503
2504int dwarf_debugnames_abbrev_by_index(Dwarf_Dnames_Head /*dn*/,
2505    Dwarf_Unsigned    /*index_number*/,
2506    Dwarf_Unsigned    /*abbrev_entry*/,
2507    Dwarf_Unsigned *  /*abbrev_code*/,
2508    Dwarf_Unsigned *  /*tag*/,
2509
2510    /*  The number of valid abbrev_entry values: 0 to number_of_abbrev-1
2511        */
2512    Dwarf_Unsigned *  /*number_of_abbrev*/,
2513
2514    /*  The number of attr/form pairs, not counting the trailing
2515        0,0 pair. */
2516    Dwarf_Unsigned * /*number_of_attr_form_entries*/,
2517    Dwarf_Error *    /*error*/);
2518
2519int dwarf_debugnames_abbrev_by_code(Dwarf_Dnames_Head /*dn*/,
2520    Dwarf_Unsigned    /*index_number*/,
2521    Dwarf_Unsigned    /*abbrev_code*/,
2522    Dwarf_Unsigned *  /*tag*/,
2523
2524    /*  The number of this code/tag as an array index. */
2525    Dwarf_Unsigned *  /*index_of_abbrev*/,
2526
2527    /*  The number of attr/form pairs, not counting the trailing
2528        0,0 pair. */
2529    Dwarf_Unsigned * /*number_of_attr_form_entries*/,
2530    Dwarf_Error *    /*error*/);
2531
2532int dwarf_debugnames_abbrev_form_by_index(Dwarf_Dnames_Head /*dn*/,
2533    Dwarf_Unsigned   /*index_number*/,
2534    Dwarf_Unsigned   /*abbrev_entry_index*/,
2535    Dwarf_Unsigned   /*abbrev_form_index*/,
2536    Dwarf_Unsigned * /*name_index_attr*/,
2537    Dwarf_Unsigned * /*form*/,
2538    Dwarf_Unsigned * /*number_of_attr_form_entries*/,
2539    Dwarf_Error    * /*error*/);
2540
2541
2542/*  This, combined with dwarf_debugnames_entrypool_values(),
2543    lets one examine as much or as little of an entrypool
2544    as one wants to by alternately calling these two
2545    functions. */
2546int dwarf_debugnames_entrypool(Dwarf_Dnames_Head /*dn*/,
2547    Dwarf_Unsigned      /*index_number*/,
2548    Dwarf_Unsigned      /*offset_in_entrypool*/,
2549    Dwarf_Unsigned *    /*abbrev_code*/,
2550    Dwarf_Unsigned *    /*tag*/,
2551    Dwarf_Unsigned *    /*value_count*/,
2552    Dwarf_Unsigned *    /*index_of_abbrev*/,
2553    Dwarf_Unsigned *    /*offset_of_initial_value*/,
2554    Dwarf_Error *       /*error*/);
2555
2556/*  Caller, knowing array size needed, passes in arrays
2557    it allocates of for idx, form, offset-size-values,
2558    and signature values.  Caller must examine idx-number
2559    and form to decide, for each array element, whether
2560    the offset or the signature contains the value.
2561    So this returns all the values for the abbrev code.
2562    And points via offset_of_next to the next abbrev code.
2563    */
2564int dwarf_debugnames_entrypool_values(Dwarf_Dnames_Head /*dn*/,
2565    Dwarf_Unsigned      /*index_number*/,
2566    Dwarf_Unsigned      /*index_of_abbrev*/,
2567    Dwarf_Unsigned      /*offset_in_entrypool_of_values*/,
2568    Dwarf_Unsigned *    /*array_dw_idx_number*/,
2569    Dwarf_Unsigned *    /*array_form*/,
2570    Dwarf_Unsigned *    /*array_of_offsets*/,
2571    Dwarf_Sig8     *    /*array_of_signatures*/,
2572
2573    /*  offset of the next entrypool entry. */
2574    Dwarf_Unsigned *    /*offset_of_next_entrypool*/,
2575    Dwarf_Error *       /*error*/);
2576
2577/*  FIXME: add interfaces for string search given hash and
2578    string */
2579
2580
2581
2582/* end of .debug_names interfaces. */
2583
2584/*  New October 2019.  Access to the GNU section named
2585    .gnu_debuglink  and/or the section .note.gnu.build-id.
2586    See
2587    https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
2588    The dbg argument provides data access and relies on
2589    fields de_path,de_debuglink_globals, de_debuglink_globals_length
2590    If no debuglink then name_returned,crc_returned and
2591    debuglink_path_returned will get set 0 through the pointers.
2592    If no .note.gnu.build-id then  buildid_length_returned,
2593    and buildid_returned will be set 0 through the pointers.
2594    See libdwarf2.1.mm for additional important details.
2595    see dwarf_add_file_path()
2596    and dwarf_add_debuglink_global_path().
2597*/
2598
2599int dwarf_gnu_debuglink(Dwarf_Debug /*dbg*/,
2600    char     **  /*name_returned*/,
2601    unsigned char ** /*crc_returned from the debuglink section*/,
2602    char     **    /*debuglink_path_returned*/,
2603    unsigned int * /*debuglink_path_count_returned*/,
2604    unsigned int * /*buildid_type_returned */,
2605    char     **    /*buildid_owner_name_returned*/,
2606    unsigned char ** /*buildid_returned*/,
2607    unsigned int * /*buildid_length_returned*/,
2608    char     ***   /*paths_returned*/,
2609    unsigned int * /*paths_length_returned*/,
2610    Dwarf_Error* /*error*/);
2611
2612/* See
2613   https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
2614   and dwarf_gnu_debuglink()
2615   pathname is a path-prefix to be added to a list of path-prefixes,
2616   The default "/usr/lib/debug" is built-in and is the first
2617   such in the list held in dbg.
2618   The path prefix should start with / .
2619   It can just end or end with / , either choice will work.
2620*/
2621int dwarf_add_debuglink_global_path(Dwarf_Debug /*dbg*/,
2622    const char *pathname,
2623    Dwarf_Error* /*error*/);
2624
2625
2626/*  global name space operations (.debug_pubnames access)
2627    The pubnames and similar sections are rarely used. Few compilers
2628    emit them. They are DWARF 2,3,4 only., not DWARF 5.  */
2629
2630/*  New March 2019. Special for dwarfdump.
2631    Sets a flag in the dbg. Always returns DW_DLV_OK
2632    and (as of March 2020) never touches error */
2633int dwarf_return_empty_pubnames(Dwarf_Debug /*dbg*/,
2634    int /* flag */,
2635    Dwarf_Error* /*error*/);
2636
2637int dwarf_get_globals(Dwarf_Debug /*dbg*/,
2638    Dwarf_Global**   /*globals*/,
2639    Dwarf_Signed *   /*number_of_globals*/,
2640    Dwarf_Error*     /*error*/);
2641void dwarf_globals_dealloc(Dwarf_Debug /*dbg*/,
2642    Dwarf_Global*    /*globals*/,
2643    Dwarf_Signed     /*number_of_globals*/);
2644
2645int dwarf_globname(Dwarf_Global /*glob*/,
2646    char   **        /*returned_name*/,
2647    Dwarf_Error*     /*error*/);
2648
2649int dwarf_global_die_offset(Dwarf_Global /*global*/,
2650    Dwarf_Off*       /*return_offset*/,
2651    Dwarf_Error *    /*error*/);
2652
2653/* This returns the CU die global offset if one knows the
2654   CU header global offset.
2655   See also dwarf_CU_dieoffset_given_die(). */
2656int dwarf_get_cu_die_offset_given_cu_header_offset(
2657    Dwarf_Debug      /*dbg*/,
2658    Dwarf_Off        /*in_cu_header_offset*/,
2659    Dwarf_Off *  /*out_cu_die_offset*/,
2660    Dwarf_Error *    /*err*/);
2661
2662/*  The _b form is new October 2011. */
2663int dwarf_get_cu_die_offset_given_cu_header_offset_b(
2664    Dwarf_Debug      /*dbg*/,
2665    Dwarf_Off        /*in_cu_header_offset*/,
2666    Dwarf_Bool       /*is_info. True means look in debug_Info,
2667        false use debug_types.*/,
2668    Dwarf_Off *  /*out_cu_die_offset*/,
2669    Dwarf_Error *    /*err*/);
2670
2671#ifdef __sgi /* pragma is sgi MIPS only */
2672#pragma optional dwarf_get_cu_die_offset_given_cu_header_offset
2673#endif
2674
2675int dwarf_global_cu_offset(Dwarf_Global /*global*/,
2676    Dwarf_Off*       /*return_offset*/,
2677    Dwarf_Error*     /*error*/);
2678
2679int dwarf_global_name_offsets(Dwarf_Global /*global*/,
2680    char   **        /*returned_name*/,
2681    Dwarf_Off*       /*die_offset*/,
2682    Dwarf_Off*       /*cu_offset*/,
2683    Dwarf_Error*     /*error*/);
2684
2685/*  New February 2019. For more complete dwarfdump printing.
2686    For each CU represented in .debug_pubnames, etc,
2687    there is a .debug_pubnames header.  For any given
2688    Dwarf_Global this returns the content of the applicable
2689    header. */
2690int dwarf_get_globals_header(Dwarf_Global /*global*/,
2691    Dwarf_Off      * /*offset_pub_header*/,
2692    Dwarf_Unsigned * /*length_size*/,
2693    Dwarf_Unsigned * /*length_pub*/,
2694    Dwarf_Unsigned * /*version*/,
2695    Dwarf_Unsigned * /*header_info_offset*/,
2696    Dwarf_Unsigned * /*info_length*/,
2697    Dwarf_Error*   /*error*/);
2698
2699/* Static function name operations.  */
2700int dwarf_get_funcs(Dwarf_Debug    /*dbg*/,
2701    Dwarf_Func**     /*funcs*/,
2702    Dwarf_Signed *   /*number_of_funcs*/,
2703    Dwarf_Error*     /*error*/);
2704void dwarf_funcs_dealloc(Dwarf_Debug /*dbg*/,
2705    Dwarf_Func*      /*funcs*/,
2706    Dwarf_Signed     /*number_of_funcs*/);
2707
2708int dwarf_funcname(Dwarf_Func /*func*/,
2709    char   **        /*returned_name*/,
2710    Dwarf_Error*     /*error*/);
2711
2712int dwarf_func_die_offset(Dwarf_Func /*func*/,
2713    Dwarf_Off*       /*return_offset*/,
2714    Dwarf_Error*     /*error*/);
2715
2716int dwarf_func_cu_offset(Dwarf_Func /*func*/,
2717    Dwarf_Off*       /*return_offset*/,
2718    Dwarf_Error*     /*error*/);
2719
2720int dwarf_func_name_offsets(Dwarf_Func /*func*/,
2721    char   **        /*returned_name*/,
2722    Dwarf_Off*       /*die_offset*/,
2723    Dwarf_Off*       /*cu_offset*/,
2724    Dwarf_Error*     /*error*/);
2725
2726/* User-defined type name operations, SGI IRIX .debug_typenames section.
2727   Same content as DWARF3 .debug_pubtypes, but defined years before
2728   .debug_pubtypes was defined.   SGI IRIX only. */
2729int dwarf_get_types(Dwarf_Debug    /*dbg*/,
2730    Dwarf_Type**     /*types*/,
2731    Dwarf_Signed *   /*number_of_types*/,
2732    Dwarf_Error*     /*error*/);
2733void dwarf_types_dealloc(Dwarf_Debug /*dbg*/,
2734    Dwarf_Type*      /*types*/,
2735    Dwarf_Signed     /*number_of_types*/);
2736
2737
2738int dwarf_typename(Dwarf_Type /*type*/,
2739    char   **        /*returned_name*/,
2740    Dwarf_Error*     /*error*/);
2741
2742int dwarf_type_die_offset(Dwarf_Type /*type*/,
2743    Dwarf_Off*       /*return_offset*/,
2744    Dwarf_Error*     /*error*/);
2745
2746int dwarf_type_cu_offset(Dwarf_Type /*type*/,
2747    Dwarf_Off*       /*return_offset*/,
2748    Dwarf_Error*     /*error*/);
2749
2750int dwarf_type_name_offsets(Dwarf_Type    /*type*/,
2751    char   **        /*returned_name*/,
2752    Dwarf_Off*       /*die_offset*/,
2753    Dwarf_Off*       /*cu_offset*/,
2754    Dwarf_Error*     /*error*/);
2755
2756/* User-defined type name operations, DWARF3  .debug_pubtypes section.
2757*/
2758int dwarf_get_pubtypes(Dwarf_Debug    /*dbg*/,
2759    Dwarf_Type**     /*types*/,
2760    Dwarf_Signed *   /*number_of_types*/,
2761    Dwarf_Error*     /*error*/);
2762void dwarf_pubtypes_dealloc(Dwarf_Debug /*dbg*/,
2763    Dwarf_Type*      /*pubtypes*/,
2764    Dwarf_Signed     /*number_of_pubtypes*/);
2765
2766
2767int dwarf_pubtypename(Dwarf_Type /*type*/,
2768    char   **        /*returned_name*/,
2769    Dwarf_Error*     /*error*/);
2770
2771int dwarf_pubtype_type_die_offset(Dwarf_Type /*type*/,
2772    Dwarf_Off*       /*return_offset*/,
2773    Dwarf_Error*     /*error*/);
2774
2775int dwarf_pubtype_cu_offset(Dwarf_Type /*type*/,
2776    Dwarf_Off*       /*return_offset*/,
2777    Dwarf_Error*     /*error*/);
2778
2779int dwarf_pubtype_name_offsets(Dwarf_Type    /*type*/,
2780    char   **        /*returned_name*/,
2781    Dwarf_Off*       /*die_offset*/,
2782    Dwarf_Off*       /*cu_offset*/,
2783    Dwarf_Error*     /*error*/);
2784
2785/* File-scope static variable name operations.  */
2786int dwarf_get_vars(Dwarf_Debug    /*dbg*/,
2787    Dwarf_Var**      /*vars*/,
2788    Dwarf_Signed *   /*number_of_vars*/,
2789    Dwarf_Error*     /*error*/);
2790void dwarf_vars_dealloc(Dwarf_Debug /*dbg*/,
2791    Dwarf_Var*       /*vars*/,
2792    Dwarf_Signed     /*number_of_vars*/);
2793
2794
2795int dwarf_varname(Dwarf_Var /*var*/,
2796    char   **        /*returned_name*/,
2797    Dwarf_Error*     /*error*/);
2798
2799int dwarf_var_die_offset(Dwarf_Var /*var*/,
2800    Dwarf_Off*       /*return_offset*/,
2801    Dwarf_Error*     /*error*/);
2802
2803int dwarf_var_cu_offset(Dwarf_Var /*var*/,
2804    Dwarf_Off*       /*return_offset*/,
2805    Dwarf_Error*     /*error*/);
2806
2807int dwarf_var_name_offsets(Dwarf_Var /*var*/,
2808    char   **        /*returned_name*/,
2809    Dwarf_Off*       /*die_offset*/,
2810    Dwarf_Off*       /*cu_offset*/,
2811    Dwarf_Error*     /*error*/);
2812
2813/* weak name operations.  */
2814int dwarf_get_weaks(Dwarf_Debug    /*dbg*/,
2815    Dwarf_Weak**     /*weaks*/,
2816    Dwarf_Signed *   /*number_of_weaks*/,
2817    Dwarf_Error*     /*error*/);
2818void dwarf_weaks_dealloc(Dwarf_Debug /*dbg*/,
2819    Dwarf_Weak*      /*weaks*/,
2820    Dwarf_Signed     /*number_of_weaks*/);
2821
2822
2823int dwarf_weakname(Dwarf_Weak /*weak*/,
2824    char   **        /*returned_name*/,
2825    Dwarf_Error*     /*error*/);
2826
2827int dwarf_weak_die_offset(Dwarf_Weak /*weak*/,
2828    Dwarf_Off*       /*return_offset*/,
2829    Dwarf_Error*     /*error*/);
2830
2831int dwarf_weak_cu_offset(Dwarf_Weak /*weak*/,
2832    Dwarf_Off*       /*return_offset*/,
2833    Dwarf_Error*     /*error*/);
2834
2835int dwarf_weak_name_offsets(Dwarf_Weak    /*weak*/,
2836    char   **        /*returned_name*/,
2837    Dwarf_Off*       /*die_offset*/,
2838    Dwarf_Off*       /*cu_offset*/,
2839    Dwarf_Error*     /*error*/);
2840
2841/* location list section operation.  (.debug_loc access) */
2842int dwarf_get_loclist_entry(Dwarf_Debug /*dbg*/,
2843    Dwarf_Unsigned   /*offset*/,
2844    Dwarf_Addr*      /*hipc*/,
2845    Dwarf_Addr*      /*lopc*/,
2846    Dwarf_Ptr*       /*data*/,
2847    Dwarf_Unsigned*  /*entry_len*/,
2848    Dwarf_Unsigned*  /*next_entry*/,
2849    Dwarf_Error*     /*error*/);
2850
2851/* abbreviation section operations */
2852int dwarf_get_abbrev(Dwarf_Debug /*dbg*/,
2853    Dwarf_Unsigned   /*offset*/,
2854    Dwarf_Abbrev  *  /*returned_abbrev*/,
2855    Dwarf_Unsigned*  /*length*/,
2856    Dwarf_Unsigned*  /*attr_count*/,
2857    Dwarf_Error*     /*error*/);
2858
2859int dwarf_get_abbrev_tag(Dwarf_Abbrev /*abbrev*/,
2860    Dwarf_Half*      /*return_tag_number*/,
2861    Dwarf_Error*     /*error*/);
2862int dwarf_get_abbrev_code(Dwarf_Abbrev /*abbrev*/,
2863    Dwarf_Unsigned*  /*return_code_number*/,
2864    Dwarf_Error*     /*error*/);
2865
2866/* See comments in dwarf_abbrev.c. Not an entirely safe function. */
2867int dwarf_get_abbrev_count(Dwarf_Debug /*dbg*/);
2868
2869int dwarf_get_abbrev_children_flag(Dwarf_Abbrev /*abbrev*/,
2870    Dwarf_Signed*    /*return_flag*/,
2871    Dwarf_Error*     /*error*/);
2872
2873/*  New August 2019.
2874    Most uses will call with filter_outliers non-zero.
2875    In that case impossible values return DW_DLV_ERROR.
2876    Those doing extra things (like dwarfdump) will
2877    call with filter_outliers zero to get the raw data
2878    (effectively); */
2879int dwarf_get_abbrev_entry_b(Dwarf_Abbrev abbrev,
2880    Dwarf_Unsigned indx,
2881    Dwarf_Bool     filter_outliers,
2882    Dwarf_Unsigned * returned_attr_num,
2883    Dwarf_Unsigned * returned_form,
2884    Dwarf_Signed   * returned_implict_const,
2885    Dwarf_Off      * offset,
2886    Dwarf_Error    * error);
2887
2888/*  Obsolete because it cannot return the
2889    DW_FORM_implicit_const value. */
2890int dwarf_get_abbrev_entry(Dwarf_Abbrev /*abbrev*/,
2891    Dwarf_Signed     /*index*/,
2892    Dwarf_Half  *    /*returned_attr_num*/,
2893    Dwarf_Signed*    /*form*/,
2894    Dwarf_Off*       /*offset*/,
2895    Dwarf_Error*     /*error*/);
2896
2897int dwarf_get_string_section_name(Dwarf_Debug /*dbg*/,
2898    const char ** /*section_name_out*/,
2899    Dwarf_Error * /*error*/);
2900
2901/* consumer string section operation */
2902int dwarf_get_str(Dwarf_Debug /*dbg*/,
2903    Dwarf_Off        /*offset*/,
2904    char**           /*string*/,
2905    Dwarf_Signed *   /*strlen_of_string*/,
2906    Dwarf_Error*     /*error*/);
2907
2908/* New November 2015 */
2909int dwarf_get_frame_section_name(Dwarf_Debug /*dbg*/,
2910   const char ** /*section_name_out*/,
2911   Dwarf_Error * /*error*/);
2912
2913/* New November 2015 */
2914int dwarf_get_frame_section_name_eh_gnu(Dwarf_Debug /*dbg*/,
2915   const char ** /*section_name_out*/,
2916   Dwarf_Error * /*error*/);
2917
2918/* Consumer op on  gnu .eh_frame info */
2919int dwarf_get_fde_list_eh(
2920    Dwarf_Debug      /*dbg*/,
2921    Dwarf_Cie**      /*cie_data*/,
2922    Dwarf_Signed*    /*cie_element_count*/,
2923    Dwarf_Fde**      /*fde_data*/,
2924    Dwarf_Signed*    /*fde_element_count*/,
2925    Dwarf_Error*     /*error*/);
2926
2927
2928/* consumer operations on frame info: .debug_frame */
2929int dwarf_get_fde_list(Dwarf_Debug /*dbg*/,
2930    Dwarf_Cie**      /*cie_data*/,
2931    Dwarf_Signed*    /*cie_element_count*/,
2932    Dwarf_Fde**      /*fde_data*/,
2933    Dwarf_Signed*    /*fde_element_count*/,
2934    Dwarf_Error*     /*error*/);
2935
2936/* Release storage gotten by dwarf_get_fde_list_eh() or
2937   dwarf_get_fde_list() */
2938void dwarf_fde_cie_list_dealloc(Dwarf_Debug /*dbg*/,
2939    Dwarf_Cie *  /*cie_data*/,
2940    Dwarf_Signed /*cie_element_count*/,
2941    Dwarf_Fde *  /*fde_data*/,
2942    Dwarf_Signed /*fde_element_count*/);
2943
2944
2945
2946int dwarf_get_fde_range(Dwarf_Fde /*fde*/,
2947    Dwarf_Addr*      /*low_pc*/,
2948    Dwarf_Unsigned*  /*func_length*/,
2949    Dwarf_Ptr*       /*fde_bytes*/,
2950    Dwarf_Unsigned*  /*fde_byte_length*/,
2951    Dwarf_Off*       /*cie_offset*/,
2952    Dwarf_Signed*    /*cie_index*/,
2953    Dwarf_Off*       /*fde_offset*/,
2954    Dwarf_Error*     /*error*/);
2955
2956/*  Useful for IRIX only:  see dwarf_get_cie_augmentation_data()
2957    dwarf_get_fde_augmentation_data() for GNU .eh_frame. */
2958int dwarf_get_fde_exception_info(Dwarf_Fde /*fde*/,
2959    Dwarf_Signed*    /* offset_into_exception_tables */,
2960    Dwarf_Error*     /*error*/);
2961
2962
2963int dwarf_get_cie_of_fde(Dwarf_Fde /*fde*/,
2964    Dwarf_Cie *      /*cie_returned*/,
2965    Dwarf_Error*     /*error*/);
2966
2967int dwarf_get_cie_info_b(Dwarf_Cie /*cie*/,
2968    Dwarf_Unsigned * /*bytes_in_cie*/,
2969    Dwarf_Small*     /*version*/,
2970    char        **   /*augmenter*/,
2971    Dwarf_Unsigned*  /*code_alignment_factor*/,
2972    Dwarf_Signed*    /*data_alignment_factor*/,
2973    Dwarf_Half*      /*return_address_register_rule*/,
2974    Dwarf_Ptr*       /*initial_instructions*/,
2975    Dwarf_Unsigned*  /*initial_instructions_length*/,
2976    Dwarf_Half*      /*offset_size*/,
2977    Dwarf_Error*     /*error*/);
2978int dwarf_get_cie_info(Dwarf_Cie /*cie*/,
2979    Dwarf_Unsigned * /*bytes_in_cie*/,
2980    Dwarf_Small*     /*version*/,
2981    char        **   /*augmenter*/,
2982    Dwarf_Unsigned*  /*code_alignment_factor*/,
2983    Dwarf_Signed*    /*data_alignment_factor*/,
2984    Dwarf_Half*      /*return_address_register_rule*/,
2985    Dwarf_Ptr*       /*initial_instructions*/,
2986    Dwarf_Unsigned*  /*initial_instructions_length*/,
2987    Dwarf_Error*     /*error*/);
2988
2989/* dwarf_get_cie_index new September 2009. */
2990int dwarf_get_cie_index(
2991    Dwarf_Cie /*cie*/,
2992    Dwarf_Signed* /*index*/,
2993    Dwarf_Error* /*error*/ );
2994
2995
2996int dwarf_get_fde_instr_bytes(Dwarf_Fde /*fde*/,
2997    Dwarf_Ptr *      /*outinstrs*/, Dwarf_Unsigned * /*outlen*/,
2998    Dwarf_Error *    /*error*/);
2999
3000int dwarf_get_fde_info_for_all_regs(Dwarf_Fde /*fde*/,
3001    Dwarf_Addr       /*pc_requested*/,
3002    Dwarf_Regtable*  /*reg_table*/,
3003    Dwarf_Addr*      /*row_pc*/,
3004    Dwarf_Error*     /*error*/);
3005
3006int dwarf_get_fde_info_for_all_regs3(Dwarf_Fde /*fde*/,
3007    Dwarf_Addr       /*pc_requested*/,
3008    Dwarf_Regtable3* /*reg_table*/,
3009    Dwarf_Addr*      /*row_pc*/,
3010    Dwarf_Error*     /*error*/);
3011
3012/* In this older interface DW_FRAME_CFA_COL is a meaningful
3013    column (which does not work well with DWARF3 or
3014    non-MIPS architectures). */
3015int dwarf_get_fde_info_for_reg(Dwarf_Fde /*fde*/,
3016    Dwarf_Half       /*table_column*/,
3017    Dwarf_Addr       /*pc_requested*/,
3018    Dwarf_Signed*    /*offset_relevant*/,
3019    Dwarf_Signed*    /*register*/,
3020    Dwarf_Signed*    /*offset*/,
3021    Dwarf_Addr*      /*row_pc*/,
3022    Dwarf_Error*     /*error*/);
3023
3024/* See discussion of dw_value_type, libdwarf.h.
3025   Use of DW_FRAME_CFA_COL is not meaningful in this interface.
3026   See dwarf_get_fde_info_for_cfa_reg3().
3027*/
3028/* dwarf_get_fde_info_for_reg3 is useful on a single column, but
3029   it is inefficient to iterate across all table_columns using this
3030   function.  Instead call dwarf_get_fde_info_for_all_regs3() and index
3031   into the table it fills in. */
3032int dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
3033    Dwarf_Half       /*table_column*/,
3034    Dwarf_Addr       /*pc_requested*/,
3035    Dwarf_Small  *   /*value_type*/,
3036    Dwarf_Signed *   /*offset_relevant*/,
3037    Dwarf_Signed *   /*register*/,
3038    Dwarf_Signed *   /*offset_or_block_len*/,
3039    Dwarf_Ptr    *   /*block_ptr */,
3040    Dwarf_Addr   *   /*row_pc_out*/,
3041    Dwarf_Error  *    /*error*/);
3042
3043int dwarf_get_fde_info_for_reg3_b(Dwarf_Fde /*fde*/,
3044    Dwarf_Half       /*table_column*/,
3045    Dwarf_Addr       /*pc_requested*/,
3046    Dwarf_Small  *   /*value_type*/,
3047    Dwarf_Signed *   /*offset_relevant*/,
3048    Dwarf_Signed *    /*register*/,
3049    Dwarf_Signed *    /*offset_or_block_len*/,
3050    Dwarf_Ptr    *    /*block_ptr */,
3051    Dwarf_Addr   *    /*row_pc_out*/,
3052    Dwarf_Bool   *    /* has_more_rows */,
3053    Dwarf_Addr   *    /* subsequent_pc */,
3054    Dwarf_Error  *    /*error*/);
3055
3056/*  Use this or the next function to get the cfa.
3057    New function, June 11, 2016*/
3058int dwarf_get_fde_info_for_cfa_reg3_b(Dwarf_Fde /*fde*/,
3059    Dwarf_Addr       /*pc_requested*/,
3060    Dwarf_Small  *   /*value_type*/,
3061    Dwarf_Signed *   /*offset_relevant*/,
3062    Dwarf_Signed*    /*register*/,
3063    Dwarf_Signed*    /*offset_or_block_len*/,
3064    Dwarf_Ptr   *    /*block_ptr */,
3065    Dwarf_Addr*      /*row_pc_out*/,
3066    Dwarf_Bool  *    /* has_more_rows */,
3067    Dwarf_Addr  *    /* subsequent_pc */,
3068    Dwarf_Error*     /*error*/);
3069/* Use this to get the cfa. Or the above function. */
3070int dwarf_get_fde_info_for_cfa_reg3(Dwarf_Fde /*fde*/,
3071    Dwarf_Addr       /*pc_requested*/,
3072    Dwarf_Small  *   /*value_type*/,
3073    Dwarf_Signed *   /*offset_relevant*/,
3074    Dwarf_Signed*    /*register*/,
3075    Dwarf_Signed*    /*offset_or_block_len*/,
3076    Dwarf_Ptr   *    /*block_ptr */,
3077    Dwarf_Addr*      /*row_pc_out*/,
3078    Dwarf_Error*     /*error*/);
3079
3080int dwarf_get_fde_for_die(Dwarf_Debug /*dbg*/,
3081    Dwarf_Die        /*subr_die */,
3082    Dwarf_Fde  *     /*returned_fde*/,
3083    Dwarf_Error*     /*error*/);
3084
3085int dwarf_get_fde_n(Dwarf_Fde* /*fde_data*/,
3086    Dwarf_Unsigned   /*fde_index*/,
3087    Dwarf_Fde  *     /*returned_fde*/,
3088    Dwarf_Error*     /*error*/);
3089
3090int dwarf_get_fde_at_pc(Dwarf_Fde* /*fde_data*/,
3091    Dwarf_Addr       /*pc_of_interest*/,
3092    Dwarf_Fde  *     /*returned_fde*/,
3093    Dwarf_Addr*      /*lopc*/,
3094    Dwarf_Addr*      /*hipc*/,
3095    Dwarf_Error*     /*error*/);
3096
3097/* GNU .eh_frame augmentation information, raw form, see
3098   Linux Standard Base Core Specification version 3.0 . */
3099int dwarf_get_cie_augmentation_data(Dwarf_Cie /* cie*/,
3100    Dwarf_Small **   /* augdata */,
3101    Dwarf_Unsigned * /* augdata_len */,
3102    Dwarf_Error*     /*error*/);
3103/* GNU .eh_frame augmentation information, raw form, see
3104   Linux Standard Base Core Specification version 3.0 . */
3105int dwarf_get_fde_augmentation_data(Dwarf_Fde /* fde*/,
3106    Dwarf_Small **   /* augdata */,
3107    Dwarf_Unsigned * /* augdata_len */,
3108    Dwarf_Error*     /*error*/);
3109
3110int dwarf_expand_frame_instructions(Dwarf_Cie /*cie*/,
3111    Dwarf_Ptr        /*instruction*/,
3112    Dwarf_Unsigned   /*i_length*/,
3113    Dwarf_Frame_Op** /*returned_op_list*/,
3114    Dwarf_Signed*    /*op_count*/,
3115    Dwarf_Error*     /*error*/);
3116
3117/* Operations on .debug_aranges. */
3118int dwarf_get_aranges(Dwarf_Debug /*dbg*/,
3119    Dwarf_Arange**   /*aranges*/,
3120    Dwarf_Signed *   /*arange_count*/,
3121    Dwarf_Error*     /*error*/);
3122
3123int dwarf_get_ranges_section_name(Dwarf_Debug /*dbg*/,
3124    const char ** /*section_name_out*/,
3125    Dwarf_Error * /*error*/);
3126
3127int dwarf_get_aranges_section_name(Dwarf_Debug /*dbg*/,
3128    const char ** /*section_name_out*/,
3129    Dwarf_Error * /*error*/);
3130
3131
3132
3133int dwarf_get_arange(
3134    Dwarf_Arange*    /*aranges*/,
3135    Dwarf_Unsigned   /*arange_count*/,
3136    Dwarf_Addr       /*address*/,
3137    Dwarf_Arange *   /*returned_arange*/,
3138    Dwarf_Error*     /*error*/);
3139
3140int dwarf_get_cu_die_offset(
3141    Dwarf_Arange     /*arange*/,
3142    Dwarf_Off*       /*return_offset*/,
3143    Dwarf_Error*     /*error*/);
3144
3145int dwarf_get_arange_cu_header_offset(
3146    Dwarf_Arange     /*arange*/,
3147    Dwarf_Off*       /*return_cu_header_offset*/,
3148    Dwarf_Error*     /*error*/);
3149#ifdef __sgi /* pragma is sgi MIPS only */
3150#pragma optional dwarf_get_arange_cu_header_offset
3151#endif
3152
3153/* DWARF2,3 interface. No longer really adequate (it was never
3154   right for segmented address spaces, please switch
3155   to using dwarf_get_arange_info_b instead.
3156   There is no effective difference between these
3157   functions  if the address space
3158   of the target is not segmented.  */
3159int dwarf_get_arange_info(
3160    Dwarf_Arange     /*arange*/,
3161    Dwarf_Addr*      /*start*/,
3162    Dwarf_Unsigned*  /*length*/,
3163    Dwarf_Off*       /*cu_die_offset*/,
3164    Dwarf_Error*     /*error*/ );
3165
3166/* New for DWARF4, entries may have segment information.
3167   *segment is only meaningful if *segment_entry_size is non-zero. */
3168int dwarf_get_arange_info_b(
3169    Dwarf_Arange     /*arange*/,
3170    Dwarf_Unsigned*  /*segment*/,
3171    Dwarf_Unsigned*  /*segment_entry_size*/,
3172    Dwarf_Addr    *  /*start*/,
3173    Dwarf_Unsigned*  /*length*/,
3174    Dwarf_Off     *  /*cu_die_offset*/,
3175    Dwarf_Error   *  /*error*/ );
3176
3177/*  BEGIN: DWARF5 .debug_macro  interfaces
3178    NEW November 2015.  */
3179int dwarf_get_macro_context(Dwarf_Die /*die*/,
3180    Dwarf_Unsigned      * /*version_out*/,
3181    Dwarf_Macro_Context * /*macro_context*/,
3182    Dwarf_Unsigned      * /*macro_unit_offset_out*/,
3183    Dwarf_Unsigned      * /*macro_ops_count_out*/,
3184    Dwarf_Unsigned      * /*macro_ops_data_length_out*/,
3185    Dwarf_Error         * /*error*/);
3186
3187/*  Just like dwarf_get_macro_context, but instead of using
3188    DW_AT_macros or DW_AT_GNU_macros to get the offset we just
3189    take the offset given. */
3190int dwarf_get_macro_context_by_offset(Dwarf_Die /*die*/,
3191    Dwarf_Unsigned        /*offset*/,
3192    Dwarf_Unsigned      * /*version_out*/,
3193    Dwarf_Macro_Context * /*macro_context*/,
3194    Dwarf_Unsigned      * /*macro_ops_count_out*/,
3195    Dwarf_Unsigned      * /*macro_ops_data_length*/,
3196    Dwarf_Error         * /*error*/);
3197
3198void dwarf_dealloc_macro_context(Dwarf_Macro_Context /*mc*/);
3199int dwarf_get_macro_section_name(Dwarf_Debug /*dbg*/,
3200    const char ** /*sec_name_out*/,
3201    Dwarf_Error * /*err*/);
3202
3203int dwarf_macro_context_head(Dwarf_Macro_Context /*head*/,
3204    Dwarf_Half     * /*version*/,
3205    Dwarf_Unsigned * /*mac_offset*/,
3206    Dwarf_Unsigned * /*mac_len*/,
3207    Dwarf_Unsigned * /*mac_header_len*/,
3208    unsigned int   * /*flags*/,
3209    Dwarf_Bool     * /*has_line_offset*/,
3210    Dwarf_Unsigned * /*line_offset*/,
3211    Dwarf_Bool     * /*has_offset_size_64*/,
3212    Dwarf_Bool     * /*has_operands_table*/,
3213    Dwarf_Half     * /*opcode_count*/,
3214    Dwarf_Error    * /*error*/);
3215
3216/*  Returns data from the operands table
3217    in the macro unit header. */
3218int dwarf_macro_operands_table(Dwarf_Macro_Context /*head*/,
3219    Dwarf_Half    /*index*/, /* 0 to opcode_count -1 */
3220    Dwarf_Half  * /*opcode_number*/,
3221    Dwarf_Half  * /*operand_count*/,
3222    const Dwarf_Small ** /*operand_array*/,
3223    Dwarf_Error * /*error*/);
3224
3225/*  Access to the macro operations, 0 to macro_ops_count_out-1
3226    Where the last of these will have macro_operator 0 (which appears
3227    in the ops data and means end-of-ops).
3228    op_start_section_offset is the section offset of
3229    the macro operator (which is a single unsigned byte,
3230    and is followed by the macro operand data). */
3231int dwarf_get_macro_op(Dwarf_Macro_Context /*macro_context*/,
3232    Dwarf_Unsigned   /*op_number*/,
3233    Dwarf_Unsigned * /*op_start_section_offset*/,
3234    Dwarf_Half     * /*macro_operator*/,
3235    Dwarf_Half     * /*forms_count*/,
3236    const Dwarf_Small **  /*formcode_array*/,
3237    Dwarf_Error    * /*error*/);
3238
3239int dwarf_get_macro_defundef(Dwarf_Macro_Context /*macro_context*/,
3240    Dwarf_Unsigned   /*op_number*/,
3241    Dwarf_Unsigned * /*line_number*/,
3242    Dwarf_Unsigned * /*index*/,
3243    Dwarf_Unsigned * /*offset*/,
3244    Dwarf_Half     * /*forms_count*/,
3245    const char    ** /*macro_string*/,
3246    Dwarf_Error    * /*error*/);
3247int dwarf_get_macro_startend_file(Dwarf_Macro_Context /*macro_context*/,
3248    Dwarf_Unsigned   /*op_number*/,
3249    Dwarf_Unsigned * /*line_number*/,
3250    Dwarf_Unsigned * /*name_index_to_line_tab*/,
3251    const char    ** /*src_file_name*/,
3252    Dwarf_Error    * /*error*/);
3253int dwarf_get_macro_import(Dwarf_Macro_Context /*macro_context*/,
3254    Dwarf_Unsigned   /*op_number*/,
3255    Dwarf_Unsigned * /*target_offset*/,
3256    Dwarf_Error    * /*error*/);
3257
3258/*  END: DWARF5 .debug_macro interfaces. */
3259
3260/* consumer .debug_macinfo information interface.
3261*/
3262struct Dwarf_Macro_Details_s {
3263    Dwarf_Off    dmd_offset; /* offset, in the section,
3264        of this macro info */
3265    Dwarf_Small  dmd_type;   /* the type, DW_MACINFO_define etc*/
3266    Dwarf_Signed dmd_lineno; /* the source line number where
3267        applicable and vend_def number if
3268        vendor_extension op */
3269
3270    Dwarf_Signed dmd_fileindex;/* the source file index:
3271        applies to define undef start_file */
3272    char *       dmd_macro;  /* macro name (with value for defineop)
3273        string from vendor ext */
3274};
3275
3276/*  dwarf_print_lines is for use by dwarfdump: it prints
3277    line info to stdout.
3278    The _dwarf name is obsolete. Use dwarf_ instead.
3279    Added extra argnument 2/2009 for better checking.
3280*/
3281int _dwarf_print_lines(Dwarf_Die /*cu_die*/,Dwarf_Error * /*error*/);
3282int dwarf_print_lines(Dwarf_Die /*cu_die*/,Dwarf_Error * /*error*/,
3283   int * /*error_count_out */);
3284
3285/*  As of August 2013, dwarf_print_lines() no longer uses printf.
3286    Instead it calls back to the application using a function pointer
3287    once per line-to-print.  The lines passed back already have any needed
3288    newlines.    The following struct is used to initialize
3289    the callback mechanism.
3290
3291    Failing to call the dwarf_register_printf_callback() function will
3292    prevent the lines from being passed back but such omission
3293    is not an error.
3294    See libdwarf2.1.mm for further documentation.
3295
3296    The return value is the previous set of callback values.
3297*/
3298
3299typedef void (* dwarf_printf_callback_function_type)
3300    (void * /*user_pointer*/, const char * /*linecontent*/);
3301
3302struct Dwarf_Printf_Callback_Info_s {
3303    void *                        dp_user_pointer;
3304    dwarf_printf_callback_function_type dp_fptr;
3305    char *                        dp_buffer;
3306    unsigned int                  dp_buffer_len;
3307    int                           dp_buffer_user_provided;
3308    void *                        dp_reserved;
3309};
3310
3311/*  If called with a NULL newvalues pointer, it simply returns
3312    the current set of values for this Dwarf_Debug. */
3313struct  Dwarf_Printf_Callback_Info_s
3314dwarf_register_printf_callback(Dwarf_Debug /*dbg*/,
3315    struct  Dwarf_Printf_Callback_Info_s * /*newvalues*/);
3316
3317
3318/*  dwarf_check_lineheader lets dwarfdump get detailed messages
3319    about some compiler errors we detect.
3320    We return the count of detected errors through the
3321    pointer.
3322
3323    Use dwarf_check_lineheader_b() (new 14 April 2020)
3324    in place of dwarf_check_lineheader().
3325*/
3326int dwarf_check_lineheader_b(Dwarf_Die /*cu_die*/,
3327    int */*errcount_out*/,
3328    Dwarf_Error * /*error*/);
3329void dwarf_check_lineheader(Dwarf_Die /*cu_die*/,
3330    int * /*errcount_out*/);
3331
3332/*  dwarf_ld_sort_lines helps SGI IRIX ld
3333    rearrange lines in .debug_line in a .o created with a text
3334    section per function.
3335        -OPT:procedure_reorder=ON
3336    where ld-cord (cord(1)ing by ld,
3337    not by cord(1)) may have changed the function order.
3338    The _dwarf name is obsolete. Use dwarf_ instead.
3339*/
3340int _dwarf_ld_sort_lines(
3341    void *         /*orig_buffer*/,
3342    unsigned long  /* buffer_len*/,
3343    int            /*is_64_bit*/,
3344    int *          /*any_change*/,
3345    int *          /*err_code*/);
3346int dwarf_ld_sort_lines(
3347    void *         /*orig_buffer*/,
3348    unsigned long  /*buffer_len*/,
3349    int            /*is_64_bit*/,
3350    int *          /*any_change*/,
3351    int *          /*err_code*/);
3352
3353/* Used by dwarfdump -v to print fde offsets from debugging
3354   info.
3355   The _dwarf name is obsolete. Use dwarf_ instead.
3356*/
3357int _dwarf_fde_section_offset(Dwarf_Debug /*dbg*/,
3358    Dwarf_Fde         /*in_fde*/,
3359    Dwarf_Off *       /*fde_off*/,
3360    Dwarf_Off *       /*cie_off*/,
3361    Dwarf_Error *     /*err*/);
3362
3363int dwarf_fde_section_offset(Dwarf_Debug /*dbg*/,
3364    Dwarf_Fde         /*in_fde*/,
3365    Dwarf_Off *       /*fde_off*/,
3366    Dwarf_Off *       /*cie_off*/,
3367    Dwarf_Error *     /*err*/);
3368
3369/* Used by dwarfdump -v to print cie offsets from debugging
3370   info.
3371   The _dwarf name is obsolete. Use dwarf_ instead.
3372*/
3373int dwarf_cie_section_offset(Dwarf_Debug /*dbg*/,
3374    Dwarf_Cie     /*in_cie*/,
3375    Dwarf_Off *   /*cie_off */,
3376    Dwarf_Error * /*err*/);
3377int _dwarf_cie_section_offset(Dwarf_Debug /*dbg*/,
3378    Dwarf_Cie     /*in_cie*/,
3379    Dwarf_Off *   /*cie_off*/,
3380    Dwarf_Error * /*err*/);
3381
3382typedef struct Dwarf_Macro_Details_s Dwarf_Macro_Details;
3383
3384char *dwarf_find_macro_value_start(char * /*macro_string*/);
3385
3386int dwarf_get_macro_details(Dwarf_Debug /*dbg*/,
3387    Dwarf_Off            /*macro_offset*/,
3388    Dwarf_Unsigned       /*maximum_count*/,
3389    Dwarf_Signed         * /*entry_count*/,
3390    Dwarf_Macro_Details ** /*details*/,
3391    Dwarf_Error *        /*err*/);
3392
3393
3394/*  dwarf_get_offset_size() New October 2015 */
3395int dwarf_get_offset_size(Dwarf_Debug /*dbg*/,
3396    Dwarf_Half  *    /*offset_size*/,
3397    Dwarf_Error *    /*error*/);
3398int dwarf_get_address_size(Dwarf_Debug /*dbg*/,
3399    Dwarf_Half  *    /*addr_size*/,
3400    Dwarf_Error *    /*error*/);
3401int dwarf_get_die_address_size(Dwarf_Die /*die*/,
3402    Dwarf_Half  *    /*addr_size*/,
3403    Dwarf_Error *    /*error*/);
3404
3405enum Dwarf_Form_Class dwarf_get_form_class(
3406    Dwarf_Half /* dwversion */,
3407    Dwarf_Half /* attrnum */,
3408    Dwarf_Half /*offset_size */,
3409    Dwarf_Half /*form*/);
3410
3411
3412/*   BEGIN gdbindex operations interfaces. */
3413/*  .gdb_index section operations.
3414    A GDB extension.
3415    The section is in some executables and if present
3416    is used to quickly map an address or name to
3417    a skeleton CU or TU.  If present then there are
3418    .dwo or .dwp files somewhere to make detailed
3419    debugging possible (up to user code to
3420    find it/them and deal with them).
3421
3422    Version 8 built by gdb, so type entries are ok as is.
3423    Version 7 built by the 'gold' linker and type index
3424    entries for a CU must be derived othewise, the
3425    type index is not correct... ? FIXME
3426    */
3427
3428/*  Creates a Dwarf_Gdbindex, returning it and
3429    its values through the pointers. */
3430int dwarf_gdbindex_header(Dwarf_Debug /*dbg*/,
3431    Dwarf_Gdbindex * /*gdbindexptr*/,
3432    Dwarf_Unsigned * /*version*/,
3433    Dwarf_Unsigned * /*cu_list_offset*/,
3434    Dwarf_Unsigned * /*types_cu_list_offset*/,
3435    Dwarf_Unsigned * /*address_area_offset*/,
3436    Dwarf_Unsigned * /*symbol_table_offset*/,
3437    Dwarf_Unsigned * /*constant_pool_offset*/,
3438    Dwarf_Unsigned * /*section_size*/,
3439    Dwarf_Unsigned * /*unused_reserved*/,
3440    const char    ** /*section_name*/,
3441    Dwarf_Error    * /*error*/);
3442
3443int dwarf_gdbindex_culist_array(Dwarf_Gdbindex /*gdbindexptr*/,
3444    Dwarf_Unsigned       * /*list_length*/,
3445    Dwarf_Error          * /*error*/);
3446
3447/*  entryindex: 0 to list_length-1 */
3448int dwarf_gdbindex_culist_entry(Dwarf_Gdbindex /*gdbindexptr*/,
3449    Dwarf_Unsigned   /*entryindex*/,
3450    Dwarf_Unsigned * /*cu_offset*/,
3451    Dwarf_Unsigned * /*cu_length*/,
3452    Dwarf_Error    * /*error*/);
3453
3454int dwarf_gdbindex_types_culist_array(Dwarf_Gdbindex /*gdbindexptr*/,
3455    Dwarf_Unsigned            * /*types_list_length*/,
3456    Dwarf_Error               * /*error*/);
3457
3458/*  entryindex: 0 to types_list_length -1 */
3459int dwarf_gdbindex_types_culist_entry(
3460    Dwarf_Gdbindex   /*gdbindexptr*/,
3461    Dwarf_Unsigned   /*entryindex*/,
3462    Dwarf_Unsigned * /*cu_offset*/,
3463    Dwarf_Unsigned * /*tu_offset*/,
3464    Dwarf_Unsigned * /*type_signature*/,
3465    Dwarf_Error    * /*error*/);
3466
3467int dwarf_gdbindex_addressarea(Dwarf_Gdbindex /*gdbindexptr*/,
3468    Dwarf_Unsigned            * /*addressarea_list_length*/,
3469    Dwarf_Error               * /*error*/);
3470
3471/*    entryindex: 0 to addressarea_list_length-1 */
3472int dwarf_gdbindex_addressarea_entry(
3473    Dwarf_Gdbindex   /*gdbindexptr*/,
3474    Dwarf_Unsigned   /*entryindex*/,
3475    Dwarf_Unsigned * /*low_adddress*/,
3476    Dwarf_Unsigned * /*high_address*/,
3477    Dwarf_Unsigned * /*cu_index*/,
3478    Dwarf_Error    * /*error*/);
3479
3480int dwarf_gdbindex_symboltable_array(Dwarf_Gdbindex /*gdbindexptr*/,
3481    Dwarf_Unsigned            * /*symtab_list_length*/,
3482    Dwarf_Error               * /*error*/);
3483
3484/*  entryindex: 0 to symtab_list_length-1 */
3485int dwarf_gdbindex_symboltable_entry(
3486    Dwarf_Gdbindex   /*gdbindexptr*/,
3487    Dwarf_Unsigned   /*entryindex*/,
3488    Dwarf_Unsigned * /*string_offset*/,
3489    Dwarf_Unsigned * /*cu_vector_offset*/,
3490    Dwarf_Error    * /*error*/);
3491
3492int dwarf_gdbindex_cuvector_length(Dwarf_Gdbindex /*gdbindex*/,
3493    Dwarf_Unsigned   /*cuvector_offset*/,
3494    Dwarf_Unsigned * /*innercount*/,
3495    Dwarf_Error    * /*error*/);
3496
3497
3498int dwarf_gdbindex_cuvector_inner_attributes(Dwarf_Gdbindex /*gdbindex*/,
3499    Dwarf_Unsigned   /*cuvector_offset*/,
3500    Dwarf_Unsigned   /*innerindex*/,
3501    /* The attr_value is a field of bits. For expanded version
3502        use  dwarf_gdbindex_cuvector_expand_value() */
3503    Dwarf_Unsigned * /*attr_value*/,
3504    Dwarf_Error    * /*error*/);
3505
3506int dwarf_gdbindex_cuvector_instance_expand_value(
3507    Dwarf_Gdbindex /*gdbindex*/,
3508    Dwarf_Unsigned   /*value*/,
3509    Dwarf_Unsigned * /*cu_index*/,
3510    Dwarf_Unsigned * /*reserved1*/,
3511    Dwarf_Unsigned * /*symbol_kind*/,
3512    Dwarf_Unsigned * /*is_static*/,
3513    Dwarf_Error    * /*error*/);
3514
3515
3516/*  The strings in the pool follow (in memory) the cu index
3517    set and are NUL terminated. */
3518
3519int dwarf_gdbindex_string_by_offset(Dwarf_Gdbindex /*gdbindexptr*/,
3520    Dwarf_Unsigned   /*stringoffset*/,
3521    const char    ** /*string_ptr*/,
3522    Dwarf_Error   *  /*error*/);
3523
3524void dwarf_gdbindex_free(Dwarf_Gdbindex /*gdbindexptr*/);
3525
3526/*  END gdbindex/debugfission operations. */
3527
3528/*  START debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3529
3530int dwarf_get_xu_index_header(Dwarf_Debug /*dbg*/,
3531    const char *  section_type, /* "tu" or "cu" */
3532    Dwarf_Xu_Index_Header *     /*xuhdr*/,
3533    Dwarf_Unsigned *            /*version_number*/,
3534    Dwarf_Unsigned *            /*offsets_count L*/,
3535    Dwarf_Unsigned *            /*units_count N*/,
3536    Dwarf_Unsigned *            /*hash_slots_count M*/,
3537    const char     **           /*sect_name*/,
3538    Dwarf_Error *               /*err*/);
3539
3540int dwarf_get_xu_index_section_type(Dwarf_Xu_Index_Header /*xuhdr*/,
3541    /*  the function returns a pointer to
3542        the immutable string "tu" or "cu" via this arg. Do not free.  */
3543    const char ** /*typename*/,
3544    /*  the function returns a pointer to
3545        the immutable section name. Do not free.
3546        .debug_cu_index or .debug_tu_index */
3547    const char ** /*sectionname*/,
3548    Dwarf_Error * /*err*/);
3549
3550/*  Index values 0 to M-1 are valid. */
3551int dwarf_get_xu_hash_entry(Dwarf_Xu_Index_Header /*xuhdr*/,
3552    Dwarf_Unsigned     /*index*/,
3553
3554    /*  Returns the hash value. 64  bits.  */
3555    Dwarf_Sig8 *      /*hash_value*/,
3556
3557    /* returns the index into rows of offset/size tables. */
3558    Dwarf_Unsigned *  /*index_to_sections*/,
3559    Dwarf_Error *     /*err*/);
3560
3561/*  Columns 0 to L-1,  valid. */
3562int dwarf_get_xu_section_names(Dwarf_Xu_Index_Header /*xuhdr*/,
3563    /* Row index defined to be row zero. */
3564    Dwarf_Unsigned  /*column_index*/,
3565    Dwarf_Unsigned* /*DW_SECT_ number*/,
3566    const char **   /*DW_SECT_ name*/,
3567    Dwarf_Error *   /*err*/);
3568
3569    /* Rows 1 to N col 0 to L-1  are valid */
3570int dwarf_get_xu_section_offset(Dwarf_Xu_Index_Header /*xuhdr*/,
3571    Dwarf_Unsigned  /*row_index*/,
3572    Dwarf_Unsigned  /*column_index*/,
3573    Dwarf_Unsigned* /*sec_offset*/,
3574    Dwarf_Unsigned* /*sec_size*/,
3575    Dwarf_Error *   /*err*/);
3576
3577void dwarf_xu_header_free(Dwarf_Xu_Index_Header /*xuhdr*/);
3578
3579/*  Defined larger than necessary. This struct, being visible,
3580    will be difficult to change: binary compatibility. */
3581#define DW_FISSION_SECT_COUNT 12
3582
3583/*  User must allocate this struct, zero it,
3584    and pass a pointer to it
3585    into dwarf_get_debugfission_for_cu .  */
3586struct Dwarf_Debug_Fission_Per_CU_s  {
3587    /*  Do not free the string. It contains "cu" or "tu". */
3588    /*  If this is not set (ie, not a CU/TU in  DWP Package File)
3589        then pcu_type will be NULL.  */
3590    const char   * pcu_type;
3591    /*  pcu_index is the index (range 1 to N )
3592        into the tu/cu table of offsets and the table
3593        of sizes.  1 to N as the zero index is reserved
3594        for special purposes.  Not a value one
3595        actually needs. */
3596    Dwarf_Unsigned pcu_index;
3597    Dwarf_Sig8     pcu_hash;  /* 8 byte  */
3598    /*  [0] has offset and size 0.
3599        [1]-[8] are DW_SECT_* indexes and the
3600        values are  the offset and size
3601        of the respective section contribution
3602        of a single .dwo object. When pcu_size[n] is
3603        zero the corresponding section is not present. */
3604    Dwarf_Unsigned pcu_offset[DW_FISSION_SECT_COUNT];
3605    Dwarf_Unsigned pcu_size[DW_FISSION_SECT_COUNT];
3606    Dwarf_Unsigned unused1;
3607    Dwarf_Unsigned unused2;
3608};
3609typedef struct Dwarf_Debug_Fission_Per_CU_s  Dwarf_Debug_Fission_Per_CU ;
3610/*  For any Dwarf_Die in a compilation unit, return
3611    the debug fission table data through
3612    percu_out.   Usually applications
3613    will pass in the CU die.
3614    Calling code should zero all of the
3615    struct Dwarf_Debug_Fission_Per_CU_s before calling this.
3616    If there is no debugfission data this returns
3617    DW_DLV_NO_ENTRY (only .dwp objects have debugfission data).  */
3618int dwarf_get_debugfission_for_die(Dwarf_Die /* die */,
3619    Dwarf_Debug_Fission_Per_CU * /* percu_out */,
3620    Dwarf_Error * /* err */);
3621
3622/* Given a key (hash signature)  from a .o, find the per-cu information
3623    for the CU with that key. */
3624int dwarf_get_debugfission_for_key(Dwarf_Debug /*dbg*/,
3625    Dwarf_Sig8 *                 /*key, hash signature */,
3626    const char * key_type        /*"cu" or "tu" */,
3627    Dwarf_Debug_Fission_Per_CU * /*percu_out */,
3628    Dwarf_Error *                /*err */);
3629
3630/*  END debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3631
3632
3633/*  Utility operations */
3634Dwarf_Unsigned dwarf_errno(Dwarf_Error     /*error*/);
3635char* dwarf_errmsg(Dwarf_Error    /*error*/);
3636char* dwarf_errmsg_by_number(Dwarf_Unsigned /* errornum */);
3637void  dwarf_error_creation(Dwarf_Debug /*dbg*/ ,
3638    Dwarf_Error * /*error*/, char * /*errmsg*/);
3639
3640
3641/*  stringcheck zero is default and means do all
3642    string length validity checks.
3643    Call with parameter value 1 to turn off many such checks (and
3644    increase performance).
3645    Call with zero for safest running.
3646    Actual value saved and returned is only 8 bits! Upper bits
3647    ignored by libdwarf (and zero on return).
3648    Returns previous value.  */
3649int dwarf_set_stringcheck(int /*stringcheck*/);
3650
3651/*  'apply' defaults to 1 and means do all
3652    'rela' relocations on reading in a dwarf object section with
3653    such relocations.
3654    Call with parameter value 0 to turn off application of
3655    such relocations.
3656    Since the static linker leaves 'bogus' data in object sections
3657    with a 'rela' relocation section such data cannot be read
3658    sensibly without processing the relocations.  Such relocations
3659    do not exist in executables and shared objects (.so), the
3660    relocations only exist in plain .o relocatable object files.
3661    Actual value saved and returned is only 8 bits! Upper bits
3662    ignored by libdwarf (and zero on return).
3663    Returns previous value.  */
3664int dwarf_set_reloc_application(int /*apply*/);
3665
3666/* Never Implemented */
3667Dwarf_Handler dwarf_seterrhand(Dwarf_Debug /*dbg*/,
3668    Dwarf_Handler /*errhand*/);
3669
3670/* Unimplemented */
3671Dwarf_Ptr dwarf_seterrarg(Dwarf_Debug /*dbg*/, Dwarf_Ptr /*errarg*/);
3672
3673void dwarf_dealloc(Dwarf_Debug /*dbg*/, void* /*space*/,
3674    Dwarf_Unsigned /*type*/);
3675/*  These convenience functions allow type checking at the call,
3676    whereas dwarf_dealloc itself uses void * so ...
3677    easy to misuse. */
3678void dwarf_dealloc_error(Dwarf_Debug /*dbg*/, Dwarf_Error /*err*/);
3679void dwarf_dealloc_die( Dwarf_Die /*die*/);
3680void dwarf_dealloc_attribute(Dwarf_Attribute /*attr*/);
3681
3682
3683/* DWARF Producer Interface */
3684
3685/*  New form June, 2011. Adds user_data argument. */
3686typedef int (*Dwarf_Callback_Func)(
3687    const char*     /*name*/,
3688    int             /*size*/,
3689    Dwarf_Unsigned  /*type*/,
3690    Dwarf_Unsigned  /*flags*/,
3691    Dwarf_Unsigned  /*link*/,
3692    Dwarf_Unsigned  /*info*/,
3693    Dwarf_Unsigned* /*sect_name_index*/,
3694    void *          /*user_data*/,
3695    int*            /*error*/);
3696
3697/*  Returns DW_DLV_OK or DW_DLV_ERROR and
3698    if DW_DLV_OK returns the Dwarf_P_Debug
3699    pointer through the dbg_returned argument. */
3700int dwarf_producer_init(
3701    Dwarf_Unsigned        /*flags*/,
3702    Dwarf_Callback_Func   /*func*/,
3703    Dwarf_Handler         /*errhand*/,
3704    Dwarf_Ptr             /*errarg*/,
3705    void *                /*user_data*/,
3706    const char *isa_name, /* See isa/abi names in pro_init.c */
3707    const char *dwarf_version, /* V2 V3 V4 or V5. */
3708    const char *extra,    /* Extra input strings, comma separated. */
3709    Dwarf_P_Debug *,      /* dbg_returned */
3710    Dwarf_Error *         /*error*/);
3711
3712/*  Returns DW_DLV_OK or DW_DLV_ERROR.
3713    The desired form must be DW_FORM_string (the default)
3714    or DW_FORM_strp.  */
3715int dwarf_pro_set_default_string_form(Dwarf_P_Debug /*dbg*/,
3716    int /*desired_form*/,
3717    Dwarf_Error*     /*error*/);
3718
3719/*  the old interface. Still supported. */
3720Dwarf_Signed dwarf_transform_to_disk_form(Dwarf_P_Debug /*dbg*/,
3721    Dwarf_Error*     /*error*/);
3722/*  New September 2016. The preferred interface. */
3723int dwarf_transform_to_disk_form_a(Dwarf_P_Debug /*dbg*/,
3724    Dwarf_Signed *   /*nbufs_out*/,
3725    Dwarf_Error*     /*error*/);
3726
3727/* New September 2016. Preferred. */
3728int dwarf_get_section_bytes_a(Dwarf_P_Debug /*dbg*/,
3729    Dwarf_Signed     /*dwarf_section*/,
3730    Dwarf_Signed*    /*elf_section_index*/,
3731    Dwarf_Unsigned*  /*length*/,
3732    Dwarf_Ptr     *  /*section_bytes*/,
3733    Dwarf_Error*     /*error*/);
3734
3735/* Original function.  Checking for error is difficult. */
3736Dwarf_Ptr dwarf_get_section_bytes(Dwarf_P_Debug /*dbg*/,
3737    Dwarf_Signed     /*dwarf_section*/,
3738    Dwarf_Signed*    /*elf_section_index*/,
3739    Dwarf_Unsigned*  /*length*/,
3740    Dwarf_Error*     /*error*/);
3741
3742int  dwarf_get_relocation_info_count(
3743    Dwarf_P_Debug    /*dbg*/,
3744    Dwarf_Unsigned * /*count_of_relocation_sections*/,
3745    int *                /*drd_buffer_version*/,
3746    Dwarf_Error*     /*error*/);
3747
3748int dwarf_get_relocation_info(
3749    Dwarf_P_Debug           /*dbg*/,
3750    Dwarf_Signed          * /*elf_section_index*/,
3751    Dwarf_Signed          * /*elf_section_index_link*/,
3752    Dwarf_Unsigned        * /*relocation_buffer_count*/,
3753    Dwarf_Relocation_Data * /*reldata_buffer*/,
3754    Dwarf_Error*            /*error*/);
3755
3756/* v1:  no drd_length field, enum explicit */
3757/* v2:  has the drd_length field, enum value in uchar member */
3758#define DWARF_DRD_BUFFER_VERSION 2
3759
3760/* Markers are not written  to DWARF2/3/4, they are user
3761   defined and may be used for any purpose.
3762*/
3763Dwarf_Signed dwarf_get_die_markers(
3764    Dwarf_P_Debug     /*dbg*/,
3765    Dwarf_P_Marker *  /*marker_list*/,
3766    Dwarf_Unsigned *  /*marker_count*/,
3767    Dwarf_Error *     /*error*/);
3768
3769/* Preferred version December 2018. */
3770int dwarf_get_die_markers_a(
3771    Dwarf_P_Debug     /*dbg*/,
3772    Dwarf_P_Marker *  /*marker_list*/,
3773    Dwarf_Unsigned *  /*marker_count*/,
3774    Dwarf_Error *     /*error*/);
3775
3776int dwarf_get_string_attributes_count(Dwarf_P_Debug,
3777    Dwarf_Unsigned *,
3778    int *,
3779    Dwarf_Error *);
3780
3781int dwarf_get_string_attributes_info(Dwarf_P_Debug,
3782    Dwarf_Signed *,
3783    Dwarf_Unsigned *,
3784    Dwarf_P_String_Attr *,
3785    Dwarf_Error *);
3786
3787void dwarf_reset_section_bytes(Dwarf_P_Debug /*dbg*/);
3788
3789Dwarf_Unsigned dwarf_producer_finish(Dwarf_P_Debug /*dbg*/,
3790    Dwarf_Error* /*error*/);
3791
3792/*  Returns DW_DLV_OK or DW_DLV_ERROR */
3793int dwarf_producer_finish_a(Dwarf_P_Debug /*dbg*/,
3794    Dwarf_Error* /*error*/);
3795
3796/* Producer attribute addition functions. */
3797Dwarf_P_Attribute dwarf_add_AT_targ_address(Dwarf_P_Debug /*dbg*/,
3798    Dwarf_P_Die     /*ownerdie*/,
3799    Dwarf_Half      /*attr*/,
3800    Dwarf_Unsigned  /*pc_value*/,
3801    Dwarf_Signed    /*sym_index*/,
3802    Dwarf_Error*    /*error*/);
3803Dwarf_P_Attribute dwarf_add_AT_targ_address_b(Dwarf_P_Debug /*dbg*/,
3804    Dwarf_P_Die     /*ownerdie*/,
3805    Dwarf_Half      /*attr*/,
3806    Dwarf_Unsigned  /*pc_value*/,
3807    Dwarf_Unsigned    /*sym_index*/,
3808    Dwarf_Error*    /*error*/);
3809
3810/*  New December 2018. Preferred version. */
3811int dwarf_add_AT_targ_address_c(Dwarf_P_Debug /*dbg*/,
3812    Dwarf_P_Die         /*ownerdie*/,
3813    Dwarf_Half          /*attr*/,
3814    Dwarf_Unsigned      /*pc_value*/,
3815    Dwarf_Unsigned      /*sym_index*/,
3816    Dwarf_P_Attribute * /*attr_out*/,
3817    Dwarf_Error*        /*error*/);
3818
3819/*  New December 2018. Preferred version. */
3820int dwarf_add_AT_block_a(Dwarf_P_Debug /*dbg*/,
3821    Dwarf_P_Die     /*ownerdie*/,
3822    Dwarf_Half      /*attr*/,
3823    Dwarf_Small*    /*block_data*/,
3824    Dwarf_Unsigned  /*block_len*/,
3825    Dwarf_P_Attribute * /*attr_out*/,
3826    Dwarf_Error*    /*error*/);
3827
3828Dwarf_P_Attribute dwarf_add_AT_block(Dwarf_P_Debug /*dbg*/,
3829    Dwarf_P_Die     /*ownerdie*/,
3830    Dwarf_Half      /*attr*/,
3831    Dwarf_Small*    /*block_data*/,
3832    Dwarf_Unsigned  /*block_len*/,
3833    Dwarf_Error*    /*error*/);
3834
3835Dwarf_P_Attribute dwarf_add_AT_ref_address(Dwarf_P_Debug /*dbg*/,
3836    Dwarf_P_Die     /*ownerdie*/,
3837    Dwarf_Half      /*attr*/,
3838    Dwarf_Unsigned  /*pc_value*/,
3839    Dwarf_Unsigned  /*sym_index*/,
3840    Dwarf_Error*    /*error*/);
3841
3842/*  New December 2018. Preferred version. */
3843int dwarf_add_AT_ref_address_a(Dwarf_P_Debug /*dbg*/,
3844    Dwarf_P_Die     /*ownerdie*/,
3845    Dwarf_Half      /*attr*/,
3846    Dwarf_Unsigned  /*pc_value*/,
3847    Dwarf_Unsigned  /*sym_index*/,
3848    Dwarf_P_Attribute * /*attr_out*/,
3849    Dwarf_Error*    /*error*/);
3850
3851Dwarf_P_Attribute dwarf_add_AT_unsigned_const(Dwarf_P_Debug /*dbg*/,
3852    Dwarf_P_Die     /*ownerdie*/,
3853    Dwarf_Half      /*attr*/,
3854    Dwarf_Unsigned  /*value*/,
3855    Dwarf_Error*    /*error*/);
3856
3857/*  New December 2018. Preferred version. */
3858int dwarf_add_AT_unsigned_const_a(Dwarf_P_Debug /*dbg*/,
3859    Dwarf_P_Die     /*ownerdie*/,
3860    Dwarf_Half      /*attr*/,
3861    Dwarf_Unsigned  /*value*/,
3862    Dwarf_P_Attribute * /*attr_out*/,
3863    Dwarf_Error*    /*error*/);
3864
3865Dwarf_P_Attribute dwarf_add_AT_signed_const(Dwarf_P_Debug /*dbg*/,
3866    Dwarf_P_Die     /*ownerdie*/,
3867    Dwarf_Half      /*attr*/,
3868    Dwarf_Signed    /*value*/,
3869    Dwarf_Error*    /*error*/);
3870
3871/*  New December 2018. Preferred version. */
3872int dwarf_add_AT_signed_const_a(Dwarf_P_Debug /*dbg*/,
3873    Dwarf_P_Die     /*ownerdie*/,
3874    Dwarf_Half      /*attr*/,
3875    Dwarf_Signed    /*value*/,
3876    Dwarf_P_Attribute * /*attr_out*/,
3877    Dwarf_Error*    /*error*/);
3878
3879Dwarf_P_Attribute dwarf_add_AT_reference(Dwarf_P_Debug /*dbg*/,
3880    Dwarf_P_Die     /*ownerdie*/,
3881    Dwarf_Half      /*attr*/,
3882    Dwarf_P_Die     /*otherdie*/,
3883    Dwarf_Error*    /*error*/);
3884
3885/*  dwarf_add_AT_reference_b allows otherdie to be NULL with
3886    the assumption the caller will then later call
3887    dwarf_fixup_AT_reference_die() with a non-null target die.
3888    New 22 October, 2013
3889*/
3890Dwarf_P_Attribute dwarf_add_AT_reference_b(Dwarf_P_Debug /*dbg*/,
3891    Dwarf_P_Die     /*ownerdie*/,
3892    Dwarf_Half      /*attr*/,
3893    Dwarf_P_Die     /*otherdie*/,
3894    Dwarf_Error*    /*error*/);
3895
3896/*  New December 2018. Preferred version. */
3897int dwarf_add_AT_reference_c(Dwarf_P_Debug /*dbg*/,
3898    Dwarf_P_Die     /*ownerdie*/,
3899    Dwarf_Half      /*attr*/,
3900    Dwarf_P_Die     /*otherdie*/,
3901    Dwarf_P_Attribute * /*attr_out*/,
3902    Dwarf_Error*    /*error*/);
3903
3904/* The following is for out-of-order cu-local
3905   references.  Allowing nominating the target Dwarf_P_Die
3906   after calling dwarf_add_AT_reference with a NULL otherdie
3907   after a single pass thru the DIE generation. Needed
3908   for forward-references.
3909   New 22 October, 2013.
3910*/
3911int dwarf_fixup_AT_reference_die(Dwarf_P_Debug /*dbg*/,
3912    Dwarf_Half    /* attrnum */,
3913    Dwarf_P_Die   /* sourcedie*/,
3914    Dwarf_P_Die   /* targetdie*/,
3915    Dwarf_Error * /*error*/);
3916
3917Dwarf_P_Attribute dwarf_add_AT_dataref(
3918    Dwarf_P_Debug   /*dbg*/,
3919    Dwarf_P_Die     /*ownerdie*/,
3920    Dwarf_Half      /*attr*/,
3921    Dwarf_Unsigned  /*pcvalue*/,
3922    Dwarf_Unsigned  /*sym_index*/,
3923    Dwarf_Error*    /*error*/);
3924
3925/*  New December 2018. Preferred version. */
3926int dwarf_add_AT_dataref_a(
3927    Dwarf_P_Debug   /*dbg*/,
3928    Dwarf_P_Die     /*ownerdie*/,
3929    Dwarf_Half      /*attr*/,
3930    Dwarf_Unsigned  /*pcvalue*/,
3931    Dwarf_Unsigned  /*sym_index*/,
3932    Dwarf_P_Attribute * /*attr_out*/,
3933    Dwarf_Error*    /*error*/);
3934
3935Dwarf_P_Attribute dwarf_add_AT_const_value_string(
3936    Dwarf_P_Die /*ownerdie*/,
3937    char*           /*string_value*/,
3938    Dwarf_Error*    /*error*/);
3939
3940/*  New December 2018. Preferred version. */
3941int dwarf_add_AT_const_value_string_a(
3942    Dwarf_P_Die /*ownerdie*/,
3943    char*           /*string_value*/,
3944    Dwarf_P_Attribute * /*attr_out*/,
3945    Dwarf_Error*    /*error*/);
3946
3947Dwarf_P_Attribute dwarf_add_AT_location_expr(Dwarf_P_Debug /*dbg*/,
3948    Dwarf_P_Die     /*ownerdie*/,
3949    Dwarf_Half      /*attr*/,
3950    Dwarf_P_Expr    /*loc_expr*/,
3951    Dwarf_Error*    /*error*/);
3952
3953/*  New December 2018. Preferred version. */
3954int dwarf_add_AT_location_expr_a(Dwarf_P_Debug /*dbg*/,
3955    Dwarf_P_Die     /*ownerdie*/,
3956    Dwarf_Half      /*attr*/,
3957    Dwarf_P_Expr    /*loc_expr*/,
3958    Dwarf_P_Attribute * /*attr_out*/,
3959    Dwarf_Error*    /*error*/);
3960
3961Dwarf_P_Attribute dwarf_add_AT_string(Dwarf_P_Debug /*dbg*/,
3962    Dwarf_P_Die     /*ownerdie*/,
3963    Dwarf_Half      /*attr*/,
3964    char*           /*string*/,
3965    Dwarf_Error*     /*error*/);
3966
3967/*  Preferred as of December 2018. */
3968int dwarf_add_AT_string_a(Dwarf_P_Debug /*dbg*/,
3969    Dwarf_P_Die     /*ownerdie*/,
3970    Dwarf_Half      /*attr*/,
3971    char*           /*string*/,
3972    Dwarf_P_Attribute * /*attr_out*/,
3973    Dwarf_Error*     /*error*/);
3974
3975Dwarf_P_Attribute dwarf_add_AT_flag(Dwarf_P_Debug /*dbg*/,
3976    Dwarf_P_Die     /*ownerdie*/,
3977    Dwarf_Half      /*attr*/,
3978    Dwarf_Small     /*flag*/,
3979    Dwarf_Error*    /*error*/);
3980
3981/*  New December 2018. Preferred version. */
3982int dwarf_add_AT_flag_a(Dwarf_P_Debug /*dbg*/,
3983    Dwarf_P_Die     /*ownerdie*/,
3984    Dwarf_Half      /*attr*/,
3985    Dwarf_Small     /*flag*/,
3986    Dwarf_P_Attribute * /*attr_out*/,
3987    Dwarf_Error*    /*error*/);
3988
3989Dwarf_P_Attribute dwarf_add_AT_producer(Dwarf_P_Die /*ownerdie*/,
3990    char*           /*producer_string*/,
3991    Dwarf_Error*    /*error*/);
3992
3993/*  New December 2018. Preferred version. */
3994int dwarf_add_AT_producer_a(Dwarf_P_Die /*ownerdie*/,
3995    char*           /*producer_string*/,
3996    Dwarf_P_Attribute * /*attr_out*/,
3997    Dwarf_Error*    /*error*/);
3998
3999/*  October 2017 for DW_FORM_data16. Usable with any attribute,
4000    though it should only be in limited use. DWARF5 only.
4001    Returns DW_DLV_OK on success, DW_DLV_ERROR on failure.
4002    Returns the new attribute pointer through *return_attr. */
4003int dwarf_add_AT_data16(Dwarf_P_Die /*ownerdie*/,
4004    Dwarf_Half    /*attrnum*/,
4005    Dwarf_Form_Data16 * /* pointstovalue */,
4006    Dwarf_P_Attribute * /* return_attr */,
4007    Dwarf_Error * /*error*/);
4008
4009/*  November 2018. DW_AT_implicit const generation. */
4010int dwarf_add_AT_implicit_const(Dwarf_P_Die /*ownerdie*/,
4011    Dwarf_Half /*attrnum*/,
4012    Dwarf_Signed /*signed_value*/,
4013    Dwarf_P_Attribute * /*outattr*/,
4014    Dwarf_Error * /*error*/);
4015
4016/* August 2013 sleb creator. For any attribute. */
4017Dwarf_P_Attribute dwarf_add_AT_any_value_sleb(Dwarf_P_Die /*ownerdie*/,
4018    Dwarf_Half    /*attrnum*/,
4019    Dwarf_Signed  /*signed_value*/,
4020    Dwarf_Error * /*error*/);
4021
4022/*  New December 2018. Preferred version. */
4023int dwarf_add_AT_any_value_sleb_a(Dwarf_P_Die /*ownerdie*/,
4024    Dwarf_Half    /*attrnum*/,
4025    Dwarf_Signed  /*signed_value*/,
4026    Dwarf_P_Attribute * /*outattr*/,
4027    Dwarf_Error * /*error*/);
4028
4029/* Original sleb creator. Only for DW_AT_const_value. */
4030Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
4031    Dwarf_Signed    /*signed_value*/,
4032    Dwarf_Error*    /*error*/);
4033
4034/*  Preferred as of December 2018. */
4035int dwarf_add_AT_const_value_signedint_a(Dwarf_P_Die /*ownerdie*/,
4036    Dwarf_Signed    /*signed_value*/,
4037    Dwarf_P_Attribute * /*outattr*/,
4038    Dwarf_Error*    /*error*/);
4039
4040/* August 2013 uleb creator. For any attribute. */
4041Dwarf_P_Attribute dwarf_add_AT_any_value_uleb(Dwarf_P_Die /*ownerdie*/,
4042    Dwarf_Half      /*attrnum*/,
4043    Dwarf_Unsigned  /*signed_value*/,
4044    Dwarf_Error *   /*error*/);
4045
4046/*  New December 2018. Preferred version. */
4047int dwarf_add_AT_any_value_uleb_a(Dwarf_P_Die /*ownerdie*/,
4048    Dwarf_Half      /*attrnum*/,
4049    Dwarf_Unsigned  /*signed_value*/,
4050    Dwarf_P_Attribute * /*outattr*/,
4051    Dwarf_Error *   /*error*/);
4052
4053/* Original uleb creator. Only for DW_AT_const_value. */
4054Dwarf_P_Attribute dwarf_add_AT_const_value_unsignedint(
4055    Dwarf_P_Die     /*ownerdie*/,
4056    Dwarf_Unsigned  /*unsigned_value*/,
4057    Dwarf_Error*    /*error*/);
4058
4059/*  New December 2018. Preferred version. */
4060int dwarf_add_AT_const_value_unsignedint_a(
4061    Dwarf_P_Die     /*ownerdie*/,
4062    Dwarf_Unsigned  /*unsigned_value*/,
4063    Dwarf_P_Attribute * /*outattr*/,
4064    Dwarf_Error*    /*error*/);
4065
4066Dwarf_P_Attribute dwarf_add_AT_comp_dir(Dwarf_P_Die /*ownerdie*/,
4067    char*           /*current_working_directory*/,
4068    Dwarf_Error*    /*error*/);
4069
4070/*  New December 2018. Preferred version. */
4071int dwarf_add_AT_comp_dir_a(Dwarf_P_Die /*ownerdie*/,
4072    char*           /*current_working_directory*/,
4073    Dwarf_P_Attribute * /*outattr*/,
4074    Dwarf_Error*    /*error*/);
4075
4076Dwarf_P_Attribute dwarf_add_AT_name(Dwarf_P_Die    /*die*/,
4077    char*           /*name*/,
4078    Dwarf_Error*    /*error*/);
4079
4080/*  New December 2018. Preferred version. */
4081int dwarf_add_AT_name_a(Dwarf_P_Die    /*die*/,
4082    char*           /*name*/,
4083    Dwarf_P_Attribute * /*outattr*/,
4084    Dwarf_Error*    /*error*/);
4085
4086Dwarf_P_Attribute dwarf_add_AT_with_ref_sig8(
4087   Dwarf_P_Die   /*ownerdie */,
4088   Dwarf_Half    /*attrnum */,
4089   const Dwarf_Sig8 *  /*sig8_in*/,
4090   Dwarf_Error * /*error*/);
4091
4092/*  New December 2018. Preferred version. */
4093int dwarf_add_AT_with_ref_sig8_a(
4094   Dwarf_P_Die   /*ownerdie */,
4095   Dwarf_Half    /*attrnum */,
4096   const Dwarf_Sig8 *  /*sig8_in*/,
4097   Dwarf_P_Attribute * /*outattr*/,
4098   Dwarf_Error * /*error*/);
4099
4100
4101/* Producer line creation functions (.debug_line) */
4102Dwarf_Unsigned dwarf_add_directory_decl(Dwarf_P_Debug /*dbg*/,
4103    char*           /*name*/,
4104    Dwarf_Error*    /*error*/);
4105
4106/*  New December 2018. Preferred version. */
4107int dwarf_add_directory_decl_a(Dwarf_P_Debug /*dbg*/,
4108    char*           /*name*/,
4109    Dwarf_Unsigned * /*index_in_directories*/,
4110    Dwarf_Error*    /*error*/);
4111
4112Dwarf_Unsigned dwarf_add_file_decl(Dwarf_P_Debug /*dbg*/,
4113    char*           /*name*/,
4114    Dwarf_Unsigned  /*dir_index*/,
4115    Dwarf_Unsigned  /*time_last_modified*/,
4116    Dwarf_Unsigned  /*length*/,
4117    Dwarf_Error*    /*error*/);
4118
4119/*  New December 2018. Preferred version. */
4120int dwarf_add_file_decl_a(Dwarf_P_Debug /*dbg*/,
4121    char*           /*name*/,
4122    Dwarf_Unsigned  /*dir_index*/,
4123    Dwarf_Unsigned  /*time_last_modified*/,
4124    Dwarf_Unsigned  /*length*/,
4125    Dwarf_Unsigned * /*file_entry_count_out*/,
4126    Dwarf_Error*    /*error*/);
4127
4128/*  New December 2018. Preferred version. */
4129int dwarf_add_line_entry_c(Dwarf_P_Debug /*dbg*/,
4130    Dwarf_Unsigned  /*file_index*/,
4131    Dwarf_Addr      /*code_address*/,
4132    Dwarf_Unsigned  /*lineno*/,
4133    Dwarf_Signed    /*column_number*/,
4134    Dwarf_Bool      /*is_source_stmt_begin*/,
4135    Dwarf_Bool      /*is_basic_block_begin*/,
4136    Dwarf_Bool      /*is_epilogue_begin*/,
4137    Dwarf_Bool      /*is_prologue_end*/,
4138    Dwarf_Unsigned  /*isa*/,
4139    Dwarf_Unsigned  /*discriminator*/,
4140    Dwarf_Error*    /*error*/);
4141
4142Dwarf_Unsigned dwarf_add_line_entry_b(Dwarf_P_Debug /*dbg*/,
4143    Dwarf_Unsigned  /*file_index*/,
4144    Dwarf_Addr      /*code_address*/,
4145    Dwarf_Unsigned  /*lineno*/,
4146    Dwarf_Signed    /*column_number*/,
4147    Dwarf_Bool      /*is_source_stmt_begin*/,
4148    Dwarf_Bool      /*is_basic_block_begin*/,
4149    Dwarf_Bool      /*is_epilogue_begin*/,
4150    Dwarf_Bool      /*is_prologue_end*/,
4151    Dwarf_Unsigned  /*isa*/,
4152    Dwarf_Unsigned  /*discriminator*/,
4153    Dwarf_Error*    /*error*/);
4154
4155Dwarf_Unsigned dwarf_add_line_entry(Dwarf_P_Debug /*dbg*/,
4156    Dwarf_Unsigned  /*file_index*/,
4157    Dwarf_Addr      /*code_address*/,
4158    Dwarf_Unsigned  /*lineno*/,
4159    Dwarf_Signed    /*column_number*/,
4160    Dwarf_Bool      /*is_source_stmt_begin*/,
4161    Dwarf_Bool      /*is_basic_block_begin*/,
4162    Dwarf_Error*    /*error*/);
4163
4164Dwarf_Unsigned dwarf_lne_set_address(Dwarf_P_Debug /*dbg*/,
4165    Dwarf_Unsigned  /*offset*/,
4166    Dwarf_Unsigned  /*symbol_index*/,
4167    Dwarf_Error*    /*error*/);
4168
4169/*  New December 2018. Preferred version. */
4170int dwarf_lne_set_address_a(Dwarf_P_Debug /*dbg*/,
4171    Dwarf_Unsigned  /*offset*/,
4172    Dwarf_Unsigned  /*symbol_index*/,
4173    Dwarf_Error*    /*error*/);
4174
4175Dwarf_Unsigned dwarf_lne_end_sequence(Dwarf_P_Debug /*dbg*/,
4176    Dwarf_Addr      /*end_address*/,
4177    Dwarf_Error*    /*error*/);
4178
4179/*  New December 2018. Preferred version. */
4180int dwarf_lne_end_sequence_a(Dwarf_P_Debug /*dbg*/,
4181    Dwarf_Addr      /*end_address*/,
4182    Dwarf_Error*    /*error*/);
4183
4184/* Producer .debug_frame functions */
4185Dwarf_Unsigned dwarf_add_frame_cie(Dwarf_P_Debug /*dbg*/,
4186    char*           /*augmenter*/,
4187    Dwarf_Small     /*code_alignment_factor*/,
4188    Dwarf_Small     /*data_alignment_factor*/,
4189    Dwarf_Small     /*return_address_reg*/,
4190    Dwarf_Ptr       /*initialization_bytes*/,
4191    Dwarf_Unsigned  /*init_byte_len*/,
4192    Dwarf_Error*    /*error*/);
4193
4194/*  New December 2018. Preferred version. */
4195int dwarf_add_frame_cie_a(Dwarf_P_Debug /*dbg*/,
4196    char*           /*augmenter*/,
4197    Dwarf_Small     /*code_alignment_factor*/,
4198    Dwarf_Small     /*data_alignment_factor*/,
4199    Dwarf_Small     /*return_address_reg*/,
4200    Dwarf_Ptr       /*initialization_bytes*/,
4201    Dwarf_Unsigned  /*init_byte_len*/,
4202    Dwarf_Unsigned * /*cie_index_out*/,
4203    Dwarf_Error*    /*error*/);
4204
4205Dwarf_Unsigned dwarf_add_frame_fde(
4206    Dwarf_P_Debug   /*dbg*/,
4207    Dwarf_P_Fde     /*fde*/,
4208    Dwarf_P_Die     /*corresponding subprogram die*/,
4209    Dwarf_Unsigned  /*cie_to_use*/,
4210    Dwarf_Unsigned  /*virt_addr_of_described_code*/,
4211    Dwarf_Unsigned  /*length_of_code*/,
4212    Dwarf_Unsigned  /*symbol_index*/,
4213    Dwarf_Error*    /*error*/);
4214
4215Dwarf_Unsigned dwarf_add_frame_fde_b(
4216    Dwarf_P_Debug  /*dbg*/,
4217    Dwarf_P_Fde    /*fde*/,
4218    Dwarf_P_Die    /*die*/,
4219    Dwarf_Unsigned /*cie*/,
4220    Dwarf_Addr     /*virt_addr*/,
4221    Dwarf_Unsigned /*code_len*/,
4222    Dwarf_Unsigned /*sym_idx*/,
4223    Dwarf_Unsigned /*sym_idx_of_end*/,
4224    Dwarf_Addr     /*offset_from_end_sym*/,
4225    Dwarf_Error*   /*error*/);
4226
4227/*  New December 2018. Preferred version. */
4228int dwarf_add_frame_fde_c(
4229    Dwarf_P_Debug  /*dbg*/,
4230    Dwarf_P_Fde    /*fde*/,
4231    Dwarf_P_Die    /*die*/,
4232    Dwarf_Unsigned /*cie*/,
4233    Dwarf_Addr     /*virt_addr*/,
4234    Dwarf_Unsigned /*code_len*/,
4235    Dwarf_Unsigned /*sym_idx*/,
4236    Dwarf_Unsigned /*sym_idx_of_end*/,
4237    Dwarf_Addr     /*offset_from_end_sym*/,
4238    Dwarf_Unsigned * /*index_to_fde*/,
4239    Dwarf_Error*   /*error*/);
4240
4241/*  New December 2018. Preferred version. */
4242int dwarf_add_frame_info_c(
4243    Dwarf_P_Debug   /*dbg*/,
4244    Dwarf_P_Fde     /*fde*/,
4245    Dwarf_P_Die     /*die*/,
4246    Dwarf_Unsigned  /*cie*/,
4247    Dwarf_Addr      /*virt_addr*/,
4248    Dwarf_Unsigned  /*code_len*/,
4249    Dwarf_Unsigned  /*symidx*/,
4250    Dwarf_Unsigned  /*end_symbol */,
4251    Dwarf_Addr      /*offset_from_end_symbol */,
4252    Dwarf_Signed    /*offset_into_exception_tables*/,
4253    Dwarf_Unsigned  /*exception_table_symbol*/,
4254    Dwarf_Unsigned * /*fde_index_out*/,
4255    Dwarf_Error*    /*error*/);
4256
4257Dwarf_Unsigned dwarf_add_frame_info_b(
4258    Dwarf_P_Debug   /*dbg*/,
4259    Dwarf_P_Fde     /*fde*/,
4260    Dwarf_P_Die     /*die*/,
4261    Dwarf_Unsigned  /*cie*/,
4262    Dwarf_Addr      /*virt_addr*/,
4263    Dwarf_Unsigned  /*code_len*/,
4264    Dwarf_Unsigned  /*symidx*/,
4265    Dwarf_Unsigned  /*end_symbol */,
4266    Dwarf_Addr      /*offset_from_end_symbol */,
4267    Dwarf_Signed    /*offset_into_exception_tables*/,
4268    Dwarf_Unsigned  /*exception_table_symbol*/,
4269    Dwarf_Error*    /*error*/);
4270
4271Dwarf_Unsigned dwarf_add_frame_info(
4272    Dwarf_P_Debug   /*dbg*/,
4273    Dwarf_P_Fde     /*fde*/,
4274    Dwarf_P_Die     /*die*/,
4275    Dwarf_Unsigned  /*cie*/,
4276    Dwarf_Addr      /*virt_addr*/,
4277    Dwarf_Unsigned  /*code_len*/,
4278    Dwarf_Unsigned  /*symidx*/,
4279    Dwarf_Signed    /*offset_into_exception_tables*/,
4280    Dwarf_Unsigned  /*exception_table_symbol*/,
4281    Dwarf_Error*    /*error*/);
4282
4283/* The fde returned is just the one passed in. Silly. */
4284Dwarf_P_Fde dwarf_add_fde_inst(
4285    Dwarf_P_Fde     /*fde*/,
4286    Dwarf_Small     /*op*/,
4287    Dwarf_Unsigned  /*val1*/,
4288    Dwarf_Unsigned  /*val2*/,
4289    Dwarf_Error*    /*error*/);
4290
4291/*  New December 2018. Preferred version. */
4292int dwarf_add_fde_inst_a(
4293    Dwarf_P_Fde     /*fde*/,
4294    Dwarf_Small     /*op*/,
4295    Dwarf_Unsigned  /*val1*/,
4296    Dwarf_Unsigned  /*val2*/,
4297    Dwarf_Error*    /*error*/);
4298
4299/* New September 17, 2009 */
4300int dwarf_insert_fde_inst_bytes(
4301    Dwarf_P_Debug  /*dbg*/,
4302    Dwarf_P_Fde    /*fde*/,
4303    Dwarf_Unsigned /*len*/,
4304    Dwarf_Ptr      /*ibytes*/,
4305    Dwarf_Error*   /*error*/);
4306
4307Dwarf_P_Fde dwarf_new_fde(Dwarf_P_Debug    /*dbg*/,
4308    Dwarf_Error* /*error*/);
4309
4310/*  New December 2018. Preferred version. */
4311int dwarf_new_fde_a(Dwarf_P_Debug    /*dbg*/,
4312    Dwarf_P_Fde * /*fde_out*/,
4313    Dwarf_Error* /*error*/);
4314
4315Dwarf_P_Fde dwarf_fde_cfa_offset(
4316    Dwarf_P_Fde     /*fde*/,
4317    Dwarf_Unsigned  /*register_number*/,
4318    Dwarf_Signed    /*offset*/,
4319    Dwarf_Error*    /*error*/);
4320
4321/*  New December 2018. Preferred version. */
4322int dwarf_fde_cfa_offset_a(
4323    Dwarf_P_Fde     /*fde*/,
4324    Dwarf_Unsigned  /*register_number*/,
4325    Dwarf_Signed    /*offset*/,
4326    Dwarf_Error*    /*error*/);
4327
4328/*  die creation & addition routines
4329    dwarf_new_die_a() new September 2016.
4330    Preferred over dwarf_new_die(). */
4331int dwarf_new_die_a(
4332    Dwarf_P_Debug   /*dbg*/,
4333    Dwarf_Tag       /*tag*/,
4334    Dwarf_P_Die     /*parent*/,
4335    Dwarf_P_Die     /*child*/,
4336    Dwarf_P_Die     /*left */,
4337    Dwarf_P_Die     /*right*/,
4338    Dwarf_P_Die   * /*die_out*/,
4339    Dwarf_Error*    /*error*/);
4340
4341Dwarf_P_Die dwarf_new_die(
4342    Dwarf_P_Debug    /*dbg*/,
4343    Dwarf_Tag         /*tag*/,
4344    Dwarf_P_Die     /*parent*/,
4345    Dwarf_P_Die     /*child*/,
4346    Dwarf_P_Die     /*left */,
4347    Dwarf_P_Die     /*right*/,
4348    Dwarf_Error*    /*error*/);
4349
4350/* New September 2016. */
4351int dwarf_add_die_to_debug_a(
4352    Dwarf_P_Debug   /*dbg*/,
4353    Dwarf_P_Die     /*die*/,
4354    Dwarf_Error*    /*error*/);
4355
4356/*  Original form.  */
4357Dwarf_Unsigned dwarf_add_die_to_debug(
4358    Dwarf_P_Debug   /*dbg*/,
4359    Dwarf_P_Die     /*die*/,
4360    Dwarf_Error*    /*error*/);
4361
4362/* Markers are not written  to DWARF2/3/4, they are user
4363   defined and may be used for any purpose.
4364*/
4365Dwarf_Unsigned dwarf_add_die_marker(
4366    Dwarf_P_Debug   /*dbg*/,
4367    Dwarf_P_Die     /*die*/,
4368    Dwarf_Unsigned  /*marker*/,
4369    Dwarf_Error *   /*error*/);
4370
4371/*  Preferred version, new December 2018. */
4372int dwarf_add_die_marker_a(Dwarf_P_Debug dbg,
4373    Dwarf_P_Die die,
4374    Dwarf_Unsigned marker,
4375    Dwarf_Error * error);
4376
4377Dwarf_Unsigned dwarf_get_die_marker(
4378    Dwarf_P_Debug   /*dbg*/,
4379    Dwarf_P_Die     /*die*/,
4380    Dwarf_Unsigned *  /*marker*/,
4381    Dwarf_Error *   /*error*/);
4382
4383/*  Preferred version, new December 2018. */
4384int dwarf_get_die_marker_a(
4385    Dwarf_P_Debug   /*dbg*/,
4386    Dwarf_P_Die     /*die*/,
4387    Dwarf_Unsigned *  /*marker*/,
4388    Dwarf_Error *   /*error*/);
4389
4390/*  New September 2016. Preferred version */
4391int dwarf_die_link_a(
4392    Dwarf_P_Die     /*die*/,
4393    Dwarf_P_Die     /*parent*/,
4394    Dwarf_P_Die     /*child*/,
4395    Dwarf_P_Die     /*left*/,
4396    Dwarf_P_Die     /*right*/,
4397    Dwarf_Error*    /*error*/);
4398
4399/*  Original version. Use dwarf_die_link_a() instead. */
4400Dwarf_P_Die dwarf_die_link(
4401    Dwarf_P_Die     /*die*/,
4402    Dwarf_P_Die     /*parent*/,
4403    Dwarf_P_Die     /*child*/,
4404    Dwarf_P_Die     /*left*/,
4405    Dwarf_P_Die     /*right*/,
4406    Dwarf_Error*    /*error*/);
4407
4408void dwarf_dealloc_compressed_block(
4409    Dwarf_P_Debug,
4410    void *
4411);
4412
4413/*  Call this passing in return value from
4414    dwarf_uncompress_integer_block()
4415    to free the space the decompression allocated. */
4416void dwarf_dealloc_uncompressed_block(
4417    Dwarf_Debug,
4418    void *
4419);
4420
4421/*  dwarf_compress_integer_block_a( new 11 February 2019.
4422    Like the earlier version this turns an array of signed
4423    integers into a block of sleb values (and if the
4424    values are small enough it might be a compression!
4425    Or it could be an expansion...). Return DW_DLV_OK
4426    on success. Supercedes dwarf_compress_integer_block():
4427    as no ugly cast needed to know if
4428    dwarf_compress_integer_block_a() succeeds or not. */
4429int
4430dwarf_compress_integer_block_a(
4431    Dwarf_P_Debug    /*dbg*/,
4432    Dwarf_Unsigned   /*input_array_length*/,
4433    Dwarf_Signed   * /*input_array*/,
4434    Dwarf_Unsigned * /*output_block_len*/,
4435    void          ** /*output_block_returned*/,
4436    Dwarf_Error    * /*error */);
4437/*  The following should be avoided as of February 2019. */
4438void * dwarf_compress_integer_block(
4439    Dwarf_P_Debug,    /*dbg*/
4440    Dwarf_Bool,       /*signed==true (or unsigned)*/
4441    Dwarf_Small,      /*size of integer units: 8, 16, 32, 64*/
4442    void*,            /*data*/
4443    Dwarf_Unsigned,   /*number of elements*/
4444    Dwarf_Unsigned*,  /*number of bytes in output block*/
4445    Dwarf_Error*      /*error*/
4446);
4447
4448/*  New February 2019.  On success returns DW_DLV_OK
4449    and creates an array of Dwarf_Signed values
4450    from the block of sleb numbers.
4451    This interface supercedes
4452    dwarf_uncompress_integer_block(). No ugly
4453    cast needed to know if
4454    dwarf_uncompress_integer_block_a() succeeds or not. */
4455int
4456dwarf_uncompress_integer_block_a(Dwarf_Debug /*dbg*/,
4457    Dwarf_Unsigned     /*input_length_in_bytes*/,
4458    void             * /*input_block*/,
4459    Dwarf_Unsigned   * /*value_count*/,
4460    Dwarf_Signed    ** /*value_array*/,
4461    Dwarf_Error      * /*error*/);
4462
4463/*  Decode an array of signed leb integers (so of course the
4464    array is not composed of fixed length values, but is instead
4465    a sequence of sleb values).
4466    Returns a DW_DLV_BADADDR on error.
4467    Otherwise returns a pointer to an array of 32bit integers.
4468    The signed argument must be non-zero (the decode
4469    assumes sleb integers in the input data) at this time.
4470    Size of integer units must be 32 (32 bits each) at this time.
4471    Number of bytes in block is a byte count (not array count).
4472    Returns number of units in output block (ie, number of elements
4473    of the array that the return value points to) thru the
4474    argument.  */
4475void * dwarf_uncompress_integer_block(
4476    Dwarf_Debug,      /*dbg */
4477    Dwarf_Bool,       /*signed==true (or unsigned) */
4478    Dwarf_Small,      /*size of integer units: 8, 16, 32, 64 */
4479    void*,            /*input data */
4480    Dwarf_Unsigned,   /*number of bytes in input */
4481    Dwarf_Unsigned*,  /*number of units in output block */
4482    Dwarf_Error*      /*error */
4483);
4484
4485/* Operations to create location expressions. */
4486Dwarf_P_Expr dwarf_new_expr(Dwarf_P_Debug /*dbg*/,
4487    Dwarf_Error* /*error*/);
4488
4489/*  New December 2018. Preferred version. */
4490int dwarf_new_expr_a(Dwarf_P_Debug /*dbg*/,
4491    Dwarf_P_Expr * /*expr_out*/,
4492    Dwarf_Error* /*error*/);
4493
4494void dwarf_expr_reset(
4495    Dwarf_P_Expr      /*expr*/,
4496    Dwarf_Error*      /*error*/);
4497
4498Dwarf_Unsigned dwarf_add_expr_gen(
4499    Dwarf_P_Expr      /*expr*/,
4500    Dwarf_Small       /*opcode*/,
4501    Dwarf_Unsigned    /*val1*/,
4502    Dwarf_Unsigned    /*val2*/,
4503    Dwarf_Error*      /*error*/);
4504
4505/*  New December 2018. Preferred version. */
4506int dwarf_add_expr_gen_a(
4507    Dwarf_P_Expr      /*expr*/,
4508    Dwarf_Small       /*opcode*/,
4509    Dwarf_Unsigned    /*val1*/,
4510    Dwarf_Unsigned    /*val2*/,
4511    Dwarf_Unsigned  * /*next_byte_offset*/,
4512    Dwarf_Error*      /*error*/);
4513
4514Dwarf_Unsigned dwarf_add_expr_addr(
4515    Dwarf_P_Expr      /*expr*/,
4516    Dwarf_Unsigned    /*addr*/,
4517    Dwarf_Signed      /*sym_index*/,
4518    Dwarf_Error*      /*error*/);
4519
4520Dwarf_Unsigned dwarf_add_expr_addr_b(
4521    Dwarf_P_Expr      /*expr*/,
4522    Dwarf_Unsigned    /*addr*/,
4523    Dwarf_Unsigned    /*sym_index*/,
4524    Dwarf_Error*      /*error*/);
4525
4526
4527/*  New December 2018. Preferred version. */
4528int dwarf_add_expr_addr_c(
4529    Dwarf_P_Expr      /*expr*/,
4530    Dwarf_Unsigned    /*addr*/,
4531    Dwarf_Unsigned    /*sym_index*/,
4532    Dwarf_Unsigned * /*next_byte_offset_out*/,
4533    Dwarf_Error*      /*error*/);
4534
4535Dwarf_Unsigned dwarf_expr_current_offset(
4536    Dwarf_P_Expr      /*expr*/,
4537    Dwarf_Error*      /*error*/);
4538
4539/*  New December 2018. Preferred version. */
4540int dwarf_expr_current_offset_a(
4541    Dwarf_P_Expr      /*expr*/,
4542    Dwarf_Unsigned * /*next_byte_offset_out*/,
4543    Dwarf_Error*      /*error*/);
4544
4545Dwarf_Addr dwarf_expr_into_block(
4546    Dwarf_P_Expr      /*expr*/,
4547    Dwarf_Unsigned*   /*length*/,
4548    Dwarf_Error*      /*error*/);
4549
4550/*  New December 2018. Preferred version. */
4551int dwarf_expr_into_block_a(
4552    Dwarf_P_Expr      /*expr*/,
4553    Dwarf_Unsigned*   /*length*/,
4554    Dwarf_Small    ** /*start_address*/,
4555    Dwarf_Error*      /*error*/);
4556
4557Dwarf_Unsigned dwarf_add_arange(Dwarf_P_Debug /*dbg*/,
4558    Dwarf_Addr        /*begin_address*/,
4559    Dwarf_Unsigned    /*length*/,
4560    Dwarf_Signed      /*symbol_index*/,
4561    Dwarf_Error*      /*error*/);
4562
4563Dwarf_Unsigned dwarf_add_arange_b(
4564    Dwarf_P_Debug  /*dbg*/,
4565    Dwarf_Addr     /*begin_address*/,
4566    Dwarf_Unsigned /*length*/,
4567    Dwarf_Unsigned /*symbol_index*/,
4568    Dwarf_Unsigned /*end_symbol_index*/,
4569    Dwarf_Addr     /*offset_from_end_symbol*/,
4570    Dwarf_Error *  /*error*/);
4571
4572/*  New December 2018. Preferred version. */
4573int dwarf_add_arange_c(
4574    Dwarf_P_Debug  /*dbg*/,
4575    Dwarf_Addr     /*begin_address*/,
4576    Dwarf_Unsigned /*length*/,
4577    Dwarf_Unsigned /*symbol_index*/,
4578    Dwarf_Unsigned /*end_symbol_index*/,
4579    Dwarf_Addr     /*offset_from_end_symbol*/,
4580    Dwarf_Error *  /*error*/);
4581
4582Dwarf_Unsigned dwarf_add_pubname(
4583    Dwarf_P_Debug      /*dbg*/,
4584    Dwarf_P_Die        /*die*/,
4585    char*              /*pubname_name*/,
4586    Dwarf_Error*       /*error*/);
4587
4588/*  New December 2018. Preferred version. */
4589int dwarf_add_pubname_a(
4590    Dwarf_P_Debug      /*dbg*/,
4591    Dwarf_P_Die        /*die*/,
4592    char*              /*pubname_name*/,
4593    Dwarf_Error*       /*error*/);
4594
4595/* Added 17 October 2013.  Introduced in DWARF3. */
4596Dwarf_Unsigned dwarf_add_pubtype(
4597    Dwarf_P_Debug      /*dbg*/,
4598    Dwarf_P_Die        /*die*/,
4599    char*              /*pubtype_name*/,
4600    Dwarf_Error*       /*error*/);
4601
4602/*  New December 2018. Preferred version. */
4603int dwarf_add_pubtype_a(
4604    Dwarf_P_Debug      /*dbg*/,
4605    Dwarf_P_Die        /*die*/,
4606    char*              /*pubtype_name*/,
4607    Dwarf_Error*       /*error*/);
4608
4609Dwarf_Unsigned dwarf_add_funcname(
4610    Dwarf_P_Debug      /*dbg*/,
4611    Dwarf_P_Die        /*die*/,
4612    char*              /*func_name*/,
4613    Dwarf_Error*       /*error*/);
4614
4615/*  New December 2018. Preferred version. */
4616int dwarf_add_funcname_a(
4617    Dwarf_P_Debug      /*dbg*/,
4618    Dwarf_P_Die        /*die*/,
4619    char*              /*func_name*/,
4620    Dwarf_Error*       /*error*/);
4621
4622Dwarf_Unsigned dwarf_add_typename(
4623    Dwarf_P_Debug     /*dbg*/,
4624    Dwarf_P_Die       /*die*/,
4625    char*             /*type_name*/,
4626    Dwarf_Error*      /*error*/);
4627
4628/*  New December 2018. Preferred version. */
4629int dwarf_add_typename_a(
4630    Dwarf_P_Debug     /*dbg*/,
4631    Dwarf_P_Die       /*die*/,
4632    char*             /*type_name*/,
4633    Dwarf_Error*      /*error*/);
4634
4635Dwarf_Unsigned dwarf_add_varname(
4636    Dwarf_P_Debug     /*dbg*/,
4637    Dwarf_P_Die       /*die*/,
4638    char*             /*var_name*/,
4639    Dwarf_Error*      /*error*/);
4640
4641/*  New December 2018. Preferred version. */
4642int dwarf_add_varname_a(
4643    Dwarf_P_Debug     /*dbg*/,
4644    Dwarf_P_Die       /*die*/,
4645    char*             /*var_name*/,
4646    Dwarf_Error*      /*error*/);
4647
4648Dwarf_Unsigned dwarf_add_weakname(
4649    Dwarf_P_Debug    /*dbg*/,
4650    Dwarf_P_Die      /*die*/,
4651    char*            /*weak_name*/,
4652    Dwarf_Error*     /*error*/);
4653
4654int dwarf_add_weakname_a(
4655    Dwarf_P_Debug    /*dbg*/,
4656    Dwarf_P_Die      /*die*/,
4657    char*            /*weak_name*/,
4658    Dwarf_Error*     /*error*/);
4659
4660/*  .debug_names producer functions */
4661
4662/*  dwarf_force_debug_names forces creation
4663    of .debug_names (if DWARF5 being produced)
4664    even if empty. Only for testing libdwarf. */
4665int dwarf_force_debug_names(Dwarf_P_Debug /* dbg */,
4666    Dwarf_Error*     /*error*/);
4667
4668/*  Other debug_names functions are needed... FIXME */
4669
4670/*  end .debug_names producer functions */
4671
4672/*  .debug_macinfo producer functions
4673    Functions must be called in right order: the section is output
4674    In the order these are presented.
4675*/
4676int dwarf_def_macro(Dwarf_P_Debug /*dbg*/,
4677    Dwarf_Unsigned   /*line*/,
4678    char *           /*macname, with (arglist), no space before (*/,
4679    char *           /*macvalue*/,
4680    Dwarf_Error*     /*error*/);
4681
4682int dwarf_undef_macro(Dwarf_P_Debug /*dbg*/,
4683    Dwarf_Unsigned   /*line*/,
4684    char *           /*macname, no arglist, of course*/,
4685    Dwarf_Error*     /*error*/);
4686
4687int dwarf_start_macro_file(Dwarf_P_Debug /*dbg*/,
4688    Dwarf_Unsigned   /*fileindex*/,
4689    Dwarf_Unsigned   /*linenumber*/,
4690    Dwarf_Error*     /*error*/);
4691
4692int dwarf_end_macro_file(Dwarf_P_Debug /*dbg*/,
4693    Dwarf_Error*     /*error*/);
4694
4695int dwarf_vendor_ext(Dwarf_P_Debug /*dbg*/,
4696    Dwarf_Unsigned   /*constant*/,
4697    char *           /*string*/,
4698    Dwarf_Error*     /*error*/);
4699
4700/* end macinfo producer functions */
4701
4702int dwarf_attr_offset(Dwarf_Die /*die*/,
4703    Dwarf_Attribute /*attr of above die*/,
4704    Dwarf_Off     * /*returns offset thru this ptr */,
4705    Dwarf_Error   * /*error*/);
4706
4707/*  This is a hack so clients can verify offsets.
4708    Added April 2005 so that debugger can detect broken offsets
4709    (which happened in an IRIX executable larger than 2GB
4710    with MIPSpro 7.3.1.3 toolchain.).
4711*/
4712int dwarf_get_section_max_offsets(Dwarf_Debug /*dbg*/,
4713    Dwarf_Unsigned * /*debug_info_size*/,
4714    Dwarf_Unsigned * /*debug_abbrev_size*/,
4715    Dwarf_Unsigned * /*debug_line_size*/,
4716    Dwarf_Unsigned * /*debug_loc_size*/,
4717    Dwarf_Unsigned * /*debug_aranges_size*/,
4718    Dwarf_Unsigned * /*debug_macinfo_size*/,
4719    Dwarf_Unsigned * /*debug_pubnames_size*/,
4720    Dwarf_Unsigned * /*debug_str_size*/,
4721    Dwarf_Unsigned * /*debug_frame_size*/,
4722    Dwarf_Unsigned * /*debug_ranges_size*/,
4723    Dwarf_Unsigned * /*debug_pubtypes_size*/);
4724
4725/*  New October 2011., adds .debug_types section to the sizes
4726    returned. */
4727int dwarf_get_section_max_offsets_b(Dwarf_Debug /*dbg*/,
4728
4729    Dwarf_Unsigned * /*debug_info_size*/,
4730    Dwarf_Unsigned * /*debug_abbrev_size*/,
4731    Dwarf_Unsigned * /*debug_line_size*/,
4732    Dwarf_Unsigned * /*debug_loc_size*/,
4733    Dwarf_Unsigned * /*debug_aranges_size*/,
4734    Dwarf_Unsigned * /*debug_macinfo_size*/,
4735    Dwarf_Unsigned * /*debug_pubnames_size*/,
4736    Dwarf_Unsigned * /*debug_str_size*/,
4737    Dwarf_Unsigned * /*debug_frame_size*/,
4738    Dwarf_Unsigned * /*debug_ranges_size*/,
4739    Dwarf_Unsigned * /*debug_pubtypes_size*/,
4740    Dwarf_Unsigned * /*debug_types_size*/);
4741
4742int dwarf_get_section_max_offsets_c(Dwarf_Debug /*dbg*/,
4743    Dwarf_Unsigned * /*debug_info_size*/,
4744    Dwarf_Unsigned * /*debug_abbrev_size*/,
4745    Dwarf_Unsigned * /*debug_line_size*/,
4746    Dwarf_Unsigned * /*debug_loc_size*/,
4747    Dwarf_Unsigned * /*debug_aranges_size*/,
4748    Dwarf_Unsigned * /*debug_macinfo_size*/,
4749    Dwarf_Unsigned * /*debug_pubnames_size*/,
4750    Dwarf_Unsigned * /*debug_str_size*/,
4751    Dwarf_Unsigned * /*debug_frame_size*/,
4752    Dwarf_Unsigned * /*debug_ranges_size*/,
4753    Dwarf_Unsigned * /*debug_pubtypes_size*/,
4754    Dwarf_Unsigned * /*debug_types_size*/,
4755    Dwarf_Unsigned * /*debug_macro_size*/,
4756    Dwarf_Unsigned * /*debug_str_offsets_size*/,
4757    Dwarf_Unsigned * /*debug_sup_size*/,
4758    Dwarf_Unsigned * /*debug_cu_index_size*/,
4759    Dwarf_Unsigned * /*debug_tu_index_size*/);
4760int dwarf_get_section_max_offsets_d(Dwarf_Debug /*dbg*/,
4761    Dwarf_Unsigned * /*debug_info_size*/,
4762    Dwarf_Unsigned * /*debug_abbrev_size*/,
4763    Dwarf_Unsigned * /*debug_line_size*/,
4764    Dwarf_Unsigned * /*debug_loc_size*/,
4765    Dwarf_Unsigned * /*debug_aranges_size*/,
4766    Dwarf_Unsigned * /*debug_macinfo_size*/,
4767    Dwarf_Unsigned * /*debug_pubnames_size*/,
4768    Dwarf_Unsigned * /*debug_str_size*/,
4769    Dwarf_Unsigned * /*debug_frame_size*/,
4770    Dwarf_Unsigned * /*debug_ranges_size*/,
4771    Dwarf_Unsigned * /*debug_pubtypes_size*/,
4772    Dwarf_Unsigned * /*debug_types_size*/,
4773    Dwarf_Unsigned * /*debug_macro_size*/,
4774    Dwarf_Unsigned * /*debug_str_offsets_size*/,
4775    Dwarf_Unsigned * /*debug_sup_size*/,
4776    Dwarf_Unsigned * /*debug_cu_index_size*/,
4777    Dwarf_Unsigned * /*debug_tu_index_size*/,
4778    Dwarf_Unsigned * /*debug_names_size*/,
4779    Dwarf_Unsigned * /*debug_loclists_size*/,
4780    Dwarf_Unsigned * /*debug_rnglists_size*/);
4781
4782/*  The 'set' calls here return the original (before any change
4783    by these set routines) of the respective fields. */
4784/*  Multiple releases spelled 'initial' as 'inital' .
4785    The 'inital' spelling should not be used. */
4786Dwarf_Half dwarf_set_frame_rule_inital_value(Dwarf_Debug /*dbg*/,
4787    Dwarf_Half /*value*/);
4788/*  Additional interface with correct 'initial' spelling. */
4789/*  It is likely you will want to call the following 6 functions
4790    before accessing any frame information.  All are useful
4791    to tailor handling of pseudo-registers needed to turn
4792    frame operation references into simpler forms and to
4793    reflect ABI specific data.  Of course altering libdwarf.h
4794    and dwarf.h allow the same capabilities, but header changes
4795    in the distribution would require you re-integrate your
4796    libdwarf.h changes into the distributed libdwarf.h ...
4797    so use the following functions instead.*/
4798Dwarf_Half dwarf_set_frame_rule_initial_value(Dwarf_Debug /*dbg*/,
4799    Dwarf_Half /*value*/);
4800Dwarf_Half dwarf_set_frame_rule_table_size(Dwarf_Debug /*dbg*/,
4801    Dwarf_Half /*value*/);
4802Dwarf_Half dwarf_set_frame_cfa_value(Dwarf_Debug /*dbg*/,
4803    Dwarf_Half /*value*/);
4804Dwarf_Half dwarf_set_frame_same_value(Dwarf_Debug /*dbg*/,
4805    Dwarf_Half /*value*/);
4806Dwarf_Half dwarf_set_frame_undefined_value(Dwarf_Debug /*dbg*/,
4807    Dwarf_Half /*value*/);
4808/*  dwarf_set_default_address_size only sets 'value' if value is
4809    greater than zero. */
4810Dwarf_Small dwarf_set_default_address_size(Dwarf_Debug /*dbg*/,
4811    Dwarf_Small /* value */);
4812
4813/*  As of April 27, 2009, this version with no diepointer is
4814    obsolete though supported.  Use dwarf_get_ranges_a() instead. */
4815int dwarf_get_ranges(Dwarf_Debug /*dbg*/,
4816    Dwarf_Off /*rangesoffset*/,
4817    Dwarf_Ranges ** /*rangesbuf*/,
4818    Dwarf_Signed * /*listlen*/,
4819    Dwarf_Unsigned * /*bytecount*/,
4820    Dwarf_Error * /*error*/);
4821
4822/* This adds the address_size argument. New April 27, 2009 */
4823int dwarf_get_ranges_a(Dwarf_Debug /*dbg*/,
4824    Dwarf_Off /*rangesoffset*/,
4825    Dwarf_Die  /* diepointer */,
4826    Dwarf_Ranges ** /*rangesbuf*/,
4827    Dwarf_Signed * /*listlen*/,
4828    Dwarf_Unsigned * /*bytecount*/,
4829    Dwarf_Error * /*error*/);
4830
4831void dwarf_ranges_dealloc(Dwarf_Debug /*dbg*/,
4832    Dwarf_Ranges * /*rangesbuf*/,
4833    Dwarf_Signed /*rangecount*/);
4834
4835/* ======= START .debug_rnglists interfaces.  New May 2020 */
4836struct Dwarf_Rnglists_Entry_s;
4837typedef struct Dwarf_Rnglists_Entry_s * Dwarf_Rnglists_Entry;
4838struct Dwarf_Rnglists_Head_s;
4839typedef struct Dwarf_Rnglists_Head_s * Dwarf_Rnglists_Head;
4840
4841/*  For DWARF5 DW_AT_ranges: DW_FORM_sec_offset DW_FORM_rnglistx */
4842int dwarf_rnglists_get_rle_head(Dwarf_Attribute       /*attr*/,
4843    Dwarf_Half            /*theform*/,
4844    Dwarf_Unsigned        /*index_or_offset_value*/,
4845    Dwarf_Rnglists_Head * /*head_out*/,
4846    Dwarf_Unsigned *      /*count_of_entries_in_head*/,
4847    Dwarf_Unsigned *      /*global_offset_of_rle_set*/,
4848    Dwarf_Error    *      /*error*/);
4849
4850/*  Get the rnglist entries details */
4851int dwarf_get_rnglists_entry_fields(Dwarf_Rnglists_Head /*head*/,
4852    Dwarf_Unsigned   /*entrynum*/,
4853    unsigned int   * /*entrylen*/,
4854    unsigned int   * /*code*/,
4855    Dwarf_Unsigned * /*raw1*/,
4856    Dwarf_Unsigned * /*raw2*/,
4857    Dwarf_Unsigned * /*cooked1*/,
4858    Dwarf_Unsigned * /*cooked2*/,
4859    Dwarf_Error    * /*error*/);
4860
4861int dwarf_dealloc_rnglists_head(Dwarf_Rnglists_Head );
4862
4863/*  Loads all the rnglists headers and
4864    returns DW_DLV_NO_ENTRY if the section
4865    is missing or empty.
4866    Intended to be done quite early and
4867    it is automatically
4868    done if .debug_info is loaded.
4869    Doing it more than once is never necessary
4870    or harmful. There is no deallocation call
4871    made visible, deallocation happens
4872    when dwarf_finish() is called.
4873    With DW_DLV_OK it returns the number of
4874    rnglists headers in the section through
4875    rnglists_count. */
4876int dwarf_load_rnglists(Dwarf_Debug /*dbg*/,
4877    Dwarf_Unsigned * /*rnglists_count*/,
4878    Dwarf_Error * /*err*/);
4879
4880/*  Retrieve the offset from the context-index'th
4881    rangelists context  and the offsetentry_index
4882    element of the array of offsets.
4883    If an index is too large to be correct
4884    this returns DW_DLV_NO_ENTRY.
4885    If all is correct it returns DW_DLV_OK and
4886    sets *offset_value_out to the offset of
4887    the range list from the base of the offset
4888    array, and *global_offset_value_out is set
4889    to the .debug_rnglists section offset of
4890    the range list. */
4891int dwarf_get_rnglist_offset_index_value(Dwarf_Debug /*dbg*/,
4892    Dwarf_Unsigned   /*context_index*/,
4893    Dwarf_Unsigned   /*offsetentry_index*/,
4894    Dwarf_Unsigned * /*offset_value_out*/,
4895    Dwarf_Unsigned * /*global_offset_value_out*/,
4896    Dwarf_Error * /*error*/);
4897
4898
4899/*  Used by dwarfdump to print basic data from the
4900    data generated to look at a specific rangelist
4901    as returned by  dwarf_rnglists_index_get_rle_head()
4902    or dwarf_rnglists_offset_get_rle_head. */
4903int dwarf_get_rnglist_head_basics(Dwarf_Rnglists_Head /*head*/,
4904    Dwarf_Unsigned * /*rle_count*/,
4905    Dwarf_Unsigned * /*rnglists_version*/,
4906    Dwarf_Unsigned * /*rnglists_index_returned*/,
4907    Dwarf_Unsigned * /*bytes_total_in_rle*/,
4908    Dwarf_Half     * /*offset_size*/,
4909    Dwarf_Half     * /*address_size*/,
4910    Dwarf_Half     * /*segment_selector_size*/,
4911    Dwarf_Unsigned * /*overall offset_of_this_context*/,
4912    Dwarf_Unsigned * /*total_length of this context*/,
4913    Dwarf_Unsigned * /*offset_table_offset*/,
4914    Dwarf_Unsigned * /*offset_table_entrycount*/,
4915    Dwarf_Bool     * /*rnglists_base_present*/,
4916    Dwarf_Unsigned * /*rnglists_base*/,
4917    Dwarf_Bool     * /*rnglists_base_address_present*/,
4918    Dwarf_Unsigned * /*rnglists_base_address*/,
4919    Dwarf_Bool     * /*rnglists_debug_addr_base_present*/,
4920    Dwarf_Unsigned * /*rnglists_debug_addr_base*/,
4921    Dwarf_Error    * /*error*/);
4922
4923/*  Enables printing of details about the Range List Table
4924    Headers, one header per call. Index starting at 0.
4925    Returns DW_DLV_NO_ENTRY if index is too high for the table.
4926    A .debug_rnglists section may contain any number
4927    of Range List Table Headers with their details.  */
4928int dwarf_get_rnglist_context_basics(Dwarf_Debug  /*dbg*/,
4929    Dwarf_Unsigned  /*index*/,
4930    Dwarf_Unsigned * /*header_offset*/,
4931    Dwarf_Small  *   /*offset_size*/,
4932    Dwarf_Small  *   /*extension_size*/,
4933    unsigned int *   /*version*/, /* 5 */
4934    Dwarf_Small  *   /*address_size*/,
4935    Dwarf_Small  *   /*segment_selector_size*/,
4936    Dwarf_Unsigned * /*offset_entry_count*/,
4937    Dwarf_Unsigned * /*offset_of_offset_array*/,
4938    Dwarf_Unsigned * /*offset_of_first_rangeentry*/,
4939    Dwarf_Unsigned * /*offset_past_last_rangeentry*/,
4940    Dwarf_Error *    /*err*/);
4941
4942/*  entry offset is offset_of_first_rangeentry.
4943    Stop when the returned *next_entry_offset
4944    is == offset_past_last_rangentry (from
4945    dwarf_get_rnglist_context_plus).
4946    This only makes sense within those ranges.
4947    This retrieves raw detail from the section,
4948    no base values or anything are added.
4949    So this returns raw individual entries
4950    for a single rnglist header, meaning a
4951    a single Dwarf_Rnglists_Context.
4952
4953    This interface assumes there is no
4954    segment selector. */
4955int dwarf_get_rnglist_raw_entry_detail(Dwarf_Debug  /*dbg*/,
4956    Dwarf_Unsigned  /*entry_offset*/,
4957    Dwarf_Unsigned * /*entry_kind*/,
4958    Dwarf_Unsigned * /*entry_operand1*/,
4959    Dwarf_Unsigned * /*entry_operand2*/,
4960    Dwarf_Unsigned *  /*next_entry_offset*/,
4961    Dwarf_Error * /*err*/);
4962
4963/*  If no error, returns DW_DLV_OK and sets
4964    the entry length,kind, and operands through
4965    the pointers. If any missing operands assign
4966    zero back through tye operand pointers. */
4967
4968int dwarf_get_rnglist_rle( Dwarf_Debug /*dbg*/,
4969    Dwarf_Unsigned /*contextnumber*/,
4970    Dwarf_Unsigned /*entry_offset*/,
4971    Dwarf_Unsigned /*endoffset*/,
4972    unsigned int   * /*entrylen*/,
4973    unsigned int   * /*entry_kind*/,
4974    Dwarf_Unsigned * /*entry_operand1*/,
4975    Dwarf_Unsigned * /*entry_operand2*/,
4976    Dwarf_Error * /*err*/);
4977
4978/* ======= END .debug_rnglists interfaces.  */
4979/* ======= START .debug_loclists interfaces.  New May 2020 */
4980/*  These interfaces allow reading the .debug_loclists
4981    section.  Normal use of .debug_loclists uses
4982    dwarf_get_loclist_c() to open access to any kind of location
4983    or loclist and uses dwarf_loc_head_c_dealloc() to
4984    deallocate that memory once one is finished with
4985    that data. So for most purposes you do not need
4986    to use these functions  */
4987struct Dwarf_Loclists_Entry_s;
4988typedef struct Dwarf_Loclists_Entry_s * Dwarf_Loclists_Entry;
4989
4990/*  See dwarf_get_loclist_c() to open a Dwarf_Loc_Head_c
4991    on any type of location list or expression. */
4992
4993/*  Get the loclists entries details */
4994int dwarf_get_loclists_entry_fields(Dwarf_Loc_Head_c /*head*/,
4995    Dwarf_Unsigned   /*entrynum*/,
4996    unsigned int   * /*entrylen*/,
4997    unsigned int   * /*code*/,
4998    Dwarf_Unsigned * /*raw1*/,
4999    Dwarf_Unsigned * /*raw2*/,
5000    Dwarf_Unsigned * /*cooked1*/,
5001    Dwarf_Unsigned * /*cooked2*/,
5002    Dwarf_Error    * /*error*/);
5003
5004/*  Loads all the loclists headers and
5005    returns DW_DLV_NO_ENTRY if the section
5006    is missing or empty.
5007    Intended to be done quite early and
5008    it is automatically
5009    done if .debug_info is loaded.
5010    Doing it more than once is never necessary
5011    or harmful. There is no deallocation call
5012    made visible, deallocation happens
5013    when dwarf_finish() is called.
5014    With DW_DLV_OK it returns the number of
5015    loclists headers in the section through
5016    loclists_count. */
5017int dwarf_load_loclists(Dwarf_Debug /*dbg*/,
5018    Dwarf_Unsigned * /*loclists_count*/,
5019    Dwarf_Error * /*err*/);
5020
5021/*  Retrieve the offset from the context-index'th
5022    loclists context  and the offsetentry_index
5023    element of the array of offsets.
5024    If an index is too large to be correct
5025    this returns DW_DLV_NO_ENTRY.
5026    If all is correct it returns DW_DLV_OK and
5027    sets *offset_value_out to the offset of
5028    the range list from the base of the offset
5029    array, and *global_offset_value_out is set
5030    to the .debug_loclists section offset of
5031    the range list. */
5032int dwarf_get_loclist_offset_index_value(Dwarf_Debug /*dbg*/,
5033    Dwarf_Unsigned   /*context_index*/,
5034    Dwarf_Unsigned   /*offsetentry_index*/,
5035    Dwarf_Unsigned * /*offset_value_out*/,
5036    Dwarf_Unsigned * /*global_offset_value_out*/,
5037    Dwarf_Error * /*error*/);
5038
5039/*  Used by dwarfdump to print basic data from the
5040    data generated to look at a specific rangelist
5041    as returned by  dwarf_loclists_index_get_lle_head()
5042    or dwarf_loclists_offset_get_lle_head. */
5043int dwarf_get_loclist_head_basics(Dwarf_Loc_Head_c /*head*/,
5044    Dwarf_Small    * /*lkind*/,
5045    Dwarf_Unsigned * /*lle_count*/,
5046    Dwarf_Unsigned * /*loclists_version*/,
5047    Dwarf_Unsigned * /*loclists_index_returned*/,
5048    Dwarf_Unsigned * /*bytes_total_in_rle*/,
5049    Dwarf_Half     * /*offset_size*/,
5050    Dwarf_Half     * /*address_size*/,
5051    Dwarf_Half     * /*segment_selector_size*/,
5052    Dwarf_Unsigned * /*overall offset_of_this_context*/,
5053    Dwarf_Unsigned * /*total_length of this context*/,
5054    Dwarf_Unsigned * /*offset_table_offset*/,
5055    Dwarf_Unsigned * /*offset_table_entrycount*/,
5056    Dwarf_Bool     * /*loclists_base_present*/,
5057    Dwarf_Unsigned * /*loclists_base*/,
5058    Dwarf_Bool     * /*loclists_base_address_present*/,
5059    Dwarf_Unsigned * /*loclists_base_address*/,
5060    Dwarf_Bool     * /*loclists_debug_addr_base_present*/,
5061    Dwarf_Unsigned * /*loclists_debug_addr_base*/,
5062    Dwarf_Unsigned * /*offset_this_lle_area*/,
5063    Dwarf_Error    * /*error*/);
5064
5065/*  Enables printing of details about the Range List Table
5066    Headers, one header per call. Index starting at 0.
5067    Returns DW_DLV_NO_ENTRY if index is too high for the table.
5068    A .debug_loclists section may contain any number
5069    of Location  List Table Headers with their details.  */
5070int dwarf_get_loclist_context_basics(Dwarf_Debug  /*dbg*/,
5071    Dwarf_Unsigned  /*index*/,
5072    Dwarf_Unsigned * /*header_offset*/,
5073    Dwarf_Small  *   /*offset_size*/,
5074    Dwarf_Small  *   /*extension_size*/,
5075    unsigned int *   /*version*/, /* 5 */
5076    Dwarf_Small  *   /*address_size*/,
5077    Dwarf_Small  *   /*segment_selector_size*/,
5078    Dwarf_Unsigned * /*offset_entry_count*/,
5079    Dwarf_Unsigned * /*offset_of_offset_array*/,
5080    Dwarf_Unsigned * /*offset_of_first_locentry*/,
5081    Dwarf_Unsigned * /*offset_past_last_locentry*/,
5082    Dwarf_Error *    /*err*/);
5083
5084/*  entry offset is offset_of_first_locentry.
5085    Stop when the returned *next_entry_offset
5086    is == offset_past_last_locentry (from
5087    dwarf_get_loclist_context_plus).
5088    This only makes sense within those ranges.
5089    This retrieves raw detail from the section,
5090    no base values or anything are added.
5091    So this returns raw individual entries
5092    for a single loclist header, meaning a
5093    a single Dwarf_Loclists_Context.
5094
5095    This interface assumes there is no
5096    segment selector. */
5097int dwarf_get_loclist_raw_entry_detail(Dwarf_Debug  /*dbg*/,
5098    Dwarf_Unsigned  /*entry_offset*/,
5099    Dwarf_Unsigned * /*entry_kind*/,
5100    Dwarf_Unsigned * /*entry_operand1*/,
5101    Dwarf_Unsigned * /*entry_operand2*/,
5102    Dwarf_Unsigned *  /*next_entry_offset*/,
5103    Dwarf_Error * /*err*/);
5104
5105/*  If no error, returns DW_DLV_OK and sets
5106    the entry length,kind, and operands through
5107    the pointers. If any missing operands assign
5108    zero back through tye operand pointers. */
5109
5110int dwarf_get_loclist_lle( Dwarf_Debug /*dbg*/,
5111    Dwarf_Unsigned   /*contextnumber*/,
5112    Dwarf_Unsigned   /*entry_offset*/,
5113    Dwarf_Unsigned   /*endoffset*/,
5114    unsigned int *   /*entrylen*/,
5115    unsigned int *   /*entry_kind*/,
5116    Dwarf_Unsigned * /*entry_operand1*/,
5117    Dwarf_Unsigned * /*entry_operand2*/,
5118    Dwarf_Unsigned * /*expr_ops_blocksize*/,
5119    Dwarf_Unsigned * /*expr_ops_offset*/,
5120    Dwarf_Small   ** /*expr_opsdata*/,
5121    Dwarf_Error * /*err*/);
5122
5123/* ======= END .debug_loclists interfaces.  */
5124
5125/*  New April 2018.
5126    Allows applications to print the .debug_str_offsets
5127    section.
5128    Beginning at starting_offset zero,
5129    returns data about the first table found.
5130    The value *next_table_offset is the value
5131    of the next table (if any), one byte past
5132    the end of the table whose data is returned..
5133    Returns DW_DLV_NO_ENTRY if the starting offset
5134    is past the end of valid data.
5135
5136    There is no guarantee that there are no non-0 nonsense
5137    bytes in the section outside of useful tables,
5138    so this can fail and return nonsense or
5139    DW_DLV_ERROR  if such garbage exists.
5140*/
5141
5142struct Dwarf_Str_Offsets_Table_s;
5143typedef struct  Dwarf_Str_Offsets_Table_s *  Dwarf_Str_Offsets_Table;
5144
5145/*  Allocates a struct Dwarf_Str_Offsets_Table_s for the section
5146    and returns DW_DLV_OK and sets a pointer to the struct through
5147    the table_data pointer if successful.
5148
5149    If there is no such section it returns DW_DLV_NO_ENTRY. */
5150int dwarf_open_str_offsets_table_access(Dwarf_Debug  /*dbg*/,
5151    Dwarf_Str_Offsets_Table * /*table_data*/,
5152    Dwarf_Error             * /*error*/);
5153
5154/*  Close access, free table_data. */
5155int dwarf_close_str_offsets_table_access(
5156    Dwarf_Str_Offsets_Table   /*table_data*/,
5157    Dwarf_Error             * /*error*/);
5158
5159/*  Call till it returns DW_DLV_NO_ENTRY (normal end)
5160    or DW_DLV_ERROR (error) and stop.
5161
5162    On successful call, call dwarf_str_offsets_table_entry()
5163    to get the individual table values on the now-active table. */
5164int dwarf_next_str_offsets_table( Dwarf_Str_Offsets_Table /*table_data*/,
5165    Dwarf_Unsigned * /*unit_length*/,
5166    Dwarf_Unsigned * /*unit_length_offset*/,
5167    Dwarf_Unsigned * /*table_start_offset*/,
5168    Dwarf_Half     * /*entry_size*/,
5169    Dwarf_Half     * /*version*/,
5170    Dwarf_Half     * /*padding*/,
5171    Dwarf_Unsigned * /*table_value_count*/,
5172    Dwarf_Error    * /*error*/);
5173
5174/*  Valid index values n:  0 <= n <  table_entry_count
5175    for the active table */
5176int dwarf_str_offsets_value_by_index(Dwarf_Str_Offsets_Table /*table_data*/,
5177    Dwarf_Unsigned   /*index_to_entry*/,
5178    Dwarf_Unsigned * /*entry_value*/,
5179    Dwarf_Error    * /*error*/);
5180
5181/*  After all str_offsets read this reports final
5182    wasted-bytes count. */
5183int dwarf_str_offsets_statistics(Dwarf_Str_Offsets_Table /*table_data*/,
5184    Dwarf_Unsigned * /*wasted_byte_count*/,
5185    Dwarf_Unsigned * /*table_count*/,
5186    Dwarf_Error    * /*error*/);
5187
5188/* The harmless error list is a circular buffer of
5189   errors we note but which do not stop us from processing
5190   the object.  Created so dwarfdump or other tools
5191   can report such inconsequential errors without causing
5192   anything to stop early. */
5193#define DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE 4
5194#define DW_HARMLESS_ERROR_MSG_STRING_SIZE   300
5195/* User code supplies size of array of pointers errmsg_ptrs_array
5196    in count and the array of pointers (the pointers themselves
5197    need not be initialized).
5198    The pointers returned in the array of pointers
5199    are invalidated by ANY call to libdwarf.
5200    Use them before making another libdwarf call!
5201    The array of string pointers passed in always has
5202    a final null pointer, so if there are N pointers the
5203    and M actual strings, then MIN(M,N-1) pointers are
5204    set to point to error strings.  The array of pointers
5205    to strings always terminates with a NULL pointer.
5206    If 'count' is passed in zero then errmsg_ptrs_array
5207    is not touched.
5208
5209    The function returns DW_DLV_NO_ENTRY if no harmless errors
5210    were noted so far.  Returns DW_DLV_OK if there are errors.
5211    Never returns DW_DLV_ERROR.
5212
5213    Each call empties the error list (discarding all current entries).
5214    If newerr_count is non-NULL the count of harmless errors
5215    since the last call is returned through the pointer
5216    (some may have been discarded or not returned, it is a circular
5217    list...).
5218    If DW_DLV_NO_ENTRY is returned none of the arguments
5219    here are touched or used.
5220    */
5221int dwarf_get_harmless_error_list(Dwarf_Debug /*dbg*/,
5222    unsigned int   /*count*/,
5223    const char **  /*errmsg_ptrs_array*/,
5224    unsigned int * /*newerr_count*/);
5225
5226/*  Insertion is only for testing the harmless error code, it is not
5227    necessarily useful otherwise. */
5228void dwarf_insert_harmless_error(Dwarf_Debug /*dbg*/,
5229    char * /*newerror*/);
5230
5231/*  The size of the circular list of strings may be set
5232    and reset as needed.  If it is shortened excess
5233    messages are simply dropped.  It returns the previous
5234    size. If zero passed in the size is unchanged
5235    and it simply returns the current size  */
5236unsigned int dwarf_set_harmless_error_list_size(Dwarf_Debug /*dbg*/,
5237    unsigned int /*maxcount*/);
5238/*  The harmless error strings (if any) are freed when the dbg
5239    is dwarf_finish()ed. */
5240
5241/*  When the val_in is known these dwarf_get_TAG_name (etc)
5242    functions return the string corresponding to the val_in passed in
5243    through the pointer s_out and the value returned is DW_DLV_OK.
5244    The strings are in static storage
5245    and must not be freed.
5246    If DW_DLV_NO_ENTRY is returned the val_in is not known and
5247    *s_out is not set.  DW_DLV_ERROR is never returned.*/
5248
5249/* The following copied from a generated dwarf_names.h */
5250
5251/* BEGIN FILE */
5252extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5253extern int dwarf_get_ADDR_name(unsigned int /*val_in*/, const char ** /*s_out */);
5254extern int dwarf_get_ATCF_name(unsigned int /*val_in*/, const char ** /*s_out */);
5255extern int dwarf_get_ATE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5256extern int dwarf_get_AT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5257extern int dwarf_get_CC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5258extern int dwarf_get_CFA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5259extern int dwarf_get_children_name(unsigned int /*val_in*/, const char ** /*s_out */);
5260extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/, const char ** /*s_out */);
5261extern int dwarf_get_DEFAULTED_name(unsigned int /*val_in*/, const char ** /*s_out */);
5262extern int dwarf_get_DSC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5263extern int dwarf_get_DS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5264extern int dwarf_get_EH_name(unsigned int /*val_in*/, const char ** /*s_out */);
5265extern int dwarf_get_END_name(unsigned int /*val_in*/, const char ** /*s_out */);
5266extern int dwarf_get_FORM_name(unsigned int /*val_in*/, const char ** /*s_out */);
5267extern int dwarf_get_FRAME_name(unsigned int /*val_in*/, const char ** /*s_out */);
5268extern int dwarf_get_ID_name(unsigned int /*val_in*/, const char ** /*s_out */);
5269extern int dwarf_get_IDX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5270extern int dwarf_get_INL_name(unsigned int /*val_in*/, const char ** /*s_out */);
5271extern int dwarf_get_ISA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5272extern int dwarf_get_LANG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5273extern int dwarf_get_LLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5274/*  dwarf_get_LLEX_name is likely just temporary. Not standard. */
5275extern int dwarf_get_LLEX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5276extern int dwarf_get_LNCT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5277extern int dwarf_get_LNE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5278extern int dwarf_get_LNS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5279extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5280extern int dwarf_get_MACRO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5281extern int dwarf_get_OP_name(unsigned int /*val_in*/, const char ** /*s_out */);
5282extern int dwarf_get_ORD_name(unsigned int /*val_in*/, const char ** /*s_out */);
5283extern int dwarf_get_RLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5284extern int dwarf_get_SECT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5285extern int dwarf_get_TAG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5286extern int dwarf_get_UT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5287extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/, const char ** /*s_out */);
5288extern int dwarf_get_VIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5289/* END FILE */
5290
5291/* Convert local offset into global offset */
5292int dwarf_convert_to_global_offset(Dwarf_Attribute  /*attr*/,
5293    Dwarf_Off        /*offset*/,
5294    Dwarf_Off*       /*ret_offset*/,
5295    Dwarf_Error*     /*error*/);
5296
5297/* Get both offsets (local and global) */
5298int dwarf_die_offsets(Dwarf_Die     /*die*/,
5299    Dwarf_Off*    /*global_offset*/,
5300    Dwarf_Off*    /*local_offset*/,
5301    Dwarf_Error*  /*error*/);
5302
5303/* Giving a section name, get its size and address */
5304int dwarf_get_section_info_by_name(Dwarf_Debug      /*dbg*/,
5305    const char *     /*section_name*/,
5306    Dwarf_Addr*      /*section_addr*/,
5307    Dwarf_Unsigned*  /*section_size*/,
5308    Dwarf_Error*     /*error*/);
5309
5310/* Giving a section index, get its size and address */
5311int dwarf_get_section_info_by_index(Dwarf_Debug      /*dbg*/,
5312    int              /*section_index*/,
5313    const char **    /*section_name*/,
5314    Dwarf_Addr*      /*section_addr*/,
5315    Dwarf_Unsigned*  /*section_size*/,
5316    Dwarf_Error*     /*error*/);
5317
5318/*  Get section count, of object file sections. */
5319int dwarf_get_section_count(Dwarf_Debug /*dbg*/);
5320
5321/*  Get the version and offset size of a CU context.
5322    This is useful as a precursor to
5323    calling dwarf_get_form_class() at times.  */
5324int dwarf_get_version_of_die(Dwarf_Die /*die*/,
5325    Dwarf_Half * /*version*/,
5326    Dwarf_Half * /*offset_size*/);
5327
5328int dwarf_discr_list(Dwarf_Debug /*dbg*/,
5329    Dwarf_Small    * /*blockpointer*/,
5330    Dwarf_Unsigned   /*blocklen*/,
5331    Dwarf_Dsc_Head * /*dsc_head_out*/,
5332    Dwarf_Unsigned * /*dsc_array_length_out*/,
5333    Dwarf_Error    * /*error*/);
5334
5335/*  NEW September 2016. Allows easy access to DW_AT_discr_list
5336    entry. Callers must know which is the appropriate
5337    one of the following two interfaces, though both
5338    will work. */
5339int dwarf_discr_entry_u(Dwarf_Dsc_Head /* dsc */,
5340    Dwarf_Unsigned   /*entrynum*/,
5341    Dwarf_Half     * /*out_type*/,
5342    Dwarf_Unsigned * /*out_discr_low*/,
5343    Dwarf_Unsigned * /*out_discr_high*/,
5344    Dwarf_Error    * /*error*/);
5345
5346/*  NEW September 2016. Allows easy access to DW_AT_discr_list
5347    entry. */
5348int dwarf_discr_entry_s(Dwarf_Dsc_Head /* dsc */,
5349    Dwarf_Unsigned   /*entrynum*/,
5350    Dwarf_Half     * /*out_type*/,
5351    Dwarf_Signed   * /*out_discr_low*/,
5352    Dwarf_Signed   * /*out_discr_high*/,
5353    Dwarf_Error    * /*error*/);
5354
5355/*  New May 2017.  So users can find out what groups (dwo or COMDAT)
5356    are in the object and how much to allocate so one can get the
5357    group-section map data. */
5358int dwarf_sec_group_sizes(Dwarf_Debug /*dbg*/,
5359    Dwarf_Unsigned * /*section_count_out*/,
5360    Dwarf_Unsigned * /*group_count_out*/,
5361    Dwarf_Unsigned * /*selected_group_out*/,
5362    Dwarf_Unsigned * /*map_entry_count_out*/,
5363    Dwarf_Error    * /*error*/);
5364
5365/*  New May 2017. Reveals the map between group numbers and section numbers.
5366    Caller must allocate the arrays with space for 'map_entry_count'
5367    values and this function fills in the array entries.
5368    Output ordered by group number and section number.
5369    */
5370int dwarf_sec_group_map(Dwarf_Debug /*dbg*/,
5371    Dwarf_Unsigned   /*map_entry_count*/,
5372    Dwarf_Unsigned * /*group_numbers_array*/,
5373    Dwarf_Unsigned * /*sec_numbers_array*/,
5374    const char    ** /*sec_names_array*/,
5375    Dwarf_Error    * /*error*/);
5376
5377/*  dwarf_get_endian_copy_function new. December 2019. */
5378void (*dwarf_get_endian_copy_function(Dwarf_Debug /*dbg*/))(void *, const void * /*src*/, unsigned long /*srclen*/);
5379
5380/*  These make the  LEB encoding routines visible to libdwarf
5381    callers. Added November, 2012. */
5382int dwarf_encode_leb128(Dwarf_Unsigned /*val*/,
5383    int * /*nbytes*/,
5384    char * /*space*/,
5385    int /*splen*/);
5386int dwarf_encode_signed_leb128(Dwarf_Signed /*val*/,
5387    int * /*nbytes*/,
5388    char * /*space*/,
5389    int /*splen*/);
5390
5391/*  Record some application command line options in libdwarf.
5392    This is not arc/argv processing, just precooked setting
5393    of a flag in libdwarf based on something the application
5394    wants.  check_verbose_mode of TRUE means do more checking
5395    and sometimes print errors (from libdwarf).
5396    Not restricted to a single Dwarf_Debug, it applies
5397    to the libdwarf the executable is using.
5398*/
5399typedef struct {
5400    Dwarf_Bool check_verbose_mode;
5401} Dwarf_Cmdline_Options;
5402extern Dwarf_Cmdline_Options dwarf_cmdline_options;
5403
5404/* Set libdwarf to reflect some application command line options. */
5405void dwarf_record_cmdline_options(Dwarf_Cmdline_Options /*options*/);
5406
5407int dwarf_pro_get_string_stats(Dwarf_P_Debug /*dbg*/,
5408    Dwarf_Unsigned * /*str_count*/,
5409    Dwarf_Unsigned * /*str_total_length*/,
5410    Dwarf_Unsigned * /*count_debug_str*/,
5411    Dwarf_Unsigned * /*len_debug_str*/,
5412    Dwarf_Unsigned * /*reused_count*/,
5413    Dwarf_Unsigned * /*reused_len*/,
5414    Dwarf_Error    * /*error*/);
5415
5416#ifndef DW_FTYPE_UNKNOWN
5417#define DW_FTYPE_UNKNOWN    0
5418#define DW_FTYPE_ELF        1  /* Unix/Linux/etc */
5419#define DW_FTYPE_MACH_O     2  /* MacOS. */
5420#define DW_FTYPE_PE         3  /* Windows */
5421#define DW_FTYPE_ARCHIVE    4  /* unix archive */
5422#define DW_FTYPE_CUSTOM_ELF 5  /* Custom ELF format. Ignore this. */
5423#endif /* DW_FTYPE_UNKNOWN */
5424
5425#ifndef DW_ENDIAN_UNKNOWN
5426#define DW_ENDIAN_UNKNOWN  0
5427#define DW_ENDIAN_BIG      1
5428#define DW_ENDIAN_LITTLE   2
5429#endif /* DW_ENDIAN_UNKNOWN */
5430
5431/*  Defined March 7 2020. Allows a caller to
5432    avoid most tracking by the de_alloc_tree hash
5433    table if called with v of zero.
5434    Returns the value the flag was before this call. */
5435int dwarf_set_de_alloc_flag(int v);
5436
5437int dwarf_object_detector_path(const char  *path,
5438    char *outpath,
5439    unsigned long,
5440    unsigned int * ftype,
5441    unsigned int * endian,
5442    unsigned int * offsetsize,
5443    Dwarf_Unsigned *filesize,
5444    int * errcode);
5445
5446int dwarf_object_detector_fd(int fd,
5447    unsigned int *ftype,
5448    unsigned int *endian,
5449    unsigned int *offsetsize,
5450    Dwarf_Unsigned  *filesize,
5451    int * errcode);
5452
5453#ifdef __cplusplus
5454}
5455#endif
5456#endif /* _LIBDWARF_H */
5457