1/*
2
3  Copyright (C) 2000,2001,2002,2005,2006 Silicon Graphics, Inc.  All Rights Reserved.
4
5  This program is free software; you can redistribute it and/or modify it
6  under the terms of version 2.1 of the GNU Lesser General Public License
7  as published by the Free Software Foundation.
8
9  This program is distributed in the hope that it would be useful, but
10  WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13  Further, this software is distributed without any warranty that it is
14  free of the rightful claim of any third person regarding infringement
15  or the like.  Any license provided herein, whether implied or
16  otherwise, applies only to this software file.  Patent licenses, if
17  any, provided herein do not apply to combinations of this program with
18  other software, or any other product whatsoever.
19
20  You should have received a copy of the GNU Lesser General Public
21  License along with this program; if not, write the Free Software
22  Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
23  USA.
24
25  Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
26  Mountain View, CA 94043, or:
27
28  http://www.sgi.com
29
30  For further information regarding this notice, see:
31
32  http://oss.sgi.com/projects/GenInfo/NoticeExplan
33
34*/
35
36
37#ifndef _LIBDWARF_H
38#define _LIBDWARF_H
39#ifdef __cplusplus
40extern "C" {
41#endif
42/*
43	libdwarf.h
44	$Revision: 1.88 $ $Date: 2006/04/18 04:46:07 $
45
46	For libdwarf producers and consumers
47
48	The interface is defined as having 8-byte signed and unsigned
49	values so it can handle 64-or-32bit target on 64-or-32bit host.
50	Addr is the native size: it represents pointers on
51	the host machine (not the target!).
52
53	This contains declarations for types and all producer
54	and consumer functions.
55
56	Function declarations are written on a single line each here
57	so one can use grep  to each declaration in its entirety.
58	The declarations are a little harder to read this way, but...
59
60*/
61
62#ifdef __SGI_FAST_LIBELF
63struct elf_sgi;
64typedef struct elf_sgi* dwarf_elf_handle;
65#else
66struct Elf;
67typedef struct Elf* dwarf_elf_handle;
68#endif
69
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*/
75typedef int             Dwarf_Bool;         /* boolean type */
76typedef unsigned long   Dwarf_Off;          /* 4 or 8 byte file offset */
77typedef unsigned long   Dwarf_Unsigned;     /* 4 or 8 byte unsigned value */
78typedef unsigned short  Dwarf_Half;         /* 2 byte unsigned value */
79typedef unsigned char   Dwarf_Small;        /* 1 byte unsigned value */
80typedef signed   long   Dwarf_Signed;       /* 4 or 8 byte signed value */
81typedef unsigned long   Dwarf_Addr;         /* target memory address */
82#else /* 32-bit */
83/* This is for ILP32, allowing i/o of 64bit dwarf info.
84   Also should be fine for LP64 and ILP64 cases.
85*/
86typedef int                 Dwarf_Bool;     /* boolean type */
87typedef unsigned long long  Dwarf_Off;      /* 8 byte file offset */
88typedef unsigned long long  Dwarf_Unsigned; /* 8 byte unsigned value*/
89typedef unsigned short      Dwarf_Half;     /* 2 byte unsigned value */
90typedef unsigned char       Dwarf_Small;    /* 1 byte unsigned value */
91typedef signed   long long  Dwarf_Signed;   /* 8 byte signed value */
92typedef unsigned long long  Dwarf_Addr;     /* target memory address */
93#endif
94typedef void*		Dwarf_Ptr;          /* host machine pointer */
95
96/* Contains info on an uninterpreted block of data
97*/
98typedef struct {
99        Dwarf_Unsigned  bl_len;         /* length of block */
100        Dwarf_Ptr       bl_data;        /* uninterpreted data */
101	Dwarf_Small     bl_from_loclist; /*non-0 if loclist, else debug_info*/
102	Dwarf_Unsigned  bl_section_offset; /* Section (not CU) offset
103                                        which 'data' comes from. */
104} Dwarf_Block;
105
106
107/* location record
108*/
109typedef struct {
110        Dwarf_Small     lr_atom;        /* location operation */
111        Dwarf_Unsigned  lr_number;      /* operand */
112	Dwarf_Unsigned  lr_number2;     /* for OP_BREGx */
113	Dwarf_Unsigned  lr_offset;      /* offset in locexpr for OP_BRA etc */
114} Dwarf_Loc;
115
116
117/* location description
118*/
119typedef struct {
120        Dwarf_Addr      ld_lopc;        /* beginning of active range */
121        Dwarf_Addr      ld_hipc;        /* end of active range */
122        Dwarf_Half      ld_cents;       /* count of location records */
123        Dwarf_Loc*      ld_s;           /* pointer to list of same */
124	Dwarf_Small     ld_from_loclist;
125				      /* non-0 if loclist, else debug_info*/
126
127	Dwarf_Unsigned  ld_section_offset; /* Section (not CU) offset
128					where loc-expr begins*/
129} Dwarf_Locdesc;
130
131/* Frame description instructions expanded.
132*/
133typedef struct {
134        Dwarf_Small     fp_base_op;
135        Dwarf_Small     fp_extended_op;
136        Dwarf_Half      fp_register;
137
138	/* Value may be signed, depends on op.
139           Any applicable data_alignment_factor has
140           not been applied, this is the  raw offset. */
141        Dwarf_Unsigned  fp_offset;
142        Dwarf_Off       fp_instr_offset;
143} Dwarf_Frame_Op; /* DWARF2 */
144
145typedef struct {
146        Dwarf_Small     fp_base_op;
147        Dwarf_Small     fp_extended_op;
148        Dwarf_Half      fp_register;
149
150	/* Value may be signed, depends on op.
151           Any applicable data_alignment_factor has
152           not been applied, this is the  raw offset. */
153        Dwarf_Unsigned  fp_offset_or_block_len;
154	Dwarf_Small     *fp_expr_block;
155
156        Dwarf_Off       fp_instr_offset;
157} Dwarf_Frame_Op3;  /* DWARF3 and DWARF2 compatible */
158
159/*  ***IMPORTANT NOTE, TARGET DEPENDENCY ****
160   DW_REG_TABLE_SIZE must be at least as large as
161   the number of registers
162   (DW_FRAME_LAST_REG_NUM) as defined in dwarf.h
163   Preferably identical to DW_FRAME_LAST_REG_NUM.
164   Ensure [0-DW_REG_TABLE_SIZE] does not overlap
165   DW_FRAME_UNDEFINED_VAL or DW_FRAME_SAME_VAL.
166   Also ensure DW_FRAME_REG_INITIAL_VALUE is set to what
167   is appropriate to your cpu.
168   For various CPUs  DW_FRAME_UNDEFINED_VAL is correct
169   as the value for DW_FRAME_REG_INITIAL_VALUE.
170
171   For consumer apps, this can be set dynamically: see
172   dwarf_set_frame_rule_table_size();
173 */
174#ifndef DW_REG_TABLE_SIZE
175#define DW_REG_TABLE_SIZE  66
176#endif
177
178/* For MIPS, DW_FRAME_SAME_VAL is the correct default value
179   for a frame register value. For other CPUS another value
180   may be better, such as DW_FRAME_UNDEFINED_VAL.
181   See dwarf_set_frame_rule_table_size
182*/
183#ifndef DW_FRAME_REG_INITIAL_VALUE
184#define DW_FRAME_REG_INITIAL_VALUE DW_FRAME_SAME_VAL
185#endif
186
187/* Taken as meaning 'undefined value', this is not
188   a column or register number.
189   Only present at libdwarf runtime. Never on disk.
190   DW_FRAME_* Values present on disk are in dwarf.h
191   Ensure this is > DW_REG_TABLE_SIZE.
192*/
193#define DW_FRAME_UNDEFINED_VAL          1034
194
195/* Taken as meaning 'same value' as caller had, not a column
196   or register number
197   Only present at libdwarf runtime. Never on disk.
198   DW_FRAME_* Values present on disk are in dwarf.h
199   Ensure this is > DW_REG_TABLE_SIZE.
200*/
201#define DW_FRAME_SAME_VAL               1035
202
203/* For DWARF3 interfaces, make the CFA a column with no
204   real table number.  This is what should have been done
205   for the DWARF2 interfaces.  This actually works for
206   both DWARF2 and DWARF3, but see the libdwarf documentation
207   on Dwarf_Regtable3 and  dwarf_get_fde_info_for_reg3()
208   and  dwarf_get_fde_info_for_all_regs3()
209   Do NOT use this with the older dwarf_get_fde_info_for_reg()
210   or dwarf_get_fde_info_for_all_regs() consumer interfaces.
211*/
212#define DW_FRAME_CFA_COL3               1036
213
214/* The following are all needed to evaluate DWARF3 register rules.
215*/
216#define DW_EXPR_OFFSET 0  /* DWARF2 only sees this. */
217#define DW_EXPR_VAL_OFFSET 1
218#define DW_EXPR_EXPRESSION 2
219#define DW_EXPR_VAL_EXPRESSION 3
220
221typedef struct Dwarf_Regtable_Entry_s {
222	/*  For each index i (naming a hardware register with dwarf number
223            i) the following is true and defines the value of that register:
224
225           If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
226	     it is not DWARF register number but
227		a place holder indicating the register has no defined value.
228           If dw_regnum is Register DW_FRAME_SAME_VAL
229  	     it  is not DWARF register number but
230		a place holder indicating the register has the same
231                value in the previous frame.
232	   DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL are
233           only present at libdwarf runtime. Never on disk.
234           DW_FRAME_* Values present on disk are in dwarf.h
235
236          Otherwise: the register number is a DWARF register number
237          (see ABI documents for how this translates to hardware/
238           software register numbers in the machine hardware)
239	  and the following applies:
240
241          if dw_value_type == DW_EXPR_OFFSET (the only  possible case for dwarf2):
242	    If dw_offset_relevant is non-zero, then
243	     the value is stored at at the address CFA+N where N is a signed offset.
244	     Rule: Offset(N)
245            If dw_offset_relevant is zero, then the value of the register
246             is the value of (DWARF) register number dw_regnum.
247             Rule: register(F)
248          Other values of dw_value_type are an error.
249        */
250	Dwarf_Small         dw_offset_relevant;
251
252	/* For DWARF2, always 0 */
253        Dwarf_Small         dw_value_type;
254
255	Dwarf_Half          dw_regnum;
256
257	/* The data type here should  the larger of Dwarf_Addr
258           and Dwarf_Unsigned and Dwarf_Signed. */
259	Dwarf_Addr          dw_offset;
260} Dwarf_Regtable_Entry;
261
262typedef struct Dwarf_Regtable_s {
263    struct Dwarf_Regtable_Entry_s rules[DW_REG_TABLE_SIZE];
264} Dwarf_Regtable;
265
266/* opaque type. Functional interface shown later. */
267struct Dwarf_Reg_value3_s;
268typedef struct Dwarf_Reg_value3_s Dwarf_Reg_Value3;
269
270typedef struct Dwarf_Regtable_Entry3_s {
271	/*  For each index i (naming a hardware register with dwarf number
272            i) the following is true and defines the value of that register:
273
274           If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
275	     it is not DWARF register number but
276		a place holder indicating the register has no defined value.
277           If dw_regnum is Register DW_FRAME_SAME_VAL
278  	     it  is not DWARF register number but
279		a place holder indicating the register has the same
280                value in the previous frame.
281	   DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL are
282           only present at libdwarf runtime. Never on disk.
283           DW_FRAME_* Values present on disk are in dwarf.h
284
285          Otherwise: the register number is a DWARF register number
286          (see ABI documnets for how this translates to hardware/
287           software register numbers in the machine hardware)
288	  and the following applies:
289
290          if dw_value_type == DW_EXPR_OFFSET (the only  possible case for
291		dwarf2):
292	    If dw_offset_relevant is non-zero, then
293	     the value is stored at at the address
294	     CFA+N where N is a signed offset.
295	     Rule: Offset(N)
296            If dw_offset_relevant is zero, then the value of the register
297             is the value of (DWARF) register number dw_regnum.
298             Rule: register(R)
299          if dw_value_type  == DW_EXPR_VAL_OFFSET
300            the  value of this register is CFA +N where N is a signed offset.
301            Rule: val_offset(N)
302
303	  E is pointed to by dw_block_ptr (length is dw_offset_or_block_len);
304          if dw_value_type  == DW_EXPR_EXPRESSION
305	    The value of the register is the value at the address
306            computed by evaluating the DWARF expression E.
307            Rule: expression(E)
308          if dw_value_type  == DW_EXPR_VAL_EXPRESSION
309	    The value of the register is the value
310            computed by evaluating the DWARF expression E.
311            Rule: val_expression(E)
312          Other values of dw_value_type are an error.
313        */
314	Dwarf_Small         dw_offset_relevant;
315        Dwarf_Small         dw_value_type;
316	Dwarf_Half          dw_regnum;
317	Dwarf_Unsigned      dw_offset_or_block_len;
318	Dwarf_Ptr           dw_block_ptr;
319
320}Dwarf_Regtable_Entry3;
321
322/* For the DWARF3 version, moved the DW_FRAME_CFA_COL
323   out of the array and into its own struct.
324   Having it part of the array is not very easy to work
325   with from a portability point of view: changing
326   the number for every architecture is a pain (if one fails
327   to set it correctly a register rule gets clobbered when
328   setting CFA).
329   With MIPS it just happened to be easy to use DW_FRAME_CFA_COL.
330
331   rt3_rules and rt3_reg_table_size must be filled in
332    before calling libdwarf.
333    Filled in with a pointer to an array (pointer and
334    array  set up by the calling application) of rt3_reg_table_size
335    Dwarf_Regtable_Entry3_s structs.
336    libdwarf does not allocate or deallocate space for the
337    rules, you must do so.   libdwarf will initialize the
338    contents rules array, you do not need to do so (though
339    if you choose to initialize the array somehow that is ok:
340    libdwarf will overwrite your initializations with its own).
341
342*/
343typedef struct Dwarf_Regtable3_s {
344    struct Dwarf_Regtable_Entry3_s   rt3_cfa_rule;
345
346    Dwarf_Half                       rt3_reg_table_size;
347    struct Dwarf_Regtable_Entry3_s * rt3_rules;
348} Dwarf_Regtable3;
349
350
351/* Use for DW_EPXR_STANDARD., DW_EXPR_VAL_OFFSET.
352   Returns DW_DLV_OK if the value is available.
353   If DW_DLV_OK returns the regnum and offset thru the pointers
354   (which the consumer must use appropriately).
355*/
356int dwarf_frame_get_reg_register(struct Dwarf_Regtable_Entry3_s *reg_in,
357	Dwarf_Small *offset_relevant,
358	Dwarf_Half *regnum_out,
359	Dwarf_Signed *offset_out);
360
361/* Use for DW_EXPR_EXPRESSION, DW_EXPR_VAL_EXPRESSION.
362   Returns DW_DLV_OK if the value is available.
363   The caller must pass in the address of a valid
364   Dwarf_Block (the caller need not initialize it).
365*/
366int dwarf_frame_get_reg_expression(struct Dwarf_Regtable_Entry3_s *reg_in,
367	Dwarf_Block *block_out);
368
369
370/* for DW_DLC_SYMBOLIC_RELOCATIONS output to caller
371   v2, adding drd_length: some relocations are 4 and
372   some 8 bytes (pointers are 8, section offsets 4) in
373   some dwarf environments. (MIPS relocations are all one
374   size in any given ABI.) Changing drd_type to an unsigned char
375   to keep struct size down.
376*/
377enum Dwarf_Rel_Type {
378		dwarf_drt_none, /* should not get to caller */
379                dwarf_drt_data_reloc, /* simple normal relocation */
380                dwarf_drt_segment_rel, /* special reloc, exceptions*/
381                dwarf_drt_first_of_length_pair,/* this and drt_second
382				for .word end - begin
383			 	case */
384                dwarf_drt_second_of_length_pair
385};
386typedef struct Dwarf_Relocation_Data_s  * Dwarf_Relocation_Data;
387struct Dwarf_Relocation_Data_s {
388        unsigned char drd_type; /* cast to/from Dwarf_Rel_Type
389					  to keep size small in struct */
390	unsigned char drd_length; /* length in bytes
391			         of data being relocated. 4 for 32bit.
392				 8 for 64bit data */
393        Dwarf_Unsigned       drd_offset; /* where the data to reloc is */
394        Dwarf_Unsigned       drd_symbol_index;
395};
396
397/* Opaque types for Consumer Library. */
398typedef struct Dwarf_Debug_s*      Dwarf_Debug;
399typedef struct Dwarf_Die_s*        Dwarf_Die;
400typedef struct Dwarf_Line_s*       Dwarf_Line;
401typedef struct Dwarf_Global_s*     Dwarf_Global;
402typedef struct Dwarf_Func_s*       Dwarf_Func;
403typedef struct Dwarf_Type_s*       Dwarf_Type;
404typedef struct Dwarf_Var_s*        Dwarf_Var;
405typedef struct Dwarf_Weak_s*       Dwarf_Weak;
406typedef struct Dwarf_Error_s*      Dwarf_Error;
407typedef struct Dwarf_Attribute_s*  Dwarf_Attribute;
408typedef struct Dwarf_Abbrev_s*	   Dwarf_Abbrev;
409typedef struct Dwarf_Fde_s*  	   Dwarf_Fde;
410typedef struct Dwarf_Cie_s*  	   Dwarf_Cie;
411typedef struct Dwarf_Arange_s*	   Dwarf_Arange;
412
413/* Opaque types for Producer Library. */
414typedef struct Dwarf_P_Debug_s*	   	Dwarf_P_Debug;
415typedef struct Dwarf_P_Die_s*	   	Dwarf_P_Die;
416typedef struct Dwarf_P_Attribute_s*	Dwarf_P_Attribute;
417typedef struct Dwarf_P_Fde_s*		Dwarf_P_Fde;
418typedef struct Dwarf_P_Expr_s*		Dwarf_P_Expr;
419typedef Dwarf_Unsigned 		   	Dwarf_Tag;
420
421
422/* error handler function
423*/
424typedef void  (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/);
425
426
427/*
428    Dwarf_dealloc() alloc_type arguments.
429    Argument points to:
430*/
431#define DW_DLA_STRING      	0x01     /* char* */
432#define DW_DLA_LOC         	0x02     /* Dwarf_Loc */
433#define DW_DLA_LOCDESC     	0x03     /* Dwarf_Locdesc */
434#define DW_DLA_ELLIST      	0x04     /* Dwarf_Ellist (not used)*/
435#define DW_DLA_BOUNDS      	0x05     /* Dwarf_Bounds (not used) */
436#define DW_DLA_BLOCK       	0x06     /* Dwarf_Block */
437#define DW_DLA_DEBUG       	0x07     /* Dwarf_Debug */
438#define DW_DLA_DIE         	0x08     /* Dwarf_Die */
439#define DW_DLA_LINE        	0x09     /* Dwarf_Line */
440#define DW_DLA_ATTR        	0x0a     /* Dwarf_Attribute */
441#define DW_DLA_TYPE        	0x0b     /* Dwarf_Type  (not used) */
442#define DW_DLA_SUBSCR      	0x0c     /* Dwarf_Subscr (not used) */
443#define DW_DLA_GLOBAL      	0x0d     /* Dwarf_Global */
444#define DW_DLA_ERROR       	0x0e     /* Dwarf_Error */
445#define DW_DLA_LIST        	0x0f     /* a list */
446#define DW_DLA_LINEBUF     	0x10     /* Dwarf_Line* (not used) */
447#define DW_DLA_ARANGE      	0x11     /* Dwarf_Arange */
448#define DW_DLA_ABBREV		0x12 	 /* Dwarf_Abbrev */
449#define DW_DLA_FRAME_OP		0x13 	 /* Dwarf_Frame_Op */
450#define DW_DLA_CIE		0x14	 /* Dwarf_Cie */
451#define DW_DLA_FDE		0x15	 /* Dwarf_Fde */
452#define DW_DLA_LOC_BLOCK	0x16	 /* Dwarf_Loc Block (not used) */
453#define DW_DLA_FRAME_BLOCK	0x17	 /* Dwarf_Frame Block (not used) */
454#define DW_DLA_FUNC		0x18	 /* Dwarf_Func */
455#define DW_DLA_TYPENAME		0x19	 /* Dwarf_Type */
456#define DW_DLA_VAR		0x1a	 /* Dwarf_Var */
457#define DW_DLA_WEAK		0x1b	 /* Dwarf_Weak */
458#define DW_DLA_ADDR		0x1c	 /* Dwarf_Addr sized entries */
459
460/* The augmenter string for CIE */
461#define DW_CIE_AUGMENTER_STRING_V0              "z"
462
463/* dwarf_init() access arguments
464*/
465#define DW_DLC_READ        0        /* read only access */
466#define DW_DLC_WRITE       1        /* write only access */
467#define DW_DLC_RDWR        2        /* read/write access NOT SUPPORTED*/
468
469/* dwarf_init() access flag modifiers
470*/
471#define DW_DLC_SIZE_64     0x40000000 /* 32-bit target */
472#define DW_DLC_SIZE_32     0x20000000 /* 64-bit target */
473
474/* dwarf_init() access flag modifiers
475*/
476#define DW_DLC_ISA_MIPS             0x00000000 /* MIPS target */
477#define DW_DLC_ISA_IA64             0x01000000 /* IA64 target */
478#define DW_DLC_STREAM_RELOCATIONS   0x02000000 /* old style binary relocs */
479#define DW_DLC_SYMBOLIC_RELOCATIONS 0x04000000 /* usable with assem output */
480#define DW_DLC_TARGET_BIGENDIAN     0x08000000 /* big    endian target */
481#define DW_DLC_TARGET_LITTLEENDIAN  0x00100000 /* little endian target */
482
483/* dwarf_pcline() slide arguments
484*/
485#define DW_DLS_BACKWARD   -1       /* slide backward to find line */
486#define DW_DLS_NOSLIDE     0       /* match exactly without sliding */
487#define DW_DLS_FORWARD     1       /* slide forward to find line */
488
489/* libdwarf error numbers
490*/
491#define DW_DLE_NE          0     /* no error */
492#define DW_DLE_VMM         1     /* dwarf format/library version mismatch */
493#define DW_DLE_MAP         2     /* memory map failure */
494#define DW_DLE_LEE         3     /* libelf error */
495#define DW_DLE_NDS         4     /* no debug section */
496#define DW_DLE_NLS         5     /* no line section */
497#define DW_DLE_ID          6     /* invalid descriptor for query */
498#define DW_DLE_IOF         7     /* I/O failure */
499#define DW_DLE_MAF         8     /* memory allocation failure */
500#define DW_DLE_IA          9     /* invalid argument */
501#define DW_DLE_MDE         10     /* mangled debugging entry */
502#define DW_DLE_MLE         11     /* mangled line number entry */
503#define DW_DLE_FNO         12     /* file not open */
504#define DW_DLE_FNR         13     /* file not a regular file */
505#define DW_DLE_FWA         14     /* file open with wrong access */
506#define DW_DLE_NOB         15     /* not an object file */
507#define DW_DLE_MOF         16     /* mangled object file header */
508#define DW_DLE_EOLL        17     /* end of location list entries */
509#define DW_DLE_NOLL        18     /* no location list section */
510#define DW_DLE_BADOFF      19     /* Invalid offset */
511#define DW_DLE_EOS         20     /* end of section  */
512#define DW_DLE_ATRUNC      21     /* abbreviations section appears truncated*/
513#define DW_DLE_BADBITC     22     /* Address size passed to dwarf bad*/
514				    /* It is not an allowed size (64 or 32) */
515    /* Error codes defined by the current Libdwarf Implementation. */
516#define DW_DLE_DBG_ALLOC                        23
517#define DW_DLE_FSTAT_ERROR                      24
518#define DW_DLE_FSTAT_MODE_ERROR                 25
519#define DW_DLE_INIT_ACCESS_WRONG                26
520#define DW_DLE_ELF_BEGIN_ERROR                  27
521#define DW_DLE_ELF_GETEHDR_ERROR                28
522#define DW_DLE_ELF_GETSHDR_ERROR                29
523#define DW_DLE_ELF_STRPTR_ERROR                 30
524#define DW_DLE_DEBUG_INFO_DUPLICATE             31
525#define DW_DLE_DEBUG_INFO_NULL                  32
526#define DW_DLE_DEBUG_ABBREV_DUPLICATE           33
527#define DW_DLE_DEBUG_ABBREV_NULL                34
528#define DW_DLE_DEBUG_ARANGES_DUPLICATE          35
529#define DW_DLE_DEBUG_ARANGES_NULL               36
530#define DW_DLE_DEBUG_LINE_DUPLICATE             37
531#define DW_DLE_DEBUG_LINE_NULL                  38
532#define DW_DLE_DEBUG_LOC_DUPLICATE              39
533#define DW_DLE_DEBUG_LOC_NULL                   40
534#define DW_DLE_DEBUG_MACINFO_DUPLICATE          41
535#define DW_DLE_DEBUG_MACINFO_NULL               42
536#define DW_DLE_DEBUG_PUBNAMES_DUPLICATE         43
537#define DW_DLE_DEBUG_PUBNAMES_NULL              44
538#define DW_DLE_DEBUG_STR_DUPLICATE              45
539#define DW_DLE_DEBUG_STR_NULL                   46
540#define DW_DLE_CU_LENGTH_ERROR                  47
541#define DW_DLE_VERSION_STAMP_ERROR              48
542#define DW_DLE_ABBREV_OFFSET_ERROR              49
543#define DW_DLE_ADDRESS_SIZE_ERROR               50
544#define DW_DLE_DEBUG_INFO_PTR_NULL              51
545#define DW_DLE_DIE_NULL                         52
546#define DW_DLE_STRING_OFFSET_BAD                53
547#define DW_DLE_DEBUG_LINE_LENGTH_BAD            54
548#define DW_DLE_LINE_PROLOG_LENGTH_BAD           55
549#define DW_DLE_LINE_NUM_OPERANDS_BAD            56
550#define DW_DLE_LINE_SET_ADDR_ERROR              57
551#define DW_DLE_LINE_EXT_OPCODE_BAD              58
552#define DW_DLE_DWARF_LINE_NULL                  59
553#define DW_DLE_INCL_DIR_NUM_BAD                 60
554#define DW_DLE_LINE_FILE_NUM_BAD                61
555#define DW_DLE_ALLOC_FAIL                       62
556#define DW_DLE_NO_CALLBACK_FUNC		    	63
557#define DW_DLE_SECT_ALLOC		    	64
558#define DW_DLE_FILE_ENTRY_ALLOC		    	65
559#define DW_DLE_LINE_ALLOC		    	66
560#define DW_DLE_FPGM_ALLOC		    	67
561#define DW_DLE_INCDIR_ALLOC		    	68
562#define DW_DLE_STRING_ALLOC		    	69
563#define DW_DLE_CHUNK_ALLOC		    	70
564#define DW_DLE_BYTEOFF_ERR		    	71
565#define	DW_DLE_CIE_ALLOC		    	72
566#define DW_DLE_FDE_ALLOC		    	73
567#define DW_DLE_REGNO_OVFL		    	74
568#define DW_DLE_CIE_OFFS_ALLOC		    	75
569#define DW_DLE_WRONG_ADDRESS		    	76
570#define DW_DLE_EXTRA_NEIGHBORS		    	77
571#define	DW_DLE_WRONG_TAG		    	78
572#define DW_DLE_DIE_ALLOC		    	79
573#define DW_DLE_PARENT_EXISTS		    	80
574#define DW_DLE_DBG_NULL                         81
575#define DW_DLE_DEBUGLINE_ERROR		    	82
576#define DW_DLE_DEBUGFRAME_ERROR		    	83
577#define DW_DLE_DEBUGINFO_ERROR		    	84
578#define DW_DLE_ATTR_ALLOC		    	85
579#define DW_DLE_ABBREV_ALLOC		    	86
580#define DW_DLE_OFFSET_UFLW		    	87
581#define DW_DLE_ELF_SECT_ERR		    	88
582#define DW_DLE_DEBUG_FRAME_LENGTH_BAD	    	89
583#define DW_DLE_FRAME_VERSION_BAD	    	90
584#define DW_DLE_CIE_RET_ADDR_REG_ERROR	    	91
585#define DW_DLE_FDE_NULL			    	92
586#define DW_DLE_FDE_DBG_NULL		    	93
587#define DW_DLE_CIE_NULL			    	94
588#define DW_DLE_CIE_DBG_NULL		    	95
589#define DW_DLE_FRAME_TABLE_COL_BAD	    	96
590#define DW_DLE_PC_NOT_IN_FDE_RANGE	    	97
591#define DW_DLE_CIE_INSTR_EXEC_ERROR	    	98
592#define DW_DLE_FRAME_INSTR_EXEC_ERROR	    	99
593#define DW_DLE_FDE_PTR_NULL		    	100
594#define DW_DLE_RET_OP_LIST_NULL		    	101
595#define DW_DLE_LINE_CONTEXT_NULL	    	102
596#define DW_DLE_DBG_NO_CU_CONTEXT	    	103
597#define DW_DLE_DIE_NO_CU_CONTEXT	    	104
598#define DW_DLE_FIRST_DIE_NOT_CU		    	105
599#define DW_DLE_NEXT_DIE_PTR_NULL	    	106
600#define DW_DLE_DEBUG_FRAME_DUPLICATE	    	107
601#define DW_DLE_DEBUG_FRAME_NULL		    	108
602#define DW_DLE_ABBREV_DECODE_ERROR	    	109
603#define DW_DLE_DWARF_ABBREV_NULL		110
604#define DW_DLE_ATTR_NULL		    	111
605#define DW_DLE_DIE_BAD			    	112
606#define DW_DLE_DIE_ABBREV_BAD		    	113
607#define DW_DLE_ATTR_FORM_BAD		    	114
608#define DW_DLE_ATTR_NO_CU_CONTEXT	    	115
609#define DW_DLE_ATTR_FORM_SIZE_BAD	    	116
610#define DW_DLE_ATTR_DBG_NULL		    	117
611#define DW_DLE_BAD_REF_FORM		    	118
612#define DW_DLE_ATTR_FORM_OFFSET_BAD	    	119
613#define DW_DLE_LINE_OFFSET_BAD		    	120
614#define DW_DLE_DEBUG_STR_OFFSET_BAD	    	121
615#define DW_DLE_STRING_PTR_NULL		    	122
616#define DW_DLE_PUBNAMES_VERSION_ERROR	    	123
617#define DW_DLE_PUBNAMES_LENGTH_BAD	    	124
618#define DW_DLE_GLOBAL_NULL		    	125
619#define DW_DLE_GLOBAL_CONTEXT_NULL	    	126
620#define DW_DLE_DIR_INDEX_BAD		    	127
621#define DW_DLE_LOC_EXPR_BAD		    	128
622#define DW_DLE_DIE_LOC_EXPR_BAD		    	129
623#define DW_DLE_ADDR_ALLOC		    	130
624#define DW_DLE_OFFSET_BAD		    	131
625#define DW_DLE_MAKE_CU_CONTEXT_FAIL	    	132
626#define DW_DLE_REL_ALLOC		    	133
627#define DW_DLE_ARANGE_OFFSET_BAD	    	134
628#define DW_DLE_SEGMENT_SIZE_BAD		    	135
629#define DW_DLE_ARANGE_LENGTH_BAD	    	136
630#define DW_DLE_ARANGE_DECODE_ERROR	    	137
631#define DW_DLE_ARANGES_NULL		    	138
632#define DW_DLE_ARANGE_NULL		    	139
633#define DW_DLE_NO_FILE_NAME		    	140
634#define DW_DLE_NO_COMP_DIR		    	141
635#define DW_DLE_CU_ADDRESS_SIZE_BAD	    	142
636#define DW_DLE_INPUT_ATTR_BAD		    	143
637#define DW_DLE_EXPR_NULL		    	144
638#define DW_DLE_BAD_EXPR_OPCODE		    	145
639#define DW_DLE_EXPR_LENGTH_BAD		    	146
640#define DW_DLE_MULTIPLE_RELOC_IN_EXPR	    	147
641#define DW_DLE_ELF_GETIDENT_ERROR	    	148
642#define DW_DLE_NO_AT_MIPS_FDE		    	149
643#define DW_DLE_NO_CIE_FOR_FDE		    	150
644#define DW_DLE_DIE_ABBREV_LIST_NULL	    	151
645#define DW_DLE_DEBUG_FUNCNAMES_DUPLICATE    	152
646#define DW_DLE_DEBUG_FUNCNAMES_NULL	    	153
647#define DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR    154
648#define DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD       155
649#define DW_DLE_FUNC_NULL		    	156
650#define DW_DLE_FUNC_CONTEXT_NULL	    	157
651#define DW_DLE_DEBUG_TYPENAMES_DUPLICATE    	158
652#define DW_DLE_DEBUG_TYPENAMES_NULL	    	159
653#define DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR    160
654#define DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD       161
655#define DW_DLE_TYPE_NULL		    	162
656#define DW_DLE_TYPE_CONTEXT_NULL	    	163
657#define DW_DLE_DEBUG_VARNAMES_DUPLICATE	    	164
658#define DW_DLE_DEBUG_VARNAMES_NULL	    	165
659#define DW_DLE_DEBUG_VARNAMES_VERSION_ERROR     166
660#define DW_DLE_DEBUG_VARNAMES_LENGTH_BAD        167
661#define DW_DLE_VAR_NULL			    	168
662#define DW_DLE_VAR_CONTEXT_NULL		    	169
663#define DW_DLE_DEBUG_WEAKNAMES_DUPLICATE    	170
664#define DW_DLE_DEBUG_WEAKNAMES_NULL	    	171
665#define DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR    172
666#define DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD       173
667#define DW_DLE_WEAK_NULL		    	174
668#define DW_DLE_WEAK_CONTEXT_NULL	    	175
669#define DW_DLE_LOCDESC_COUNT_WRONG              176
670#define DW_DLE_MACINFO_STRING_NULL              177
671#define DW_DLE_MACINFO_STRING_EMPTY             178
672#define DW_DLE_MACINFO_INTERNAL_ERROR_SPACE     179
673#define DW_DLE_MACINFO_MALLOC_FAIL              180
674#define DW_DLE_DEBUGMACINFO_ERROR		181
675#define DW_DLE_DEBUG_MACRO_LENGTH_BAD		182
676#define DW_DLE_DEBUG_MACRO_MAX_BAD		183
677#define DW_DLE_DEBUG_MACRO_INTERNAL_ERR		184
678#define DW_DLE_DEBUG_MACRO_MALLOC_SPACE	        185
679#define DW_DLE_DEBUG_MACRO_INCONSISTENT	        186
680#define DW_DLE_DF_NO_CIE_AUGMENTATION          	187
681#define DW_DLE_DF_REG_NUM_TOO_HIGH  		188
682#define DW_DLE_DF_MAKE_INSTR_NO_INIT          	189
683#define DW_DLE_DF_NEW_LOC_LESS_OLD_LOC         	190
684#define DW_DLE_DF_POP_EMPTY_STACK              	191
685#define DW_DLE_DF_ALLOC_FAIL                   	192
686#define DW_DLE_DF_FRAME_DECODING_ERROR         	193
687#define DW_DLE_DEBUG_LOC_SECTION_SHORT         	194
688#define DW_DLE_FRAME_AUGMENTATION_UNKNOWN       195
689#define DW_DLA_PUBTYPE_CONTEXT                  196
690#define DW_DLE_DEBUG_PUBTYPES_LENGTH_BAD        197
691#define DW_DLE_DEBUG_PUBTYPES_VERSION_ERROR     198
692#define DW_DLE_DEBUG_PUBTYPES_DUPLICATE         199
693#define DW_DLE_FRAME_CIE_DECODE_ERROR           200
694#define DW_DLE_FRAME_REGISTER_UNREPRESENTABLE   201
695#define DW_DLE_NOT_REF_FORM                     202
696#define DW_DLE_FORM_SEC_OFFSET_LENGTH_BAD       203
697
698
699
700    /* DW_DLE_LAST MUST EQUAL LAST ERROR NUMBER */
701#define DW_DLE_LAST        			203
702#define DW_DLE_LO_USER     0x10000
703
704        /* taken as meaning 'undefined value', this is not
705           a column or register number.
706           Only present at libdwarf runtime. Never on disk.
707	   DW_FRAME_* Values present on disk are in dwarf.h
708        */
709#define DW_FRAME_UNDEFINED_VAL          1034
710
711        /* taken as meaning 'same value' as caller had, not a column
712           or register number
713           Only present at libdwarf runtime. Never on disk.
714	   DW_FRAME_* Values present on disk are in dwarf.h
715        */
716#define DW_FRAME_SAME_VAL               1035
717
718
719
720/* error return values
721*/
722#define DW_DLV_BADADDR     (~(Dwarf_Addr)0)
723	/* for functions returning target address */
724
725#define DW_DLV_NOCOUNT     ((Dwarf_Signed)-1)
726	/* for functions returning count */
727
728#define DW_DLV_BADOFFSET   (~(Dwarf_Off)0)
729	/* for functions returning offset */
730
731/* standard return values for functions */
732#define DW_DLV_NO_ENTRY -1
733#define DW_DLV_OK        0
734#define DW_DLV_ERROR     1
735
736/* Special values for offset_into_exception_table field of dwarf fde's. */
737/* The following value indicates that there is no Exception table offset
738   associated with a dwarf frame. */
739#define DW_DLX_NO_EH_OFFSET  	   (-1LL)
740/* The following value indicates that the producer was unable to analyse the
741   source file to generate Exception tables for this function. */
742#define DW_DLX_EH_OFFSET_UNAVAILABLE  (-2LL)
743
744
745/*===========================================================================*/
746/*  Dwarf consumer interface initialization and termination operations */
747
748/* non-elf initialization */
749int dwarf_init(int 	/*fd*/,
750    Dwarf_Unsigned 	/*access*/,
751    Dwarf_Handler 	/*errhand*/,
752    Dwarf_Ptr 		/*errarg*/,
753    Dwarf_Debug      *  /*dbg*/,
754    Dwarf_Error* 	/*error*/);
755
756/* elf intialization */
757int dwarf_elf_init(dwarf_elf_handle /*elf*/,
758    Dwarf_Unsigned 	/*access*/,
759    Dwarf_Handler 	/*errhand*/,
760    Dwarf_Ptr 		/*errarg*/,
761    Dwarf_Debug      *  /*dbg*/,
762    Dwarf_Error* 	/*error*/);
763
764/* Undocumented function for memory allocator. */
765void dwarf_print_memory_stats(Dwarf_Debug  /*dbg*/);
766
767
768int dwarf_get_elf(Dwarf_Debug /*dbg*/,
769    dwarf_elf_handle*   /*return_elfptr*/,
770    Dwarf_Error*	/*error*/);
771
772int dwarf_finish(Dwarf_Debug /*dbg*/, Dwarf_Error* /*error*/);
773
774/* die traversal operations */
775int dwarf_next_cu_header(Dwarf_Debug /*dbg*/,
776    Dwarf_Unsigned* 	/*cu_header_length*/,
777    Dwarf_Half*     	/*version_stamp*/,
778    Dwarf_Off*  	/*abbrev_offset*/,
779    Dwarf_Half* 	/*address_size*/,
780    Dwarf_Unsigned*     /*next_cu_header_offset*/,
781    Dwarf_Error* 	/*error*/);
782
783int dwarf_siblingof(Dwarf_Debug /*dbg*/,
784    Dwarf_Die 		/*die*/,
785    Dwarf_Die*          /*return_siblingdie*/,
786    Dwarf_Error* 	/*error*/);
787
788int dwarf_child(Dwarf_Die /*die*/,
789    Dwarf_Die*          /*return_childdie*/,
790    Dwarf_Error* 	/*error*/);
791
792/* finding die given offset */
793int dwarf_offdie(Dwarf_Debug /*dbg*/,
794    Dwarf_Off 		/*offset*/,
795    Dwarf_Die*          /*return_die*/,
796    Dwarf_Error* 	/*error*/);
797
798/* higher level functions (Unimplemented) */
799int dwarf_pcfile(Dwarf_Debug /*dbg*/,
800    Dwarf_Addr 		/*pc*/,
801    Dwarf_Die*          /*return_die*/,
802    Dwarf_Error* 	/*error*/);
803
804/* Unimplemented */
805int dwarf_pcsubr(Dwarf_Debug /*dbg*/,
806    Dwarf_Addr 		/*pc*/,
807    Dwarf_Die*          /*return_die*/,
808    Dwarf_Error* 	/*error*/);
809
810/* Unimplemented */
811int dwarf_pcscope(Dwarf_Debug /*dbg*/,
812    Dwarf_Addr 		/*pc*/,
813    Dwarf_Die*          /*return_die*/,
814    Dwarf_Error* 	/*error*/);
815
816/* operations on DIEs */
817int dwarf_tag(Dwarf_Die /*die*/,
818    Dwarf_Half*	        /*return_tag*/,
819    Dwarf_Error* 	/*error*/);
820
821/* utility? */
822int dwarf_dieoffset(Dwarf_Die /*die*/,
823    Dwarf_Off*          /*return_offset*/,
824    Dwarf_Error* 	/*error*/);
825
826int dwarf_die_CU_offset(Dwarf_Die /*die*/,
827    Dwarf_Off*          /*return_offset*/,
828    Dwarf_Error*	/*error*/);
829
830int dwarf_attr (Dwarf_Die /*die*/,
831    Dwarf_Half 		/*attr*/,
832    Dwarf_Attribute *   /*returned_attr*/,
833    Dwarf_Error* 	/*error*/);
834
835int dwarf_diename(Dwarf_Die /*die*/,
836    char   **           /*diename*/,
837    Dwarf_Error* 	/*error*/);
838
839/* convenience functions, alternative to using dwarf_attrlist() */
840int dwarf_hasattr(Dwarf_Die /*die*/,
841    Dwarf_Half 		/*attr*/,
842    Dwarf_Bool     *    /*returned_bool*/,
843    Dwarf_Error* 	/*error*/);
844
845/* dwarf_loclist_n preferred over dwarf_loclist */
846int dwarf_loclist_n(Dwarf_Attribute /*attr*/,
847    Dwarf_Locdesc***	/*llbuf*/,
848    Dwarf_Signed *      /*locCount*/,
849    Dwarf_Error* 	/*error*/);
850
851int dwarf_loclist(Dwarf_Attribute /*attr*/,  /* inflexible! */
852    Dwarf_Locdesc** 	/*llbuf*/,
853    Dwarf_Signed *      /*locCount*/,
854    Dwarf_Error* 	/*error*/);
855
856/* Unimplemented */
857int dwarf_stringlen(Dwarf_Die /*die*/,
858    Dwarf_Locdesc **    /*returned_locdesc*/,
859    Dwarf_Error* 	/*error*/);
860
861/* Unimplemented */
862int dwarf_subscrcnt(Dwarf_Die /*die*/,
863    Dwarf_Signed *      /*returned_count*/,
864    Dwarf_Error* 	/*error*/);
865
866/* Unimplemented */
867int dwarf_nthsubscr(Dwarf_Die /*die*/,
868    Dwarf_Unsigned 	/*ssndx*/,
869    Dwarf_Die *         /*returned_die*/,
870    Dwarf_Error* 	/*error*/);
871
872int dwarf_lowpc(Dwarf_Die /*die*/,
873    Dwarf_Addr  *       /*returned_addr*/,
874    Dwarf_Error* 	/*error*/);
875
876int dwarf_highpc(Dwarf_Die /*die*/,
877    Dwarf_Addr  *       /*returned_addr*/,
878    Dwarf_Error* 	/*error*/);
879
880int dwarf_bytesize(Dwarf_Die /*die*/,
881    Dwarf_Unsigned *    /*returned_size*/,
882    Dwarf_Error* 	/*error*/);
883
884/* Unimplemented */
885int dwarf_isbitfield(Dwarf_Die /*die*/,
886    Dwarf_Bool  *       /*returned_bool*/,
887    Dwarf_Error* 	/*error*/);
888
889int dwarf_bitsize(Dwarf_Die /*die*/,
890    Dwarf_Unsigned *    /*returned_size*/,
891    Dwarf_Error* 	/*error*/);
892
893int dwarf_bitoffset(Dwarf_Die /*die*/,
894    Dwarf_Unsigned *    /*returned_offset*/,
895    Dwarf_Error* 	/*error*/);
896
897int dwarf_srclang(Dwarf_Die /*die*/,
898    Dwarf_Unsigned *    /*returned_lang*/,
899    Dwarf_Error* 	/*error*/);
900
901int dwarf_arrayorder(Dwarf_Die /*die*/,
902    Dwarf_Unsigned *    /*returned_order*/,
903    Dwarf_Error* 	/*error*/);
904
905/* end of convenience function list */
906
907/* this is the main interface to attributes of a DIE */
908int dwarf_attrlist(Dwarf_Die /*die*/,
909    Dwarf_Attribute** 	/*attrbuf*/,
910    Dwarf_Signed   *    /*attrcount*/,
911    Dwarf_Error* 	/*error*/);
912
913/* query operations for attributes */
914int dwarf_hasform(Dwarf_Attribute /*attr*/,
915    Dwarf_Half 		/*form*/,
916    Dwarf_Bool *        /*returned_bool*/,
917    Dwarf_Error* 	/*error*/);
918
919int dwarf_whatform(Dwarf_Attribute /*attr*/,
920    Dwarf_Half *        /*returned_form*/,
921    Dwarf_Error* 	/*error*/);
922
923int dwarf_whatform_direct(Dwarf_Attribute /*attr*/,
924    Dwarf_Half *        /*returned_form*/,
925    Dwarf_Error* 	/*error*/);
926
927int dwarf_whatattr(Dwarf_Attribute /*attr*/,
928    Dwarf_Half *        /*returned_attr_num*/,
929    Dwarf_Error* 	/*error*/);
930
931/*
932    The following are concerned with the Primary Interface: getting
933    the actual data values. One function per 'kind' of FORM.
934*/
935	/*dwarf_formref returns, thru return_offset, a CU-relative offset
936	** and does not allow DW_FORM_ref_addr*/
937int dwarf_formref(Dwarf_Attribute /*attr*/,
938    Dwarf_Off*          /*return_offset*/,
939    Dwarf_Error* 	/*error*/);
940	/*dwarf_global_formref returns, thru return_offset,
941	 a debug_info-relative offset and does allow all reference forms*/
942int dwarf_global_formref(Dwarf_Attribute /*attr*/,
943    Dwarf_Off*          /*return_offset*/,
944    Dwarf_Error* 	/*error*/);
945
946int dwarf_formaddr(Dwarf_Attribute /*attr*/,
947    Dwarf_Addr   *      /*returned_addr*/,
948    Dwarf_Error* 	/*error*/);
949
950int dwarf_formflag(Dwarf_Attribute /*attr*/,
951    Dwarf_Bool *        /*returned_bool*/,
952    Dwarf_Error*	/*error*/);
953
954int dwarf_formudata(Dwarf_Attribute /*attr*/,
955    Dwarf_Unsigned  *   /*returned_val*/,
956    Dwarf_Error* 	/*error*/);
957
958int dwarf_formsdata(Dwarf_Attribute 	/*attr*/,
959    Dwarf_Signed  *     /*returned_val*/,
960    Dwarf_Error* 	/*error*/);
961
962int dwarf_formblock(Dwarf_Attribute /*attr*/,
963    Dwarf_Block    **   /*returned_block*/,
964    Dwarf_Error* 	/*error*/);
965
966int dwarf_formstring(Dwarf_Attribute /*attr*/,
967    char   **           /*returned_string*/,
968    Dwarf_Error* 	/*error*/);
969
970/* end attribute query operations. */
971
972/* line number operations */
973/* dwarf_srclines  is the normal interface */
974int dwarf_srclines(Dwarf_Die /*die*/,
975    Dwarf_Line** 	/*linebuf*/,
976    Dwarf_Signed *      /*linecount*/,
977    Dwarf_Error* 	/*error*/);
978
979/* dwarf_srclines_dealloc, created July 2005, is the new
980   method for deallocating what dwarf_srclines returns.
981   More complete free than using dwarf_dealloc directly. */
982void dwarf_srclines_dealloc(Dwarf_Debug /*dbg*/,
983   Dwarf_Line*  /*linebuf*/,
984   Dwarf_Signed /*count */);
985
986
987int dwarf_srcfiles(Dwarf_Die /*die*/,
988    char*** 		/*srcfiles*/,
989    Dwarf_Signed *      /*filecount*/,
990    Dwarf_Error* 	/*error*/);
991
992/* Unimplemented. */
993int dwarf_dieline(Dwarf_Die /*die*/,
994    Dwarf_Line  *       /*returned_line*/,
995    Dwarf_Error *       /*error*/);
996
997int dwarf_linebeginstatement(Dwarf_Line /*line*/,
998    Dwarf_Bool  *       /*returned_bool*/,
999    Dwarf_Error* 	/*error*/);
1000
1001int dwarf_lineendsequence(Dwarf_Line /*line*/,
1002    Dwarf_Bool  *       /*returned_bool*/,
1003    Dwarf_Error*        /*error*/);
1004
1005int dwarf_lineno(Dwarf_Line /*line*/,
1006    Dwarf_Unsigned *    /*returned_lineno*/,
1007    Dwarf_Error* 	/*error*/);
1008
1009int dwarf_line_srcfileno(Dwarf_Line /*line*/,
1010    Dwarf_Unsigned * /*ret_fileno*/,
1011    Dwarf_Error *    /*error*/);
1012
1013int dwarf_lineaddr(Dwarf_Line /*line*/,
1014    Dwarf_Addr *        /*returned_addr*/,
1015    Dwarf_Error* 	/*error*/);
1016
1017int dwarf_lineoff(Dwarf_Line /*line*/,
1018    Dwarf_Signed  *     /*returned_lineoffset*/,
1019    Dwarf_Error* 	/*error*/);
1020
1021int dwarf_linesrc(Dwarf_Line /*line*/,
1022    char   **           /*returned_name*/,
1023    Dwarf_Error* 	/*error*/);
1024
1025int dwarf_lineblock(Dwarf_Line /*line*/,
1026    Dwarf_Bool  *       /*returned_bool*/,
1027    Dwarf_Error* 	/*error*/);
1028
1029/* tertiary interface to line info */
1030/* Unimplemented */
1031int dwarf_pclines(Dwarf_Debug /*dbg*/,
1032    Dwarf_Addr 		/*pc*/,
1033    Dwarf_Line** 	/*linebuf*/,
1034    Dwarf_Signed *      /*linecount*/,
1035    Dwarf_Signed 	/*slide*/,
1036    Dwarf_Error* 	/*error*/);
1037/* end line number operations */
1038
1039/* global name space operations (.debug_pubnames access) */
1040int dwarf_get_globals(Dwarf_Debug /*dbg*/,
1041    Dwarf_Global** 	/*globals*/,
1042    Dwarf_Signed *      /*number_of_globals*/,
1043    Dwarf_Error* 	/*error*/);
1044void dwarf_globals_dealloc(Dwarf_Debug /*dbg*/,
1045    Dwarf_Global* /*globals*/,
1046    Dwarf_Signed /*number_of_globals*/);
1047
1048int dwarf_globname(Dwarf_Global /*glob*/,
1049    char   **           /*returned_name*/,
1050    Dwarf_Error* 	/*error*/);
1051
1052int dwarf_global_die_offset(Dwarf_Global /*global*/,
1053    Dwarf_Off*          /*return_offset*/,
1054    Dwarf_Error * 	/*error*/);
1055
1056int dwarf_get_cu_die_offset_given_cu_header_offset(
1057	Dwarf_Debug     /*dbg*/,
1058	Dwarf_Off       /*in_cu_header_offset*/,
1059        Dwarf_Off *     /*out_cu_die_offset*/,
1060	Dwarf_Error *   /*err*/);
1061#ifdef __sgi /* pragma is sgi MIPS only */
1062#pragma optional dwarf_get_cu_die_offset_given_cu_header_offset
1063#endif
1064
1065int dwarf_global_cu_offset(Dwarf_Global /*global*/,
1066    Dwarf_Off*          /*return_offset*/,
1067    Dwarf_Error* 	/*error*/);
1068
1069int dwarf_global_name_offsets(Dwarf_Global /*global*/,
1070    char   **           /*returned_name*/,
1071    Dwarf_Off* 		/*die_offset*/,
1072    Dwarf_Off* 		/*cu_offset*/,
1073    Dwarf_Error* 	/*error*/);
1074
1075/* Static function name operations.  */
1076int dwarf_get_funcs(Dwarf_Debug	/*dbg*/,
1077    Dwarf_Func**	/*funcs*/,
1078    Dwarf_Signed *      /*number_of_funcs*/,
1079    Dwarf_Error*	/*error*/);
1080void dwarf_funcs_dealloc(Dwarf_Debug /*dbg*/,
1081    Dwarf_Func* /*funcs*/,
1082    Dwarf_Signed /*number_of_funcs*/);
1083
1084int dwarf_funcname(Dwarf_Func /*func*/,
1085    char   **           /*returned_name*/,
1086    Dwarf_Error*	/*error*/);
1087
1088int dwarf_func_die_offset(Dwarf_Func /*func*/,
1089    Dwarf_Off*          /*return_offset*/,
1090    Dwarf_Error*	/*error*/);
1091
1092int dwarf_func_cu_offset(Dwarf_Func /*func*/,
1093    Dwarf_Off*          /*return_offset*/,
1094    Dwarf_Error*	/*error*/);
1095
1096int dwarf_func_name_offsets(Dwarf_Func /*func*/,
1097    char   **           /*returned_name*/,
1098    Dwarf_Off*		/*die_offset*/,
1099    Dwarf_Off*		/*cu_offset*/,
1100    Dwarf_Error*	/*error*/);
1101
1102/* User-defined type name operations, SGI IRIX .debug_typenames section.
1103   Same content as DWARF3 .debug_pubtypes, but defined years before
1104   .debug_pubtypes was defined.   SGI IRIX only. */
1105int dwarf_get_types(Dwarf_Debug	/*dbg*/,
1106    Dwarf_Type**	/*types*/,
1107    Dwarf_Signed *      /*number_of_types*/,
1108    Dwarf_Error*	/*error*/);
1109void dwarf_types_dealloc(Dwarf_Debug /*dbg*/,
1110    Dwarf_Type* /*types*/,
1111    Dwarf_Signed /*number_of_types*/);
1112
1113
1114int dwarf_typename(Dwarf_Type /*type*/,
1115    char   **           /*returned_name*/,
1116    Dwarf_Error*	/*error*/);
1117
1118int dwarf_type_die_offset(Dwarf_Type /*type*/,
1119    Dwarf_Off*          /*return_offset*/,
1120    Dwarf_Error*	/*error*/);
1121
1122int dwarf_type_cu_offset(Dwarf_Type /*type*/,
1123    Dwarf_Off*          /*return_offset*/,
1124    Dwarf_Error*	/*error*/);
1125
1126int dwarf_type_name_offsets(Dwarf_Type	/*type*/,
1127    char   **           /*returned_name*/,
1128    Dwarf_Off*		/*die_offset*/,
1129    Dwarf_Off*		/*cu_offset*/,
1130    Dwarf_Error*	/*error*/);
1131
1132/* User-defined type name operations, DWARF3  .debug_pubtypes section.
1133*/
1134int dwarf_get_pubtypes(Dwarf_Debug	/*dbg*/,
1135    Dwarf_Type**	/*types*/,
1136    Dwarf_Signed *      /*number_of_types*/,
1137    Dwarf_Error*	/*error*/);
1138void dwarf_pubtypes_dealloc(Dwarf_Debug /*dbg*/,
1139    Dwarf_Type* /*pubtypes*/,
1140    Dwarf_Signed /*number_of_pubtypes*/);
1141
1142
1143int dwarf_pubtypename(Dwarf_Type /*type*/,
1144    char   **           /*returned_name*/,
1145    Dwarf_Error*	/*error*/);
1146
1147int dwarf_pubtype_die_offset(Dwarf_Type /*type*/,
1148    Dwarf_Off*          /*return_offset*/,
1149    Dwarf_Error*	/*error*/);
1150
1151int dwarf_pubtype_cu_offset(Dwarf_Type /*type*/,
1152    Dwarf_Off*          /*return_offset*/,
1153    Dwarf_Error*	/*error*/);
1154
1155int dwarf_pubtype_name_offsets(Dwarf_Type	/*type*/,
1156    char   **           /*returned_name*/,
1157    Dwarf_Off*		/*die_offset*/,
1158    Dwarf_Off*		/*cu_offset*/,
1159    Dwarf_Error*	/*error*/);
1160
1161/* File-scope static variable name operations.  */
1162int dwarf_get_vars(Dwarf_Debug	/*dbg*/,
1163    Dwarf_Var**		/*vars*/,
1164    Dwarf_Signed *      /*number_of_vars*/,
1165    Dwarf_Error*	/*error*/);
1166void dwarf_vars_dealloc(Dwarf_Debug /*dbg*/,
1167    Dwarf_Var* /*vars*/,
1168    Dwarf_Signed /*number_of_vars*/);
1169
1170
1171int dwarf_varname(Dwarf_Var /*var*/,
1172    char   **           /*returned_name*/,
1173    Dwarf_Error*	/*error*/);
1174
1175int dwarf_var_die_offset(Dwarf_Var /*var*/,
1176    Dwarf_Off*          /*return_offset*/,
1177    Dwarf_Error*	/*error*/);
1178
1179int dwarf_var_cu_offset(Dwarf_Var /*var*/,
1180    Dwarf_Off*          /*return_offset*/,
1181    Dwarf_Error*	/*error*/);
1182
1183int dwarf_var_name_offsets(Dwarf_Var /*var*/,
1184    char   **           /*returned_name*/,
1185    Dwarf_Off*		/*die_offset*/,
1186    Dwarf_Off*		/*cu_offset*/,
1187    Dwarf_Error*	/*error*/);
1188
1189/* weak name operations.  */
1190int dwarf_get_weaks(Dwarf_Debug	/*dbg*/,
1191    Dwarf_Weak**	/*weaks*/,
1192    Dwarf_Signed *      /*number_of_weaks*/,
1193    Dwarf_Error*	/*error*/);
1194void dwarf_weaks_dealloc(Dwarf_Debug /*dbg*/,
1195    Dwarf_Weak* /*weaks*/,
1196    Dwarf_Signed /*number_of_weaks*/);
1197
1198
1199int dwarf_weakname(Dwarf_Weak /*weak*/,
1200    char   **           /*returned_name*/,
1201    Dwarf_Error*	/*error*/);
1202
1203int dwarf_weak_die_offset(Dwarf_Weak /*weak*/,
1204    Dwarf_Off*          /*return_offset*/,
1205    Dwarf_Error*	/*error*/);
1206
1207int dwarf_weak_cu_offset(Dwarf_Weak /*weak*/,
1208    Dwarf_Off*          /*return_offset*/,
1209    Dwarf_Error*	/*error*/);
1210
1211int dwarf_weak_name_offsets(Dwarf_Weak	/*weak*/,
1212    char   **           /*returned_name*/,
1213    Dwarf_Off*		/*die_offset*/,
1214    Dwarf_Off*		/*cu_offset*/,
1215    Dwarf_Error*	/*error*/);
1216
1217/* location list section operation.  (.debug_loc access) */
1218/* Unimplemented. */
1219int dwarf_get_loclist_entry(Dwarf_Debug /*dbg*/,
1220    Dwarf_Unsigned 	/*offset*/,
1221    Dwarf_Addr* 	/*hipc*/,
1222    Dwarf_Addr* 	/*lopc*/,
1223    Dwarf_Ptr* 		/*data*/,
1224    Dwarf_Unsigned* 	/*entry_len*/,
1225    Dwarf_Unsigned* 	/*next_entry*/,
1226    Dwarf_Error* 	/*error*/);
1227
1228/* abbreviation section operations */
1229int dwarf_get_abbrev(Dwarf_Debug /*dbg*/,
1230    Dwarf_Unsigned 	/*offset*/,
1231    Dwarf_Abbrev  *     /*returned_abbrev*/,
1232    Dwarf_Unsigned* 	/*length*/,
1233    Dwarf_Unsigned* 	/*attr_count*/,
1234    Dwarf_Error* 	/*error*/);
1235
1236int dwarf_get_abbrev_tag(Dwarf_Abbrev /*abbrev*/,
1237    Dwarf_Half*        /*return_tag_number*/,
1238    Dwarf_Error* 	/*error*/);
1239int dwarf_get_abbrev_code(Dwarf_Abbrev /*abbrev*/,
1240    Dwarf_Unsigned*        /*return_code_number*/,
1241    Dwarf_Error* 	/*error*/);
1242
1243int dwarf_get_abbrev_children_flag(Dwarf_Abbrev /*abbrev*/,
1244    Dwarf_Signed*        /*return_flag*/,
1245    Dwarf_Error* 	/*error*/);
1246
1247int dwarf_get_abbrev_entry(Dwarf_Abbrev /*abbrev*/,
1248    Dwarf_Signed  	/*index*/,
1249    Dwarf_Half  *       /*returned_attr_num*/,
1250    Dwarf_Signed* 	/*form*/,
1251    Dwarf_Off*    	/*offset*/,
1252    Dwarf_Error*  	/*error*/);
1253
1254/* consumer string section operation */
1255int dwarf_get_str(Dwarf_Debug /*dbg*/,
1256    Dwarf_Off    	/*offset*/,
1257    char** 		/*string*/,
1258    Dwarf_Signed *      /*strlen_of_string*/,
1259    Dwarf_Error*  	/*error*/);
1260
1261/* Consumer op on  gnu .eh_frame info */
1262int dwarf_get_fde_list_eh(
1263    Dwarf_Debug        /*dbg*/,
1264    Dwarf_Cie       ** /*cie_data*/,
1265    Dwarf_Signed    *  /*cie_element_count*/,
1266    Dwarf_Fde       ** /*fde_data*/,
1267    Dwarf_Signed    *  /*fde_element_count*/,
1268    Dwarf_Error     *  /*error*/);
1269
1270
1271/* consumer operations on frame info: .debug_frame */
1272int dwarf_get_fde_list(Dwarf_Debug /*dbg*/,
1273    Dwarf_Cie**   	/*cie_data*/,
1274    Dwarf_Signed* 	/*cie_element_count*/,
1275    Dwarf_Fde**   	/*fde_data*/,
1276    Dwarf_Signed* 	/*fde_element_count*/,
1277    Dwarf_Error* 	/*error*/);
1278
1279/* Release storage gotten by dwarf_get_fde_list_eh() or
1280   dwarf_get_fde_list() */
1281void dwarf_fde_cie_list_dealloc(Dwarf_Debug dbg,
1282        Dwarf_Cie *cie_data,
1283        Dwarf_Signed cie_element_count,
1284        Dwarf_Fde *fde_data,
1285        Dwarf_Signed fde_element_count);
1286
1287
1288
1289int dwarf_get_fde_range(Dwarf_Fde /*fde*/,
1290    Dwarf_Addr* 	/*low_pc*/,
1291    Dwarf_Unsigned* 	/*func_length*/,
1292    Dwarf_Ptr*    	/*fde_bytes*/,
1293    Dwarf_Unsigned* 	/*fde_byte_length*/,
1294    Dwarf_Off*    	/*cie_offset*/,
1295    Dwarf_Signed*  	/*cie_index*/,
1296    Dwarf_Off*   	/*fde_offset*/,
1297    Dwarf_Error* 	/*error*/);
1298
1299/*  Useful for IRIX only:  see dwarf_get_cie_augmentation_data()
1300       dwarf_get_fde_augmentation_data() for GNU .eh_frame. */
1301int dwarf_get_fde_exception_info(Dwarf_Fde /*fde*/,
1302    Dwarf_Signed*	/* offset_into_exception_tables */,
1303    Dwarf_Error*        /*error*/);
1304
1305
1306int dwarf_get_cie_of_fde(Dwarf_Fde /*fde*/,
1307    Dwarf_Cie *         /*cie_returned*/,
1308    Dwarf_Error*        /*error*/);
1309
1310int dwarf_get_cie_info(Dwarf_Cie /*cie*/,
1311    Dwarf_Unsigned *    /*bytes_in_cie*/,
1312    Dwarf_Small*    	/*version*/,
1313    char        **      /*augmenter*/,
1314    Dwarf_Unsigned* 	/*code_alignment_factor*/,
1315    Dwarf_Signed* 	/*data_alignment_factor*/,
1316    Dwarf_Half*     	/*return_address_register_rule*/,
1317    Dwarf_Ptr*     	/*initial_instructions*/,
1318    Dwarf_Unsigned*  	/*initial_instructions_length*/,
1319    Dwarf_Error* 	/*error*/);
1320
1321int dwarf_get_fde_instr_bytes(Dwarf_Fde /*fde*/,
1322    Dwarf_Ptr * /*outinstrs*/, Dwarf_Unsigned * /*outlen*/,
1323    Dwarf_Error * /*error*/);
1324
1325int dwarf_get_fde_info_for_all_regs(Dwarf_Fde /*fde*/,
1326    Dwarf_Addr          /*pc_requested*/,
1327    Dwarf_Regtable*     /*reg_table*/,
1328    Dwarf_Addr*         /*row_pc*/,
1329    Dwarf_Error*        /*error*/);
1330
1331int dwarf_get_fde_info_for_all_regs3(Dwarf_Fde /*fde*/,
1332    Dwarf_Addr          /*pc_requested*/,
1333    Dwarf_Regtable3*     /*reg_table*/,
1334    Dwarf_Addr*         /*row_pc*/,
1335    Dwarf_Error*        /*error*/);
1336
1337/* In this older interface DW_FRAME_CFA_COL is a meaningful
1338    column (which does not work well with DWARF3 or
1339    non-MIPS architectures). */
1340int dwarf_get_fde_info_for_reg(Dwarf_Fde /*fde*/,
1341    Dwarf_Half    	/*table_column*/,
1342    Dwarf_Addr    	/*pc_requested*/,
1343    Dwarf_Signed*       /*offset_relevant*/,
1344    Dwarf_Signed* 	/*register*/,
1345    Dwarf_Signed* 	/*offset*/,
1346    Dwarf_Addr* 	/*row_pc*/,
1347    Dwarf_Error* 	/*error*/);
1348
1349/* See discussion of dw_value_type, libdwarf.h.
1350   Use of DW_FRAME_CFA_COL is not meaningful in this interface.
1351   Nor is DDW_FRAME_CFA_COL3.
1352   See dwarf_get_fde_info_for_cfa_reg3().
1353*/
1354int dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
1355    Dwarf_Half    	/*table_column*/,
1356    Dwarf_Addr    	/*pc_requested*/,
1357    Dwarf_Small  *  	/*value_type*/,
1358    Dwarf_Signed *      /*offset_relevant*/,
1359    Dwarf_Signed* 	/*register*/,
1360    Dwarf_Signed* 	/*offset_or_block_len*/,
1361    Dwarf_Ptr   *       /*block_ptr */,
1362    Dwarf_Addr* 	/*row_pc_out*/,
1363    Dwarf_Error* 	/*error*/);
1364
1365/* Use this to get the cfa. */
1366int dwarf_get_fde_info_for_cfa_reg3(Dwarf_Fde /*fde*/,
1367    Dwarf_Addr    	/*pc_requested*/,
1368    Dwarf_Small  *  	/*value_type*/,
1369    Dwarf_Signed *      /*offset_relevant*/,
1370    Dwarf_Signed* 	/*register*/,
1371    Dwarf_Signed* 	/*offset_or_block_len*/,
1372    Dwarf_Ptr   *       /*block_ptr */,
1373    Dwarf_Addr* 	/*row_pc_out*/,
1374    Dwarf_Error* 	/*error*/);
1375
1376int dwarf_get_fde_for_die(Dwarf_Debug /*dbg*/,
1377    Dwarf_Die 		/*subr_die */,
1378    Dwarf_Fde  *        /*returned_fde*/,
1379    Dwarf_Error*	/*error*/);
1380
1381int dwarf_get_fde_n(Dwarf_Fde* /*fde_data*/,
1382    Dwarf_Unsigned 	/*fde_index*/,
1383    Dwarf_Fde  *        /*returned_fde*/,
1384    Dwarf_Error*  	/*error*/);
1385
1386int dwarf_get_fde_at_pc(Dwarf_Fde* /*fde_data*/,
1387    Dwarf_Addr 		/*pc_of_interest*/,
1388    Dwarf_Fde  *        /*returned_fde*/,
1389    Dwarf_Addr* 	/*lopc*/,
1390    Dwarf_Addr* 	/*hipc*/,
1391    Dwarf_Error* 	/*error*/);
1392
1393/* GNU .eh_frame augmentation information, raw form, see
1394   Linux Standard Base Core Specification version 3.0 . */
1395int dwarf_get_cie_augmentation_data(Dwarf_Cie /* cie*/,
1396    Dwarf_Small **         /* augdata */,
1397    Dwarf_Unsigned *    /* augdata_len */,
1398    Dwarf_Error*        /*error*/);
1399/* GNU .eh_frame augmentation information, raw form, see
1400   Linux Standard Base Core Specification version 3.0 . */
1401int dwarf_get_fde_augmentation_data(Dwarf_Fde /* fde*/,
1402    Dwarf_Small **         /* augdata */,
1403    Dwarf_Unsigned *    /* augdata_len */,
1404    Dwarf_Error*        /*error*/);
1405
1406int dwarf_expand_frame_instructions(Dwarf_Debug /*dbg*/,
1407    Dwarf_Ptr 		/*instruction*/,
1408    Dwarf_Unsigned  	/*i_length*/,
1409    Dwarf_Frame_Op** 	/*returned_op_list*/,
1410    Dwarf_Signed*       /*op_count*/,
1411    Dwarf_Error* 	/*error*/);
1412
1413/* Operations on .debug_aranges. */
1414int dwarf_get_aranges(Dwarf_Debug /*dbg*/,
1415    Dwarf_Arange** 	/*aranges*/,
1416    Dwarf_Signed *      /*arange_count*/,
1417    Dwarf_Error* 	/*error*/);
1418
1419
1420
1421int dwarf_get_arange(
1422    Dwarf_Arange* 	/*aranges*/,
1423    Dwarf_Unsigned 	/*arange_count*/,
1424    Dwarf_Addr 		/*address*/,
1425    Dwarf_Arange *      /*returned_arange*/,
1426    Dwarf_Error* 	/*error*/);
1427
1428int dwarf_get_cu_die_offset(
1429    Dwarf_Arange 	/*arange*/,
1430    Dwarf_Off*          /*return_offset*/,
1431    Dwarf_Error* 	/*error*/);
1432
1433int dwarf_get_arange_cu_header_offset(
1434    Dwarf_Arange 	/*arange*/,
1435    Dwarf_Off*          /*return_cu_header_offset*/,
1436    Dwarf_Error* 	/*error*/);
1437#ifdef __sgi /* pragma is sgi MIPS only */
1438#pragma optional dwarf_get_arange_cu_header_offset
1439#endif
1440
1441int dwarf_get_arange_info(
1442    Dwarf_Arange 	/*arange*/,
1443    Dwarf_Addr* 	/*start*/,
1444    Dwarf_Unsigned* 	/*length*/,
1445    Dwarf_Off* 		/*cu_die_offset*/,
1446    Dwarf_Error* 	/*error*/);
1447
1448
1449/* consumer .debug_macinfo information interface.
1450*/
1451struct Dwarf_Macro_Details_s {
1452  Dwarf_Off    dmd_offset; /* offset, in the section,
1453                              of this macro info */
1454  Dwarf_Small  dmd_type;   /* the type, DW_MACINFO_define etc*/
1455  Dwarf_Signed dmd_lineno; /* the source line number where
1456                              applicable and vend_def # if
1457                              vendor_extension op
1458                           */
1459
1460  Dwarf_Signed dmd_fileindex;/* the source file index:
1461                              applies to define undef start_file
1462                             */
1463  char *       dmd_macro;  /* macro name (with value for defineop)
1464                              string from vendor ext
1465                           */
1466};
1467
1468/* _dwarf_print_lines is for use by dwarfdump: it prints
1469   line info to stdout.
1470*/
1471int _dwarf_print_lines(Dwarf_Die cu_die,Dwarf_Error * /*error*/);
1472
1473/* _dwarf_ld_sort_lines is for use solely by ld for
1474   rearranging lines in .debug_line in a .o created with a text
1475   section per function.
1476		-OPT:procedure_reorder=ON
1477   where ld-cord (cord(1)ing by ld,
1478   not by cord(1)) may have changed the function order.
1479*/
1480int _dwarf_ld_sort_lines(
1481        void * orig_buffer,
1482        unsigned long   buffer_len,
1483        int is_64_bit,
1484        int *any_change,
1485        int * err_code);
1486
1487/* Used by dwarfdump -v to print offsets, for debugging
1488   dwarf info
1489*/
1490int _dwarf_fde_section_offset(Dwarf_Debug dbg,Dwarf_Fde in_fde,
1491        Dwarf_Off *fde_off, Dwarf_Off *cie_off,
1492        Dwarf_Error *err);
1493
1494/* Used by dwarfdump -v to print offsets, for debugging
1495   dwarf info
1496*/
1497int _dwarf_cie_section_offset(Dwarf_Debug dbg,Dwarf_Cie in_cie,
1498        Dwarf_Off *cie_off,
1499        Dwarf_Error *err);
1500
1501
1502
1503
1504typedef struct Dwarf_Macro_Details_s Dwarf_Macro_Details;
1505
1506int dwarf_get_macro(Dwarf_Debug /*dbg*/,
1507    char *        /*requested_macro_name*/,
1508    Dwarf_Addr    /*pc_of_request*/,
1509    char **       /*returned_macro_value*/,
1510    Dwarf_Error * /*error*/);
1511
1512int dwarf_get_all_defined_macros(Dwarf_Debug /*dbg*/,
1513    Dwarf_Addr     /*pc_of_request*/,
1514    Dwarf_Signed * /*returned_count*/,
1515    char ***       /*returned_pointers_to_macros*/,
1516    Dwarf_Error *  /*error*/);
1517
1518char *dwarf_find_macro_value_start(char * /*macro_string*/);
1519
1520int dwarf_get_macro_details(Dwarf_Debug /*dbg*/,
1521    Dwarf_Off              /*macro_offset*/,
1522    Dwarf_Unsigned	   /*maximum_count*/,
1523    Dwarf_Signed         * /*entry_count*/,
1524    Dwarf_Macro_Details ** /*details*/,
1525    Dwarf_Error *          /*err*/);
1526
1527
1528int dwarf_get_address_size(Dwarf_Debug /*dbg*/,
1529        Dwarf_Half  * /*addr_size*/,
1530        Dwarf_Error * /*error*/);
1531
1532/* utility operations */
1533Dwarf_Unsigned dwarf_errno(Dwarf_Error 	/*error*/);
1534
1535char* dwarf_errmsg(Dwarf_Error	/*error*/);
1536
1537/* stringcheck zero is default and means do all
1538** string length validity checks.
1539** Call with parameter value 1 to turn off many such checks (and
1540** increase performance).
1541** Call with zero for safest running.
1542** Actual value saved and returned is only 8 bits! Upper bits
1543** ignored by libdwarf (and zero on return).
1544** Returns previous value.
1545*/
1546int dwarf_set_stringcheck(int /*stringcheck*/);
1547
1548/* Unimplemented */
1549Dwarf_Handler dwarf_seterrhand(Dwarf_Debug /*dbg*/, Dwarf_Handler /*errhand*/);
1550
1551/* Unimplemented */
1552Dwarf_Ptr dwarf_seterrarg(Dwarf_Debug /*dbg*/, Dwarf_Ptr /*errarg*/);
1553
1554void dwarf_dealloc(Dwarf_Debug /*dbg*/, void* /*space*/,
1555    Dwarf_Unsigned /*type*/);
1556
1557/* DWARF Producer Interface */
1558
1559typedef int (*Dwarf_Callback_Func)(
1560    char* /*name*/,
1561    int 		/*size*/,
1562    Dwarf_Unsigned 	/*type*/,
1563    Dwarf_Unsigned 	/*flags*/,
1564    Dwarf_Unsigned 	/*link*/,
1565    Dwarf_Unsigned 	/*info*/,
1566    int* 		/*sect name index*/,
1567    int* 		/*error*/);
1568
1569Dwarf_P_Debug dwarf_producer_init(
1570    Dwarf_Unsigned      /*creation_flags*/,
1571    Dwarf_Callback_Func	/*func*/,
1572    Dwarf_Handler 	/*errhand*/,
1573    Dwarf_Ptr 		/*errarg*/,
1574    Dwarf_Error* 	/*error*/);
1575
1576typedef int (*Dwarf_Callback_Func_b)(
1577    char* 		/*name*/,
1578    int                 /*size*/,
1579    Dwarf_Unsigned      /*type*/,
1580    Dwarf_Unsigned      /*flags*/,
1581    Dwarf_Unsigned      /*link*/,
1582    Dwarf_Unsigned      /*info*/,
1583    Dwarf_Unsigned*     /*sect_name_index*/,
1584    int*                /*error*/);
1585
1586
1587Dwarf_P_Debug dwarf_producer_init_b(
1588    Dwarf_Unsigned        /*flags*/,
1589    Dwarf_Callback_Func_b /*func*/,
1590    Dwarf_Handler         /*errhand*/,
1591    Dwarf_Ptr             /*errarg*/,
1592    Dwarf_Error *         /*error*/);
1593
1594
1595Dwarf_Signed dwarf_transform_to_disk_form(Dwarf_P_Debug /*dbg*/,
1596    Dwarf_Error* 	/*error*/);
1597
1598Dwarf_Ptr dwarf_get_section_bytes(Dwarf_P_Debug /*dbg*/,
1599    Dwarf_Signed 	/*dwarf_section*/,
1600    Dwarf_Signed* 	/*elf_section_index*/,
1601    Dwarf_Unsigned* 	/*length*/,
1602    Dwarf_Error* 	/*error*/);
1603
1604int  dwarf_get_relocation_info_count(
1605        Dwarf_P_Debug    /*dbg*/,
1606        Dwarf_Unsigned * /*count_of_relocation_sections*/,
1607	int *            /*drd_buffer_version*/,
1608        Dwarf_Error*     /*error*/);
1609
1610int dwarf_get_relocation_info(
1611        Dwarf_P_Debug           /*dbg*/,
1612        Dwarf_Signed          * /*elf_section_index*/,
1613        Dwarf_Signed          * /*elf_section_index_link*/,
1614        Dwarf_Unsigned        * /*relocation_buffer_count*/,
1615        Dwarf_Relocation_Data * /*reldata_buffer*/,
1616        Dwarf_Error*            /*error*/);
1617
1618/* v1:  no drd_length field, enum explicit */
1619/* v2:  has the drd_length field, enum value in uchar member */
1620#define DWARF_DRD_BUFFER_VERSION 2
1621
1622void dwarf_reset_section_bytes(Dwarf_P_Debug /*dbg*/);
1623
1624Dwarf_Unsigned dwarf_producer_finish(Dwarf_P_Debug /*dbg*/,
1625    Dwarf_Error* /*error*/);
1626
1627/* Producer attribute addition functions. */
1628Dwarf_P_Attribute dwarf_add_AT_targ_address(Dwarf_P_Debug /*dbg*/,
1629    Dwarf_P_Die 	/*ownerdie*/,
1630    Dwarf_Half 		/*attr*/,
1631    Dwarf_Unsigned 	/*pc_value*/,
1632    Dwarf_Signed 	/*sym_index*/,
1633    Dwarf_Error* 	/*error*/);
1634
1635Dwarf_P_Attribute dwarf_add_AT_targ_address_b(Dwarf_P_Debug /*dbg*/,
1636    Dwarf_P_Die 	/*ownerdie*/,
1637    Dwarf_Half 		/*attr*/,
1638    Dwarf_Unsigned 	/*pc_value*/,
1639    Dwarf_Unsigned 	/*sym_index*/,
1640    Dwarf_Error* 	/*error*/);
1641
1642Dwarf_P_Attribute dwarf_add_AT_unsigned_const(Dwarf_P_Debug /*dbg*/,
1643    Dwarf_P_Die 	/*ownerdie*/,
1644    Dwarf_Half 		/*attr*/,
1645    Dwarf_Unsigned 	/*value*/,
1646    Dwarf_Error* 	/*error*/);
1647
1648Dwarf_P_Attribute dwarf_add_AT_signed_const(Dwarf_P_Debug /*dbg*/,
1649    Dwarf_P_Die 	/*ownerdie*/,
1650    Dwarf_Half 		/*attr*/,
1651    Dwarf_Signed 	/*value*/,
1652    Dwarf_Error* 	/*error*/);
1653
1654Dwarf_P_Attribute dwarf_add_AT_reference(Dwarf_P_Debug /*dbg*/,
1655    Dwarf_P_Die 	/*ownerdie*/,
1656    Dwarf_Half 		/*attr*/,
1657    Dwarf_P_Die 	/*otherdie*/,
1658    Dwarf_Error* 	/*error*/);
1659
1660Dwarf_P_Attribute dwarf_add_AT_const_value_string(Dwarf_P_Die /*ownerdie*/,
1661    char* 		/*string_value*/,
1662    Dwarf_Error* 	/*error*/);
1663
1664Dwarf_P_Attribute dwarf_add_AT_location_expr(Dwarf_P_Debug /*dbg*/,
1665    Dwarf_P_Die 	/*ownerdie*/,
1666    Dwarf_Half 		/*attr*/,
1667    Dwarf_P_Expr 	/*loc_expr*/,
1668    Dwarf_Error* 	/*error*/);
1669
1670Dwarf_P_Attribute dwarf_add_AT_string(Dwarf_P_Debug /*dbg*/,
1671    Dwarf_P_Die 	/*ownerdie*/,
1672    Dwarf_Half 		/*attr*/,
1673    char* 		/*string*/,
1674    Dwarf_Error* 	/*error*/);
1675
1676Dwarf_P_Attribute dwarf_add_AT_flag(Dwarf_P_Debug /*dbg*/,
1677    Dwarf_P_Die 	/*ownerdie*/,
1678    Dwarf_Half 		/*attr*/,
1679    Dwarf_Small 	/*flag*/,
1680    Dwarf_Error* 	/*error*/);
1681
1682Dwarf_P_Attribute dwarf_add_AT_producer(Dwarf_P_Die /*ownerdie*/,
1683    char* 		/*producer_string*/,
1684    Dwarf_Error* 	/*error*/);
1685
1686Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
1687    Dwarf_Signed 	/*signed_value*/,
1688    Dwarf_Error* 	/*error*/);
1689
1690Dwarf_P_Attribute dwarf_add_AT_const_value_unsignedint(
1691    Dwarf_P_Die         /*ownerdie*/,
1692    Dwarf_Unsigned 	/*unsigned_value*/,
1693    Dwarf_Error* 	/*error*/);
1694
1695Dwarf_P_Attribute dwarf_add_AT_comp_dir(Dwarf_P_Die /*ownerdie*/,
1696    char* 		/*current_working_directory*/,
1697    Dwarf_Error* 	/*error*/);
1698
1699Dwarf_P_Attribute dwarf_add_AT_name(Dwarf_P_Die	/*die*/,
1700    char* 		/*name*/,
1701    Dwarf_Error* 	/*error*/);
1702
1703/* Producer line creation functions (.debug_line) */
1704Dwarf_Unsigned dwarf_add_directory_decl(Dwarf_P_Debug /*dbg*/,
1705    char* 		/*name*/,
1706    Dwarf_Error*	/*error*/);
1707
1708Dwarf_Unsigned dwarf_add_file_decl(Dwarf_P_Debug /*dbg*/,
1709    char* 		/*name*/,
1710    Dwarf_Unsigned 	/*dir_index*/,
1711    Dwarf_Unsigned 	/*time_last_modified*/,
1712    Dwarf_Unsigned 	/*length*/,
1713    Dwarf_Error*	/*error*/);
1714
1715Dwarf_Unsigned dwarf_add_line_entry(Dwarf_P_Debug /*dbg*/,
1716    Dwarf_Unsigned 	/*file_index*/,
1717    Dwarf_Addr 		/*code_address*/,
1718    Dwarf_Unsigned 	/*lineno*/,
1719    Dwarf_Signed 	/*column_number*/,
1720    Dwarf_Bool 		/*is_source_stmt_begin*/,
1721    Dwarf_Bool 		/*is_basic_block_begin*/,
1722    Dwarf_Error* 	/*error*/);
1723
1724Dwarf_Unsigned dwarf_lne_set_address(Dwarf_P_Debug /*dbg*/,
1725    Dwarf_Unsigned 	/*offset*/,
1726    Dwarf_Unsigned 	/*symbol_index*/,
1727    Dwarf_Error* 	/*error*/);
1728
1729Dwarf_Unsigned dwarf_lne_end_sequence(Dwarf_P_Debug /*dbg*/,
1730    Dwarf_Addr		/*end_address*/,
1731    Dwarf_Error* 	/*error*/);
1732
1733/* Producer .debug_frame functions */
1734Dwarf_Unsigned dwarf_add_frame_cie(Dwarf_P_Debug /*dbg*/,
1735    char* 		/*augmenter*/,
1736    Dwarf_Small 	/*code_alignent_factor*/,
1737    Dwarf_Small 	/*data_alignment_factor*/,
1738    Dwarf_Small 	/*return_address_reg*/,
1739    Dwarf_Ptr 		/*initialization_bytes*/,
1740    Dwarf_Unsigned 	/*init_byte_len*/,
1741    Dwarf_Error* 	/*error*/);
1742
1743Dwarf_Unsigned dwarf_add_frame_fde(
1744    Dwarf_P_Debug 	/*dbg*/,
1745    Dwarf_P_Fde 	/*fde*/,
1746    Dwarf_P_Die 	/*corresponding subprogram die*/,
1747    Dwarf_Unsigned 	/*cie_to_use*/,
1748    Dwarf_Unsigned  	/*virt_addr_of_described_code*/,
1749    Dwarf_Unsigned  	/*length_of_code*/,
1750    Dwarf_Unsigned 	/*symbol_index*/,
1751    Dwarf_Error* 	/*error*/);
1752
1753Dwarf_Unsigned dwarf_add_frame_fde_b(
1754        Dwarf_P_Debug  /*dbg*/,
1755        Dwarf_P_Fde    /*fde*/,
1756        Dwarf_P_Die    /*die*/,
1757        Dwarf_Unsigned /*cie*/,
1758        Dwarf_Addr     /*virt_addr*/,
1759        Dwarf_Unsigned /*code_len*/,
1760        Dwarf_Unsigned /*sym_idx*/,
1761        Dwarf_Unsigned /*sym_idx_of_end*/,
1762        Dwarf_Addr     /*offset_from_end_sym*/,
1763        Dwarf_Error*   /*error*/);
1764
1765Dwarf_Unsigned dwarf_add_frame_info_b(
1766    Dwarf_P_Debug dbg   /*dbg*/,
1767    Dwarf_P_Fde 	/*fde*/,
1768    Dwarf_P_Die 	/*die*/,
1769    Dwarf_Unsigned 	/*cie*/,
1770    Dwarf_Addr 	        /*virt_addr*/,
1771    Dwarf_Unsigned 	/*code_len*/,
1772    Dwarf_Unsigned 	/*symidx*/,
1773    Dwarf_Unsigned      /* end_symbol */,
1774    Dwarf_Addr          /* offset_from_end_symbol */,
1775    Dwarf_Signed   	/*offset_into_exception_tables*/,
1776    Dwarf_Unsigned 	/*exception_table_symbol*/,
1777    Dwarf_Error*	/*error*/);
1778
1779Dwarf_Unsigned dwarf_add_frame_info(
1780    Dwarf_P_Debug dbg   /*dbg*/,
1781    Dwarf_P_Fde 	/*fde*/,
1782    Dwarf_P_Die 	/*die*/,
1783    Dwarf_Unsigned 	/*cie*/,
1784    Dwarf_Addr 	        /*virt_addr*/,
1785    Dwarf_Unsigned 	/*code_len*/,
1786    Dwarf_Unsigned 	/*symidx*/,
1787    Dwarf_Signed   	/*offset_into_exception_tables*/,
1788    Dwarf_Unsigned 	/*exception_table_symbol*/,
1789    Dwarf_Error*	/*error*/);
1790
1791Dwarf_P_Fde dwarf_add_fde_inst(
1792    Dwarf_P_Fde         /*fde*/,
1793    Dwarf_Small 	/*op*/,
1794    Dwarf_Unsigned 	/*val1*/,
1795    Dwarf_Unsigned 	/*val2*/,
1796    Dwarf_Error* 	/*error*/);
1797
1798Dwarf_P_Fde dwarf_new_fde(Dwarf_P_Debug	/*dbg*/, Dwarf_Error* /*error*/);
1799
1800Dwarf_P_Fde dwarf_fde_cfa_offset(
1801    Dwarf_P_Fde         /*fde*/,
1802    Dwarf_Unsigned  	/*register_number*/,
1803    Dwarf_Signed    	/*offset*/,
1804    Dwarf_Error* 	/*error*/);
1805
1806/* die creation & addition routines */
1807Dwarf_P_Die dwarf_new_die(
1808    Dwarf_P_Debug	/*dbg*/,
1809    Dwarf_Tag 		/*tag*/,
1810    Dwarf_P_Die 	/*parent*/,
1811    Dwarf_P_Die 	/*child*/,
1812    Dwarf_P_Die 	/*left */,
1813    Dwarf_P_Die 	/*right*/,
1814    Dwarf_Error*	/*error*/);
1815
1816Dwarf_Unsigned dwarf_add_die_to_debug(
1817    Dwarf_P_Debug       /*dbg*/,
1818    Dwarf_P_Die		/*die*/,
1819    Dwarf_Error*	/*error*/);
1820
1821Dwarf_P_Die dwarf_die_link(
1822    Dwarf_P_Die         /*die*/,
1823    Dwarf_P_Die 	/*parent*/,
1824    Dwarf_P_Die 	/*child*/,
1825    Dwarf_P_Die		/*left*/,
1826    Dwarf_P_Die		/*right*/,
1827    Dwarf_Error* 	/*error*/);
1828
1829/* Operations to create location expressions. */
1830Dwarf_P_Expr dwarf_new_expr(Dwarf_P_Debug /*dbg*/, Dwarf_Error* /*error*/);
1831
1832Dwarf_Unsigned dwarf_add_expr_gen(
1833    Dwarf_P_Expr        /*expr*/,
1834    Dwarf_Small 	/*opcode*/,
1835    Dwarf_Unsigned 	/*val1*/,
1836    Dwarf_Unsigned 	/*val2*/,
1837    Dwarf_Error* 	/*error*/);
1838
1839Dwarf_Unsigned dwarf_add_expr_addr(
1840    Dwarf_P_Expr        /*expr*/,
1841    Dwarf_Unsigned 	/*addr*/,
1842    Dwarf_Signed 	/*sym_index*/,
1843    Dwarf_Error* 	/*error*/);
1844
1845Dwarf_Unsigned dwarf_add_expr_addr_b(
1846    Dwarf_P_Expr        /*expr*/,
1847    Dwarf_Unsigned      /*addr*/,
1848    Dwarf_Unsigned      /*sym_index*/,
1849    Dwarf_Error*        /*error*/);
1850
1851Dwarf_Unsigned dwarf_expr_current_offset(
1852    Dwarf_P_Expr /*expr*/,
1853    Dwarf_Error* /*error*/);
1854
1855Dwarf_Addr dwarf_expr_into_block(
1856    Dwarf_P_Expr        /*expr*/,
1857    Dwarf_Unsigned* 	/*length*/,
1858    Dwarf_Error* 	/*error*/);
1859
1860Dwarf_Unsigned dwarf_add_arange(Dwarf_P_Debug /*dbg*/,
1861    Dwarf_Addr 		/*begin_address*/,
1862    Dwarf_Unsigned 	/*length*/,
1863    Dwarf_Signed 	/*symbol_index*/,
1864    Dwarf_Error* 	/*error*/);
1865
1866Dwarf_Unsigned dwarf_add_arange_b(
1867        Dwarf_P_Debug  /*dbg*/,
1868        Dwarf_Addr     /*begin_address*/,
1869        Dwarf_Unsigned /*length*/,
1870        Dwarf_Unsigned /*symbol_index*/,
1871        Dwarf_Unsigned /*end_symbol_index*/,
1872        Dwarf_Addr     /*offset_from_end_symbol*/,
1873        Dwarf_Error *  /*error*/);
1874
1875Dwarf_Unsigned dwarf_add_pubname(
1876    Dwarf_P_Debug       /*dbg*/,
1877    Dwarf_P_Die 	/*die*/,
1878    char* 		/*pubname_name*/,
1879    Dwarf_Error* 	/*error*/);
1880
1881Dwarf_Unsigned dwarf_add_funcname(
1882    Dwarf_P_Debug       /*dbg*/,
1883    Dwarf_P_Die 	/*die*/,
1884    char* 		/*func_name*/,
1885    Dwarf_Error* 	/*error*/);
1886
1887Dwarf_Unsigned dwarf_add_typename(
1888    Dwarf_P_Debug       /*dbg*/,
1889    Dwarf_P_Die 	/*die*/,
1890    char* 		/*type_name*/,
1891    Dwarf_Error* 	/*error*/);
1892
1893Dwarf_Unsigned dwarf_add_varname(
1894    Dwarf_P_Debug       /*dbg*/,
1895    Dwarf_P_Die 	/*die*/,
1896    char* 		/*var_name*/,
1897    Dwarf_Error* 	/*error*/);
1898
1899Dwarf_Unsigned dwarf_add_weakname(
1900    Dwarf_P_Debug       /*dbg*/,
1901    Dwarf_P_Die 	/*die*/,
1902    char* 		/*weak_name*/,
1903    Dwarf_Error* 	/*error*/);
1904
1905/* .debug_macinfo producer functions
1906   Functions must be called in right order: the section is output
1907   In the order these are presented.
1908*/
1909int dwarf_def_macro(Dwarf_P_Debug /*dbg*/,
1910    Dwarf_Unsigned  /*line*/,
1911    char *          /*macname, with (arglist), no space before (*/,
1912    char *	    /*macvalue*/,
1913    Dwarf_Error*    /*error*/);
1914
1915int dwarf_undef_macro(Dwarf_P_Debug /*dbg*/,
1916    Dwarf_Unsigned  /*line*/,
1917    char *          /*macname, no arglist, of course*/,
1918    Dwarf_Error*    /*error*/);
1919
1920int dwarf_start_macro_file(Dwarf_P_Debug /*dbg*/,
1921    Dwarf_Unsigned /*fileindex*/,
1922    Dwarf_Unsigned /*linenumber*/,
1923    Dwarf_Error*   /*error*/);
1924
1925int dwarf_end_macro_file(Dwarf_P_Debug /*dbg*/,
1926    Dwarf_Error*   /*error*/);
1927
1928int dwarf_vendor_ext(Dwarf_P_Debug /*dbg*/,
1929    Dwarf_Unsigned /*constant*/,
1930    char *         /*string*/,
1931    Dwarf_Error*   /*error*/);
1932
1933/* end macinfo producer functions */
1934
1935
1936void dwarf_p_dealloc(void* /*space*/, Dwarf_Unsigned /*type*/);
1937
1938int dwarf_attr_offset(Dwarf_Die /*die*/,
1939    Dwarf_Attribute /*attr of above die*/,
1940    Dwarf_Off     * /*returns offset thru this ptr */,
1941    Dwarf_Error   * /*error*/);
1942
1943/* This is a hack so clients can verify offsets.
1944   Added April 2005 so that debugger can detect broken offsets
1945   (which happened in an IRIX executable larger than 2GB
1946    with MIPSpro 7.3.1.3 toolchain.).
1947*/
1948int
1949dwarf_get_section_max_offsets(Dwarf_Debug /*dbg*/,
1950    Dwarf_Unsigned * /*debug_info_size*/,
1951    Dwarf_Unsigned * /*debug_abbrev_size*/,
1952    Dwarf_Unsigned * /*debug_line_size*/,
1953    Dwarf_Unsigned * /*debug_loc_size*/,
1954    Dwarf_Unsigned * /*debug_aranges_size*/,
1955    Dwarf_Unsigned * /*debug_macinfo_size*/,
1956    Dwarf_Unsigned * /*debug_pubnames_size*/,
1957    Dwarf_Unsigned * /*debug_str_size*/,
1958    Dwarf_Unsigned * /*debug_frame_size*/,
1959    Dwarf_Unsigned * /*debug_ranges_size*/,
1960    Dwarf_Unsigned * /*debug_pubtypes_size*/);
1961
1962Dwarf_Half
1963dwarf_set_frame_rule_inital_value(Dwarf_Debug /*dbg*/,
1964	Dwarf_Half /*value*/);
1965
1966Dwarf_Half
1967dwarf_set_frame_rule_table_size(Dwarf_Debug dbg,
1968        Dwarf_Half value);
1969
1970
1971#ifdef __cplusplus
1972}
1973#endif
1974#endif /* _LIBDWARF_H */
1975
1976