xref: /titanic_41/usr/src/tools/ctf/dwarf/common/libdwarf.h (revision 654b400c387942fc00d4f6869539adbd7b25fbce)
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-2010 David Anderson. All rights reserved.
6   Portions Copyright 2008-2010 Arxan Technologies, Inc. All rights reserved.
7 
8   This program is free software; you can redistribute it and/or modify it
9   under the terms of version 2.1 of the GNU Lesser General Public License
10   as published by the Free Software Foundation.
11 
12   This program is distributed in the hope that it would be useful, but
13   WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16   Further, this software is distributed without any warranty that it is
17   free of the rightful claim of any third person regarding infringement
18   or the like.  Any license provided herein, whether implied or
19   otherwise, applies only to this software file.  Patent licenses, if
20   any, provided herein do not apply to combinations of this program with
21   other software, or any other product whatsoever.
22 
23   You should have received a copy of the GNU Lesser General Public
24   License along with this program; if not, write the Free Software
25   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
26   USA.
27 
28   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
29   Mountain View, CA 94043, or:
30 
31   http://www.sgi.com
32 
33   For further information regarding this notice, see:
34 
35   http://oss.sgi.com/projects/GenInfo/NoticeExplan
36 
37 */
38 
39 
40 #ifndef _LIBDWARF_H
41 #define _LIBDWARF_H
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 /*
46     libdwarf.h
47     $Revision: #9 $ $Date: 2008/01/17 $
48 
49     For libdwarf producers and consumers
50 
51     The interface is defined as having 8-byte signed and unsigned
52     values so it can handle 64-or-32bit target on 64-or-32bit host.
53     Addr is the native size: it represents pointers on
54     the host machine (not the target!).
55 
56     This contains declarations for types and all producer
57     and consumer functions.
58 
59     Function declarations are written on a single line each here
60     so one can use grep  to each declaration in its entirety.
61     The declarations are a little harder to read this way, but...
62 
63 */
64 
65 struct Elf;
66 typedef struct Elf* dwarf_elf_handle;
67 
68 /* To enable printing with printf regardless of the
69    actual underlying data type, we define the DW_PR_xxx macros. */
70 #if (_MIPS_SZLONG == 64)
71 /* Special case for MIPS, so -64 (LP64) build gets simple -long-.
72    Non-MIPS LP64 or ILP64 environments should probably ensure
73    _MIPS_SZLONG set to 64 everywhere this header is #included.
74 */
75 typedef int             Dwarf_Bool;         /* boolean type */
76 typedef unsigned long   Dwarf_Off;          /* 4 or 8 byte file offset */
77 typedef unsigned long   Dwarf_Unsigned;     /* 4 or 8 byte unsigned value */
78 typedef unsigned short  Dwarf_Half;         /* 2 byte unsigned value */
79 typedef unsigned char   Dwarf_Small;        /* 1 byte unsigned value */
80 typedef signed   long   Dwarf_Signed;       /* 4 or 8 byte signed value */
81 typedef unsigned long   Dwarf_Addr;         /* target memory address */
82 #define  DW_PR_DUx  "lx"
83 #define  DW_PR_DSx  "lx"
84 #define  DW_PR_DUu  "lu"
85 #define  DW_PR_DSd  "ld"
86 
87 #else /* 32-bit */
88 /* This is for ILP32, allowing i/o of 64bit dwarf info.
89    Also should be fine for LP64 and ILP64 cases.
90 */
91 typedef int                 Dwarf_Bool;     /* boolean type */
92 typedef unsigned long long  Dwarf_Off;      /* 8 byte file offset */
93 typedef unsigned long long  Dwarf_Unsigned; /* 8 byte unsigned value*/
94 typedef unsigned short      Dwarf_Half;     /* 2 byte unsigned value */
95 typedef unsigned char       Dwarf_Small;    /* 1 byte unsigned value */
96 typedef signed   long long  Dwarf_Signed;   /* 8 byte signed value */
97 typedef unsigned long long  Dwarf_Addr;     /* target memory address */
98 #define  DW_PR_DUx  "llx"
99 #define  DW_PR_DSx  "llx"
100 #define  DW_PR_DUu  "llu"
101 #define  DW_PR_DSd  "lld"
102 #endif
103 #ifdef HAVE_NONSTANDARD_PRINTF_64_FORMAT
104 /* Windows does not use std C formatting, so allow it. */
105 #undef DW_PR_DUx
106 #undef DW_PR_DSx
107 #undef DW_PR_DUu
108 #undef DW_PR_DSd
109 #define  DW_PR_DUx  "I64x"
110 #define  DW_PR_DSx  "I64x"
111 #define  DW_PR_DUu  "I64u"
112 #define  DW_PR_DSd  "I64d"
113 #endif /* HAVE_NONSTANDARD_FORMAT */
114 
115 typedef void*        Dwarf_Ptr;          /* host machine pointer */
116 
117 /* Used for DW_FORM_ref_sig8. It is not a string, it
118    is 8 bytes of a signature one would use to find
119    a type unit. See dwarf_formsig8()
120 */
121 typedef struct  {
122     char signature[8];
123 } Dwarf_Sig8;
124 
125 /* Contains info on an uninterpreted block of data
126 */
127 typedef struct {
128     Dwarf_Unsigned  bl_len;         /* length of block */
129     Dwarf_Ptr       bl_data;        /* uninterpreted data */
130     Dwarf_Small     bl_from_loclist; /*non-0 if loclist, else debug_info*/
131     Dwarf_Unsigned  bl_section_offset; /* Section (not CU) offset
132                                         which 'data' comes from. */
133 } Dwarf_Block;
134 
135 
136 /* location record
137 */
138 typedef struct {
139     Dwarf_Small     lr_atom;        /* location operation */
140     Dwarf_Unsigned  lr_number;      /* operand */
141     Dwarf_Unsigned  lr_number2;     /* for OP_BREGx */
142     Dwarf_Unsigned  lr_offset;      /* offset in locexpr for OP_BRA etc */
143 } Dwarf_Loc;
144 
145 
146 /* location description
147 */
148 typedef struct {
149     Dwarf_Addr      ld_lopc;        /* beginning of active range */
150     Dwarf_Addr      ld_hipc;        /* end of active range */
151     Dwarf_Half      ld_cents;       /* count of location records */
152     Dwarf_Loc*      ld_s;           /* pointer to list of same */
153     Dwarf_Small     ld_from_loclist;
154                       /* non-0 if loclist, else debug_info*/
155 
156     Dwarf_Unsigned  ld_section_offset; /* Section (not CU) offset
157                     where loc-expr begins*/
158 } Dwarf_Locdesc;
159 
160 /* First appears in DWARF3.
161    The dwr_addr1/addr2 data is either an offset (DW_RANGES_ENTRY)
162    or an address (dwr_addr2 in DW_RANGES_ADDRESS_SELECTION) or
163    both are zero (DW_RANGES_END).
164 */
165 enum Dwarf_Ranges_Entry_Type { DW_RANGES_ENTRY,
166     DW_RANGES_ADDRESS_SELECTION,
167     DW_RANGES_END };
168 typedef struct {
169     Dwarf_Addr dwr_addr1;
170     Dwarf_Addr dwr_addr2;
171     enum Dwarf_Ranges_Entry_Type  dwr_type;
172 } Dwarf_Ranges;
173 
174 /* Frame description instructions expanded.
175 */
176 typedef struct {
177     Dwarf_Small     fp_base_op;
178     Dwarf_Small     fp_extended_op;
179     Dwarf_Half      fp_register;
180 
181     /* Value may be signed, depends on op.
182            Any applicable data_alignment_factor has
183            not been applied, this is the  raw offset. */
184     Dwarf_Unsigned  fp_offset;
185     Dwarf_Off       fp_instr_offset;
186 } Dwarf_Frame_Op; /* DWARF2 */
187 
188 typedef struct {
189     Dwarf_Small     fp_base_op;
190     Dwarf_Small     fp_extended_op;
191     Dwarf_Half      fp_register;
192 
193     /* Value may be signed, depends on op.
194            Any applicable data_alignment_factor has
195            not been applied, this is the  raw offset. */
196     Dwarf_Unsigned  fp_offset_or_block_len;
197     Dwarf_Small     *fp_expr_block;
198 
199     Dwarf_Off       fp_instr_offset;
200 } Dwarf_Frame_Op3;  /* DWARF3 and DWARF2 compatible */
201 
202 /*  ***IMPORTANT NOTE, TARGET DEPENDENCY ****
203    DW_REG_TABLE_SIZE must be at least as large as
204    the number of registers
205    (DW_FRAME_LAST_REG_NUM) as defined in dwarf.h
206    Preferably identical to DW_FRAME_LAST_REG_NUM.
207    Ensure [0-DW_REG_TABLE_SIZE] does not overlap
208    DW_FRAME_UNDEFINED_VAL or DW_FRAME_SAME_VAL.
209    Also ensure DW_FRAME_REG_INITIAL_VALUE is set to what
210    is appropriate to your cpu.
211    For various CPUs  DW_FRAME_UNDEFINED_VAL is correct
212    as the value for DW_FRAME_REG_INITIAL_VALUE.
213 
214    For consumer apps, this can be set dynamically: see
215    dwarf_set_frame_rule_table_size();
216  */
217 #ifndef DW_REG_TABLE_SIZE
218 #define DW_REG_TABLE_SIZE  66
219 #endif
220 
221 /* For MIPS, DW_FRAME_SAME_VAL is the correct default value
222    for a frame register value. For other CPUS another value
223    may be better, such as DW_FRAME_UNDEFINED_VAL.
224    See dwarf_set_frame_rule_table_size
225 */
226 #ifndef DW_FRAME_REG_INITIAL_VALUE
227 #define DW_FRAME_REG_INITIAL_VALUE DW_FRAME_SAME_VAL
228 #endif
229 
230 /* Taken as meaning 'undefined value', this is not
231    a column or register number.
232    Only present at libdwarf runtime in the consumer
233    interfaces. Never on disk.
234    DW_FRAME_* Values present on disk are in dwarf.h
235    Ensure this is > DW_REG_TABLE_SIZE (the reg table
236    size is changeable at runtime with the *reg3() interfaces,
237    and this value must be greater than the reg table size).
238 */
239 #define DW_FRAME_UNDEFINED_VAL          1034
240 
241 /* Taken as meaning 'same value' as caller had, not a column
242    or register number.
243    Only present at libdwarf runtime in the consumer
244    interfaces. Never on disk.
245    DW_FRAME_* Values present on disk are in dwarf.h
246    Ensure this is > DW_REG_TABLE_SIZE (the reg table
247    size is changeable at runtime with the *reg3() interfaces,
248    and this value must be greater than the reg table size).
249 */
250 #define DW_FRAME_SAME_VAL               1035
251 
252 /* For DWARF3 consumer interfaces, make the CFA a column with no
253    real table number.  This is what should have been done
254    for the DWARF2 interfaces.  This actually works for
255    both DWARF2 and DWARF3, but see the libdwarf documentation
256    on Dwarf_Regtable3 and  dwarf_get_fde_info_for_reg3()
257    and  dwarf_get_fde_info_for_all_regs3()
258    Do NOT use this with the older dwarf_get_fde_info_for_reg()
259    or dwarf_get_fde_info_for_all_regs() consumer interfaces.
260    Must be higher than any register count for *any* ABI
261    (ensures maximum applicability with minimum effort).
262    Ensure this is > DW_REG_TABLE_SIZE (the reg table
263    size is changeable at runtime with the *reg3() interfaces,
264    and this value must be greater than the reg table size).
265    Only present at libdwarf runtime in the consumer
266    interfaces. Never on disk.
267 */
268 #define DW_FRAME_CFA_COL3               1436
269 
270 /* The following are all needed to evaluate DWARF3 register rules.
271 */
272 #define DW_EXPR_OFFSET 0  /* DWARF2 only sees this. */
273 #define DW_EXPR_VAL_OFFSET 1
274 #define DW_EXPR_EXPRESSION 2
275 #define DW_EXPR_VAL_EXPRESSION 3
276 
277 typedef struct Dwarf_Regtable_Entry_s {
278     /*  For each index i (naming a hardware register with dwarf number
279             i) the following is true and defines the value of that register:
280 
281            If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
282          it is not DWARF register number but
283         a place holder indicating the register has no defined value.
284            If dw_regnum is Register DW_FRAME_SAME_VAL
285            it  is not DWARF register number but
286         a place holder indicating the register has the same
287                 value in the previous frame.
288        DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL are
289            only present at libdwarf runtime. Never on disk.
290            DW_FRAME_* Values present on disk are in dwarf.h
291 
292           Otherwise: the register number is a DWARF register number
293           (see ABI documents for how this translates to hardware/
294            software register numbers in the machine hardware)
295       and the following applies:
296 
297           if dw_value_type == DW_EXPR_OFFSET (the only case for dwarf2):
298             If dw_offset_relevant is non-zero, then
299                 the value is stored at at the address CFA+N where
300                 N is a signed offset.
301                 Rule: Offset(N)
302             If dw_offset_relevant is zero, then the value of the register
303                 is the value of (DWARF) register number dw_regnum.
304                 Rule: register(F)
305           Other values of dw_value_type are an error.
306         */
307     Dwarf_Small         dw_offset_relevant;
308 
309     /* For DWARF2, always 0 */
310         Dwarf_Small         dw_value_type;
311 
312     Dwarf_Half          dw_regnum;
313 
314     /* The data type here should  the larger of Dwarf_Addr
315            and Dwarf_Unsigned and Dwarf_Signed. */
316     Dwarf_Addr          dw_offset;
317 } Dwarf_Regtable_Entry;
318 
319 typedef struct Dwarf_Regtable_s {
320     struct Dwarf_Regtable_Entry_s rules[DW_REG_TABLE_SIZE];
321 } Dwarf_Regtable;
322 
323 /* opaque type. Functional interface shown later. */
324 struct Dwarf_Reg_value3_s;
325 typedef struct Dwarf_Reg_value3_s Dwarf_Reg_Value3;
326 
327 typedef struct Dwarf_Regtable_Entry3_s {
328     /*  For each index i (naming a hardware register with dwarf number
329         i) the following is true and defines the value of that register:
330 
331           If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
332              it is not DWARF register number but
333              a place holder indicating the register has no defined value.
334           If dw_regnum is Register DW_FRAME_SAME_VAL
335              it  is not DWARF register number but
336              a place holder indicating the register has the same
337              value in the previous frame.
338            DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL and
339              DW_FRAME_CFA_COL3 are only present at libdwarf runtime.
340              Never on disk.
341              DW_FRAME_* Values present on disk are in dwarf.h
342            Because DW_FRAME_SAME_VAL and DW_FRAME_UNDEFINED_VAL
343            and DW_FRAME_CFA_COL3 are defineable at runtime
344            consider the names symbolic in this comment, not absolute.
345 
346           Otherwise: the register number is a DWARF register number
347             (see ABI documents for how this translates to hardware/
348              software register numbers in the machine hardware)
349              and the following applies:
350 
351            In a cfa-defining entry (rt3_cfa_rule) the regnum is the
352            CFA 'register number'. Which is some 'normal' register,
353            not DW_FRAME_CFA_COL3, nor DW_FRAME_SAME_VAL, nor
354            DW_FRAME_UNDEFINED_VAL.
355 
356           If dw_value_type == DW_EXPR_OFFSET (the only  possible case for
357              dwarf2):
358             If dw_offset_relevant is non-zero, then
359                the value is stored at at the address
360                CFA+N where N is a signed offset.
361                dw_regnum is the cfa register rule which means
362                one ignores dw_regnum and uses the CFA appropriately.
363                So dw_offset_or_block_len is a signed value, really,
364                and must be printed/evaluated as such.
365                Rule: Offset(N)
366             If dw_offset_relevant is zero, then the value of the register
367                is the value of (DWARF) register number dw_regnum.
368                Rule: register(R)
369           If dw_value_type  == DW_EXPR_VAL_OFFSET
370             the  value of this register is CFA +N where N is a signed offset.
371             dw_regnum is the cfa register rule which means
372             one ignores dw_regnum and uses the CFA appropriately.
373             Rule: val_offset(N)
374           If dw_value_type  == DW_EXPR_EXPRESSION
375             The value of the register is the value at the address
376             computed by evaluating the DWARF expression E.
377             Rule: expression(E)
378             The expression E byte stream is pointed to by dw_block_ptr.
379             The expression length in bytes is given by
380             dw_offset_or_block_len.
381           If dw_value_type  == DW_EXPR_VAL_EXPRESSION
382             The value of the register is the value
383             computed by evaluating the DWARF expression E.
384             Rule: val_expression(E)
385             The expression E byte stream is pointed to by dw_block_ptr.
386             The expression length in bytes is given by
387             dw_offset_or_block_len.
388           Other values of dw_value_type are an error.
389         */
390     Dwarf_Small         dw_offset_relevant;
391     Dwarf_Small         dw_value_type;
392     Dwarf_Half          dw_regnum;
393     Dwarf_Unsigned      dw_offset_or_block_len;
394     Dwarf_Ptr           dw_block_ptr;
395 
396 }Dwarf_Regtable_Entry3;
397 
398 /* For the DWARF3 version, moved the DW_FRAME_CFA_COL
399    out of the array and into its own struct.
400    Having it part of the array is not very easy to work
401    with from a portability point of view: changing
402    the number for every architecture is a pain (if one fails
403    to set it correctly a register rule gets clobbered when
404    setting CFA).  With MIPS it just happened to be easy to use
405    DW_FRAME_CFA_COL (it was wrong conceptually but it was easy...).
406 
407    rt3_rules and rt3_reg_table_size must be filled in before
408    calling libdwarf.  Filled in with a pointer to an array
409    (pointer and array  set up by the calling application)
410    of rt3_reg_table_size Dwarf_Regtable_Entry3_s structs.
411    libdwarf does not allocate or deallocate space for the
412    rules, you must do so.   libdwarf will initialize the
413    contents rules array, you do not need to do so (though
414    if you choose to initialize the array somehow that is ok:
415    libdwarf will overwrite your initializations with its own).
416 
417 */
418 typedef struct Dwarf_Regtable3_s {
419     struct Dwarf_Regtable_Entry3_s   rt3_cfa_rule;
420 
421     Dwarf_Half                       rt3_reg_table_size;
422     struct Dwarf_Regtable_Entry3_s * rt3_rules;
423 } Dwarf_Regtable3;
424 
425 
426 /* Use for DW_EPXR_STANDARD., DW_EXPR_VAL_OFFSET.
427    Returns DW_DLV_OK if the value is available.
428    If DW_DLV_OK returns the regnum and offset thru the pointers
429    (which the consumer must use appropriately).
430 */
431 int dwarf_frame_get_reg_register(struct Dwarf_Regtable_Entry3_s *reg_in,
432     Dwarf_Small *offset_relevant,
433     Dwarf_Half *regnum_out,
434     Dwarf_Signed *offset_out);
435 
436 /* Use for DW_EXPR_EXPRESSION, DW_EXPR_VAL_EXPRESSION.
437    Returns DW_DLV_OK if the value is available.
438    The caller must pass in the address of a valid
439    Dwarf_Block (the caller need not initialize it).
440 */
441 int dwarf_frame_get_reg_expression(struct Dwarf_Regtable_Entry3_s *reg_in,
442     Dwarf_Block *block_out);
443 
444 
445 /* For DW_DLC_SYMBOLIC_RELOCATIONS output to caller
446    v2, adding drd_length: some relocations are 4 and
447    some 8 bytes (pointers are 8, section offsets 4) in
448    some dwarf environments. (MIPS relocations are all one
449    size in any given ABI.) Changing drd_type to an unsigned char
450    to keep struct size down.
451 */
452 enum Dwarf_Rel_Type {
453         dwarf_drt_none,        /* Should not get to caller */
454         dwarf_drt_data_reloc,  /* Simple normal relocation. */
455         dwarf_drt_segment_rel, /* Special reloc, exceptions. */
456         /* dwarf_drt_first_of_length_pair  and drt_second
457            are for for the  .word end - begin case. */
458         dwarf_drt_first_of_length_pair,
459         dwarf_drt_second_of_length_pair
460 };
461 
462 typedef struct Dwarf_P_Marker_s * Dwarf_P_Marker;
463 struct Dwarf_P_Marker_s {
464     Dwarf_Unsigned ma_marker;
465     Dwarf_Unsigned ma_offset;
466 };
467 
468 typedef struct Dwarf_Relocation_Data_s  * Dwarf_Relocation_Data;
469 struct Dwarf_Relocation_Data_s {
470     unsigned char drd_type;   /* Cast to/from Dwarf_Rel_Type
471                                to keep size small in struct. */
472     unsigned char drd_length; /* Length in bytes of data being
473                                relocated. 4 for 32bit data,
474                                8 for 64bit data. */
475     Dwarf_Unsigned       drd_offset; /* Where the data to reloc is. */
476     Dwarf_Unsigned       drd_symbol_index;
477 };
478 
479 typedef struct Dwarf_P_String_Attr_s  * Dwarf_P_String_Attr;
480 struct Dwarf_P_String_Attr_s {
481     Dwarf_Unsigned        sa_offset;  /* Offset of string attribute data */
482     Dwarf_Unsigned        sa_nbytes;
483 };
484 
485 
486 /* Opaque types for Consumer Library. */
487 typedef struct Dwarf_Debug_s*      Dwarf_Debug;
488 typedef struct Dwarf_Die_s*        Dwarf_Die;
489 typedef struct Dwarf_Line_s*       Dwarf_Line;
490 typedef struct Dwarf_Global_s*     Dwarf_Global;
491 typedef struct Dwarf_Func_s*       Dwarf_Func;
492 typedef struct Dwarf_Type_s*       Dwarf_Type;
493 typedef struct Dwarf_Var_s*        Dwarf_Var;
494 typedef struct Dwarf_Weak_s*       Dwarf_Weak;
495 typedef struct Dwarf_Error_s*      Dwarf_Error;
496 typedef struct Dwarf_Attribute_s*  Dwarf_Attribute;
497 typedef struct Dwarf_Abbrev_s*       Dwarf_Abbrev;
498 typedef struct Dwarf_Fde_s*         Dwarf_Fde;
499 typedef struct Dwarf_Cie_s*         Dwarf_Cie;
500 typedef struct Dwarf_Arange_s*       Dwarf_Arange;
501 
502 /* Opaque types for Producer Library. */
503 typedef struct Dwarf_P_Debug_s*           Dwarf_P_Debug;
504 typedef struct Dwarf_P_Die_s*           Dwarf_P_Die;
505 typedef struct Dwarf_P_Attribute_s*    Dwarf_P_Attribute;
506 typedef struct Dwarf_P_Fde_s*        Dwarf_P_Fde;
507 typedef struct Dwarf_P_Expr_s*        Dwarf_P_Expr;
508 typedef Dwarf_Unsigned                Dwarf_Tag;
509 
510 
511 /* error handler function
512 */
513 typedef void  (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/);
514 
515 
516 /* Begin libdwarf Object File Interface declarations.
517 
518 As of February 2008 there are multiple dwarf_reader object access
519 initialization methods available:
520 The traditional dwarf_elf_init() and dwarf_init()  and dwarf_finish()
521     which assume libelf and POSIX file access.
522 An object-file and library agnostic dwarf_object_init() and dwarf_object_finish()
523     which allow the coder to provide object access routines
524     abstracting away the elf interface.  So there is no dependence in the
525     reader code on the object format and no dependence on libelf.
526     See the code in dwarf_elf_access.c  and dwarf_original_elf_init.c
527     to see an example of initializing the structures mentioned below.
528 
529 Projects using dwarf_elf_init() or dwarf_init() can ignore
530 the Dwarf_Obj_Access* structures entirely as all these details
531 are completed for you.
532 
533 */
534 
535 typedef struct Dwarf_Obj_Access_Interface_s   Dwarf_Obj_Access_Interface;
536 typedef struct Dwarf_Obj_Access_Methods_s     Dwarf_Obj_Access_Methods;
537 typedef struct Dwarf_Obj_Access_Section_s     Dwarf_Obj_Access_Section;
538 
539 
540 /* Used in the get_section interface function
541    in Dwarf_Obj_Access_Section_s.  Since libdwarf
542    depends on standard DWARF section names an object
543    format that has no such names (but has some
544    method of setting up 'sections equivalents')
545    must arrange to return standard DWARF section
546    names in the 'name' field.  libdwarf does
547    not free the strings in 'name'. */
548 struct Dwarf_Obj_Access_Section_s {
549     Dwarf_Addr     addr;
550     Dwarf_Unsigned size;
551     const char*    name;
552     /* Set link to zero if it is meaningless.  If non-zero
553        it should be a link to a rela section or from symtab
554        to strtab.  In Elf it is sh_link. */
555     Dwarf_Unsigned link;
556 };
557 
558 /* Returned by the get_endianness function in
559    Dwarf_Obj_Access_Methods_s. */
560 typedef enum {
561     DW_OBJECT_MSB,
562     DW_OBJECT_LSB
563 } Dwarf_Endianness;
564 
565 /* The functions we need to access object data from libdwarf are declared here.
566 
567    In these function pointer declarations
568    'void *obj' is intended to be a pointer (the object field in
569    Dwarf_Obj_Access_Interface_s)
570    that hides the library-specific and object-specific data that makes
571    it possible to handle multiple object formats and multiple libraries.
572    It's not required that one handles multiple such in a single libdwarf
573    archive/shared-library (but not ruled out either).
574    See  dwarf_elf_object_access_internals_t and dwarf_elf_access.c
575    for an example.
576 
577 */
578 struct Dwarf_Obj_Access_Methods_s {
579     /**
580      * get_section_info
581      *
582      * Get address, size, and name info about a section.
583      *
584      * Parameters
585      * section_index - Zero-based index.
586      * return_section - Pointer to a structure in which section info
587      *   will be placed.   Caller must provide a valid pointer to a
588      *   structure area.  The structure's contents will be overwritten
589      *   by the call to get_section_info.
590      * error - A pointer to an integer in which an error code may be stored.
591      *
592      * Return
593      * DW_DLV_OK - Everything ok.
594      * DW_DLV_ERROR - Error occurred. Use 'error' to determine the
595      *    libdwarf defined error.
596      * DW_DLV_NO_ENTRY - No such section.
597      */
598     int    (*get_section_info)(void* obj, Dwarf_Half section_index,
599         Dwarf_Obj_Access_Section* return_section, int* error);
600     /**
601      * get_byte_order
602      *
603      * Get whether the object file represented by this interface is big-endian
604      * (DW_OBJECT_MSB) or little endian (DW_OBJECT_LSB).
605      *
606      * Parameters
607      * obj - Equivalent to 'this' in OO languages.
608      *
609      * Return
610      * Endianness of object. Cannot fail.
611      */
612     Dwarf_Endianness  (*get_byte_order)(void* obj);
613     /**
614      * get_length_size
615      *
616      * Get the size of a length field in the underlying object file.
617      * libdwarf currently supports * 4 and 8 byte sizes, but may
618      * support larger in the future.
619      * Perhaps the return type should be an enumeration?
620      *
621      * Parameters
622      * obj - Equivalent to 'this' in OO languages.
623      *
624      * Return
625      * Size of length. Cannot fail.
626      */
627     Dwarf_Small   (*get_length_size)(void* obj);
628     /**
629      * get_pointer_size
630      *
631      * Get the size of a pointer field in the underlying object file.
632      * libdwarf currently supports  4 and 8 byte sizes.
633      * Perhaps the return type should be an enumeration?
634 
635      * Return
636      * Size of pointer. Cannot fail.
637      */
638     Dwarf_Small   (*get_pointer_size)(void* obj);
639     /**
640      * get_section_count
641      *
642      * Get the number of sections in the object file.
643      *
644      * Parameters
645      *
646      * Return
647      * Number of sections
648      */
649     Dwarf_Unsigned  (*get_section_count)(void* obj);
650     /**
651      * load_section
652      *
653      * Get a pointer to an array of bytes that represent the section.
654      *
655      * Parameters
656      * section_index - Zero-based index.
657      * return_data - The address of a pointer to which the section data block
658      *   will be assigned.
659      * error - Pointer to an integer for returning libdwarf-defined
660      *   error numbers.
661      *
662      * Return
663      * DW_DLV_OK - No error.
664      * DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
665      *    error number.
666      * DW_DLV_NO_ENTRY - No such section.
667      */
668     int    (*load_section)(void* obj, Dwarf_Half section_index,
669         Dwarf_Small** return_data, int* error);
670 
671    /**
672     * relocate_a_section
673     * If relocations are not supported leave this pointer NULL.
674     *
675     * Get a pointer to an array of bytes that represent the section.
676     *
677     * Parameters
678     * section_index - Zero-based index of the section to be relocated.
679     * error - Pointer to an integer for returning libdwarf-defined
680     *   error numbers.
681     *
682     * Return
683     * DW_DLV_OK - No error.
684     * DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
685     *    error number.
686     * DW_DLV_NO_ENTRY - No such section.
687     */
688     int    (*relocate_a_section)(void* obj, Dwarf_Half section_index,
689          Dwarf_Debug dbg,
690          int* error);
691 
692 };
693 
694 
695 
696 /* These structures are allocated and deallocated by your code
697    when you are using the libdwarf Object File Interface
698    [dwarf_object_init() and dwarf_object_finish()] directly.
699    dwarf_object_finish() does not free
700    struct Dwarf_Obj_Access_Interface_s or its content.
701    (libdwarf does record a pointer to this struct: you must
702    ensure that pointer remains valid for as long as
703    a libdwarf instance is open (meaning
704    after dwarf_init() and before dwarf_finish()).
705 
706    If you are reading Elf objects and libelf use dwarf_init()
707    or dwarf_elf_init() which take care of these details.
708 */
709 struct Dwarf_Obj_Access_Interface_s {
710     /* object is a void* as it hides the data the object access routines
711        need (which varies by library in use and object format).
712     */
713     void* object;
714     const Dwarf_Obj_Access_Methods * methods;
715 };
716 
717 /* End libdwarf Object File Interface */
718 
719 /*
720     Dwarf_dealloc() alloc_type arguments.
721     Argument points to:
722 */
723 #define DW_DLA_STRING          0x01     /* char* */
724 #define DW_DLA_LOC             0x02     /* Dwarf_Loc */
725 #define DW_DLA_LOCDESC         0x03     /* Dwarf_Locdesc */
726 #define DW_DLA_ELLIST          0x04     /* Dwarf_Ellist (not used)*/
727 #define DW_DLA_BOUNDS          0x05     /* Dwarf_Bounds (not used) */
728 #define DW_DLA_BLOCK           0x06     /* Dwarf_Block */
729 #define DW_DLA_DEBUG           0x07     /* Dwarf_Debug */
730 #define DW_DLA_DIE             0x08     /* Dwarf_Die */
731 #define DW_DLA_LINE            0x09     /* Dwarf_Line */
732 #define DW_DLA_ATTR            0x0a     /* Dwarf_Attribute */
733 #define DW_DLA_TYPE            0x0b     /* Dwarf_Type  (not used) */
734 #define DW_DLA_SUBSCR          0x0c     /* Dwarf_Subscr (not used) */
735 #define DW_DLA_GLOBAL          0x0d     /* Dwarf_Global */
736 #define DW_DLA_ERROR           0x0e     /* Dwarf_Error */
737 #define DW_DLA_LIST            0x0f     /* a list */
738 #define DW_DLA_LINEBUF         0x10     /* Dwarf_Line* (not used) */
739 #define DW_DLA_ARANGE          0x11     /* Dwarf_Arange */
740 #define DW_DLA_ABBREV          0x12      /* Dwarf_Abbrev */
741 #define DW_DLA_FRAME_OP        0x13      /* Dwarf_Frame_Op */
742 #define DW_DLA_CIE             0x14     /* Dwarf_Cie */
743 #define DW_DLA_FDE             0x15     /* Dwarf_Fde */
744 #define DW_DLA_LOC_BLOCK       0x16     /* Dwarf_Loc Block (not used) */
745 #define DW_DLA_FRAME_BLOCK     0x17     /* Dwarf_Frame Block (not used) */
746 #define DW_DLA_FUNC            0x18     /* Dwarf_Func */
747 #define DW_DLA_TYPENAME        0x19     /* Dwarf_Type */
748 #define DW_DLA_VAR             0x1a     /* Dwarf_Var */
749 #define DW_DLA_WEAK            0x1b     /* Dwarf_Weak */
750 #define DW_DLA_ADDR            0x1c     /* Dwarf_Addr sized entries */
751 #define DW_DLA_RANGES          0x1d     /* Dwarf_Ranges */
752 
753 /* The augmenter string for CIE */
754 #define DW_CIE_AUGMENTER_STRING_V0              "z"
755 
756 /* dwarf_init() access arguments
757 */
758 #define DW_DLC_READ        0        /* read only access */
759 #define DW_DLC_WRITE       1        /* write only access */
760 #define DW_DLC_RDWR        2        /* read/write access NOT SUPPORTED*/
761 
762 /* pro_init() access flag modifiers
763    If HAVE_DWARF2_99_EXTENSION is defined at libdwarf build time
764    and DW_DLC_OFFSET_SIZE_64  is passed in pro_init() flags then the DWARF3
765    64 bit offset extension is used to generate 64 bit offsets.
766 */
767 #define DW_DLC_SIZE_64     0x40000000 /* 32-bit address-size target */
768 #define DW_DLC_SIZE_32     0x20000000 /* 64-bit address-size target */
769 #define DW_DLC_OFFSET_SIZE_64 0x10000000 /* 64-bit offset-size DWARF */
770 
771 /* dwarf_pro_init() access flag modifiers
772 */
773 #define DW_DLC_ISA_MIPS             0x00000000 /* MIPS target */
774 #define DW_DLC_ISA_IA64             0x01000000 /* IA64 target */
775 #define DW_DLC_STREAM_RELOCATIONS   0x02000000 /* Old style binary relocs */
776 
777     /* Usable with assembly output because it is up to the producer to
778        deal with locations in whatever manner the producer code wishes.
779        Possibly emitting text an assembler will recognize. */
780 #define DW_DLC_SYMBOLIC_RELOCATIONS 0x04000000
781 
782 #define DW_DLC_TARGET_BIGENDIAN     0x08000000 /* Big    endian target */
783 #define DW_DLC_TARGET_LITTLEENDIAN  0x00100000 /* Little endian target */
784 
785 #if 0
786   /*
787    The libdwarf producer interfaces jumble these two semantics together in
788    confusing ways.  We *should* have flags like these...
789    But changing the code means a lot of diffs.  So for now,
790    we leave things as they are
791   */
792   #define DW_DLC_SUN_OFFSET32        0x00010000 /* use 32-bit sec offsets */
793   #define DW_DLC_SUN_OFFSET64        0x00020000 /* use 64-bit sec offsets */
794   #define DW_DLC_SUN_POINTER32        0x00040000 /* use 4 for address_size */
795   #define DW_DLC_SUN_POINTER64        0x00080000 /* use 8 for address_size */
796 #endif
797 
798 /* dwarf_pcline() slide arguments
799 */
800 #define DW_DLS_BACKWARD   -1       /* slide backward to find line */
801 #define DW_DLS_NOSLIDE     0       /* match exactly without sliding */
802 #define DW_DLS_FORWARD     1       /* slide forward to find line */
803 
804 /* libdwarf error numbers
805 */
806 #define DW_DLE_NE          0     /* no error */
807 #define DW_DLE_VMM         1     /* dwarf format/library version mismatch */
808 #define DW_DLE_MAP         2     /* memory map failure */
809 #define DW_DLE_LEE         3     /* libelf error */
810 #define DW_DLE_NDS         4     /* no debug section */
811 #define DW_DLE_NLS         5     /* no line section */
812 #define DW_DLE_ID          6     /* invalid descriptor for query */
813 #define DW_DLE_IOF         7     /* I/O failure */
814 #define DW_DLE_MAF         8     /* memory allocation failure */
815 #define DW_DLE_IA          9     /* invalid argument */
816 #define DW_DLE_MDE         10     /* mangled debugging entry */
817 #define DW_DLE_MLE         11     /* mangled line number entry */
818 #define DW_DLE_FNO         12     /* file not open */
819 #define DW_DLE_FNR         13     /* file not a regular file */
820 #define DW_DLE_FWA         14     /* file open with wrong access */
821 #define DW_DLE_NOB         15     /* not an object file */
822 #define DW_DLE_MOF         16     /* mangled object file header */
823 #define DW_DLE_EOLL        17     /* end of location list entries */
824 #define DW_DLE_NOLL        18     /* no location list section */
825 #define DW_DLE_BADOFF      19     /* Invalid offset */
826 #define DW_DLE_EOS         20     /* end of section  */
827 #define DW_DLE_ATRUNC      21     /* abbreviations section appears truncated*/
828 #define DW_DLE_BADBITC     22     /* Address size passed to dwarf bad*/
829                     /* It is not an allowed size (64 or 32) */
830     /* Error codes defined by the current Libdwarf Implementation. */
831 #define DW_DLE_DBG_ALLOC                        23
832 #define DW_DLE_FSTAT_ERROR                      24
833 #define DW_DLE_FSTAT_MODE_ERROR                 25
834 #define DW_DLE_INIT_ACCESS_WRONG                26
835 #define DW_DLE_ELF_BEGIN_ERROR                  27
836 #define DW_DLE_ELF_GETEHDR_ERROR                28
837 #define DW_DLE_ELF_GETSHDR_ERROR                29
838 #define DW_DLE_ELF_STRPTR_ERROR                 30
839 #define DW_DLE_DEBUG_INFO_DUPLICATE             31
840 #define DW_DLE_DEBUG_INFO_NULL                  32
841 #define DW_DLE_DEBUG_ABBREV_DUPLICATE           33
842 #define DW_DLE_DEBUG_ABBREV_NULL                34
843 #define DW_DLE_DEBUG_ARANGES_DUPLICATE          35
844 #define DW_DLE_DEBUG_ARANGES_NULL               36
845 #define DW_DLE_DEBUG_LINE_DUPLICATE             37
846 #define DW_DLE_DEBUG_LINE_NULL                  38
847 #define DW_DLE_DEBUG_LOC_DUPLICATE              39
848 #define DW_DLE_DEBUG_LOC_NULL                   40
849 #define DW_DLE_DEBUG_MACINFO_DUPLICATE          41
850 #define DW_DLE_DEBUG_MACINFO_NULL               42
851 #define DW_DLE_DEBUG_PUBNAMES_DUPLICATE         43
852 #define DW_DLE_DEBUG_PUBNAMES_NULL              44
853 #define DW_DLE_DEBUG_STR_DUPLICATE              45
854 #define DW_DLE_DEBUG_STR_NULL                   46
855 #define DW_DLE_CU_LENGTH_ERROR                  47
856 #define DW_DLE_VERSION_STAMP_ERROR              48
857 #define DW_DLE_ABBREV_OFFSET_ERROR              49
858 #define DW_DLE_ADDRESS_SIZE_ERROR               50
859 #define DW_DLE_DEBUG_INFO_PTR_NULL              51
860 #define DW_DLE_DIE_NULL                         52
861 #define DW_DLE_STRING_OFFSET_BAD                53
862 #define DW_DLE_DEBUG_LINE_LENGTH_BAD            54
863 #define DW_DLE_LINE_PROLOG_LENGTH_BAD           55
864 #define DW_DLE_LINE_NUM_OPERANDS_BAD            56
865 #define DW_DLE_LINE_SET_ADDR_ERROR              57 /* No longer used. */
866 #define DW_DLE_LINE_EXT_OPCODE_BAD              58
867 #define DW_DLE_DWARF_LINE_NULL                  59
868 #define DW_DLE_INCL_DIR_NUM_BAD                 60
869 #define DW_DLE_LINE_FILE_NUM_BAD                61
870 #define DW_DLE_ALLOC_FAIL                       62
871 #define DW_DLE_NO_CALLBACK_FUNC                 63
872 #define DW_DLE_SECT_ALLOC                       64
873 #define DW_DLE_FILE_ENTRY_ALLOC                 65
874 #define DW_DLE_LINE_ALLOC                       66
875 #define DW_DLE_FPGM_ALLOC                       67
876 #define DW_DLE_INCDIR_ALLOC                     68
877 #define DW_DLE_STRING_ALLOC                     69
878 #define DW_DLE_CHUNK_ALLOC                      70
879 #define DW_DLE_BYTEOFF_ERR                      71
880 #define DW_DLE_CIE_ALLOC                        72
881 #define DW_DLE_FDE_ALLOC                        73
882 #define DW_DLE_REGNO_OVFL                       74
883 #define DW_DLE_CIE_OFFS_ALLOC                   75
884 #define DW_DLE_WRONG_ADDRESS                    76
885 #define DW_DLE_EXTRA_NEIGHBORS                  77
886 #define    DW_DLE_WRONG_TAG                     78
887 #define DW_DLE_DIE_ALLOC                        79
888 #define DW_DLE_PARENT_EXISTS                    80
889 #define DW_DLE_DBG_NULL                         81
890 #define DW_DLE_DEBUGLINE_ERROR                  82
891 #define DW_DLE_DEBUGFRAME_ERROR                 83
892 #define DW_DLE_DEBUGINFO_ERROR                  84
893 #define DW_DLE_ATTR_ALLOC                       85
894 #define DW_DLE_ABBREV_ALLOC                     86
895 #define DW_DLE_OFFSET_UFLW                      87
896 #define DW_DLE_ELF_SECT_ERR                     88
897 #define DW_DLE_DEBUG_FRAME_LENGTH_BAD           89
898 #define DW_DLE_FRAME_VERSION_BAD                90
899 #define DW_DLE_CIE_RET_ADDR_REG_ERROR           91
900 #define DW_DLE_FDE_NULL                         92
901 #define DW_DLE_FDE_DBG_NULL                     93
902 #define DW_DLE_CIE_NULL                         94
903 #define DW_DLE_CIE_DBG_NULL                     95
904 #define DW_DLE_FRAME_TABLE_COL_BAD              96
905 #define DW_DLE_PC_NOT_IN_FDE_RANGE              97
906 #define DW_DLE_CIE_INSTR_EXEC_ERROR             98
907 #define DW_DLE_FRAME_INSTR_EXEC_ERROR           99
908 #define DW_DLE_FDE_PTR_NULL                    100
909 #define DW_DLE_RET_OP_LIST_NULL                101
910 #define DW_DLE_LINE_CONTEXT_NULL               102
911 #define DW_DLE_DBG_NO_CU_CONTEXT               103
912 #define DW_DLE_DIE_NO_CU_CONTEXT               104
913 #define DW_DLE_FIRST_DIE_NOT_CU                105
914 #define DW_DLE_NEXT_DIE_PTR_NULL               106
915 #define DW_DLE_DEBUG_FRAME_DUPLICATE           107
916 #define DW_DLE_DEBUG_FRAME_NULL                108
917 #define DW_DLE_ABBREV_DECODE_ERROR             109
918 #define DW_DLE_DWARF_ABBREV_NULL               110
919 #define DW_DLE_ATTR_NULL                       111
920 #define DW_DLE_DIE_BAD                         112
921 #define DW_DLE_DIE_ABBREV_BAD                  113
922 #define DW_DLE_ATTR_FORM_BAD                   114
923 #define DW_DLE_ATTR_NO_CU_CONTEXT              115
924 #define DW_DLE_ATTR_FORM_SIZE_BAD              116
925 #define DW_DLE_ATTR_DBG_NULL                   117
926 #define DW_DLE_BAD_REF_FORM                    118
927 #define DW_DLE_ATTR_FORM_OFFSET_BAD            119
928 #define DW_DLE_LINE_OFFSET_BAD                 120
929 #define DW_DLE_DEBUG_STR_OFFSET_BAD            121
930 #define DW_DLE_STRING_PTR_NULL                 122
931 #define DW_DLE_PUBNAMES_VERSION_ERROR          123
932 #define DW_DLE_PUBNAMES_LENGTH_BAD             124
933 #define DW_DLE_GLOBAL_NULL                     125
934 #define DW_DLE_GLOBAL_CONTEXT_NULL             126
935 #define DW_DLE_DIR_INDEX_BAD                   127
936 #define DW_DLE_LOC_EXPR_BAD                    128
937 #define DW_DLE_DIE_LOC_EXPR_BAD                129
938 #define DW_DLE_ADDR_ALLOC                      130
939 #define DW_DLE_OFFSET_BAD                      131
940 #define DW_DLE_MAKE_CU_CONTEXT_FAIL            132
941 #define DW_DLE_REL_ALLOC                       133
942 #define DW_DLE_ARANGE_OFFSET_BAD               134
943 #define DW_DLE_SEGMENT_SIZE_BAD                135
944 #define DW_DLE_ARANGE_LENGTH_BAD               136
945 #define DW_DLE_ARANGE_DECODE_ERROR             137
946 #define DW_DLE_ARANGES_NULL                    138
947 #define DW_DLE_ARANGE_NULL                     139
948 #define DW_DLE_NO_FILE_NAME                    140
949 #define DW_DLE_NO_COMP_DIR                     141
950 #define DW_DLE_CU_ADDRESS_SIZE_BAD             142
951 #define DW_DLE_INPUT_ATTR_BAD                  143
952 #define DW_DLE_EXPR_NULL                       144
953 #define DW_DLE_BAD_EXPR_OPCODE                 145
954 #define DW_DLE_EXPR_LENGTH_BAD                 146
955 #define DW_DLE_MULTIPLE_RELOC_IN_EXPR          147
956 #define DW_DLE_ELF_GETIDENT_ERROR              148
957 #define DW_DLE_NO_AT_MIPS_FDE                  149
958 #define DW_DLE_NO_CIE_FOR_FDE                  150
959 #define DW_DLE_DIE_ABBREV_LIST_NULL            151
960 #define DW_DLE_DEBUG_FUNCNAMES_DUPLICATE       152
961 #define DW_DLE_DEBUG_FUNCNAMES_NULL            153
962 #define DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR   154
963 #define DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD      155
964 #define DW_DLE_FUNC_NULL                       156
965 #define DW_DLE_FUNC_CONTEXT_NULL               157
966 #define DW_DLE_DEBUG_TYPENAMES_DUPLICATE       158
967 #define DW_DLE_DEBUG_TYPENAMES_NULL            159
968 #define DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR   160
969 #define DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD      161
970 #define DW_DLE_TYPE_NULL                       162
971 #define DW_DLE_TYPE_CONTEXT_NULL               163
972 #define DW_DLE_DEBUG_VARNAMES_DUPLICATE        164
973 #define DW_DLE_DEBUG_VARNAMES_NULL             165
974 #define DW_DLE_DEBUG_VARNAMES_VERSION_ERROR    166
975 #define DW_DLE_DEBUG_VARNAMES_LENGTH_BAD       167
976 #define DW_DLE_VAR_NULL                        168
977 #define DW_DLE_VAR_CONTEXT_NULL                169
978 #define DW_DLE_DEBUG_WEAKNAMES_DUPLICATE       170
979 #define DW_DLE_DEBUG_WEAKNAMES_NULL            171
980 #define DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR   172
981 #define DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD      173
982 #define DW_DLE_WEAK_NULL                       174
983 #define DW_DLE_WEAK_CONTEXT_NULL               175
984 #define DW_DLE_LOCDESC_COUNT_WRONG             176
985 #define DW_DLE_MACINFO_STRING_NULL             177
986 #define DW_DLE_MACINFO_STRING_EMPTY            178
987 #define DW_DLE_MACINFO_INTERNAL_ERROR_SPACE    179
988 #define DW_DLE_MACINFO_MALLOC_FAIL             180
989 #define DW_DLE_DEBUGMACINFO_ERROR              181
990 #define DW_DLE_DEBUG_MACRO_LENGTH_BAD          182
991 #define DW_DLE_DEBUG_MACRO_MAX_BAD             183
992 #define DW_DLE_DEBUG_MACRO_INTERNAL_ERR        184
993 #define DW_DLE_DEBUG_MACRO_MALLOC_SPACE        185
994 #define DW_DLE_DEBUG_MACRO_INCONSISTENT        186
995 #define DW_DLE_DF_NO_CIE_AUGMENTATION          187
996 #define DW_DLE_DF_REG_NUM_TOO_HIGH             188
997 #define DW_DLE_DF_MAKE_INSTR_NO_INIT           189
998 #define DW_DLE_DF_NEW_LOC_LESS_OLD_LOC         190
999 #define DW_DLE_DF_POP_EMPTY_STACK              191
1000 #define DW_DLE_DF_ALLOC_FAIL                   192
1001 #define DW_DLE_DF_FRAME_DECODING_ERROR         193
1002 #define DW_DLE_DEBUG_LOC_SECTION_SHORT         194
1003 #define DW_DLE_FRAME_AUGMENTATION_UNKNOWN      195
1004 #define DW_DLE_PUBTYPE_CONTEXT                 196 /* Unused. */
1005 #define DW_DLE_DEBUG_PUBTYPES_LENGTH_BAD       197
1006 #define DW_DLE_DEBUG_PUBTYPES_VERSION_ERROR    198
1007 #define DW_DLE_DEBUG_PUBTYPES_DUPLICATE        199
1008 #define DW_DLE_FRAME_CIE_DECODE_ERROR          200
1009 #define DW_DLE_FRAME_REGISTER_UNREPRESENTABLE  201
1010 #define DW_DLE_FRAME_REGISTER_COUNT_MISMATCH   202
1011 #define DW_DLE_LINK_LOOP                       203
1012 #define DW_DLE_STRP_OFFSET_BAD                 204
1013 #define DW_DLE_DEBUG_RANGES_DUPLICATE          205
1014 #define DW_DLE_DEBUG_RANGES_OFFSET_BAD         206
1015 #define DW_DLE_DEBUG_RANGES_MISSING_END        207
1016 #define DW_DLE_DEBUG_RANGES_OUT_OF_MEM         208
1017 #define DW_DLE_DEBUG_SYMTAB_ERR                209
1018 #define DW_DLE_DEBUG_STRTAB_ERR                210
1019 #define DW_DLE_RELOC_MISMATCH_INDEX            211
1020 #define DW_DLE_RELOC_MISMATCH_RELOC_INDEX      212
1021 #define DW_DLE_RELOC_MISMATCH_STRTAB_INDEX     213
1022 #define DW_DLE_RELOC_SECTION_MISMATCH          214
1023 #define DW_DLE_RELOC_SECTION_MISSING_INDEX     215
1024 #define DW_DLE_RELOC_SECTION_LENGTH_ODD        216
1025 #define DW_DLE_RELOC_SECTION_PTR_NULL          217
1026 #define DW_DLE_RELOC_SECTION_MALLOC_FAIL       218
1027 #define DW_DLE_NO_ELF64_SUPPORT                219
1028 #define DW_DLE_MISSING_ELF64_SUPPORT           220
1029 #define DW_DLE_ORPHAN_FDE                      221
1030 #define DW_DLE_DUPLICATE_INST_BLOCK            222
1031 #define DW_DLE_BAD_REF_SIG8_FORM               223
1032 #define DW_DLE_ATTR_EXPRLOC_FORM_BAD           224
1033 #define DW_DLE_FORM_SEC_OFFSET_LENGTH_BAD      225
1034 #define DW_DLE_NOT_REF_FORM                    226
1035 #define DW_DLE_DEBUG_FRAME_LENGTH_NOT_MULTIPLE 227
1036 
1037 
1038 
1039     /* DW_DLE_LAST MUST EQUAL LAST ERROR NUMBER */
1040 #define DW_DLE_LAST        227
1041 #define DW_DLE_LO_USER     0x10000
1042 
1043    /* Taken as meaning 'undefined value', this is not
1044       a column or register number.
1045       Only present at libdwarf runtime. Never on disk.
1046       DW_FRAME_* Values present on disk are in dwarf.h
1047    */
1048 #define DW_FRAME_UNDEFINED_VAL          1034
1049 
1050    /* Taken as meaning 'same value' as caller had, not a column
1051       or register number
1052       Only present at libdwarf runtime. Never on disk.
1053       DW_FRAME_* Values present on disk are in dwarf.h
1054    */
1055 #define DW_FRAME_SAME_VAL               1035
1056 
1057 
1058 
1059 /* error return values
1060 */
1061 #define DW_DLV_BADADDR     (~(Dwarf_Addr)0)
1062     /* for functions returning target address */
1063 
1064 #define DW_DLV_NOCOUNT     ((Dwarf_Signed)-1)
1065     /* for functions returning count */
1066 
1067 #define DW_DLV_BADOFFSET   (~(Dwarf_Off)0)
1068     /* for functions returning offset */
1069 
1070 /* standard return values for functions */
1071 #define DW_DLV_NO_ENTRY -1
1072 #define DW_DLV_OK        0
1073 #define DW_DLV_ERROR     1
1074 
1075 /* Special values for offset_into_exception_table field of dwarf fde's. */
1076 /* The following value indicates that there is no Exception table offset
1077    associated with a dwarf frame. */
1078 #define DW_DLX_NO_EH_OFFSET         (-1LL)
1079 /* The following value indicates that the producer was unable to analyse the
1080    source file to generate Exception tables for this function. */
1081 #define DW_DLX_EH_OFFSET_UNAVAILABLE  (-2LL)
1082 
1083 
1084 /*===========================================================================*/
1085 /*  Dwarf consumer interface initialization and termination operations */
1086 
1087 /* Initialization based on Unix open fd (using libelf internally). */
1088 int dwarf_init(int    /*fd*/,
1089     Dwarf_Unsigned    /*access*/,
1090     Dwarf_Handler     /*errhand*/,
1091     Dwarf_Ptr         /*errarg*/,
1092     Dwarf_Debug*      /*dbg*/,
1093     Dwarf_Error*      /*error*/);
1094 
1095 /* Initialization based on libelf/sgi-fastlibelf open pointer. */
1096 int dwarf_elf_init(dwarf_elf_handle /*elf*/,
1097     Dwarf_Unsigned    /*access*/,
1098     Dwarf_Handler     /*errhand*/,
1099     Dwarf_Ptr         /*errarg*/,
1100     Dwarf_Debug*      /*dbg*/,
1101     Dwarf_Error*      /*error*/);
1102 
1103 /* Undocumented function for memory allocator. */
1104 void dwarf_print_memory_stats(Dwarf_Debug  /*dbg*/);
1105 
1106 int dwarf_get_elf(Dwarf_Debug /*dbg*/,
1107     dwarf_elf_handle* /*return_elfptr*/,
1108     Dwarf_Error*      /*error*/);
1109 
1110 int dwarf_finish(Dwarf_Debug /*dbg*/, Dwarf_Error* /*error*/);
1111 
1112 
1113 int dwarf_object_init(Dwarf_Obj_Access_Interface* /* obj */,
1114     Dwarf_Handler /* errhand */,
1115     Dwarf_Ptr     /* errarg */,
1116     Dwarf_Debug*  /* dbg */,
1117     Dwarf_Error*  /* error */);
1118 
1119 int dwarf_object_finish(Dwarf_Debug /* dbg */,
1120     Dwarf_Error* /* error */);
1121 
1122 /* die traversal operations */
1123 int dwarf_next_cu_header_b(Dwarf_Debug /*dbg*/,
1124     Dwarf_Unsigned* /*cu_header_length*/,
1125     Dwarf_Half*     /*version_stamp*/,
1126     Dwarf_Off*      /*abbrev_offset*/,
1127     Dwarf_Half*     /*address_size*/,
1128     Dwarf_Half*     /*length_size*/,
1129     Dwarf_Half*     /*extension_size*/,
1130     Dwarf_Unsigned* /*next_cu_header_offset*/,
1131     Dwarf_Error*    /*error*/);
1132 /* The following is now obsolete, though supported. November 2009. */
1133 int dwarf_next_cu_header(Dwarf_Debug /*dbg*/,
1134     Dwarf_Unsigned* /*cu_header_length*/,
1135     Dwarf_Half*     /*version_stamp*/,
1136     Dwarf_Off*      /*abbrev_offset*/,
1137     Dwarf_Half*     /*address_size*/,
1138     Dwarf_Unsigned* /*next_cu_header_offset*/,
1139     Dwarf_Error*    /*error*/);
1140 
1141 int dwarf_siblingof(Dwarf_Debug /*dbg*/,
1142     Dwarf_Die        /*die*/,
1143     Dwarf_Die*       /*return_siblingdie*/,
1144     Dwarf_Error*     /*error*/);
1145 
1146 int dwarf_child(Dwarf_Die /*die*/,
1147     Dwarf_Die*       /*return_childdie*/,
1148     Dwarf_Error*     /*error*/);
1149 
1150 /* Finding die given global (not CU-relative) offset */
1151 int dwarf_offdie(Dwarf_Debug /*dbg*/,
1152     Dwarf_Off        /*offset*/,
1153     Dwarf_Die*       /*return_die*/,
1154     Dwarf_Error*     /*error*/);
1155 
1156 /* Higher level functions (Unimplemented) */
1157 int dwarf_pcfile(Dwarf_Debug /*dbg*/,
1158     Dwarf_Addr       /*pc*/,
1159     Dwarf_Die*       /*return_die*/,
1160     Dwarf_Error*     /*error*/);
1161 
1162 /* Unimplemented */
1163 int dwarf_pcsubr(Dwarf_Debug /*dbg*/,
1164     Dwarf_Addr       /*pc*/,
1165     Dwarf_Die*       /*return_die*/,
1166     Dwarf_Error*     /*error*/);
1167 
1168 /* Unimplemented */
1169 int dwarf_pcscope(Dwarf_Debug /*dbg*/,
1170     Dwarf_Addr       /*pc*/,
1171     Dwarf_Die*       /*return_die*/,
1172     Dwarf_Error*     /*error*/);
1173 
1174 /* operations on DIEs */
1175 int dwarf_tag(Dwarf_Die /*die*/,
1176     Dwarf_Half*      /*return_tag*/,
1177     Dwarf_Error*     /*error*/);
1178 
1179 /* utility? */
1180 /* dwarf_dieoffset returns the global debug_info
1181    section offset, not the CU relative offset. */
1182 int dwarf_dieoffset(Dwarf_Die /*die*/,
1183     Dwarf_Off*       /*return_offset*/,
1184     Dwarf_Error*     /*error*/);
1185 
1186 /* dwarf_CU_dieoffset_given_die returns
1187    the global debug_info section offset of the CU die
1188    that is the CU containing the given_die
1189    (the passed in DIE can be any DIE).
1190    This information makes it possible for a consumer to
1191    find and print CU context information for any die.
1192    See also dwarf_get_cu_die_offset_given_cu_header_offset(). */
1193 int dwarf_CU_dieoffset_given_die(Dwarf_Die /*given_die*/,
1194     Dwarf_Off*       /*return_offset*/,
1195     Dwarf_Error*     /*error*/);
1196 
1197 /* dwarf_die_CU_offset returns the CU relative offset
1198    not the global debug_info section offset, given
1199    any DIE in the CU.  See also dwarf_CU_dieoffset_given_die().
1200    */
1201 int dwarf_die_CU_offset(Dwarf_Die /*die*/,
1202     Dwarf_Off*       /*return_offset*/,
1203     Dwarf_Error*     /*error*/);
1204 
1205 int dwarf_die_CU_offset_range(Dwarf_Die /*die*/,
1206     Dwarf_Off*       /*return_CU_header_offset*/,
1207     Dwarf_Off*       /*return_CU_length_bytes*/,
1208     Dwarf_Error*     /*error*/);
1209 
1210 int dwarf_attr (Dwarf_Die /*die*/,
1211     Dwarf_Half        /*attr*/,
1212     Dwarf_Attribute * /*returned_attr*/,
1213     Dwarf_Error*      /*error*/);
1214 
1215 int dwarf_diename(Dwarf_Die /*die*/,
1216     char   **        /*diename*/,
1217     Dwarf_Error*     /*error*/);
1218 
1219 /* Returns the  abbrev code of the die. Cannot fail. */
1220 int dwarf_die_abbrev_code(Dwarf_Die /*die */);
1221 
1222 
1223 /* convenience functions, alternative to using dwarf_attrlist() */
1224 int dwarf_hasattr(Dwarf_Die /*die*/,
1225     Dwarf_Half       /*attr*/,
1226     Dwarf_Bool *     /*returned_bool*/,
1227     Dwarf_Error*     /*error*/);
1228 
1229 /* dwarf_loclist_n preferred over dwarf_loclist */
1230 int dwarf_loclist_n(Dwarf_Attribute /*attr*/,
1231     Dwarf_Locdesc*** /*llbuf*/,
1232     Dwarf_Signed *   /*locCount*/,
1233     Dwarf_Error*     /*error*/);
1234 
1235 int dwarf_loclist(Dwarf_Attribute /*attr*/,  /* inflexible! */
1236     Dwarf_Locdesc**  /*llbuf*/,
1237     Dwarf_Signed *   /*locCount*/,
1238     Dwarf_Error*     /*error*/);
1239 
1240 /* Extracts a dwarf expression from an expression byte stream.
1241    Useful to get expressions from DW_CFA_def_cfa_expression
1242    DW_CFA_expression DW_CFA_val_expression expression bytes.
1243    27 April 2009: dwarf_loclist_from_expr() interface with
1244    no addr_size is obsolete but supported,
1245    use dwarf_loclist_from_expr_a() instead.
1246 */
1247 int dwarf_loclist_from_expr(Dwarf_Debug dbg,
1248     Dwarf_Ptr expression_in,
1249     Dwarf_Unsigned expression_length,
1250     Dwarf_Locdesc ** llbuf,
1251     Dwarf_Signed * listlen, Dwarf_Error * error);
1252 
1253 /* dwarf_loclist_from_expr_a() new 27 Apr 2009: added addr_size argument. */
1254 int dwarf_loclist_from_expr_a(Dwarf_Debug dbg,
1255     Dwarf_Ptr expression_in,
1256     Dwarf_Unsigned expression_length,
1257     Dwarf_Half addr_size,
1258     Dwarf_Locdesc ** llbuf,
1259     Dwarf_Signed * listlen, Dwarf_Error * error);
1260 
1261 /* Unimplemented */
1262 int dwarf_stringlen(Dwarf_Die /*die*/,
1263     Dwarf_Locdesc ** /*returned_locdesc*/,
1264     Dwarf_Error*     /*error*/);
1265 
1266 /* Unimplemented */
1267 int dwarf_subscrcnt(Dwarf_Die /*die*/,
1268     Dwarf_Signed *   /*returned_count*/,
1269     Dwarf_Error*     /*error*/);
1270 
1271 /* Unimplemented */
1272 int dwarf_nthsubscr(Dwarf_Die /*die*/,
1273     Dwarf_Unsigned   /*ssndx*/,
1274     Dwarf_Die *      /*returned_die*/,
1275     Dwarf_Error*     /*error*/);
1276 
1277 int dwarf_lowpc(Dwarf_Die /*die*/,
1278     Dwarf_Addr  *    /*returned_addr*/,
1279     Dwarf_Error*     /*error*/);
1280 
1281 int dwarf_highpc(Dwarf_Die /*die*/,
1282     Dwarf_Addr  *    /*returned_addr*/,
1283     Dwarf_Error*     /*error*/);
1284 
1285 int dwarf_bytesize(Dwarf_Die /*die*/,
1286     Dwarf_Unsigned * /*returned_size*/,
1287     Dwarf_Error*     /*error*/);
1288 
1289 /* Unimplemented */
1290 int dwarf_isbitfield(Dwarf_Die /*die*/,
1291     Dwarf_Bool  *    /*returned_bool*/,
1292     Dwarf_Error*     /*error*/);
1293 
1294 int dwarf_bitsize(Dwarf_Die /*die*/,
1295     Dwarf_Unsigned * /*returned_size*/,
1296     Dwarf_Error*     /*error*/);
1297 
1298 int dwarf_bitoffset(Dwarf_Die /*die*/,
1299     Dwarf_Unsigned * /*returned_offset*/,
1300     Dwarf_Error*     /*error*/);
1301 
1302 int dwarf_srclang(Dwarf_Die /*die*/,
1303     Dwarf_Unsigned * /*returned_lang*/,
1304     Dwarf_Error*     /*error*/);
1305 
1306 int dwarf_arrayorder(Dwarf_Die /*die*/,
1307     Dwarf_Unsigned * /*returned_order*/,
1308     Dwarf_Error*     /*error*/);
1309 
1310 /* end of convenience function list */
1311 
1312 /* this is the main interface to attributes of a DIE */
1313 int dwarf_attrlist(Dwarf_Die /*die*/,
1314     Dwarf_Attribute** /*attrbuf*/,
1315     Dwarf_Signed   * /*attrcount*/,
1316     Dwarf_Error*     /*error*/);
1317 
1318 /* query operations for attributes */
1319 int dwarf_hasform(Dwarf_Attribute /*attr*/,
1320     Dwarf_Half       /*form*/,
1321     Dwarf_Bool *     /*returned_bool*/,
1322     Dwarf_Error*     /*error*/);
1323 
1324 int dwarf_whatform(Dwarf_Attribute /*attr*/,
1325     Dwarf_Half *     /*returned_form*/,
1326     Dwarf_Error*     /*error*/);
1327 
1328 int dwarf_whatform_direct(Dwarf_Attribute /*attr*/,
1329     Dwarf_Half *     /*returned_form*/,
1330     Dwarf_Error*     /*error*/);
1331 
1332 int dwarf_whatattr(Dwarf_Attribute /*attr*/,
1333     Dwarf_Half *     /*returned_attr_num*/,
1334     Dwarf_Error*     /*error*/);
1335 
1336 /*
1337     The following are concerned with the Primary Interface: getting
1338     the actual data values. One function per 'kind' of FORM.
1339 */
1340 /*  dwarf_formref returns, thru return_offset, a CU-relative offset
1341     and does not allow DW_FORM_ref_addr*/
1342 int dwarf_formref(Dwarf_Attribute /*attr*/,
1343     Dwarf_Off*       /*return_offset*/,
1344     Dwarf_Error*     /*error*/);
1345 /*  dwarf_global_formref returns, thru return_offset,
1346     a debug_info-relative offset and does allow all reference forms*/
1347 int dwarf_global_formref(Dwarf_Attribute /*attr*/,
1348     Dwarf_Off*       /*return_offset*/,
1349     Dwarf_Error*     /*error*/);
1350 
1351 /*  dwarf_formsig8 returns in the caller-provided 8 byte area
1352     the 8 bytes of a DW_FORM_ref_sig8.  Not a string.  */
1353 int dwarf_formsig8(Dwarf_Attribute /*attr*/,
1354     Dwarf_Sig8 * /*returned sig bytes*/,
1355     Dwarf_Error*     /*error*/);
1356 
1357 int dwarf_formaddr(Dwarf_Attribute /*attr*/,
1358     Dwarf_Addr   *   /*returned_addr*/,
1359     Dwarf_Error*     /*error*/);
1360 
1361 int dwarf_formflag(Dwarf_Attribute /*attr*/,
1362     Dwarf_Bool *     /*returned_bool*/,
1363     Dwarf_Error*     /*error*/);
1364 
1365 int dwarf_formudata(Dwarf_Attribute /*attr*/,
1366     Dwarf_Unsigned  * /*returned_val*/,
1367     Dwarf_Error*     /*error*/);
1368 
1369 int dwarf_formsdata(Dwarf_Attribute     /*attr*/,
1370     Dwarf_Signed  *  /*returned_val*/,
1371     Dwarf_Error*     /*error*/);
1372 
1373 int dwarf_formblock(Dwarf_Attribute /*attr*/,
1374     Dwarf_Block    ** /*returned_block*/,
1375     Dwarf_Error*     /*error*/);
1376 
1377 int dwarf_formstring(Dwarf_Attribute /*attr*/,
1378     char   **        /*returned_string*/,
1379     Dwarf_Error*     /*error*/);
1380 
1381 int dwarf_formexprloc(Dwarf_Attribute /*attr*/,
1382     Dwarf_Unsigned * /*return_exprlen*/,
1383     Dwarf_Ptr  * /*block_ptr*/,
1384     Dwarf_Error * /*error*/);
1385 
1386 
1387 /* end attribute query operations. */
1388 
1389 /* line number operations */
1390 /* dwarf_srclines  is the normal interface */
1391 int dwarf_srclines(Dwarf_Die /*die*/,
1392     Dwarf_Line**     /*linebuf*/,
1393     Dwarf_Signed *   /*linecount*/,
1394     Dwarf_Error*     /*error*/);
1395 
1396 /* dwarf_srclines_dealloc, created July 2005, is the new
1397    method for deallocating what dwarf_srclines returns.
1398    More complete free than using dwarf_dealloc directly. */
1399 void dwarf_srclines_dealloc(Dwarf_Debug /*dbg*/,
1400     Dwarf_Line*       /*linebuf*/,
1401     Dwarf_Signed      /*count */);
1402 
1403 
1404 int dwarf_srcfiles(Dwarf_Die /*die*/,
1405     char***          /*srcfiles*/,
1406     Dwarf_Signed *   /*filecount*/,
1407     Dwarf_Error*     /*error*/);
1408 
1409 /* Unimplemented. */
1410 int dwarf_dieline(Dwarf_Die /*die*/,
1411     Dwarf_Line  *    /*returned_line*/,
1412     Dwarf_Error *    /*error*/);
1413 
1414 int dwarf_linebeginstatement(Dwarf_Line /*line*/,
1415     Dwarf_Bool  *    /*returned_bool*/,
1416     Dwarf_Error*     /*error*/);
1417 
1418 int dwarf_lineendsequence(Dwarf_Line /*line*/,
1419     Dwarf_Bool  *    /*returned_bool*/,
1420     Dwarf_Error*     /*error*/);
1421 
1422 int dwarf_lineno(Dwarf_Line /*line*/,
1423     Dwarf_Unsigned * /*returned_lineno*/,
1424     Dwarf_Error*     /*error*/);
1425 
1426 int dwarf_line_srcfileno(Dwarf_Line /*line*/,
1427     Dwarf_Unsigned * /*ret_fileno*/,
1428     Dwarf_Error *    /*error*/);
1429 
1430 int dwarf_lineaddr(Dwarf_Line /*line*/,
1431     Dwarf_Addr *     /*returned_addr*/,
1432     Dwarf_Error*     /*error*/);
1433 
1434 int dwarf_lineoff(Dwarf_Line /*line*/,
1435     Dwarf_Signed  *  /*returned_lineoffset*/,
1436     Dwarf_Error*     /*error*/);
1437 
1438 int dwarf_linesrc(Dwarf_Line /*line*/,
1439     char   **        /*returned_name*/,
1440     Dwarf_Error*     /*error*/);
1441 
1442 int dwarf_lineblock(Dwarf_Line /*line*/,
1443     Dwarf_Bool  *    /*returned_bool*/,
1444     Dwarf_Error*     /*error*/);
1445 
1446 /* tertiary interface to line info */
1447 /* Unimplemented */
1448 int dwarf_pclines(Dwarf_Debug /*dbg*/,
1449     Dwarf_Addr       /*pc*/,
1450     Dwarf_Line**     /*linebuf*/,
1451     Dwarf_Signed *   /*linecount*/,
1452     Dwarf_Signed     /*slide*/,
1453     Dwarf_Error*     /*error*/);
1454 /* end line number operations */
1455 
1456 /* global name space operations (.debug_pubnames access) */
1457 int dwarf_get_globals(Dwarf_Debug /*dbg*/,
1458     Dwarf_Global**   /*globals*/,
1459     Dwarf_Signed *   /*number_of_globals*/,
1460     Dwarf_Error*     /*error*/);
1461 void dwarf_globals_dealloc(Dwarf_Debug /*dbg*/,
1462     Dwarf_Global*    /*globals*/,
1463     Dwarf_Signed     /*number_of_globals*/);
1464 
1465 int dwarf_globname(Dwarf_Global /*glob*/,
1466     char   **        /*returned_name*/,
1467     Dwarf_Error*     /*error*/);
1468 
1469 int dwarf_global_die_offset(Dwarf_Global /*global*/,
1470     Dwarf_Off*       /*return_offset*/,
1471     Dwarf_Error *    /*error*/);
1472 
1473 /* This returns the CU die global offset if one knows the
1474    CU header global offset.
1475    See also dwarf_CU_dieoffset_given_die(). */
1476 int dwarf_get_cu_die_offset_given_cu_header_offset(
1477     Dwarf_Debug      /*dbg*/,
1478     Dwarf_Off        /*in_cu_header_offset*/,
1479     Dwarf_Off *  /*out_cu_die_offset*/,
1480     Dwarf_Error *    /*err*/);
1481 #ifdef __sgi /* pragma is sgi MIPS only */
1482 #pragma optional dwarf_get_cu_die_offset_given_cu_header_offset
1483 #endif
1484 
1485 int dwarf_global_cu_offset(Dwarf_Global /*global*/,
1486     Dwarf_Off*       /*return_offset*/,
1487     Dwarf_Error*     /*error*/);
1488 
1489 int dwarf_global_name_offsets(Dwarf_Global /*global*/,
1490     char   **        /*returned_name*/,
1491     Dwarf_Off*       /*die_offset*/,
1492     Dwarf_Off*       /*cu_offset*/,
1493     Dwarf_Error*     /*error*/);
1494 
1495 /* Static function name operations.  */
1496 int dwarf_get_funcs(Dwarf_Debug    /*dbg*/,
1497     Dwarf_Func**     /*funcs*/,
1498     Dwarf_Signed *   /*number_of_funcs*/,
1499     Dwarf_Error*     /*error*/);
1500 void dwarf_funcs_dealloc(Dwarf_Debug /*dbg*/,
1501     Dwarf_Func*      /*funcs*/,
1502     Dwarf_Signed     /*number_of_funcs*/);
1503 
1504 int dwarf_funcname(Dwarf_Func /*func*/,
1505     char   **        /*returned_name*/,
1506     Dwarf_Error*     /*error*/);
1507 
1508 int dwarf_func_die_offset(Dwarf_Func /*func*/,
1509     Dwarf_Off*       /*return_offset*/,
1510     Dwarf_Error*     /*error*/);
1511 
1512 int dwarf_func_cu_offset(Dwarf_Func /*func*/,
1513     Dwarf_Off*       /*return_offset*/,
1514     Dwarf_Error*     /*error*/);
1515 
1516 int dwarf_func_name_offsets(Dwarf_Func /*func*/,
1517     char   **        /*returned_name*/,
1518     Dwarf_Off*       /*die_offset*/,
1519     Dwarf_Off*       /*cu_offset*/,
1520     Dwarf_Error*     /*error*/);
1521 
1522 /* User-defined type name operations, SGI IRIX .debug_typenames section.
1523    Same content as DWARF3 .debug_pubtypes, but defined years before
1524    .debug_pubtypes was defined.   SGI IRIX only. */
1525 int dwarf_get_types(Dwarf_Debug    /*dbg*/,
1526     Dwarf_Type**     /*types*/,
1527     Dwarf_Signed *   /*number_of_types*/,
1528     Dwarf_Error*     /*error*/);
1529 void dwarf_types_dealloc(Dwarf_Debug /*dbg*/,
1530     Dwarf_Type*      /*types*/,
1531     Dwarf_Signed     /*number_of_types*/);
1532 
1533 
1534 int dwarf_typename(Dwarf_Type /*type*/,
1535     char   **        /*returned_name*/,
1536     Dwarf_Error*     /*error*/);
1537 
1538 int dwarf_type_die_offset(Dwarf_Type /*type*/,
1539     Dwarf_Off*       /*return_offset*/,
1540     Dwarf_Error*     /*error*/);
1541 
1542 int dwarf_type_cu_offset(Dwarf_Type /*type*/,
1543     Dwarf_Off*       /*return_offset*/,
1544     Dwarf_Error*     /*error*/);
1545 
1546 int dwarf_type_name_offsets(Dwarf_Type    /*type*/,
1547     char   **        /*returned_name*/,
1548     Dwarf_Off*       /*die_offset*/,
1549     Dwarf_Off*       /*cu_offset*/,
1550     Dwarf_Error*     /*error*/);
1551 
1552 /* User-defined type name operations, DWARF3  .debug_pubtypes section.
1553 */
1554 int dwarf_get_pubtypes(Dwarf_Debug    /*dbg*/,
1555     Dwarf_Type**     /*types*/,
1556     Dwarf_Signed *   /*number_of_types*/,
1557     Dwarf_Error*     /*error*/);
1558 void dwarf_pubtypes_dealloc(Dwarf_Debug /*dbg*/,
1559     Dwarf_Type*      /*pubtypes*/,
1560     Dwarf_Signed     /*number_of_pubtypes*/);
1561 
1562 
1563 int dwarf_pubtypename(Dwarf_Type /*type*/,
1564     char   **        /*returned_name*/,
1565     Dwarf_Error*     /*error*/);
1566 
1567 int dwarf_pubtype_die_offset(Dwarf_Type /*type*/,
1568     Dwarf_Off*       /*return_offset*/,
1569     Dwarf_Error*     /*error*/);
1570 
1571 int dwarf_pubtype_cu_offset(Dwarf_Type /*type*/,
1572     Dwarf_Off*       /*return_offset*/,
1573     Dwarf_Error*     /*error*/);
1574 
1575 int dwarf_pubtype_name_offsets(Dwarf_Type    /*type*/,
1576     char   **        /*returned_name*/,
1577     Dwarf_Off*       /*die_offset*/,
1578     Dwarf_Off*       /*cu_offset*/,
1579     Dwarf_Error*     /*error*/);
1580 
1581 /* File-scope static variable name operations.  */
1582 int dwarf_get_vars(Dwarf_Debug    /*dbg*/,
1583     Dwarf_Var**      /*vars*/,
1584     Dwarf_Signed *   /*number_of_vars*/,
1585     Dwarf_Error*     /*error*/);
1586 void dwarf_vars_dealloc(Dwarf_Debug /*dbg*/,
1587     Dwarf_Var*       /*vars*/,
1588     Dwarf_Signed     /*number_of_vars*/);
1589 
1590 
1591 int dwarf_varname(Dwarf_Var /*var*/,
1592     char   **        /*returned_name*/,
1593     Dwarf_Error*     /*error*/);
1594 
1595 int dwarf_var_die_offset(Dwarf_Var /*var*/,
1596     Dwarf_Off*       /*return_offset*/,
1597     Dwarf_Error*     /*error*/);
1598 
1599 int dwarf_var_cu_offset(Dwarf_Var /*var*/,
1600     Dwarf_Off*       /*return_offset*/,
1601     Dwarf_Error*     /*error*/);
1602 
1603 int dwarf_var_name_offsets(Dwarf_Var /*var*/,
1604     char   **        /*returned_name*/,
1605     Dwarf_Off*       /*die_offset*/,
1606     Dwarf_Off*       /*cu_offset*/,
1607     Dwarf_Error*     /*error*/);
1608 
1609 /* weak name operations.  */
1610 int dwarf_get_weaks(Dwarf_Debug    /*dbg*/,
1611     Dwarf_Weak**     /*weaks*/,
1612     Dwarf_Signed *   /*number_of_weaks*/,
1613     Dwarf_Error*     /*error*/);
1614 void dwarf_weaks_dealloc(Dwarf_Debug /*dbg*/,
1615     Dwarf_Weak*      /*weaks*/,
1616     Dwarf_Signed     /*number_of_weaks*/);
1617 
1618 
1619 int dwarf_weakname(Dwarf_Weak /*weak*/,
1620     char   **        /*returned_name*/,
1621     Dwarf_Error*     /*error*/);
1622 
1623 int dwarf_weak_die_offset(Dwarf_Weak /*weak*/,
1624     Dwarf_Off*       /*return_offset*/,
1625     Dwarf_Error*     /*error*/);
1626 
1627 int dwarf_weak_cu_offset(Dwarf_Weak /*weak*/,
1628     Dwarf_Off*       /*return_offset*/,
1629     Dwarf_Error*     /*error*/);
1630 
1631 int dwarf_weak_name_offsets(Dwarf_Weak    /*weak*/,
1632     char   **        /*returned_name*/,
1633     Dwarf_Off*       /*die_offset*/,
1634     Dwarf_Off*       /*cu_offset*/,
1635     Dwarf_Error*     /*error*/);
1636 
1637 /* location list section operation.  (.debug_loc access) */
1638 int dwarf_get_loclist_entry(Dwarf_Debug /*dbg*/,
1639     Dwarf_Unsigned   /*offset*/,
1640     Dwarf_Addr*      /*hipc*/,
1641     Dwarf_Addr*      /*lopc*/,
1642     Dwarf_Ptr*       /*data*/,
1643     Dwarf_Unsigned*  /*entry_len*/,
1644     Dwarf_Unsigned*  /*next_entry*/,
1645     Dwarf_Error*     /*error*/);
1646 
1647 /* abbreviation section operations */
1648 int dwarf_get_abbrev(Dwarf_Debug /*dbg*/,
1649     Dwarf_Unsigned   /*offset*/,
1650     Dwarf_Abbrev  *  /*returned_abbrev*/,
1651     Dwarf_Unsigned*  /*length*/,
1652     Dwarf_Unsigned*  /*attr_count*/,
1653     Dwarf_Error*     /*error*/);
1654 
1655 int dwarf_get_abbrev_tag(Dwarf_Abbrev /*abbrev*/,
1656     Dwarf_Half*      /*return_tag_number*/,
1657     Dwarf_Error*     /*error*/);
1658 int dwarf_get_abbrev_code(Dwarf_Abbrev /*abbrev*/,
1659     Dwarf_Unsigned*  /*return_code_number*/,
1660     Dwarf_Error*     /*error*/);
1661 
1662 int dwarf_get_abbrev_children_flag(Dwarf_Abbrev /*abbrev*/,
1663     Dwarf_Signed*    /*return_flag*/,
1664     Dwarf_Error*     /*error*/);
1665 
1666 int dwarf_get_abbrev_entry(Dwarf_Abbrev /*abbrev*/,
1667     Dwarf_Signed     /*index*/,
1668     Dwarf_Half  *    /*returned_attr_num*/,
1669     Dwarf_Signed*    /*form*/,
1670     Dwarf_Off*       /*offset*/,
1671     Dwarf_Error*     /*error*/);
1672 
1673 /* consumer string section operation */
1674 int dwarf_get_str(Dwarf_Debug /*dbg*/,
1675     Dwarf_Off        /*offset*/,
1676     char**           /*string*/,
1677     Dwarf_Signed *   /*strlen_of_string*/,
1678     Dwarf_Error*     /*error*/);
1679 
1680 /* Consumer op on  gnu .eh_frame info */
1681 int dwarf_get_fde_list_eh(
1682     Dwarf_Debug      /*dbg*/,
1683     Dwarf_Cie**      /*cie_data*/,
1684     Dwarf_Signed*    /*cie_element_count*/,
1685     Dwarf_Fde**      /*fde_data*/,
1686     Dwarf_Signed*    /*fde_element_count*/,
1687     Dwarf_Error*     /*error*/);
1688 
1689 
1690 /* consumer operations on frame info: .debug_frame */
1691 int dwarf_get_fde_list(Dwarf_Debug /*dbg*/,
1692     Dwarf_Cie**      /*cie_data*/,
1693     Dwarf_Signed*    /*cie_element_count*/,
1694     Dwarf_Fde**      /*fde_data*/,
1695     Dwarf_Signed*    /*fde_element_count*/,
1696     Dwarf_Error*     /*error*/);
1697 
1698 /* Release storage gotten by dwarf_get_fde_list_eh() or
1699    dwarf_get_fde_list() */
1700 void dwarf_fde_cie_list_dealloc(Dwarf_Debug dbg,
1701     Dwarf_Cie *cie_data,
1702     Dwarf_Signed cie_element_count,
1703     Dwarf_Fde *fde_data,
1704     Dwarf_Signed fde_element_count);
1705 
1706 
1707 
1708 int dwarf_get_fde_range(Dwarf_Fde /*fde*/,
1709     Dwarf_Addr*      /*low_pc*/,
1710     Dwarf_Unsigned*  /*func_length*/,
1711     Dwarf_Ptr*       /*fde_bytes*/,
1712     Dwarf_Unsigned*  /*fde_byte_length*/,
1713     Dwarf_Off*       /*cie_offset*/,
1714     Dwarf_Signed*    /*cie_index*/,
1715     Dwarf_Off*       /*fde_offset*/,
1716     Dwarf_Error*     /*error*/);
1717 
1718 /*  Useful for IRIX only:  see dwarf_get_cie_augmentation_data()
1719        dwarf_get_fde_augmentation_data() for GNU .eh_frame. */
1720 int dwarf_get_fde_exception_info(Dwarf_Fde /*fde*/,
1721     Dwarf_Signed*    /* offset_into_exception_tables */,
1722     Dwarf_Error*     /*error*/);
1723 
1724 
1725 int dwarf_get_cie_of_fde(Dwarf_Fde /*fde*/,
1726     Dwarf_Cie *      /*cie_returned*/,
1727     Dwarf_Error*     /*error*/);
1728 
1729 int dwarf_get_cie_info(Dwarf_Cie /*cie*/,
1730     Dwarf_Unsigned * /*bytes_in_cie*/,
1731     Dwarf_Small*     /*version*/,
1732     char        **   /*augmenter*/,
1733     Dwarf_Unsigned*  /*code_alignment_factor*/,
1734     Dwarf_Signed*    /*data_alignment_factor*/,
1735     Dwarf_Half*      /*return_address_register_rule*/,
1736     Dwarf_Ptr*       /*initial_instructions*/,
1737     Dwarf_Unsigned*  /*initial_instructions_length*/,
1738     Dwarf_Error*     /*error*/);
1739 
1740 /* dwarf_get_cie_index new September 2009. */
1741 int dwarf_get_cie_index(
1742     Dwarf_Cie /*cie*/,
1743     Dwarf_Signed* /*index*/,
1744     Dwarf_Error* /*error*/ );
1745 
1746 
1747 int dwarf_get_fde_instr_bytes(Dwarf_Fde /*fde*/,
1748     Dwarf_Ptr *      /*outinstrs*/, Dwarf_Unsigned * /*outlen*/,
1749     Dwarf_Error *    /*error*/);
1750 
1751 int dwarf_get_fde_info_for_all_regs(Dwarf_Fde /*fde*/,
1752     Dwarf_Addr       /*pc_requested*/,
1753     Dwarf_Regtable*  /*reg_table*/,
1754     Dwarf_Addr*      /*row_pc*/,
1755     Dwarf_Error*     /*error*/);
1756 
1757 int dwarf_get_fde_info_for_all_regs3(Dwarf_Fde /*fde*/,
1758     Dwarf_Addr       /*pc_requested*/,
1759     Dwarf_Regtable3* /*reg_table*/,
1760     Dwarf_Addr*      /*row_pc*/,
1761     Dwarf_Error*     /*error*/);
1762 
1763 /* In this older interface DW_FRAME_CFA_COL is a meaningful
1764     column (which does not work well with DWARF3 or
1765     non-MIPS architectures). */
1766 int dwarf_get_fde_info_for_reg(Dwarf_Fde /*fde*/,
1767     Dwarf_Half       /*table_column*/,
1768     Dwarf_Addr       /*pc_requested*/,
1769     Dwarf_Signed*    /*offset_relevant*/,
1770     Dwarf_Signed*    /*register*/,
1771     Dwarf_Signed*    /*offset*/,
1772     Dwarf_Addr*      /*row_pc*/,
1773     Dwarf_Error*     /*error*/);
1774 
1775 /* See discussion of dw_value_type, libdwarf.h.
1776    Use of DW_FRAME_CFA_COL is not meaningful in this interface.
1777    See dwarf_get_fde_info_for_cfa_reg3().
1778 */
1779 /* dwarf_get_fde_info_for_reg3 is useful on a single column, but
1780    it is inefficient to iterate across all table_columns using this
1781    function.  Instead call dwarf_get_fde_info_for_all_regs3() and index
1782    into the table it fills in. */
1783 int dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
1784     Dwarf_Half       /*table_column*/,
1785     Dwarf_Addr       /*pc_requested*/,
1786     Dwarf_Small  *   /*value_type*/,
1787     Dwarf_Signed *   /*offset_relevant*/,
1788     Dwarf_Signed*    /*register*/,
1789     Dwarf_Signed*    /*offset_or_block_len*/,
1790     Dwarf_Ptr   *    /*block_ptr */,
1791     Dwarf_Addr*      /*row_pc_out*/,
1792     Dwarf_Error*     /*error*/);
1793 
1794 /* Use this to get the cfa. */
1795 int dwarf_get_fde_info_for_cfa_reg3(Dwarf_Fde /*fde*/,
1796     Dwarf_Addr       /*pc_requested*/,
1797     Dwarf_Small  *   /*value_type*/,
1798     Dwarf_Signed *   /*offset_relevant*/,
1799     Dwarf_Signed*    /*register*/,
1800     Dwarf_Signed*    /*offset_or_block_len*/,
1801     Dwarf_Ptr   *    /*block_ptr */,
1802     Dwarf_Addr*      /*row_pc_out*/,
1803     Dwarf_Error*     /*error*/);
1804 
1805 int dwarf_get_fde_for_die(Dwarf_Debug /*dbg*/,
1806     Dwarf_Die        /*subr_die */,
1807     Dwarf_Fde  *     /*returned_fde*/,
1808     Dwarf_Error*     /*error*/);
1809 
1810 int dwarf_get_fde_n(Dwarf_Fde* /*fde_data*/,
1811     Dwarf_Unsigned   /*fde_index*/,
1812     Dwarf_Fde  *     /*returned_fde*/,
1813     Dwarf_Error*     /*error*/);
1814 
1815 int dwarf_get_fde_at_pc(Dwarf_Fde* /*fde_data*/,
1816     Dwarf_Addr       /*pc_of_interest*/,
1817     Dwarf_Fde  *     /*returned_fde*/,
1818     Dwarf_Addr*      /*lopc*/,
1819     Dwarf_Addr*      /*hipc*/,
1820     Dwarf_Error*     /*error*/);
1821 
1822 /* GNU .eh_frame augmentation information, raw form, see
1823    Linux Standard Base Core Specification version 3.0 . */
1824 int dwarf_get_cie_augmentation_data(Dwarf_Cie /* cie*/,
1825     Dwarf_Small **   /* augdata */,
1826     Dwarf_Unsigned * /* augdata_len */,
1827     Dwarf_Error*     /*error*/);
1828 /* GNU .eh_frame augmentation information, raw form, see
1829    Linux Standard Base Core Specification version 3.0 . */
1830 int dwarf_get_fde_augmentation_data(Dwarf_Fde /* fde*/,
1831     Dwarf_Small **   /* augdata */,
1832     Dwarf_Unsigned * /* augdata_len */,
1833     Dwarf_Error*     /*error*/);
1834 
1835 int dwarf_expand_frame_instructions(Dwarf_Cie /*cie*/,
1836     Dwarf_Ptr        /*instruction*/,
1837     Dwarf_Unsigned   /*i_length*/,
1838     Dwarf_Frame_Op** /*returned_op_list*/,
1839     Dwarf_Signed*    /*op_count*/,
1840     Dwarf_Error*     /*error*/);
1841 
1842 /* Operations on .debug_aranges. */
1843 int dwarf_get_aranges(Dwarf_Debug /*dbg*/,
1844     Dwarf_Arange**   /*aranges*/,
1845     Dwarf_Signed *   /*arange_count*/,
1846     Dwarf_Error*     /*error*/);
1847 
1848 
1849 
1850 int dwarf_get_arange(
1851     Dwarf_Arange*    /*aranges*/,
1852     Dwarf_Unsigned   /*arange_count*/,
1853     Dwarf_Addr       /*address*/,
1854     Dwarf_Arange *   /*returned_arange*/,
1855     Dwarf_Error*     /*error*/);
1856 
1857 int dwarf_get_cu_die_offset(
1858     Dwarf_Arange     /*arange*/,
1859     Dwarf_Off*       /*return_offset*/,
1860     Dwarf_Error*     /*error*/);
1861 
1862 int dwarf_get_arange_cu_header_offset(
1863     Dwarf_Arange     /*arange*/,
1864     Dwarf_Off*       /*return_cu_header_offset*/,
1865     Dwarf_Error*     /*error*/);
1866 #ifdef __sgi /* pragma is sgi MIPS only */
1867 #pragma optional dwarf_get_arange_cu_header_offset
1868 #endif
1869 
1870 /* DWARF2,3 interface. No longer really adequate (it was never
1871    right for segmented address spaces, please switch
1872    to using dwarf_get_arange_info_b instead.
1873    There is no effective difference between these
1874    functions  if the address space
1875    of the target is not segmented.  */
1876 int dwarf_get_arange_info(
1877     Dwarf_Arange     /*arange*/,
1878     Dwarf_Addr*      /*start*/,
1879     Dwarf_Unsigned*  /*length*/,
1880     Dwarf_Off*       /*cu_die_offset*/,
1881     Dwarf_Error*     /*error*/ );
1882 
1883 /* New for DWARF4, entries may have segment information.
1884    *segment is only meaningful if *segment_entry_size is non-zero. */
1885 int dwarf_get_arange_info_b(
1886     Dwarf_Arange     /*arange*/,
1887     Dwarf_Unsigned*  /*segment*/,
1888     Dwarf_Unsigned*  /*segment_entry_size*/,
1889     Dwarf_Addr    *  /*start*/,
1890     Dwarf_Unsigned*  /*length*/,
1891     Dwarf_Off     *  /*cu_die_offset*/,
1892     Dwarf_Error   *  /*error*/ );
1893 
1894 
1895 /* consumer .debug_macinfo information interface.
1896 */
1897 struct Dwarf_Macro_Details_s {
1898     Dwarf_Off    dmd_offset; /* offset, in the section,
1899                               of this macro info */
1900     Dwarf_Small  dmd_type;   /* the type, DW_MACINFO_define etc*/
1901     Dwarf_Signed dmd_lineno; /* the source line number where
1902                               applicable and vend_def # if
1903                               vendor_extension op
1904                              */
1905 
1906     Dwarf_Signed dmd_fileindex;/* the source file index:
1907                               applies to define undef start_file
1908                                */
1909     char *       dmd_macro;  /* macro name (with value for defineop)
1910                               string from vendor ext
1911                              */
1912 };
1913 
1914 /* dwarf_print_lines is for use by dwarfdump: it prints
1915    line info to stdout.
1916    The _dwarf name is obsolete. Use dwarf_ instead.
1917    Added extra argnument 2/2009 for better checking.
1918 */
1919 int _dwarf_print_lines(Dwarf_Die /*cu_die*/,Dwarf_Error * /*error*/);
1920 int dwarf_print_lines(Dwarf_Die /*cu_die*/,Dwarf_Error * /*error*/,
1921    int * /*error_count_out */);
1922 
1923 /* dwarf_check_lineheader lets dwarfdump get detailed messages
1924    about some compiler errors we detect.
1925    We return the count of detected errors throught the
1926    pointer.
1927 */
1928 void dwarf_check_lineheader(Dwarf_Die /*cu_die*/,int *errcount_out);
1929 
1930 /* dwarf_ld_sort_lines helps SGI IRIX ld
1931    rearrange lines in .debug_line in a .o created with a text
1932    section per function.
1933         -OPT:procedure_reorder=ON
1934    where ld-cord (cord(1)ing by ld,
1935    not by cord(1)) may have changed the function order.
1936    The _dwarf name is obsolete. Use dwarf_ instead.
1937 */
1938 int _dwarf_ld_sort_lines(
1939     void *         /*orig_buffer*/,
1940     unsigned long  /* buffer_len*/,
1941     int            /*is_64_bit*/,
1942     int *          /*any_change*/,
1943     int *          /*err_code*/);
1944 int dwarf_ld_sort_lines(
1945     void *         /*orig_buffer*/,
1946     unsigned long  /*buffer_len*/,
1947     int            /*is_64_bit*/,
1948     int *          /*any_change*/,
1949     int *          /*err_code*/);
1950 
1951 /* Used by dwarfdump -v to print fde offsets from debugging
1952    info.
1953    The _dwarf name is obsolete. Use dwarf_ instead.
1954 */
1955 int _dwarf_fde_section_offset(Dwarf_Debug dbg,
1956     Dwarf_Fde         /*in_fde*/,
1957     Dwarf_Off *       /*fde_off*/,
1958     Dwarf_Off *       /*cie_off*/,
1959     Dwarf_Error *     /*err*/);
1960 int dwarf_fde_section_offset(Dwarf_Debug dbg,
1961     Dwarf_Fde         /*in_fde*/,
1962     Dwarf_Off *       /*fde_off*/,
1963     Dwarf_Off *       /*cie_off*/,
1964     Dwarf_Error *     /*err*/);
1965 
1966 /* Used by dwarfdump -v to print cie offsets from debugging
1967    info.
1968    The _dwarf name is obsolete. Use dwarf_ instead.
1969 */
1970 int dwarf_cie_section_offset(Dwarf_Debug /*dbg*/,
1971     Dwarf_Cie     /*in_cie*/,
1972     Dwarf_Off *   /*cie_off */,
1973     Dwarf_Error * /*err*/);
1974 int _dwarf_cie_section_offset(Dwarf_Debug /*dbg*/,
1975     Dwarf_Cie     /*in_cie*/,
1976     Dwarf_Off *   /*cie_off*/,
1977     Dwarf_Error * /*err*/);
1978 
1979 typedef struct Dwarf_Macro_Details_s Dwarf_Macro_Details;
1980 
1981 int dwarf_get_macro(Dwarf_Debug /*dbg*/,
1982     char *        /*requested_macro_name*/,
1983     Dwarf_Addr    /*pc_of_request*/,
1984     char **       /*returned_macro_value*/,
1985     Dwarf_Error * /*error*/);
1986 
1987 int dwarf_get_all_defined_macros(Dwarf_Debug /*dbg*/,
1988     Dwarf_Addr     /*pc_of_request*/,
1989     Dwarf_Signed * /*returned_count*/,
1990     char ***       /*returned_pointers_to_macros*/,
1991     Dwarf_Error *  /*error*/);
1992 
1993 char *dwarf_find_macro_value_start(char * /*macro_string*/);
1994 
1995 int dwarf_get_macro_details(Dwarf_Debug /*dbg*/,
1996     Dwarf_Off            /*macro_offset*/,
1997     Dwarf_Unsigned       /*maximum_count*/,
1998     Dwarf_Signed         * /*entry_count*/,
1999     Dwarf_Macro_Details ** /*details*/,
2000     Dwarf_Error *        /*err*/);
2001 
2002 
2003 int dwarf_get_address_size(Dwarf_Debug /*dbg*/,
2004     Dwarf_Half  *    /*addr_size*/,
2005     Dwarf_Error *    /*error*/);
2006 int dwarf_get_die_address_size(Dwarf_Die /*die*/,
2007     Dwarf_Half  *    /*addr_size*/,
2008     Dwarf_Error *    /*error*/);
2009 
2010 /* The dwarf specification separates FORMs into
2011 different classes.  To do the seperation properly
2012 requires 4 pieces of data as of DWARF4 (thus the
2013 function arguments listed here).
2014 The DWARF4 specification class definition suffices to
2015 describe all DWARF versions.
2016 See section 7.5.4, Attribute Encodings.
2017 A return of DW_FORM_CLASS_UNKNOWN means we could not properly figure
2018 out what form-class it is.
2019 
2020     DW_FORM_CLASS_FRAMEPTR is MIPS/IRIX only, and refers
2021     to the DW_AT_MIPS_fde attribute (a reference to the
2022     .debug_frame section).
2023 */
2024 enum Dwarf_Form_Class {
2025     DW_FORM_CLASS_UNKNOWN,   DW_FORM_CLASS_ADDRESS,
2026     DW_FORM_CLASS_BLOCK,     DW_FORM_CLASS_CONSTANT,
2027     DW_FORM_CLASS_EXPRLOC,   DW_FORM_CLASS_FLAG,
2028     DW_FORM_CLASS_LINEPTR,   DW_FORM_CLASS_LOCLISTPTR,
2029     DW_FORM_CLASS_MACPTR,    DW_FORM_CLASS_RANGELISTPTR,
2030     DW_FORM_CLASS_REFERENCE, DW_FORM_CLASS_STRING,
2031     DW_FORM_CLASS_FRAMEPTR
2032 };
2033 
2034 enum Dwarf_Form_Class dwarf_get_form_class(
2035     Dwarf_Half /* dwversion */,
2036     Dwarf_Half /* attrnum */,
2037     Dwarf_Half /*offset_size */,
2038     Dwarf_Half /*form*/);
2039 
2040 /* utility operations */
2041 Dwarf_Unsigned dwarf_errno(Dwarf_Error     /*error*/);
2042 
2043 char* dwarf_errmsg(Dwarf_Error    /*error*/);
2044 
2045 /* stringcheck zero is default and means do all
2046 ** string length validity checks.
2047 ** Call with parameter value 1 to turn off many such checks (and
2048 ** increase performance).
2049 ** Call with zero for safest running.
2050 ** Actual value saved and returned is only 8 bits! Upper bits
2051 ** ignored by libdwarf (and zero on return).
2052 ** Returns previous value.
2053 */
2054 int dwarf_set_stringcheck(int /*stringcheck*/);
2055 
2056 /* 'apply' defaults to 1 and means do all
2057  * 'rela' relocations on reading in a dwarf object section with
2058  * such relocations.
2059  * Call with parameter value 0 to turn off application of
2060  * such relocations.
2061  * Since the static linker leaves 'bogus' data in object sections
2062  * with a 'rela' relocation section such data cannot be read
2063  * sensibly without processing the relocations.  Such relocations
2064  * do not exist in executables and shared objects (.so), the
2065  * relocations only exist in plain .o relocatable object files.
2066  * Actual value saved and returned is only 8 bits! Upper bits
2067  * ignored by libdwarf (and zero on return).
2068  * Returns previous value.
2069  * */
2070 int dwarf_set_reloc_application(int /*apply*/);
2071 
2072 
2073 /* Unimplemented */
2074 Dwarf_Handler dwarf_seterrhand(Dwarf_Debug /*dbg*/, Dwarf_Handler /*errhand*/);
2075 
2076 /* Unimplemented */
2077 Dwarf_Ptr dwarf_seterrarg(Dwarf_Debug /*dbg*/, Dwarf_Ptr /*errarg*/);
2078 
2079 void dwarf_dealloc(Dwarf_Debug /*dbg*/, void* /*space*/,
2080     Dwarf_Unsigned /*type*/);
2081 
2082 /* DWARF Producer Interface */
2083 
2084 typedef int (*Dwarf_Callback_Func)(
2085     char*           /*name*/,
2086     int             /*size*/,
2087     Dwarf_Unsigned  /*type*/,
2088     Dwarf_Unsigned  /*flags*/,
2089     Dwarf_Unsigned  /*link*/,
2090     Dwarf_Unsigned  /*info*/,
2091     int*            /*sect name index*/,
2092     int*            /*error*/);
2093 
2094 Dwarf_P_Debug dwarf_producer_init(
2095     Dwarf_Unsigned  /*creation_flags*/,
2096     Dwarf_Callback_Func    /*func*/,
2097     Dwarf_Handler   /*errhand*/,
2098     Dwarf_Ptr       /*errarg*/,
2099     Dwarf_Error*    /*error*/);
2100 
2101 typedef int (*Dwarf_Callback_Func_b)(
2102     char*           /*name*/,
2103     int             /*size*/,
2104     Dwarf_Unsigned  /*type*/,
2105     Dwarf_Unsigned  /*flags*/,
2106     Dwarf_Unsigned  /*link*/,
2107     Dwarf_Unsigned  /*info*/,
2108     Dwarf_Unsigned* /*sect_name_index*/,
2109     int*            /*error*/);
2110 
2111 
2112 Dwarf_P_Debug dwarf_producer_init_b(
2113     Dwarf_Unsigned        /*flags*/,
2114     Dwarf_Callback_Func_b /*func*/,
2115     Dwarf_Handler         /*errhand*/,
2116     Dwarf_Ptr             /*errarg*/,
2117     Dwarf_Error *         /*error*/);
2118 
2119 
2120 Dwarf_Signed dwarf_transform_to_disk_form(Dwarf_P_Debug /*dbg*/,
2121     Dwarf_Error*     /*error*/);
2122 
2123 Dwarf_Ptr dwarf_get_section_bytes(Dwarf_P_Debug /*dbg*/,
2124     Dwarf_Signed     /*dwarf_section*/,
2125     Dwarf_Signed*    /*elf_section_index*/,
2126     Dwarf_Unsigned*  /*length*/,
2127     Dwarf_Error*     /*error*/);
2128 
2129 int  dwarf_get_relocation_info_count(
2130     Dwarf_P_Debug    /*dbg*/,
2131     Dwarf_Unsigned * /*count_of_relocation_sections*/,
2132     int *                /*drd_buffer_version*/,
2133     Dwarf_Error*     /*error*/);
2134 
2135 int dwarf_get_relocation_info(
2136     Dwarf_P_Debug           /*dbg*/,
2137     Dwarf_Signed          * /*elf_section_index*/,
2138     Dwarf_Signed          * /*elf_section_index_link*/,
2139     Dwarf_Unsigned        * /*relocation_buffer_count*/,
2140     Dwarf_Relocation_Data * /*reldata_buffer*/,
2141     Dwarf_Error*            /*error*/);
2142 
2143 /* v1:  no drd_length field, enum explicit */
2144 /* v2:  has the drd_length field, enum value in uchar member */
2145 #define DWARF_DRD_BUFFER_VERSION 2
2146 
2147 /* Markers are not written  to DWARF2/3/4, they are user
2148    defined and may be used for any purpose.
2149 */
2150 Dwarf_Signed dwarf_get_die_markers(
2151     Dwarf_P_Debug     /*dbg*/,
2152     Dwarf_P_Marker *  /*marker_list*/,
2153     Dwarf_Unsigned *  /*marker_count*/,
2154     Dwarf_Error *     /*error*/);
2155 
2156 int dwarf_get_string_attributes_count(Dwarf_P_Debug,
2157     Dwarf_Unsigned *,
2158     int *,
2159     Dwarf_Error *);
2160 
2161 int dwarf_get_string_attributes_info(Dwarf_P_Debug,
2162     Dwarf_Signed *,
2163     Dwarf_Unsigned *,
2164     Dwarf_P_String_Attr *,
2165     Dwarf_Error *);
2166 
2167 void dwarf_reset_section_bytes(Dwarf_P_Debug /*dbg*/);
2168 
2169 Dwarf_Unsigned dwarf_producer_finish(Dwarf_P_Debug /*dbg*/,
2170     Dwarf_Error* /*error*/);
2171 
2172 /* Producer attribute addition functions. */
2173 Dwarf_P_Attribute dwarf_add_AT_targ_address(Dwarf_P_Debug /*dbg*/,
2174     Dwarf_P_Die     /*ownerdie*/,
2175     Dwarf_Half      /*attr*/,
2176     Dwarf_Unsigned  /*pc_value*/,
2177     Dwarf_Signed    /*sym_index*/,
2178     Dwarf_Error*    /*error*/);
2179 
2180 Dwarf_P_Attribute dwarf_add_AT_block(Dwarf_P_Debug /*dbg*/,
2181     Dwarf_P_Die     /*ownerdie*/,
2182     Dwarf_Half      /*attr*/,
2183     Dwarf_Small*    /*block_data*/,
2184     Dwarf_Unsigned  /*block_len*/,
2185     Dwarf_Error*    /*error*/);
2186 
2187 Dwarf_P_Attribute dwarf_add_AT_targ_address_b(Dwarf_P_Debug /*dbg*/,
2188     Dwarf_P_Die     /*ownerdie*/,
2189     Dwarf_Half      /*attr*/,
2190     Dwarf_Unsigned  /*pc_value*/,
2191     Dwarf_Unsigned  /*sym_index*/,
2192     Dwarf_Error*    /*error*/);
2193 
2194 Dwarf_P_Attribute dwarf_add_AT_ref_address(Dwarf_P_Debug /*dbg*/,
2195     Dwarf_P_Die     /*ownerdie*/,
2196     Dwarf_Half      /*attr*/,
2197     Dwarf_Unsigned  /*pc_value*/,
2198     Dwarf_Unsigned  /*sym_index*/,
2199     Dwarf_Error*    /*error*/);
2200 
2201 Dwarf_P_Attribute dwarf_add_AT_unsigned_const(Dwarf_P_Debug /*dbg*/,
2202     Dwarf_P_Die     /*ownerdie*/,
2203     Dwarf_Half      /*attr*/,
2204     Dwarf_Unsigned  /*value*/,
2205     Dwarf_Error*    /*error*/);
2206 
2207 Dwarf_P_Attribute dwarf_add_AT_signed_const(Dwarf_P_Debug /*dbg*/,
2208     Dwarf_P_Die     /*ownerdie*/,
2209     Dwarf_Half      /*attr*/,
2210     Dwarf_Signed    /*value*/,
2211     Dwarf_Error*    /*error*/);
2212 
2213 Dwarf_P_Attribute dwarf_add_AT_reference(Dwarf_P_Debug /*dbg*/,
2214     Dwarf_P_Die     /*ownerdie*/,
2215     Dwarf_Half      /*attr*/,
2216     Dwarf_P_Die     /*otherdie*/,
2217     Dwarf_Error*    /*error*/);
2218 
2219 Dwarf_P_Attribute dwarf_add_AT_dataref(
2220     Dwarf_P_Debug   /* dbg*/,
2221     Dwarf_P_Die     /*ownerdie*/,
2222     Dwarf_Half      /*attr*/,
2223     Dwarf_Unsigned  /*pcvalue*/,
2224     Dwarf_Unsigned  /*sym_index*/,
2225     Dwarf_Error*    /*error*/);
2226 
2227 Dwarf_P_Attribute dwarf_add_AT_const_value_string(Dwarf_P_Die /*ownerdie*/,
2228     char*           /*string_value*/,
2229     Dwarf_Error*    /*error*/);
2230 
2231 Dwarf_P_Attribute dwarf_add_AT_location_expr(Dwarf_P_Debug /*dbg*/,
2232     Dwarf_P_Die     /*ownerdie*/,
2233     Dwarf_Half      /*attr*/,
2234     Dwarf_P_Expr    /*loc_expr*/,
2235     Dwarf_Error*    /*error*/);
2236 
2237 Dwarf_P_Attribute dwarf_add_AT_string(Dwarf_P_Debug /*dbg*/,
2238     Dwarf_P_Die     /*ownerdie*/,
2239     Dwarf_Half      /*attr*/,
2240     char*           /*string*/,
2241     Dwarf_Error*     /*error*/);
2242 
2243 Dwarf_P_Attribute dwarf_add_AT_flag(Dwarf_P_Debug /*dbg*/,
2244     Dwarf_P_Die     /*ownerdie*/,
2245     Dwarf_Half      /*attr*/,
2246     Dwarf_Small     /*flag*/,
2247     Dwarf_Error*    /*error*/);
2248 
2249 Dwarf_P_Attribute dwarf_add_AT_producer(Dwarf_P_Die /*ownerdie*/,
2250     char*           /*producer_string*/,
2251     Dwarf_Error*    /*error*/);
2252 
2253 Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
2254     Dwarf_Signed    /*signed_value*/,
2255     Dwarf_Error*    /*error*/);
2256 
2257 Dwarf_P_Attribute dwarf_add_AT_const_value_unsignedint(
2258     Dwarf_P_Die     /*ownerdie*/,
2259     Dwarf_Unsigned  /*unsigned_value*/,
2260     Dwarf_Error*    /*error*/);
2261 
2262 Dwarf_P_Attribute dwarf_add_AT_comp_dir(Dwarf_P_Die /*ownerdie*/,
2263     char*           /*current_working_directory*/,
2264     Dwarf_Error*    /*error*/);
2265 
2266 Dwarf_P_Attribute dwarf_add_AT_name(Dwarf_P_Die    /*die*/,
2267     char*           /*name*/,
2268     Dwarf_Error*    /*error*/);
2269 
2270 /* Producer line creation functions (.debug_line) */
2271 Dwarf_Unsigned dwarf_add_directory_decl(Dwarf_P_Debug /*dbg*/,
2272     char*           /*name*/,
2273     Dwarf_Error*    /*error*/);
2274 
2275 Dwarf_Unsigned dwarf_add_file_decl(Dwarf_P_Debug /*dbg*/,
2276     char*           /*name*/,
2277     Dwarf_Unsigned  /*dir_index*/,
2278     Dwarf_Unsigned  /*time_last_modified*/,
2279     Dwarf_Unsigned  /*length*/,
2280     Dwarf_Error*    /*error*/);
2281 
2282 Dwarf_Unsigned dwarf_add_line_entry(Dwarf_P_Debug /*dbg*/,
2283     Dwarf_Unsigned  /*file_index*/,
2284     Dwarf_Addr      /*code_address*/,
2285     Dwarf_Unsigned  /*lineno*/,
2286     Dwarf_Signed    /*column_number*/,
2287     Dwarf_Bool      /*is_source_stmt_begin*/,
2288     Dwarf_Bool      /*is_basic_block_begin*/,
2289     Dwarf_Error*    /*error*/);
2290 
2291 Dwarf_Unsigned dwarf_lne_set_address(Dwarf_P_Debug /*dbg*/,
2292     Dwarf_Unsigned  /*offset*/,
2293     Dwarf_Unsigned  /*symbol_index*/,
2294     Dwarf_Error*    /*error*/);
2295 
2296 Dwarf_Unsigned dwarf_lne_end_sequence(Dwarf_P_Debug /*dbg*/,
2297     Dwarf_Addr      /*end_address*/,
2298     Dwarf_Error*    /*error*/);
2299 
2300 /* Producer .debug_frame functions */
2301 Dwarf_Unsigned dwarf_add_frame_cie(Dwarf_P_Debug /*dbg*/,
2302     char*           /*augmenter*/,
2303     Dwarf_Small     /*code_alignent_factor*/,
2304     Dwarf_Small     /*data_alignment_factor*/,
2305     Dwarf_Small     /*return_address_reg*/,
2306     Dwarf_Ptr       /*initialization_bytes*/,
2307     Dwarf_Unsigned  /*init_byte_len*/,
2308     Dwarf_Error*    /*error*/);
2309 
2310 Dwarf_Unsigned dwarf_add_frame_fde(
2311     Dwarf_P_Debug   /*dbg*/,
2312     Dwarf_P_Fde     /*fde*/,
2313     Dwarf_P_Die     /*corresponding subprogram die*/,
2314     Dwarf_Unsigned  /*cie_to_use*/,
2315     Dwarf_Unsigned  /*virt_addr_of_described_code*/,
2316     Dwarf_Unsigned  /*length_of_code*/,
2317     Dwarf_Unsigned  /*symbol_index*/,
2318     Dwarf_Error*    /*error*/);
2319 
2320 Dwarf_Unsigned dwarf_add_frame_fde_b(
2321     Dwarf_P_Debug  /*dbg*/,
2322     Dwarf_P_Fde    /*fde*/,
2323     Dwarf_P_Die    /*die*/,
2324     Dwarf_Unsigned /*cie*/,
2325     Dwarf_Addr     /*virt_addr*/,
2326     Dwarf_Unsigned /*code_len*/,
2327     Dwarf_Unsigned /*sym_idx*/,
2328     Dwarf_Unsigned /*sym_idx_of_end*/,
2329     Dwarf_Addr     /*offset_from_end_sym*/,
2330     Dwarf_Error*   /*error*/);
2331 
2332 Dwarf_Unsigned dwarf_add_frame_info_b(
2333     Dwarf_P_Debug dbg   /*dbg*/,
2334     Dwarf_P_Fde     /*fde*/,
2335     Dwarf_P_Die     /*die*/,
2336     Dwarf_Unsigned  /*cie*/,
2337     Dwarf_Addr      /*virt_addr*/,
2338     Dwarf_Unsigned  /*code_len*/,
2339     Dwarf_Unsigned  /*symidx*/,
2340     Dwarf_Unsigned  /*end_symbol */,
2341     Dwarf_Addr      /*offset_from_end_symbol */,
2342     Dwarf_Signed    /*offset_into_exception_tables*/,
2343     Dwarf_Unsigned  /*exception_table_symbol*/,
2344     Dwarf_Error*    /*error*/);
2345 
2346 Dwarf_Unsigned dwarf_add_frame_info(
2347     Dwarf_P_Debug dbg   /*dbg*/,
2348     Dwarf_P_Fde     /*fde*/,
2349     Dwarf_P_Die     /*die*/,
2350     Dwarf_Unsigned  /*cie*/,
2351     Dwarf_Addr      /*virt_addr*/,
2352     Dwarf_Unsigned  /*code_len*/,
2353     Dwarf_Unsigned  /*symidx*/,
2354     Dwarf_Signed    /*offset_into_exception_tables*/,
2355     Dwarf_Unsigned  /*exception_table_symbol*/,
2356     Dwarf_Error*    /*error*/);
2357 
2358 Dwarf_P_Fde dwarf_add_fde_inst(
2359     Dwarf_P_Fde     /*fde*/,
2360     Dwarf_Small     /*op*/,
2361     Dwarf_Unsigned  /*val1*/,
2362     Dwarf_Unsigned  /*val2*/,
2363     Dwarf_Error*    /*error*/);
2364 
2365 /* New September 17, 2009 */
2366 int dwarf_insert_fde_inst_bytes(
2367     Dwarf_P_Debug  /*dbg*/,
2368     Dwarf_P_Fde    /*fde*/,
2369     Dwarf_Unsigned /*len*/,
2370     Dwarf_Ptr      /*ibytes*/,
2371     Dwarf_Error*   /*error*/);
2372 
2373 
2374 Dwarf_P_Fde dwarf_new_fde(Dwarf_P_Debug    /*dbg*/, Dwarf_Error* /*error*/);
2375 
2376 Dwarf_P_Fde dwarf_fde_cfa_offset(
2377     Dwarf_P_Fde     /*fde*/,
2378     Dwarf_Unsigned  /*register_number*/,
2379     Dwarf_Signed    /*offset*/,
2380     Dwarf_Error*    /*error*/);
2381 
2382 /* die creation & addition routines */
2383 Dwarf_P_Die dwarf_new_die(
2384     Dwarf_P_Debug    /*dbg*/,
2385     Dwarf_Tag         /*tag*/,
2386     Dwarf_P_Die     /*parent*/,
2387     Dwarf_P_Die     /*child*/,
2388     Dwarf_P_Die     /*left */,
2389     Dwarf_P_Die     /*right*/,
2390     Dwarf_Error*    /*error*/);
2391 
2392 Dwarf_Unsigned dwarf_add_die_to_debug(
2393     Dwarf_P_Debug   /*dbg*/,
2394     Dwarf_P_Die     /*die*/,
2395     Dwarf_Error*    /*error*/);
2396 
2397 /* Markers are not written  to DWARF2/3/4, they are user
2398    defined and may be used for any purpose.
2399 */
2400 Dwarf_Unsigned dwarf_add_die_marker(
2401     Dwarf_P_Debug   /*dbg*/,
2402     Dwarf_P_Die     /*die*/,
2403     Dwarf_Unsigned  /*marker*/,
2404     Dwarf_Error *   /*error*/);
2405 
2406 Dwarf_Unsigned dwarf_get_die_marker(
2407     Dwarf_P_Debug   /*dbg*/,
2408     Dwarf_P_Die     /*die*/,
2409     Dwarf_Unsigned *  /*marker*/,
2410     Dwarf_Error *   /*error*/);
2411 
2412 Dwarf_P_Die dwarf_die_link(
2413     Dwarf_P_Die     /*die*/,
2414     Dwarf_P_Die     /*parent*/,
2415     Dwarf_P_Die     /*child*/,
2416     Dwarf_P_Die     /*left*/,
2417     Dwarf_P_Die     /*right*/,
2418     Dwarf_Error*    /*error*/);
2419 
2420 void dwarf_dealloc_compressed_block(
2421     Dwarf_P_Debug,
2422     void *
2423 );
2424 
2425 /* Call this passing in return value from dwarf_uncompress_integer_block()
2426  * to free the space the decompression allocated. */
2427 void dwarf_dealloc_uncompressed_block(
2428     Dwarf_Debug,
2429     void *
2430 );
2431 
2432 void * dwarf_compress_integer_block(
2433     Dwarf_P_Debug,    /* dbg */
2434     Dwarf_Bool,       /* signed==true (or unsigned) */
2435     Dwarf_Small,      /* size of integer units: 8, 16, 32, 64 */
2436     void*,            /* data */
2437     Dwarf_Unsigned,   /* number of elements */
2438     Dwarf_Unsigned*,  /* number of bytes in output block */
2439     Dwarf_Error*      /* error */
2440 );
2441 
2442 /* Decode an array of signed leb integers (so of course the
2443  * array is not composed of fixed length values, but is instead
2444  * a sequence of sleb values).
2445  * Returns a DW_DLV_BADADDR on error.
2446  * Otherwise returns a pointer to an array of 32bit integers.
2447  * The signed argument must be non-zero (the decode
2448  * assumes sleb integers in the input data) at this time.
2449  * Size of integer units must be 32 (32 bits each) at this time.
2450  * Number of bytes in block is a byte count (not array count).
2451  * Returns number of units in output block (ie, number of elements
2452  * of the array that the return value points to) thru the argument.
2453  */
2454 void * dwarf_uncompress_integer_block(
2455     Dwarf_Debug,      /* dbg */
2456     Dwarf_Bool,       /* signed==true (or unsigned) */
2457     Dwarf_Small,      /* size of integer units: 8, 16, 32, 64 */
2458     void*,            /* input data */
2459     Dwarf_Unsigned,   /* number of bytes in input */
2460     Dwarf_Unsigned*,  /* number of units in output block */
2461     Dwarf_Error*      /* error */
2462 );
2463 
2464 /* Operations to create location expressions. */
2465 Dwarf_P_Expr dwarf_new_expr(Dwarf_P_Debug /*dbg*/, Dwarf_Error* /*error*/);
2466 
2467 void dwarf_expr_reset(
2468     Dwarf_P_Expr      /*expr*/,
2469     Dwarf_Error*      /*error*/);
2470 
2471 Dwarf_Unsigned dwarf_add_expr_gen(
2472     Dwarf_P_Expr      /*expr*/,
2473     Dwarf_Small       /*opcode*/,
2474     Dwarf_Unsigned    /*val1*/,
2475     Dwarf_Unsigned    /*val2*/,
2476     Dwarf_Error*      /*error*/);
2477 
2478 Dwarf_Unsigned dwarf_add_expr_addr(
2479     Dwarf_P_Expr      /*expr*/,
2480     Dwarf_Unsigned    /*addr*/,
2481     Dwarf_Signed      /*sym_index*/,
2482     Dwarf_Error*      /*error*/);
2483 
2484 Dwarf_Unsigned dwarf_add_expr_addr_b(
2485     Dwarf_P_Expr      /*expr*/,
2486     Dwarf_Unsigned    /*addr*/,
2487     Dwarf_Unsigned    /*sym_index*/,
2488     Dwarf_Error*      /*error*/);
2489 
2490 Dwarf_Unsigned dwarf_expr_current_offset(
2491     Dwarf_P_Expr      /*expr*/,
2492     Dwarf_Error*      /*error*/);
2493 
2494 Dwarf_Addr dwarf_expr_into_block(
2495     Dwarf_P_Expr      /*expr*/,
2496     Dwarf_Unsigned*   /*length*/,
2497     Dwarf_Error*      /*error*/);
2498 
2499 Dwarf_Unsigned dwarf_add_arange(Dwarf_P_Debug /*dbg*/,
2500     Dwarf_Addr        /*begin_address*/,
2501     Dwarf_Unsigned    /*length*/,
2502     Dwarf_Signed      /*symbol_index*/,
2503     Dwarf_Error*      /*error*/);
2504 
2505 Dwarf_Unsigned dwarf_add_arange_b(
2506     Dwarf_P_Debug  /*dbg*/,
2507     Dwarf_Addr     /*begin_address*/,
2508     Dwarf_Unsigned /*length*/,
2509     Dwarf_Unsigned /*symbol_index*/,
2510     Dwarf_Unsigned /*end_symbol_index*/,
2511     Dwarf_Addr     /*offset_from_end_symbol*/,
2512     Dwarf_Error *  /*error*/);
2513 
2514 Dwarf_Unsigned dwarf_add_pubname(
2515     Dwarf_P_Debug      /*dbg*/,
2516     Dwarf_P_Die        /*die*/,
2517     char*              /*pubname_name*/,
2518     Dwarf_Error*       /*error*/);
2519 
2520 Dwarf_Unsigned dwarf_add_funcname(
2521     Dwarf_P_Debug      /*dbg*/,
2522     Dwarf_P_Die        /*die*/,
2523     char*              /*func_name*/,
2524     Dwarf_Error*       /*error*/);
2525 
2526 Dwarf_Unsigned dwarf_add_typename(
2527     Dwarf_P_Debug     /*dbg*/,
2528     Dwarf_P_Die       /*die*/,
2529     char*             /*type_name*/,
2530     Dwarf_Error*      /*error*/);
2531 
2532 Dwarf_Unsigned dwarf_add_varname(
2533     Dwarf_P_Debug     /*dbg*/,
2534     Dwarf_P_Die       /*die*/,
2535     char*             /*var_name*/,
2536     Dwarf_Error*      /*error*/);
2537 
2538 Dwarf_Unsigned dwarf_add_weakname(
2539     Dwarf_P_Debug    /*dbg*/,
2540     Dwarf_P_Die      /*die*/,
2541     char*            /*weak_name*/,
2542     Dwarf_Error*     /*error*/);
2543 
2544 /* .debug_macinfo producer functions
2545    Functions must be called in right order: the section is output
2546    In the order these are presented.
2547 */
2548 int dwarf_def_macro(Dwarf_P_Debug /*dbg*/,
2549     Dwarf_Unsigned   /*line*/,
2550     char *           /*macname, with (arglist), no space before (*/,
2551     char *           /*macvalue*/,
2552     Dwarf_Error*     /*error*/);
2553 
2554 int dwarf_undef_macro(Dwarf_P_Debug /*dbg*/,
2555     Dwarf_Unsigned   /*line*/,
2556     char *           /*macname, no arglist, of course*/,
2557     Dwarf_Error*     /*error*/);
2558 
2559 int dwarf_start_macro_file(Dwarf_P_Debug /*dbg*/,
2560     Dwarf_Unsigned   /*fileindex*/,
2561     Dwarf_Unsigned   /*linenumber*/,
2562     Dwarf_Error*     /*error*/);
2563 
2564 int dwarf_end_macro_file(Dwarf_P_Debug /*dbg*/,
2565     Dwarf_Error*     /*error*/);
2566 
2567 int dwarf_vendor_ext(Dwarf_P_Debug /*dbg*/,
2568     Dwarf_Unsigned   /*constant*/,
2569     char *           /*string*/,
2570     Dwarf_Error*     /*error*/);
2571 
2572 /* end macinfo producer functions */
2573 
2574 int dwarf_attr_offset(Dwarf_Die /*die*/,
2575     Dwarf_Attribute /*attr of above die*/,
2576     Dwarf_Off     * /*returns offset thru this ptr */,
2577     Dwarf_Error   * /*error*/);
2578 
2579 /* This is a hack so clients can verify offsets.
2580    Added April 2005 so that debugger can detect broken offsets
2581    (which happened in an IRIX executable larger than 2GB
2582     with MIPSpro 7.3.1.3 toolchain.).
2583 */
2584 int
2585 dwarf_get_section_max_offsets(Dwarf_Debug /*dbg*/,
2586     Dwarf_Unsigned * /*debug_info_size*/,
2587     Dwarf_Unsigned * /*debug_abbrev_size*/,
2588     Dwarf_Unsigned * /*debug_line_size*/,
2589     Dwarf_Unsigned * /*debug_loc_size*/,
2590     Dwarf_Unsigned * /*debug_aranges_size*/,
2591     Dwarf_Unsigned * /*debug_macinfo_size*/,
2592     Dwarf_Unsigned * /*debug_pubnames_size*/,
2593     Dwarf_Unsigned * /*debug_str_size*/,
2594     Dwarf_Unsigned * /*debug_frame_size*/,
2595     Dwarf_Unsigned * /*debug_ranges_size*/,
2596     Dwarf_Unsigned * /*debug_pubtypes_size*/);
2597 
2598 /* Multiple releases spelled 'initial' as 'inital' .
2599    The 'inital' spelling should not be used. */
2600 Dwarf_Half dwarf_set_frame_rule_inital_value(Dwarf_Debug /*dbg*/,
2601     Dwarf_Half /*value*/);
2602 /* Additional interface with correct 'initial' spelling. */
2603 /* It is likely you will want to call the following 5 functions
2604    before accessing any frame information.  All are useful
2605    to tailor handling of pseudo-registers needed to turn
2606    frame operation references into simpler forms and to
2607    reflect ABI specific data.  Of course altering libdwarf.h
2608    and dwarf.h allow the same capabilities, but such header changes
2609    do not let one change these values at runtime. */
2610 Dwarf_Half dwarf_set_frame_rule_initial_value(Dwarf_Debug /*dbg*/,
2611     Dwarf_Half /*value*/);
2612 Dwarf_Half dwarf_set_frame_rule_table_size(Dwarf_Debug /*dbg*/,
2613     Dwarf_Half /*value*/);
2614 Dwarf_Half dwarf_set_frame_cfa_value(Dwarf_Debug /*dbg*/,
2615     Dwarf_Half /*value*/);
2616 Dwarf_Half dwarf_set_frame_same_value(Dwarf_Debug /*dbg*/,
2617     Dwarf_Half /*value*/);
2618 Dwarf_Half dwarf_set_frame_undefined_value(Dwarf_Debug /*dbg*/,
2619     Dwarf_Half /*value*/);
2620 
2621 /* As of April 27, 2009, this version with no diepointer is
2622    obsolete though supported.  Use dwarf_get_ranges_a() instead. */
2623 int dwarf_get_ranges(Dwarf_Debug /*dbg*/,
2624     Dwarf_Off /*rangesoffset*/,
2625     Dwarf_Ranges ** /*rangesbuf*/,
2626     Dwarf_Signed * /*listlen*/,
2627     Dwarf_Unsigned * /*bytecount*/,
2628     Dwarf_Error * /*error*/);
2629 
2630 /* This adds the address_size argument. New April 27, 2009 */
2631 int dwarf_get_ranges_a(Dwarf_Debug /*dbg*/,
2632     Dwarf_Off /*rangesoffset*/,
2633     Dwarf_Die  /* diepointer */,
2634     Dwarf_Ranges ** /*rangesbuf*/,
2635     Dwarf_Signed * /*listlen*/,
2636     Dwarf_Unsigned * /*bytecount*/,
2637     Dwarf_Error * /*error*/);
2638 
2639 void dwarf_ranges_dealloc(Dwarf_Debug /*dbg*/,
2640     Dwarf_Ranges * /*rangesbuf*/,
2641     Dwarf_Signed /*rangecount*/);
2642 
2643 /* The harmless error list is a circular buffer of
2644    errors we note but which do not stop us from processing
2645    the object.  Created so dwarfdump or other tools
2646    can report such inconsequential errors without causing
2647    anything to stop early. */
2648 #define DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE 4
2649 #define DW_HARMLESS_ERROR_MSG_STRING_SIZE   200
2650 /* User code supplies size of array of pointers errmsg_ptrs_array
2651     in count and the array of pointers (the pointers themselves
2652     need not be initialized).
2653     The pointers returned in the array of pointers
2654     are invalidated by ANY call to libdwarf.
2655     Use them before making another libdwarf call!
2656     The array of string pointers passed in always has
2657     a final null pointer, so if there are N pointers the
2658     and M actual strings, then MIN(M,N-1) pointers are
2659     set to point to error strings.  The array of pointers
2660     to strings always terminates with a NULL pointer.
2661     If 'count' is passed in zero then errmsg_ptrs_array
2662     is not touched.
2663 
2664     The function returns DW_DLV_NO_ENTRY if no harmless errors
2665     were noted so far.  Returns DW_DLV_OK if there are errors.
2666     Never returns DW_DLV_ERROR.
2667 
2668     Each call empties the error list (discarding all current entries).
2669     If newerr_count is non-NULL the count of harmless errors
2670     since the last call is returned through the pointer
2671     (some may have been discarded or not returned, it is a circular
2672     list...).
2673     If DW_DLV_NO_ENTRY is returned none of the arguments
2674     here are touched or used.
2675     */
2676 int dwarf_get_harmless_error_list(Dwarf_Debug /*dbg*/,
2677     unsigned  /*count*/,
2678     const char ** /*errmsg_ptrs_array*/,
2679     unsigned * /*newerr_count*/);
2680 
2681 /* Insertion is only for testing the harmless error code, it is not
2682     necessarily useful otherwise. */
2683 void dwarf_insert_harmless_error(Dwarf_Debug /*dbg*/,
2684     char * /*newerror*/);
2685 
2686 /* The size of the circular list of strings may be set
2687    and reset as needed.  If it is shortened excess
2688    messages are simply dropped.  It returns the previous
2689    size. If zero passed in the size is unchanged
2690    and it simply returns the current size  */
2691 unsigned dwarf_set_harmless_error_list_size(Dwarf_Debug /*dbg*/,
2692     unsigned /*maxcount*/);
2693 /* The harmless error strings (if any) are freed when the dbg
2694    is dwarf_finish()ed. */
2695 
2696 /*  When the val_in is known these dwarf_get_TAG_name (etc)
2697     functions return the string corresponding to the val_in passed in
2698     through the pointer s_out and the value returned is DW_DLV_OK.
2699     The strings are in static storage
2700     and must not be freed.
2701     If DW_DLV_NO_ENTRY is returned the val_in is not known and
2702     *s_out is not set.  DW_DLV_ERROR is never returned.*/
2703 
2704 extern int dwarf_get_TAG_name(unsigned int /*val_in*/, const char ** /*s_out */);
2705 extern int dwarf_get_children_name(unsigned int /*val_in*/, const char ** /*s_out */);
2706 extern int dwarf_get_FORM_name(unsigned int /*val_in*/, const char ** /*s_out */);
2707 extern int dwarf_get_AT_name(unsigned int /*val_in*/, const char ** /*s_out */);
2708 extern int dwarf_get_OP_name(unsigned int /*val_in*/, const char ** /*s_out */);
2709 extern int dwarf_get_ATE_name(unsigned int /*val_in*/, const char ** /*s_out */);
2710 extern int dwarf_get_DS_name(unsigned int /*val_in*/, const char ** /*s_out */);
2711 extern int dwarf_get_END_name(unsigned int /*val_in*/, const char ** /*s_out */);
2712 extern int dwarf_get_ATCF_name(unsigned int /*val_in*/, const char ** /*s_out */);
2713 extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/, const char ** /*s_out */);
2714 extern int dwarf_get_VIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
2715 extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/, const char ** /*s_out */);
2716 extern int dwarf_get_LANG_name(unsigned int /*val_in*/, const char ** /*s_out */);
2717 extern int dwarf_get_ID_name(unsigned int /*val_in*/, const char ** /*s_out */);
2718 extern int dwarf_get_CC_name(unsigned int /*val_in*/, const char ** /*s_out */);
2719 extern int dwarf_get_INL_name(unsigned int /*val_in*/, const char ** /*s_out */);
2720 extern int dwarf_get_ORD_name(unsigned int /*val_in*/, const char ** /*s_out */);
2721 extern int dwarf_get_DSC_name(unsigned int /*val_in*/, const char ** /*s_out */);
2722 extern int dwarf_get_LNS_name(unsigned int /*val_in*/, const char ** /*s_out */);
2723 extern int dwarf_get_LNE_name(unsigned int /*val_in*/, const char ** /*s_out */);
2724 extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/, const char ** /*s_out */);
2725 extern int dwarf_get_CFA_name(unsigned int /*val_in*/, const char ** /*s_out */);
2726 extern int dwarf_get_EH_name(unsigned int /*val_in*/, const char ** /*s_out */);
2727 extern int dwarf_get_FRAME_name(unsigned int /*val_in*/, const char ** /*s_out */);
2728 extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/, const char ** /*s_out */);
2729 extern int dwarf_get_ADDR_name(unsigned int /*val_in*/, const char ** /*s_out */);
2730 
2731 #ifdef __cplusplus
2732 }
2733 #endif
2734 #endif /* _LIBDWARF_H */
2735 
2736 
2737