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
696
697
698    /* DW_DLE_LAST MUST EQUAL LAST ERROR NUMBER */
699#define DW_DLE_LAST        			201
700#define DW_DLE_LO_USER     0x10000
701
702        /* taken as meaning 'undefined value', this is not
703           a column or register number.
704           Only present at libdwarf runtime. Never on disk.
705	   DW_FRAME_* Values present on disk are in dwarf.h
706        */
707#define DW_FRAME_UNDEFINED_VAL          1034
708
709        /* taken as meaning 'same value' as caller had, not a column
710           or register number
711           Only present at libdwarf runtime. Never on disk.
712	   DW_FRAME_* Values present on disk are in dwarf.h
713        */
714#define DW_FRAME_SAME_VAL               1035
715
716
717
718/* error return values
719*/
720#define DW_DLV_BADADDR     (~(Dwarf_Addr)0)
721	/* for functions returning target address */
722
723#define DW_DLV_NOCOUNT     ((Dwarf_Signed)-1)
724	/* for functions returning count */
725
726#define DW_DLV_BADOFFSET   (~(Dwarf_Off)0)
727	/* for functions returning offset */
728
729/* standard return values for functions */
730#define DW_DLV_NO_ENTRY -1
731#define DW_DLV_OK        0
732#define DW_DLV_ERROR     1
733
734/* Special values for offset_into_exception_table field of dwarf fde's. */
735/* The following value indicates that there is no Exception table offset
736   associated with a dwarf frame. */
737#define DW_DLX_NO_EH_OFFSET  	   (-1LL)
738/* The following value indicates that the producer was unable to analyse the
739   source file to generate Exception tables for this function. */
740#define DW_DLX_EH_OFFSET_UNAVAILABLE  (-2LL)
741
742
743/*===========================================================================*/
744/*  Dwarf consumer interface initialization and termination operations */
745
746/* non-elf initialization */
747int dwarf_init(int 	/*fd*/,
748    Dwarf_Unsigned 	/*access*/,
749    Dwarf_Handler 	/*errhand*/,
750    Dwarf_Ptr 		/*errarg*/,
751    Dwarf_Debug      *  /*dbg*/,
752    Dwarf_Error* 	/*error*/);
753
754/* elf intialization */
755int dwarf_elf_init(dwarf_elf_handle /*elf*/,
756    Dwarf_Unsigned 	/*access*/,
757    Dwarf_Handler 	/*errhand*/,
758    Dwarf_Ptr 		/*errarg*/,
759    Dwarf_Debug      *  /*dbg*/,
760    Dwarf_Error* 	/*error*/);
761
762/* Undocumented function for memory allocator. */
763void dwarf_print_memory_stats(Dwarf_Debug  /*dbg*/);
764
765
766int dwarf_get_elf(Dwarf_Debug /*dbg*/,
767    dwarf_elf_handle*   /*return_elfptr*/,
768    Dwarf_Error*	/*error*/);
769
770int dwarf_finish(Dwarf_Debug /*dbg*/, Dwarf_Error* /*error*/);
771
772/* die traversal operations */
773int dwarf_next_cu_header(Dwarf_Debug /*dbg*/,
774    Dwarf_Unsigned* 	/*cu_header_length*/,
775    Dwarf_Half*     	/*version_stamp*/,
776    Dwarf_Off*  	/*abbrev_offset*/,
777    Dwarf_Half* 	/*address_size*/,
778    Dwarf_Unsigned*     /*next_cu_header_offset*/,
779    Dwarf_Error* 	/*error*/);
780
781int dwarf_siblingof(Dwarf_Debug /*dbg*/,
782    Dwarf_Die 		/*die*/,
783    Dwarf_Die*          /*return_siblingdie*/,
784    Dwarf_Error* 	/*error*/);
785
786int dwarf_child(Dwarf_Die /*die*/,
787    Dwarf_Die*          /*return_childdie*/,
788    Dwarf_Error* 	/*error*/);
789
790/* finding die given offset */
791int dwarf_offdie(Dwarf_Debug /*dbg*/,
792    Dwarf_Off 		/*offset*/,
793    Dwarf_Die*          /*return_die*/,
794    Dwarf_Error* 	/*error*/);
795
796/* higher level functions (Unimplemented) */
797int dwarf_pcfile(Dwarf_Debug /*dbg*/,
798    Dwarf_Addr 		/*pc*/,
799    Dwarf_Die*          /*return_die*/,
800    Dwarf_Error* 	/*error*/);
801
802/* Unimplemented */
803int dwarf_pcsubr(Dwarf_Debug /*dbg*/,
804    Dwarf_Addr 		/*pc*/,
805    Dwarf_Die*          /*return_die*/,
806    Dwarf_Error* 	/*error*/);
807
808/* Unimplemented */
809int dwarf_pcscope(Dwarf_Debug /*dbg*/,
810    Dwarf_Addr 		/*pc*/,
811    Dwarf_Die*          /*return_die*/,
812    Dwarf_Error* 	/*error*/);
813
814/* operations on DIEs */
815int dwarf_tag(Dwarf_Die /*die*/,
816    Dwarf_Half*	        /*return_tag*/,
817    Dwarf_Error* 	/*error*/);
818
819/* utility? */
820int dwarf_dieoffset(Dwarf_Die /*die*/,
821    Dwarf_Off*          /*return_offset*/,
822    Dwarf_Error* 	/*error*/);
823
824int dwarf_die_CU_offset(Dwarf_Die /*die*/,
825    Dwarf_Off*          /*return_offset*/,
826    Dwarf_Error*	/*error*/);
827
828int dwarf_attr (Dwarf_Die /*die*/,
829    Dwarf_Half 		/*attr*/,
830    Dwarf_Attribute *   /*returned_attr*/,
831    Dwarf_Error* 	/*error*/);
832
833int dwarf_diename(Dwarf_Die /*die*/,
834    char   **           /*diename*/,
835    Dwarf_Error* 	/*error*/);
836
837/* convenience functions, alternative to using dwarf_attrlist() */
838int dwarf_hasattr(Dwarf_Die /*die*/,
839    Dwarf_Half 		/*attr*/,
840    Dwarf_Bool     *    /*returned_bool*/,
841    Dwarf_Error* 	/*error*/);
842
843/* dwarf_loclist_n preferred over dwarf_loclist */
844int dwarf_loclist_n(Dwarf_Attribute /*attr*/,
845    Dwarf_Locdesc***	/*llbuf*/,
846    Dwarf_Signed *      /*locCount*/,
847    Dwarf_Error* 	/*error*/);
848
849int dwarf_loclist(Dwarf_Attribute /*attr*/,  /* inflexible! */
850    Dwarf_Locdesc** 	/*llbuf*/,
851    Dwarf_Signed *      /*locCount*/,
852    Dwarf_Error* 	/*error*/);
853
854/* Unimplemented */
855int dwarf_stringlen(Dwarf_Die /*die*/,
856    Dwarf_Locdesc **    /*returned_locdesc*/,
857    Dwarf_Error* 	/*error*/);
858
859/* Unimplemented */
860int dwarf_subscrcnt(Dwarf_Die /*die*/,
861    Dwarf_Signed *      /*returned_count*/,
862    Dwarf_Error* 	/*error*/);
863
864/* Unimplemented */
865int dwarf_nthsubscr(Dwarf_Die /*die*/,
866    Dwarf_Unsigned 	/*ssndx*/,
867    Dwarf_Die *         /*returned_die*/,
868    Dwarf_Error* 	/*error*/);
869
870int dwarf_lowpc(Dwarf_Die /*die*/,
871    Dwarf_Addr  *       /*returned_addr*/,
872    Dwarf_Error* 	/*error*/);
873
874int dwarf_highpc(Dwarf_Die /*die*/,
875    Dwarf_Addr  *       /*returned_addr*/,
876    Dwarf_Error* 	/*error*/);
877
878int dwarf_bytesize(Dwarf_Die /*die*/,
879    Dwarf_Unsigned *    /*returned_size*/,
880    Dwarf_Error* 	/*error*/);
881
882/* Unimplemented */
883int dwarf_isbitfield(Dwarf_Die /*die*/,
884    Dwarf_Bool  *       /*returned_bool*/,
885    Dwarf_Error* 	/*error*/);
886
887int dwarf_bitsize(Dwarf_Die /*die*/,
888    Dwarf_Unsigned *    /*returned_size*/,
889    Dwarf_Error* 	/*error*/);
890
891int dwarf_bitoffset(Dwarf_Die /*die*/,
892    Dwarf_Unsigned *    /*returned_offset*/,
893    Dwarf_Error* 	/*error*/);
894
895int dwarf_srclang(Dwarf_Die /*die*/,
896    Dwarf_Unsigned *    /*returned_lang*/,
897    Dwarf_Error* 	/*error*/);
898
899int dwarf_arrayorder(Dwarf_Die /*die*/,
900    Dwarf_Unsigned *    /*returned_order*/,
901    Dwarf_Error* 	/*error*/);
902
903/* end of convenience function list */
904
905/* this is the main interface to attributes of a DIE */
906int dwarf_attrlist(Dwarf_Die /*die*/,
907    Dwarf_Attribute** 	/*attrbuf*/,
908    Dwarf_Signed   *    /*attrcount*/,
909    Dwarf_Error* 	/*error*/);
910
911/* query operations for attributes */
912int dwarf_hasform(Dwarf_Attribute /*attr*/,
913    Dwarf_Half 		/*form*/,
914    Dwarf_Bool *        /*returned_bool*/,
915    Dwarf_Error* 	/*error*/);
916
917int dwarf_whatform(Dwarf_Attribute /*attr*/,
918    Dwarf_Half *        /*returned_form*/,
919    Dwarf_Error* 	/*error*/);
920
921int dwarf_whatform_direct(Dwarf_Attribute /*attr*/,
922    Dwarf_Half *        /*returned_form*/,
923    Dwarf_Error* 	/*error*/);
924
925int dwarf_whatattr(Dwarf_Attribute /*attr*/,
926    Dwarf_Half *        /*returned_attr_num*/,
927    Dwarf_Error* 	/*error*/);
928
929/*
930    The following are concerned with the Primary Interface: getting
931    the actual data values. One function per 'kind' of FORM.
932*/
933	/*dwarf_formref returns, thru return_offset, a CU-relative offset
934	** and does not allow DW_FORM_ref_addr*/
935int dwarf_formref(Dwarf_Attribute /*attr*/,
936    Dwarf_Off*          /*return_offset*/,
937    Dwarf_Error* 	/*error*/);
938	/*dwarf_global_formref returns, thru return_offset,
939	 a debug_info-relative offset and does allow all reference forms*/
940int dwarf_global_formref(Dwarf_Attribute /*attr*/,
941    Dwarf_Off*          /*return_offset*/,
942    Dwarf_Error* 	/*error*/);
943
944int dwarf_formaddr(Dwarf_Attribute /*attr*/,
945    Dwarf_Addr   *      /*returned_addr*/,
946    Dwarf_Error* 	/*error*/);
947
948int dwarf_formflag(Dwarf_Attribute /*attr*/,
949    Dwarf_Bool *        /*returned_bool*/,
950    Dwarf_Error*	/*error*/);
951
952int dwarf_formudata(Dwarf_Attribute /*attr*/,
953    Dwarf_Unsigned  *   /*returned_val*/,
954    Dwarf_Error* 	/*error*/);
955
956int dwarf_formsdata(Dwarf_Attribute 	/*attr*/,
957    Dwarf_Signed  *     /*returned_val*/,
958    Dwarf_Error* 	/*error*/);
959
960int dwarf_formblock(Dwarf_Attribute /*attr*/,
961    Dwarf_Block    **   /*returned_block*/,
962    Dwarf_Error* 	/*error*/);
963
964int dwarf_formstring(Dwarf_Attribute /*attr*/,
965    char   **           /*returned_string*/,
966    Dwarf_Error* 	/*error*/);
967
968/* end attribute query operations. */
969
970/* line number operations */
971/* dwarf_srclines  is the normal interface */
972int dwarf_srclines(Dwarf_Die /*die*/,
973    Dwarf_Line** 	/*linebuf*/,
974    Dwarf_Signed *      /*linecount*/,
975    Dwarf_Error* 	/*error*/);
976
977/* dwarf_srclines_dealloc, created July 2005, is the new
978   method for deallocating what dwarf_srclines returns.
979   More complete free than using dwarf_dealloc directly. */
980void dwarf_srclines_dealloc(Dwarf_Debug /*dbg*/,
981   Dwarf_Line*  /*linebuf*/,
982   Dwarf_Signed /*count */);
983
984
985int dwarf_srcfiles(Dwarf_Die /*die*/,
986    char*** 		/*srcfiles*/,
987    Dwarf_Signed *      /*filecount*/,
988    Dwarf_Error* 	/*error*/);
989
990/* Unimplemented. */
991int dwarf_dieline(Dwarf_Die /*die*/,
992    Dwarf_Line  *       /*returned_line*/,
993    Dwarf_Error *       /*error*/);
994
995int dwarf_linebeginstatement(Dwarf_Line /*line*/,
996    Dwarf_Bool  *       /*returned_bool*/,
997    Dwarf_Error* 	/*error*/);
998
999int dwarf_lineendsequence(Dwarf_Line /*line*/,
1000    Dwarf_Bool  *       /*returned_bool*/,
1001    Dwarf_Error*        /*error*/);
1002
1003int dwarf_lineno(Dwarf_Line /*line*/,
1004    Dwarf_Unsigned *    /*returned_lineno*/,
1005    Dwarf_Error* 	/*error*/);
1006
1007int dwarf_line_srcfileno(Dwarf_Line /*line*/,
1008    Dwarf_Unsigned * /*ret_fileno*/,
1009    Dwarf_Error *    /*error*/);
1010
1011int dwarf_lineaddr(Dwarf_Line /*line*/,
1012    Dwarf_Addr *        /*returned_addr*/,
1013    Dwarf_Error* 	/*error*/);
1014
1015int dwarf_lineoff(Dwarf_Line /*line*/,
1016    Dwarf_Signed  *     /*returned_lineoffset*/,
1017    Dwarf_Error* 	/*error*/);
1018
1019int dwarf_linesrc(Dwarf_Line /*line*/,
1020    char   **           /*returned_name*/,
1021    Dwarf_Error* 	/*error*/);
1022
1023int dwarf_lineblock(Dwarf_Line /*line*/,
1024    Dwarf_Bool  *       /*returned_bool*/,
1025    Dwarf_Error* 	/*error*/);
1026
1027/* tertiary interface to line info */
1028/* Unimplemented */
1029int dwarf_pclines(Dwarf_Debug /*dbg*/,
1030    Dwarf_Addr 		/*pc*/,
1031    Dwarf_Line** 	/*linebuf*/,
1032    Dwarf_Signed *      /*linecount*/,
1033    Dwarf_Signed 	/*slide*/,
1034    Dwarf_Error* 	/*error*/);
1035/* end line number operations */
1036
1037/* global name space operations (.debug_pubnames access) */
1038int dwarf_get_globals(Dwarf_Debug /*dbg*/,
1039    Dwarf_Global** 	/*globals*/,
1040    Dwarf_Signed *      /*number_of_globals*/,
1041    Dwarf_Error* 	/*error*/);
1042void dwarf_globals_dealloc(Dwarf_Debug /*dbg*/,
1043    Dwarf_Global* /*globals*/,
1044    Dwarf_Signed /*number_of_globals*/);
1045
1046int dwarf_globname(Dwarf_Global /*glob*/,
1047    char   **           /*returned_name*/,
1048    Dwarf_Error* 	/*error*/);
1049
1050int dwarf_global_die_offset(Dwarf_Global /*global*/,
1051    Dwarf_Off*          /*return_offset*/,
1052    Dwarf_Error * 	/*error*/);
1053
1054int dwarf_get_cu_die_offset_given_cu_header_offset(
1055	Dwarf_Debug     /*dbg*/,
1056	Dwarf_Off       /*in_cu_header_offset*/,
1057        Dwarf_Off *     /*out_cu_die_offset*/,
1058	Dwarf_Error *   /*err*/);
1059#ifdef __sgi /* pragma is sgi MIPS only */
1060#pragma optional dwarf_get_cu_die_offset_given_cu_header_offset
1061#endif
1062
1063int dwarf_global_cu_offset(Dwarf_Global /*global*/,
1064    Dwarf_Off*          /*return_offset*/,
1065    Dwarf_Error* 	/*error*/);
1066
1067int dwarf_global_name_offsets(Dwarf_Global /*global*/,
1068    char   **           /*returned_name*/,
1069    Dwarf_Off* 		/*die_offset*/,
1070    Dwarf_Off* 		/*cu_offset*/,
1071    Dwarf_Error* 	/*error*/);
1072
1073/* Static function name operations.  */
1074int dwarf_get_funcs(Dwarf_Debug	/*dbg*/,
1075    Dwarf_Func**	/*funcs*/,
1076    Dwarf_Signed *      /*number_of_funcs*/,
1077    Dwarf_Error*	/*error*/);
1078void dwarf_funcs_dealloc(Dwarf_Debug /*dbg*/,
1079    Dwarf_Func* /*funcs*/,
1080    Dwarf_Signed /*number_of_funcs*/);
1081
1082int dwarf_funcname(Dwarf_Func /*func*/,
1083    char   **           /*returned_name*/,
1084    Dwarf_Error*	/*error*/);
1085
1086int dwarf_func_die_offset(Dwarf_Func /*func*/,
1087    Dwarf_Off*          /*return_offset*/,
1088    Dwarf_Error*	/*error*/);
1089
1090int dwarf_func_cu_offset(Dwarf_Func /*func*/,
1091    Dwarf_Off*          /*return_offset*/,
1092    Dwarf_Error*	/*error*/);
1093
1094int dwarf_func_name_offsets(Dwarf_Func /*func*/,
1095    char   **           /*returned_name*/,
1096    Dwarf_Off*		/*die_offset*/,
1097    Dwarf_Off*		/*cu_offset*/,
1098    Dwarf_Error*	/*error*/);
1099
1100/* User-defined type name operations, SGI IRIX .debug_typenames section.
1101   Same content as DWARF3 .debug_pubtypes, but defined years before
1102   .debug_pubtypes was defined.   SGI IRIX only. */
1103int dwarf_get_types(Dwarf_Debug	/*dbg*/,
1104    Dwarf_Type**	/*types*/,
1105    Dwarf_Signed *      /*number_of_types*/,
1106    Dwarf_Error*	/*error*/);
1107void dwarf_types_dealloc(Dwarf_Debug /*dbg*/,
1108    Dwarf_Type* /*types*/,
1109    Dwarf_Signed /*number_of_types*/);
1110
1111
1112int dwarf_typename(Dwarf_Type /*type*/,
1113    char   **           /*returned_name*/,
1114    Dwarf_Error*	/*error*/);
1115
1116int dwarf_type_die_offset(Dwarf_Type /*type*/,
1117    Dwarf_Off*          /*return_offset*/,
1118    Dwarf_Error*	/*error*/);
1119
1120int dwarf_type_cu_offset(Dwarf_Type /*type*/,
1121    Dwarf_Off*          /*return_offset*/,
1122    Dwarf_Error*	/*error*/);
1123
1124int dwarf_type_name_offsets(Dwarf_Type	/*type*/,
1125    char   **           /*returned_name*/,
1126    Dwarf_Off*		/*die_offset*/,
1127    Dwarf_Off*		/*cu_offset*/,
1128    Dwarf_Error*	/*error*/);
1129
1130/* User-defined type name operations, DWARF3  .debug_pubtypes section.
1131*/
1132int dwarf_get_pubtypes(Dwarf_Debug	/*dbg*/,
1133    Dwarf_Type**	/*types*/,
1134    Dwarf_Signed *      /*number_of_types*/,
1135    Dwarf_Error*	/*error*/);
1136void dwarf_pubtypes_dealloc(Dwarf_Debug /*dbg*/,
1137    Dwarf_Type* /*pubtypes*/,
1138    Dwarf_Signed /*number_of_pubtypes*/);
1139
1140
1141int dwarf_pubtypename(Dwarf_Type /*type*/,
1142    char   **           /*returned_name*/,
1143    Dwarf_Error*	/*error*/);
1144
1145int dwarf_pubtype_die_offset(Dwarf_Type /*type*/,
1146    Dwarf_Off*          /*return_offset*/,
1147    Dwarf_Error*	/*error*/);
1148
1149int dwarf_pubtype_cu_offset(Dwarf_Type /*type*/,
1150    Dwarf_Off*          /*return_offset*/,
1151    Dwarf_Error*	/*error*/);
1152
1153int dwarf_pubtype_name_offsets(Dwarf_Type	/*type*/,
1154    char   **           /*returned_name*/,
1155    Dwarf_Off*		/*die_offset*/,
1156    Dwarf_Off*		/*cu_offset*/,
1157    Dwarf_Error*	/*error*/);
1158
1159/* File-scope static variable name operations.  */
1160int dwarf_get_vars(Dwarf_Debug	/*dbg*/,
1161    Dwarf_Var**		/*vars*/,
1162    Dwarf_Signed *      /*number_of_vars*/,
1163    Dwarf_Error*	/*error*/);
1164void dwarf_vars_dealloc(Dwarf_Debug /*dbg*/,
1165    Dwarf_Var* /*vars*/,
1166    Dwarf_Signed /*number_of_vars*/);
1167
1168
1169int dwarf_varname(Dwarf_Var /*var*/,
1170    char   **           /*returned_name*/,
1171    Dwarf_Error*	/*error*/);
1172
1173int dwarf_var_die_offset(Dwarf_Var /*var*/,
1174    Dwarf_Off*          /*return_offset*/,
1175    Dwarf_Error*	/*error*/);
1176
1177int dwarf_var_cu_offset(Dwarf_Var /*var*/,
1178    Dwarf_Off*          /*return_offset*/,
1179    Dwarf_Error*	/*error*/);
1180
1181int dwarf_var_name_offsets(Dwarf_Var /*var*/,
1182    char   **           /*returned_name*/,
1183    Dwarf_Off*		/*die_offset*/,
1184    Dwarf_Off*		/*cu_offset*/,
1185    Dwarf_Error*	/*error*/);
1186
1187/* weak name operations.  */
1188int dwarf_get_weaks(Dwarf_Debug	/*dbg*/,
1189    Dwarf_Weak**	/*weaks*/,
1190    Dwarf_Signed *      /*number_of_weaks*/,
1191    Dwarf_Error*	/*error*/);
1192void dwarf_weaks_dealloc(Dwarf_Debug /*dbg*/,
1193    Dwarf_Weak* /*weaks*/,
1194    Dwarf_Signed /*number_of_weaks*/);
1195
1196
1197int dwarf_weakname(Dwarf_Weak /*weak*/,
1198    char   **           /*returned_name*/,
1199    Dwarf_Error*	/*error*/);
1200
1201int dwarf_weak_die_offset(Dwarf_Weak /*weak*/,
1202    Dwarf_Off*          /*return_offset*/,
1203    Dwarf_Error*	/*error*/);
1204
1205int dwarf_weak_cu_offset(Dwarf_Weak /*weak*/,
1206    Dwarf_Off*          /*return_offset*/,
1207    Dwarf_Error*	/*error*/);
1208
1209int dwarf_weak_name_offsets(Dwarf_Weak	/*weak*/,
1210    char   **           /*returned_name*/,
1211    Dwarf_Off*		/*die_offset*/,
1212    Dwarf_Off*		/*cu_offset*/,
1213    Dwarf_Error*	/*error*/);
1214
1215/* location list section operation.  (.debug_loc access) */
1216/* Unimplemented. */
1217int dwarf_get_loclist_entry(Dwarf_Debug /*dbg*/,
1218    Dwarf_Unsigned 	/*offset*/,
1219    Dwarf_Addr* 	/*hipc*/,
1220    Dwarf_Addr* 	/*lopc*/,
1221    Dwarf_Ptr* 		/*data*/,
1222    Dwarf_Unsigned* 	/*entry_len*/,
1223    Dwarf_Unsigned* 	/*next_entry*/,
1224    Dwarf_Error* 	/*error*/);
1225
1226/* abbreviation section operations */
1227int dwarf_get_abbrev(Dwarf_Debug /*dbg*/,
1228    Dwarf_Unsigned 	/*offset*/,
1229    Dwarf_Abbrev  *     /*returned_abbrev*/,
1230    Dwarf_Unsigned* 	/*length*/,
1231    Dwarf_Unsigned* 	/*attr_count*/,
1232    Dwarf_Error* 	/*error*/);
1233
1234int dwarf_get_abbrev_tag(Dwarf_Abbrev /*abbrev*/,
1235    Dwarf_Half*        /*return_tag_number*/,
1236    Dwarf_Error* 	/*error*/);
1237int dwarf_get_abbrev_code(Dwarf_Abbrev /*abbrev*/,
1238    Dwarf_Unsigned*        /*return_code_number*/,
1239    Dwarf_Error* 	/*error*/);
1240
1241int dwarf_get_abbrev_children_flag(Dwarf_Abbrev /*abbrev*/,
1242    Dwarf_Signed*        /*return_flag*/,
1243    Dwarf_Error* 	/*error*/);
1244
1245int dwarf_get_abbrev_entry(Dwarf_Abbrev /*abbrev*/,
1246    Dwarf_Signed  	/*index*/,
1247    Dwarf_Half  *       /*returned_attr_num*/,
1248    Dwarf_Signed* 	/*form*/,
1249    Dwarf_Off*    	/*offset*/,
1250    Dwarf_Error*  	/*error*/);
1251
1252/* consumer string section operation */
1253int dwarf_get_str(Dwarf_Debug /*dbg*/,
1254    Dwarf_Off    	/*offset*/,
1255    char** 		/*string*/,
1256    Dwarf_Signed *      /*strlen_of_string*/,
1257    Dwarf_Error*  	/*error*/);
1258
1259/* Consumer op on  gnu .eh_frame info */
1260int dwarf_get_fde_list_eh(
1261    Dwarf_Debug        /*dbg*/,
1262    Dwarf_Cie       ** /*cie_data*/,
1263    Dwarf_Signed    *  /*cie_element_count*/,
1264    Dwarf_Fde       ** /*fde_data*/,
1265    Dwarf_Signed    *  /*fde_element_count*/,
1266    Dwarf_Error     *  /*error*/);
1267
1268
1269/* consumer operations on frame info: .debug_frame */
1270int dwarf_get_fde_list(Dwarf_Debug /*dbg*/,
1271    Dwarf_Cie**   	/*cie_data*/,
1272    Dwarf_Signed* 	/*cie_element_count*/,
1273    Dwarf_Fde**   	/*fde_data*/,
1274    Dwarf_Signed* 	/*fde_element_count*/,
1275    Dwarf_Error* 	/*error*/);
1276
1277/* Release storage gotten by dwarf_get_fde_list_eh() or
1278   dwarf_get_fde_list() */
1279void dwarf_fde_cie_list_dealloc(Dwarf_Debug dbg,
1280        Dwarf_Cie *cie_data,
1281        Dwarf_Signed cie_element_count,
1282        Dwarf_Fde *fde_data,
1283        Dwarf_Signed fde_element_count);
1284
1285
1286
1287int dwarf_get_fde_range(Dwarf_Fde /*fde*/,
1288    Dwarf_Addr* 	/*low_pc*/,
1289    Dwarf_Unsigned* 	/*func_length*/,
1290    Dwarf_Ptr*    	/*fde_bytes*/,
1291    Dwarf_Unsigned* 	/*fde_byte_length*/,
1292    Dwarf_Off*    	/*cie_offset*/,
1293    Dwarf_Signed*  	/*cie_index*/,
1294    Dwarf_Off*   	/*fde_offset*/,
1295    Dwarf_Error* 	/*error*/);
1296
1297/*  Useful for IRIX only:  see dwarf_get_cie_augmentation_data()
1298       dwarf_get_fde_augmentation_data() for GNU .eh_frame. */
1299int dwarf_get_fde_exception_info(Dwarf_Fde /*fde*/,
1300    Dwarf_Signed*	/* offset_into_exception_tables */,
1301    Dwarf_Error*        /*error*/);
1302
1303
1304int dwarf_get_cie_of_fde(Dwarf_Fde /*fde*/,
1305    Dwarf_Cie *         /*cie_returned*/,
1306    Dwarf_Error*        /*error*/);
1307
1308int dwarf_get_cie_info(Dwarf_Cie /*cie*/,
1309    Dwarf_Unsigned *    /*bytes_in_cie*/,
1310    Dwarf_Small*    	/*version*/,
1311    char        **      /*augmenter*/,
1312    Dwarf_Unsigned* 	/*code_alignment_factor*/,
1313    Dwarf_Signed* 	/*data_alignment_factor*/,
1314    Dwarf_Half*     	/*return_address_register_rule*/,
1315    Dwarf_Ptr*     	/*initial_instructions*/,
1316    Dwarf_Unsigned*  	/*initial_instructions_length*/,
1317    Dwarf_Error* 	/*error*/);
1318
1319int dwarf_get_fde_instr_bytes(Dwarf_Fde /*fde*/,
1320    Dwarf_Ptr * /*outinstrs*/, Dwarf_Unsigned * /*outlen*/,
1321    Dwarf_Error * /*error*/);
1322
1323int dwarf_get_fde_info_for_all_regs(Dwarf_Fde /*fde*/,
1324    Dwarf_Addr          /*pc_requested*/,
1325    Dwarf_Regtable*     /*reg_table*/,
1326    Dwarf_Addr*         /*row_pc*/,
1327    Dwarf_Error*        /*error*/);
1328
1329int dwarf_get_fde_info_for_all_regs3(Dwarf_Fde /*fde*/,
1330    Dwarf_Addr          /*pc_requested*/,
1331    Dwarf_Regtable3*     /*reg_table*/,
1332    Dwarf_Addr*         /*row_pc*/,
1333    Dwarf_Error*        /*error*/);
1334
1335/* In this older interface DW_FRAME_CFA_COL is a meaningful
1336    column (which does not work well with DWARF3 or
1337    non-MIPS architectures). */
1338int dwarf_get_fde_info_for_reg(Dwarf_Fde /*fde*/,
1339    Dwarf_Half    	/*table_column*/,
1340    Dwarf_Addr    	/*pc_requested*/,
1341    Dwarf_Signed*       /*offset_relevant*/,
1342    Dwarf_Signed* 	/*register*/,
1343    Dwarf_Signed* 	/*offset*/,
1344    Dwarf_Addr* 	/*row_pc*/,
1345    Dwarf_Error* 	/*error*/);
1346
1347/* See discussion of dw_value_type, libdwarf.h.
1348   Use of DW_FRAME_CFA_COL is not meaningful in this interface.
1349   Nor is DDW_FRAME_CFA_COL3.
1350   See dwarf_get_fde_info_for_cfa_reg3().
1351*/
1352int dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
1353    Dwarf_Half    	/*table_column*/,
1354    Dwarf_Addr    	/*pc_requested*/,
1355    Dwarf_Small  *  	/*value_type*/,
1356    Dwarf_Signed *      /*offset_relevant*/,
1357    Dwarf_Signed* 	/*register*/,
1358    Dwarf_Signed* 	/*offset_or_block_len*/,
1359    Dwarf_Ptr   *       /*block_ptr */,
1360    Dwarf_Addr* 	/*row_pc_out*/,
1361    Dwarf_Error* 	/*error*/);
1362
1363/* Use this to get the cfa. */
1364int dwarf_get_fde_info_for_cfa_reg3(Dwarf_Fde /*fde*/,
1365    Dwarf_Addr    	/*pc_requested*/,
1366    Dwarf_Small  *  	/*value_type*/,
1367    Dwarf_Signed *      /*offset_relevant*/,
1368    Dwarf_Signed* 	/*register*/,
1369    Dwarf_Signed* 	/*offset_or_block_len*/,
1370    Dwarf_Ptr   *       /*block_ptr */,
1371    Dwarf_Addr* 	/*row_pc_out*/,
1372    Dwarf_Error* 	/*error*/);
1373
1374int dwarf_get_fde_for_die(Dwarf_Debug /*dbg*/,
1375    Dwarf_Die 		/*subr_die */,
1376    Dwarf_Fde  *        /*returned_fde*/,
1377    Dwarf_Error*	/*error*/);
1378
1379int dwarf_get_fde_n(Dwarf_Fde* /*fde_data*/,
1380    Dwarf_Unsigned 	/*fde_index*/,
1381    Dwarf_Fde  *        /*returned_fde*/,
1382    Dwarf_Error*  	/*error*/);
1383
1384int dwarf_get_fde_at_pc(Dwarf_Fde* /*fde_data*/,
1385    Dwarf_Addr 		/*pc_of_interest*/,
1386    Dwarf_Fde  *        /*returned_fde*/,
1387    Dwarf_Addr* 	/*lopc*/,
1388    Dwarf_Addr* 	/*hipc*/,
1389    Dwarf_Error* 	/*error*/);
1390
1391/* GNU .eh_frame augmentation information, raw form, see
1392   Linux Standard Base Core Specification version 3.0 . */
1393int dwarf_get_cie_augmentation_data(Dwarf_Cie /* cie*/,
1394    Dwarf_Small **         /* augdata */,
1395    Dwarf_Unsigned *    /* augdata_len */,
1396    Dwarf_Error*        /*error*/);
1397/* GNU .eh_frame augmentation information, raw form, see
1398   Linux Standard Base Core Specification version 3.0 . */
1399int dwarf_get_fde_augmentation_data(Dwarf_Fde /* fde*/,
1400    Dwarf_Small **         /* augdata */,
1401    Dwarf_Unsigned *    /* augdata_len */,
1402    Dwarf_Error*        /*error*/);
1403
1404int dwarf_expand_frame_instructions(Dwarf_Debug /*dbg*/,
1405    Dwarf_Ptr 		/*instruction*/,
1406    Dwarf_Unsigned  	/*i_length*/,
1407    Dwarf_Frame_Op** 	/*returned_op_list*/,
1408    Dwarf_Signed*       /*op_count*/,
1409    Dwarf_Error* 	/*error*/);
1410
1411/* Operations on .debug_aranges. */
1412int dwarf_get_aranges(Dwarf_Debug /*dbg*/,
1413    Dwarf_Arange** 	/*aranges*/,
1414    Dwarf_Signed *      /*arange_count*/,
1415    Dwarf_Error* 	/*error*/);
1416
1417
1418
1419int dwarf_get_arange(
1420    Dwarf_Arange* 	/*aranges*/,
1421    Dwarf_Unsigned 	/*arange_count*/,
1422    Dwarf_Addr 		/*address*/,
1423    Dwarf_Arange *      /*returned_arange*/,
1424    Dwarf_Error* 	/*error*/);
1425
1426int dwarf_get_cu_die_offset(
1427    Dwarf_Arange 	/*arange*/,
1428    Dwarf_Off*          /*return_offset*/,
1429    Dwarf_Error* 	/*error*/);
1430
1431int dwarf_get_arange_cu_header_offset(
1432    Dwarf_Arange 	/*arange*/,
1433    Dwarf_Off*          /*return_cu_header_offset*/,
1434    Dwarf_Error* 	/*error*/);
1435#ifdef __sgi /* pragma is sgi MIPS only */
1436#pragma optional dwarf_get_arange_cu_header_offset
1437#endif
1438
1439int dwarf_get_arange_info(
1440    Dwarf_Arange 	/*arange*/,
1441    Dwarf_Addr* 	/*start*/,
1442    Dwarf_Unsigned* 	/*length*/,
1443    Dwarf_Off* 		/*cu_die_offset*/,
1444    Dwarf_Error* 	/*error*/);
1445
1446
1447/* consumer .debug_macinfo information interface.
1448*/
1449struct Dwarf_Macro_Details_s {
1450  Dwarf_Off    dmd_offset; /* offset, in the section,
1451                              of this macro info */
1452  Dwarf_Small  dmd_type;   /* the type, DW_MACINFO_define etc*/
1453  Dwarf_Signed dmd_lineno; /* the source line number where
1454                              applicable and vend_def # if
1455                              vendor_extension op
1456                           */
1457
1458  Dwarf_Signed dmd_fileindex;/* the source file index:
1459                              applies to define undef start_file
1460                             */
1461  char *       dmd_macro;  /* macro name (with value for defineop)
1462                              string from vendor ext
1463                           */
1464};
1465
1466/* _dwarf_print_lines is for use by dwarfdump: it prints
1467   line info to stdout.
1468*/
1469int _dwarf_print_lines(Dwarf_Die cu_die,Dwarf_Error * /*error*/);
1470
1471/* _dwarf_ld_sort_lines is for use solely by ld for
1472   rearranging lines in .debug_line in a .o created with a text
1473   section per function.
1474		-OPT:procedure_reorder=ON
1475   where ld-cord (cord(1)ing by ld,
1476   not by cord(1)) may have changed the function order.
1477*/
1478int _dwarf_ld_sort_lines(
1479        void * orig_buffer,
1480        unsigned long   buffer_len,
1481        int is_64_bit,
1482        int *any_change,
1483        int * err_code);
1484
1485/* Used by dwarfdump -v to print offsets, for debugging
1486   dwarf info
1487*/
1488int _dwarf_fde_section_offset(Dwarf_Debug dbg,Dwarf_Fde in_fde,
1489        Dwarf_Off *fde_off, Dwarf_Off *cie_off,
1490        Dwarf_Error *err);
1491
1492/* Used by dwarfdump -v to print offsets, for debugging
1493   dwarf info
1494*/
1495int _dwarf_cie_section_offset(Dwarf_Debug dbg,Dwarf_Cie in_cie,
1496        Dwarf_Off *cie_off,
1497        Dwarf_Error *err);
1498
1499
1500
1501
1502typedef struct Dwarf_Macro_Details_s Dwarf_Macro_Details;
1503
1504int dwarf_get_macro(Dwarf_Debug /*dbg*/,
1505    char *        /*requested_macro_name*/,
1506    Dwarf_Addr    /*pc_of_request*/,
1507    char **       /*returned_macro_value*/,
1508    Dwarf_Error * /*error*/);
1509
1510int dwarf_get_all_defined_macros(Dwarf_Debug /*dbg*/,
1511    Dwarf_Addr     /*pc_of_request*/,
1512    Dwarf_Signed * /*returned_count*/,
1513    char ***       /*returned_pointers_to_macros*/,
1514    Dwarf_Error *  /*error*/);
1515
1516char *dwarf_find_macro_value_start(char * /*macro_string*/);
1517
1518int dwarf_get_macro_details(Dwarf_Debug /*dbg*/,
1519    Dwarf_Off              /*macro_offset*/,
1520    Dwarf_Unsigned	   /*maximum_count*/,
1521    Dwarf_Signed         * /*entry_count*/,
1522    Dwarf_Macro_Details ** /*details*/,
1523    Dwarf_Error *          /*err*/);
1524
1525
1526int dwarf_get_address_size(Dwarf_Debug /*dbg*/,
1527        Dwarf_Half  * /*addr_size*/,
1528        Dwarf_Error * /*error*/);
1529
1530/* utility operations */
1531Dwarf_Unsigned dwarf_errno(Dwarf_Error 	/*error*/);
1532
1533char* dwarf_errmsg(Dwarf_Error	/*error*/);
1534
1535/* stringcheck zero is default and means do all
1536** string length validity checks.
1537** Call with parameter value 1 to turn off many such checks (and
1538** increase performance).
1539** Call with zero for safest running.
1540** Actual value saved and returned is only 8 bits! Upper bits
1541** ignored by libdwarf (and zero on return).
1542** Returns previous value.
1543*/
1544int dwarf_set_stringcheck(int /*stringcheck*/);
1545
1546/* Unimplemented */
1547Dwarf_Handler dwarf_seterrhand(Dwarf_Debug /*dbg*/, Dwarf_Handler /*errhand*/);
1548
1549/* Unimplemented */
1550Dwarf_Ptr dwarf_seterrarg(Dwarf_Debug /*dbg*/, Dwarf_Ptr /*errarg*/);
1551
1552void dwarf_dealloc(Dwarf_Debug /*dbg*/, void* /*space*/,
1553    Dwarf_Unsigned /*type*/);
1554
1555/* DWARF Producer Interface */
1556
1557typedef int (*Dwarf_Callback_Func)(
1558    char* /*name*/,
1559    int 		/*size*/,
1560    Dwarf_Unsigned 	/*type*/,
1561    Dwarf_Unsigned 	/*flags*/,
1562    Dwarf_Unsigned 	/*link*/,
1563    Dwarf_Unsigned 	/*info*/,
1564    int* 		/*sect name index*/,
1565    int* 		/*error*/);
1566
1567Dwarf_P_Debug dwarf_producer_init(
1568    Dwarf_Unsigned      /*creation_flags*/,
1569    Dwarf_Callback_Func	/*func*/,
1570    Dwarf_Handler 	/*errhand*/,
1571    Dwarf_Ptr 		/*errarg*/,
1572    Dwarf_Error* 	/*error*/);
1573
1574typedef int (*Dwarf_Callback_Func_b)(
1575    char* 		/*name*/,
1576    int                 /*size*/,
1577    Dwarf_Unsigned      /*type*/,
1578    Dwarf_Unsigned      /*flags*/,
1579    Dwarf_Unsigned      /*link*/,
1580    Dwarf_Unsigned      /*info*/,
1581    Dwarf_Unsigned*     /*sect_name_index*/,
1582    int*                /*error*/);
1583
1584
1585Dwarf_P_Debug dwarf_producer_init_b(
1586    Dwarf_Unsigned        /*flags*/,
1587    Dwarf_Callback_Func_b /*func*/,
1588    Dwarf_Handler         /*errhand*/,
1589    Dwarf_Ptr             /*errarg*/,
1590    Dwarf_Error *         /*error*/);
1591
1592
1593Dwarf_Signed dwarf_transform_to_disk_form(Dwarf_P_Debug /*dbg*/,
1594    Dwarf_Error* 	/*error*/);
1595
1596Dwarf_Ptr dwarf_get_section_bytes(Dwarf_P_Debug /*dbg*/,
1597    Dwarf_Signed 	/*dwarf_section*/,
1598    Dwarf_Signed* 	/*elf_section_index*/,
1599    Dwarf_Unsigned* 	/*length*/,
1600    Dwarf_Error* 	/*error*/);
1601
1602int  dwarf_get_relocation_info_count(
1603        Dwarf_P_Debug    /*dbg*/,
1604        Dwarf_Unsigned * /*count_of_relocation_sections*/,
1605	int *            /*drd_buffer_version*/,
1606        Dwarf_Error*     /*error*/);
1607
1608int dwarf_get_relocation_info(
1609        Dwarf_P_Debug           /*dbg*/,
1610        Dwarf_Signed          * /*elf_section_index*/,
1611        Dwarf_Signed          * /*elf_section_index_link*/,
1612        Dwarf_Unsigned        * /*relocation_buffer_count*/,
1613        Dwarf_Relocation_Data * /*reldata_buffer*/,
1614        Dwarf_Error*            /*error*/);
1615
1616/* v1:  no drd_length field, enum explicit */
1617/* v2:  has the drd_length field, enum value in uchar member */
1618#define DWARF_DRD_BUFFER_VERSION 2
1619
1620void dwarf_reset_section_bytes(Dwarf_P_Debug /*dbg*/);
1621
1622Dwarf_Unsigned dwarf_producer_finish(Dwarf_P_Debug /*dbg*/,
1623    Dwarf_Error* /*error*/);
1624
1625/* Producer attribute addition functions. */
1626Dwarf_P_Attribute dwarf_add_AT_targ_address(Dwarf_P_Debug /*dbg*/,
1627    Dwarf_P_Die 	/*ownerdie*/,
1628    Dwarf_Half 		/*attr*/,
1629    Dwarf_Unsigned 	/*pc_value*/,
1630    Dwarf_Signed 	/*sym_index*/,
1631    Dwarf_Error* 	/*error*/);
1632
1633Dwarf_P_Attribute dwarf_add_AT_targ_address_b(Dwarf_P_Debug /*dbg*/,
1634    Dwarf_P_Die 	/*ownerdie*/,
1635    Dwarf_Half 		/*attr*/,
1636    Dwarf_Unsigned 	/*pc_value*/,
1637    Dwarf_Unsigned 	/*sym_index*/,
1638    Dwarf_Error* 	/*error*/);
1639
1640Dwarf_P_Attribute dwarf_add_AT_unsigned_const(Dwarf_P_Debug /*dbg*/,
1641    Dwarf_P_Die 	/*ownerdie*/,
1642    Dwarf_Half 		/*attr*/,
1643    Dwarf_Unsigned 	/*value*/,
1644    Dwarf_Error* 	/*error*/);
1645
1646Dwarf_P_Attribute dwarf_add_AT_signed_const(Dwarf_P_Debug /*dbg*/,
1647    Dwarf_P_Die 	/*ownerdie*/,
1648    Dwarf_Half 		/*attr*/,
1649    Dwarf_Signed 	/*value*/,
1650    Dwarf_Error* 	/*error*/);
1651
1652Dwarf_P_Attribute dwarf_add_AT_reference(Dwarf_P_Debug /*dbg*/,
1653    Dwarf_P_Die 	/*ownerdie*/,
1654    Dwarf_Half 		/*attr*/,
1655    Dwarf_P_Die 	/*otherdie*/,
1656    Dwarf_Error* 	/*error*/);
1657
1658Dwarf_P_Attribute dwarf_add_AT_const_value_string(Dwarf_P_Die /*ownerdie*/,
1659    char* 		/*string_value*/,
1660    Dwarf_Error* 	/*error*/);
1661
1662Dwarf_P_Attribute dwarf_add_AT_location_expr(Dwarf_P_Debug /*dbg*/,
1663    Dwarf_P_Die 	/*ownerdie*/,
1664    Dwarf_Half 		/*attr*/,
1665    Dwarf_P_Expr 	/*loc_expr*/,
1666    Dwarf_Error* 	/*error*/);
1667
1668Dwarf_P_Attribute dwarf_add_AT_string(Dwarf_P_Debug /*dbg*/,
1669    Dwarf_P_Die 	/*ownerdie*/,
1670    Dwarf_Half 		/*attr*/,
1671    char* 		/*string*/,
1672    Dwarf_Error* 	/*error*/);
1673
1674Dwarf_P_Attribute dwarf_add_AT_flag(Dwarf_P_Debug /*dbg*/,
1675    Dwarf_P_Die 	/*ownerdie*/,
1676    Dwarf_Half 		/*attr*/,
1677    Dwarf_Small 	/*flag*/,
1678    Dwarf_Error* 	/*error*/);
1679
1680Dwarf_P_Attribute dwarf_add_AT_producer(Dwarf_P_Die /*ownerdie*/,
1681    char* 		/*producer_string*/,
1682    Dwarf_Error* 	/*error*/);
1683
1684Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
1685    Dwarf_Signed 	/*signed_value*/,
1686    Dwarf_Error* 	/*error*/);
1687
1688Dwarf_P_Attribute dwarf_add_AT_const_value_unsignedint(
1689    Dwarf_P_Die         /*ownerdie*/,
1690    Dwarf_Unsigned 	/*unsigned_value*/,
1691    Dwarf_Error* 	/*error*/);
1692
1693Dwarf_P_Attribute dwarf_add_AT_comp_dir(Dwarf_P_Die /*ownerdie*/,
1694    char* 		/*current_working_directory*/,
1695    Dwarf_Error* 	/*error*/);
1696
1697Dwarf_P_Attribute dwarf_add_AT_name(Dwarf_P_Die	/*die*/,
1698    char* 		/*name*/,
1699    Dwarf_Error* 	/*error*/);
1700
1701/* Producer line creation functions (.debug_line) */
1702Dwarf_Unsigned dwarf_add_directory_decl(Dwarf_P_Debug /*dbg*/,
1703    char* 		/*name*/,
1704    Dwarf_Error*	/*error*/);
1705
1706Dwarf_Unsigned dwarf_add_file_decl(Dwarf_P_Debug /*dbg*/,
1707    char* 		/*name*/,
1708    Dwarf_Unsigned 	/*dir_index*/,
1709    Dwarf_Unsigned 	/*time_last_modified*/,
1710    Dwarf_Unsigned 	/*length*/,
1711    Dwarf_Error*	/*error*/);
1712
1713Dwarf_Unsigned dwarf_add_line_entry(Dwarf_P_Debug /*dbg*/,
1714    Dwarf_Unsigned 	/*file_index*/,
1715    Dwarf_Addr 		/*code_address*/,
1716    Dwarf_Unsigned 	/*lineno*/,
1717    Dwarf_Signed 	/*column_number*/,
1718    Dwarf_Bool 		/*is_source_stmt_begin*/,
1719    Dwarf_Bool 		/*is_basic_block_begin*/,
1720    Dwarf_Error* 	/*error*/);
1721
1722Dwarf_Unsigned dwarf_lne_set_address(Dwarf_P_Debug /*dbg*/,
1723    Dwarf_Unsigned 	/*offset*/,
1724    Dwarf_Unsigned 	/*symbol_index*/,
1725    Dwarf_Error* 	/*error*/);
1726
1727Dwarf_Unsigned dwarf_lne_end_sequence(Dwarf_P_Debug /*dbg*/,
1728    Dwarf_Addr		/*end_address*/,
1729    Dwarf_Error* 	/*error*/);
1730
1731/* Producer .debug_frame functions */
1732Dwarf_Unsigned dwarf_add_frame_cie(Dwarf_P_Debug /*dbg*/,
1733    char* 		/*augmenter*/,
1734    Dwarf_Small 	/*code_alignent_factor*/,
1735    Dwarf_Small 	/*data_alignment_factor*/,
1736    Dwarf_Small 	/*return_address_reg*/,
1737    Dwarf_Ptr 		/*initialization_bytes*/,
1738    Dwarf_Unsigned 	/*init_byte_len*/,
1739    Dwarf_Error* 	/*error*/);
1740
1741Dwarf_Unsigned dwarf_add_frame_fde(
1742    Dwarf_P_Debug 	/*dbg*/,
1743    Dwarf_P_Fde 	/*fde*/,
1744    Dwarf_P_Die 	/*corresponding subprogram die*/,
1745    Dwarf_Unsigned 	/*cie_to_use*/,
1746    Dwarf_Unsigned  	/*virt_addr_of_described_code*/,
1747    Dwarf_Unsigned  	/*length_of_code*/,
1748    Dwarf_Unsigned 	/*symbol_index*/,
1749    Dwarf_Error* 	/*error*/);
1750
1751Dwarf_Unsigned dwarf_add_frame_fde_b(
1752        Dwarf_P_Debug  /*dbg*/,
1753        Dwarf_P_Fde    /*fde*/,
1754        Dwarf_P_Die    /*die*/,
1755        Dwarf_Unsigned /*cie*/,
1756        Dwarf_Addr     /*virt_addr*/,
1757        Dwarf_Unsigned /*code_len*/,
1758        Dwarf_Unsigned /*sym_idx*/,
1759        Dwarf_Unsigned /*sym_idx_of_end*/,
1760        Dwarf_Addr     /*offset_from_end_sym*/,
1761        Dwarf_Error*   /*error*/);
1762
1763Dwarf_Unsigned dwarf_add_frame_info_b(
1764    Dwarf_P_Debug dbg   /*dbg*/,
1765    Dwarf_P_Fde 	/*fde*/,
1766    Dwarf_P_Die 	/*die*/,
1767    Dwarf_Unsigned 	/*cie*/,
1768    Dwarf_Addr 	        /*virt_addr*/,
1769    Dwarf_Unsigned 	/*code_len*/,
1770    Dwarf_Unsigned 	/*symidx*/,
1771    Dwarf_Unsigned      /* end_symbol */,
1772    Dwarf_Addr          /* offset_from_end_symbol */,
1773    Dwarf_Signed   	/*offset_into_exception_tables*/,
1774    Dwarf_Unsigned 	/*exception_table_symbol*/,
1775    Dwarf_Error*	/*error*/);
1776
1777Dwarf_Unsigned dwarf_add_frame_info(
1778    Dwarf_P_Debug dbg   /*dbg*/,
1779    Dwarf_P_Fde 	/*fde*/,
1780    Dwarf_P_Die 	/*die*/,
1781    Dwarf_Unsigned 	/*cie*/,
1782    Dwarf_Addr 	        /*virt_addr*/,
1783    Dwarf_Unsigned 	/*code_len*/,
1784    Dwarf_Unsigned 	/*symidx*/,
1785    Dwarf_Signed   	/*offset_into_exception_tables*/,
1786    Dwarf_Unsigned 	/*exception_table_symbol*/,
1787    Dwarf_Error*	/*error*/);
1788
1789Dwarf_P_Fde dwarf_add_fde_inst(
1790    Dwarf_P_Fde         /*fde*/,
1791    Dwarf_Small 	/*op*/,
1792    Dwarf_Unsigned 	/*val1*/,
1793    Dwarf_Unsigned 	/*val2*/,
1794    Dwarf_Error* 	/*error*/);
1795
1796Dwarf_P_Fde dwarf_new_fde(Dwarf_P_Debug	/*dbg*/, Dwarf_Error* /*error*/);
1797
1798Dwarf_P_Fde dwarf_fde_cfa_offset(
1799    Dwarf_P_Fde         /*fde*/,
1800    Dwarf_Unsigned  	/*register_number*/,
1801    Dwarf_Signed    	/*offset*/,
1802    Dwarf_Error* 	/*error*/);
1803
1804/* die creation & addition routines */
1805Dwarf_P_Die dwarf_new_die(
1806    Dwarf_P_Debug	/*dbg*/,
1807    Dwarf_Tag 		/*tag*/,
1808    Dwarf_P_Die 	/*parent*/,
1809    Dwarf_P_Die 	/*child*/,
1810    Dwarf_P_Die 	/*left */,
1811    Dwarf_P_Die 	/*right*/,
1812    Dwarf_Error*	/*error*/);
1813
1814Dwarf_Unsigned dwarf_add_die_to_debug(
1815    Dwarf_P_Debug       /*dbg*/,
1816    Dwarf_P_Die		/*die*/,
1817    Dwarf_Error*	/*error*/);
1818
1819Dwarf_P_Die dwarf_die_link(
1820    Dwarf_P_Die         /*die*/,
1821    Dwarf_P_Die 	/*parent*/,
1822    Dwarf_P_Die 	/*child*/,
1823    Dwarf_P_Die		/*left*/,
1824    Dwarf_P_Die		/*right*/,
1825    Dwarf_Error* 	/*error*/);
1826
1827/* Operations to create location expressions. */
1828Dwarf_P_Expr dwarf_new_expr(Dwarf_P_Debug /*dbg*/, Dwarf_Error* /*error*/);
1829
1830Dwarf_Unsigned dwarf_add_expr_gen(
1831    Dwarf_P_Expr        /*expr*/,
1832    Dwarf_Small 	/*opcode*/,
1833    Dwarf_Unsigned 	/*val1*/,
1834    Dwarf_Unsigned 	/*val2*/,
1835    Dwarf_Error* 	/*error*/);
1836
1837Dwarf_Unsigned dwarf_add_expr_addr(
1838    Dwarf_P_Expr        /*expr*/,
1839    Dwarf_Unsigned 	/*addr*/,
1840    Dwarf_Signed 	/*sym_index*/,
1841    Dwarf_Error* 	/*error*/);
1842
1843Dwarf_Unsigned dwarf_add_expr_addr_b(
1844    Dwarf_P_Expr        /*expr*/,
1845    Dwarf_Unsigned      /*addr*/,
1846    Dwarf_Unsigned      /*sym_index*/,
1847    Dwarf_Error*        /*error*/);
1848
1849Dwarf_Unsigned dwarf_expr_current_offset(
1850    Dwarf_P_Expr /*expr*/,
1851    Dwarf_Error* /*error*/);
1852
1853Dwarf_Addr dwarf_expr_into_block(
1854    Dwarf_P_Expr        /*expr*/,
1855    Dwarf_Unsigned* 	/*length*/,
1856    Dwarf_Error* 	/*error*/);
1857
1858Dwarf_Unsigned dwarf_add_arange(Dwarf_P_Debug /*dbg*/,
1859    Dwarf_Addr 		/*begin_address*/,
1860    Dwarf_Unsigned 	/*length*/,
1861    Dwarf_Signed 	/*symbol_index*/,
1862    Dwarf_Error* 	/*error*/);
1863
1864Dwarf_Unsigned dwarf_add_arange_b(
1865        Dwarf_P_Debug  /*dbg*/,
1866        Dwarf_Addr     /*begin_address*/,
1867        Dwarf_Unsigned /*length*/,
1868        Dwarf_Unsigned /*symbol_index*/,
1869        Dwarf_Unsigned /*end_symbol_index*/,
1870        Dwarf_Addr     /*offset_from_end_symbol*/,
1871        Dwarf_Error *  /*error*/);
1872
1873Dwarf_Unsigned dwarf_add_pubname(
1874    Dwarf_P_Debug       /*dbg*/,
1875    Dwarf_P_Die 	/*die*/,
1876    char* 		/*pubname_name*/,
1877    Dwarf_Error* 	/*error*/);
1878
1879Dwarf_Unsigned dwarf_add_funcname(
1880    Dwarf_P_Debug       /*dbg*/,
1881    Dwarf_P_Die 	/*die*/,
1882    char* 		/*func_name*/,
1883    Dwarf_Error* 	/*error*/);
1884
1885Dwarf_Unsigned dwarf_add_typename(
1886    Dwarf_P_Debug       /*dbg*/,
1887    Dwarf_P_Die 	/*die*/,
1888    char* 		/*type_name*/,
1889    Dwarf_Error* 	/*error*/);
1890
1891Dwarf_Unsigned dwarf_add_varname(
1892    Dwarf_P_Debug       /*dbg*/,
1893    Dwarf_P_Die 	/*die*/,
1894    char* 		/*var_name*/,
1895    Dwarf_Error* 	/*error*/);
1896
1897Dwarf_Unsigned dwarf_add_weakname(
1898    Dwarf_P_Debug       /*dbg*/,
1899    Dwarf_P_Die 	/*die*/,
1900    char* 		/*weak_name*/,
1901    Dwarf_Error* 	/*error*/);
1902
1903/* .debug_macinfo producer functions
1904   Functions must be called in right order: the section is output
1905   In the order these are presented.
1906*/
1907int dwarf_def_macro(Dwarf_P_Debug /*dbg*/,
1908    Dwarf_Unsigned  /*line*/,
1909    char *          /*macname, with (arglist), no space before (*/,
1910    char *	    /*macvalue*/,
1911    Dwarf_Error*    /*error*/);
1912
1913int dwarf_undef_macro(Dwarf_P_Debug /*dbg*/,
1914    Dwarf_Unsigned  /*line*/,
1915    char *          /*macname, no arglist, of course*/,
1916    Dwarf_Error*    /*error*/);
1917
1918int dwarf_start_macro_file(Dwarf_P_Debug /*dbg*/,
1919    Dwarf_Unsigned /*fileindex*/,
1920    Dwarf_Unsigned /*linenumber*/,
1921    Dwarf_Error*   /*error*/);
1922
1923int dwarf_end_macro_file(Dwarf_P_Debug /*dbg*/,
1924    Dwarf_Error*   /*error*/);
1925
1926int dwarf_vendor_ext(Dwarf_P_Debug /*dbg*/,
1927    Dwarf_Unsigned /*constant*/,
1928    char *         /*string*/,
1929    Dwarf_Error*   /*error*/);
1930
1931/* end macinfo producer functions */
1932
1933
1934void dwarf_p_dealloc(void* /*space*/, Dwarf_Unsigned /*type*/);
1935
1936int dwarf_attr_offset(Dwarf_Die /*die*/,
1937    Dwarf_Attribute /*attr of above die*/,
1938    Dwarf_Off     * /*returns offset thru this ptr */,
1939    Dwarf_Error   * /*error*/);
1940
1941/* This is a hack so clients can verify offsets.
1942   Added April 2005 so that debugger can detect broken offsets
1943   (which happened in an IRIX executable larger than 2GB
1944    with MIPSpro 7.3.1.3 toolchain.).
1945*/
1946int
1947dwarf_get_section_max_offsets(Dwarf_Debug /*dbg*/,
1948    Dwarf_Unsigned * /*debug_info_size*/,
1949    Dwarf_Unsigned * /*debug_abbrev_size*/,
1950    Dwarf_Unsigned * /*debug_line_size*/,
1951    Dwarf_Unsigned * /*debug_loc_size*/,
1952    Dwarf_Unsigned * /*debug_aranges_size*/,
1953    Dwarf_Unsigned * /*debug_macinfo_size*/,
1954    Dwarf_Unsigned * /*debug_pubnames_size*/,
1955    Dwarf_Unsigned * /*debug_str_size*/,
1956    Dwarf_Unsigned * /*debug_frame_size*/,
1957    Dwarf_Unsigned * /*debug_ranges_size*/,
1958    Dwarf_Unsigned * /*debug_pubtypes_size*/);
1959
1960Dwarf_Half
1961dwarf_set_frame_rule_inital_value(Dwarf_Debug /*dbg*/,
1962	Dwarf_Half /*value*/);
1963
1964Dwarf_Half
1965dwarf_set_frame_rule_table_size(Dwarf_Debug dbg,
1966        Dwarf_Half value);
1967
1968
1969#ifdef __cplusplus
1970}
1971#endif
1972#endif /* _LIBDWARF_H */
1973
1974