17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate
307dc194Richard Lowe  Copyright (C) 2000-2010 Silicon Graphics, Inc.  All Rights Reserved.
407dc194Richard Lowe  Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
507dc194Richard Lowe  Portions Copyright 2008-2010 David Anderson. All rights reserved.
607dc194Richard Lowe  Portions Copyright 2008-2010 Arxan Technologies, Inc. All rights reserved.
77c478bdstevel@tonic-gate
87c478bdstevel@tonic-gate  This program is free software; you can redistribute it and/or modify it
97c478bdstevel@tonic-gate  under the terms of version 2.1 of the GNU Lesser General Public License
107c478bdstevel@tonic-gate  as published by the Free Software Foundation.
117c478bdstevel@tonic-gate
127c478bdstevel@tonic-gate  This program is distributed in the hope that it would be useful, but
137c478bdstevel@tonic-gate  WITHOUT ANY WARRANTY; without even the implied warranty of
147c478bdstevel@tonic-gate  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
157c478bdstevel@tonic-gate
167c478bdstevel@tonic-gate  Further, this software is distributed without any warranty that it is
177c478bdstevel@tonic-gate  free of the rightful claim of any third person regarding infringement
187c478bdstevel@tonic-gate  or the like.  Any license provided herein, whether implied or
197c478bdstevel@tonic-gate  otherwise, applies only to this software file.  Patent licenses, if
207c478bdstevel@tonic-gate  any, provided herein do not apply to combinations of this program with
217c478bdstevel@tonic-gate  other software, or any other product whatsoever.
227c478bdstevel@tonic-gate
237c478bdstevel@tonic-gate  You should have received a copy of the GNU Lesser General Public
247c478bdstevel@tonic-gate  License along with this program; if not, write the Free Software
2507dc194Richard Lowe  Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
267c478bdstevel@tonic-gate  USA.
277c478bdstevel@tonic-gate
2807dc194Richard Lowe  Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
297c478bdstevel@tonic-gate  Mountain View, CA 94043, or:
307c478bdstevel@tonic-gate
317c478bdstevel@tonic-gate  http://www.sgi.com
327c478bdstevel@tonic-gate
337c478bdstevel@tonic-gate  For further information regarding this notice, see:
347c478bdstevel@tonic-gate
357c478bdstevel@tonic-gate  http://oss.sgi.com/projects/GenInfo/NoticeExplan
367c478bdstevel@tonic-gate
377c478bdstevel@tonic-gate*/
387c478bdstevel@tonic-gate
397c478bdstevel@tonic-gate
407c478bdstevel@tonic-gate#ifndef _LIBDWARF_H
417c478bdstevel@tonic-gate#define _LIBDWARF_H
427c478bdstevel@tonic-gate#ifdef __cplusplus
437c478bdstevel@tonic-gateextern "C" {
447c478bdstevel@tonic-gate#endif
457c478bdstevel@tonic-gate/*
4607dc194Richard Lowe    libdwarf.h
4707dc194Richard Lowe    $Revision: #9 $ $Date: 2008/01/17 $
487c478bdstevel@tonic-gate
4907dc194Richard Lowe    For libdwarf producers and consumers
507c478bdstevel@tonic-gate
5107dc194Richard Lowe    The interface is defined as having 8-byte signed and unsigned
5207dc194Richard Lowe    values so it can handle 64-or-32bit target on 64-or-32bit host.
5307dc194Richard Lowe    Addr is the native size: it represents pointers on
5407dc194Richard Lowe    the host machine (not the target!).
557c478bdstevel@tonic-gate
5607dc194Richard Lowe    This contains declarations for types and all producer
5707dc194Richard Lowe    and consumer functions.
587c478bdstevel@tonic-gate
5907dc194Richard Lowe    Function declarations are written on a single line each here
6007dc194Richard Lowe    so one can use grep  to each declaration in its entirety.
6107dc194Richard Lowe    The declarations are a little harder to read this way, but...
627c478bdstevel@tonic-gate
637c478bdstevel@tonic-gate*/
647c478bdstevel@tonic-gate
6549d3bc9Richard Lowestruct Elf;
6649d3bc9Richard Lowetypedef struct Elf* dwarf_elf_handle;
6749d3bc9Richard Lowe
6807dc194Richard Lowe/* To enable printing with printf regardless of the
6907dc194Richard Lowe   actual underlying data type, we define the DW_PR_xxx macros. */
707c478bdstevel@tonic-gate#if (_MIPS_SZLONG == 64)
717c478bdstevel@tonic-gate/* Special case for MIPS, so -64 (LP64) build gets simple -long-.
727c478bdstevel@tonic-gate   Non-MIPS LP64 or ILP64 environments should probably ensure
737c478bdstevel@tonic-gate   _MIPS_SZLONG set to 64 everywhere this header is #included.
747c478bdstevel@tonic-gate*/
757c478bdstevel@tonic-gatetypedef int             Dwarf_Bool;         /* boolean type */
767c478bdstevel@tonic-gatetypedef unsigned long   Dwarf_Off;          /* 4 or 8 byte file offset */
777c478bdstevel@tonic-gatetypedef unsigned long   Dwarf_Unsigned;     /* 4 or 8 byte unsigned value */
787c478bdstevel@tonic-gatetypedef unsigned short  Dwarf_Half;         /* 2 byte unsigned value */
797c478bdstevel@tonic-gatetypedef unsigned char   Dwarf_Small;        /* 1 byte unsigned value */
807c478bdstevel@tonic-gatetypedef signed   long   Dwarf_Signed;       /* 4 or 8 byte signed value */
817c478bdstevel@tonic-gatetypedef unsigned long   Dwarf_Addr;         /* target memory address */
8207dc194Richard Lowe#define  DW_PR_DUx  "lx"
8307dc194Richard Lowe#define  DW_PR_DSx  "lx"
8407dc194Richard Lowe#define  DW_PR_DUu  "lu"
8507dc194Richard Lowe#define  DW_PR_DSd  "ld"
8607dc194Richard Lowe
877c478bdstevel@tonic-gate#else /* 32-bit */
887c478bdstevel@tonic-gate/* This is for ILP32, allowing i/o of 64bit dwarf info.
897c478bdstevel@tonic-gate   Also should be fine for LP64 and ILP64 cases.
907c478bdstevel@tonic-gate*/
917c478bdstevel@tonic-gatetypedef int                 Dwarf_Bool;     /* boolean type */
927c478bdstevel@tonic-gatetypedef unsigned long long  Dwarf_Off;      /* 8 byte file offset */
937c478bdstevel@tonic-gatetypedef unsigned long long  Dwarf_Unsigned; /* 8 byte unsigned value*/
947c478bdstevel@tonic-gatetypedef unsigned short      Dwarf_Half;     /* 2 byte unsigned value */
957c478bdstevel@tonic-gatetypedef unsigned char       Dwarf_Small;    /* 1 byte unsigned value */
967c478bdstevel@tonic-gatetypedef signed   long long  Dwarf_Signed;   /* 8 byte signed value */
977c478bdstevel@tonic-gatetypedef unsigned long long  Dwarf_Addr;     /* target memory address */
9807dc194Richard Lowe#define  DW_PR_DUx  "llx"
9907dc194Richard Lowe#define  DW_PR_DSx  "llx"
10007dc194Richard Lowe#define  DW_PR_DUu  "llu"
10107dc194Richard Lowe#define  DW_PR_DSd  "lld"
1027c478bdstevel@tonic-gate#endif
10307dc194Richard Lowe#ifdef HAVE_NONSTANDARD_PRINTF_64_FORMAT
10407dc194Richard Lowe/* Windows does not use std C formatting, so allow it. */
10507dc194Richard Lowe#undef DW_PR_DUx
10607dc194Richard Lowe#undef DW_PR_DSx
10707dc194Richard Lowe#undef DW_PR_DUu
10807dc194Richard Lowe#undef DW_PR_DSd
10907dc194Richard Lowe#define  DW_PR_DUx  "I64x"
11007dc194Richard Lowe#define  DW_PR_DSx  "I64x"
11107dc194Richard Lowe#define  DW_PR_DUu  "I64u"
11207dc194Richard Lowe#define  DW_PR_DSd  "I64d"
11307dc194Richard Lowe#endif /* HAVE_NONSTANDARD_FORMAT */
11407dc194Richard Lowe
11507dc194Richard Lowetypedef void*        Dwarf_Ptr;          /* host machine pointer */
11607dc194Richard Lowe
11707dc194Richard Lowe/* Used for DW_FORM_ref_sig8. It is not a string, it
11807dc194Richard Lowe   is 8 bytes of a signature one would use to find
11907dc194Richard Lowe   a type unit. See dwarf_formsig8()
12007dc194Richard Lowe*/
12107dc194Richard Lowetypedef struct  {
12207dc194Richard Lowe    char signature[8];
12307dc194Richard Lowe} Dwarf_Sig8;
1247c478bdstevel@tonic-gate
12549d3bc9Richard Lowe/* Contains info on an uninterpreted block of data
1267c478bdstevel@tonic-gate*/
1277c478bdstevel@tonic-gatetypedef struct {
12807dc194Richard Lowe    Dwarf_Unsigned  bl_len;         /* length of block */
12907dc194Richard Lowe    Dwarf_Ptr       bl_data;        /* uninterpreted data */
13007dc194Richard Lowe    Dwarf_Small     bl_from_loclist; /*non-0 if loclist, else debug_info*/
13107dc194Richard Lowe    Dwarf_Unsigned  bl_section_offset; /* Section (not CU) offset
13249d3bc9Richard Lowe                                        which 'data' comes from. */
1337c478bdstevel@tonic-gate} Dwarf_Block;
1347c478bdstevel@tonic-gate
1357c478bdstevel@tonic-gate
1367c478bdstevel@tonic-gate/* location record
1377c478bdstevel@tonic-gate*/
1387c478bdstevel@tonic-gatetypedef struct {
13907dc194Richard Lowe    Dwarf_Small     lr_atom;        /* location operation */
14007dc194Richard Lowe    Dwarf_Unsigned  lr_number;      /* operand */
14107dc194Richard Lowe    Dwarf_Unsigned  lr_number2;     /* for OP_BREGx */
14207dc194Richard Lowe    Dwarf_Unsigned  lr_offset;      /* offset in locexpr for OP_BRA etc */
1437c478bdstevel@tonic-gate} Dwarf_Loc;
1447c478bdstevel@tonic-gate
1457c478bdstevel@tonic-gate
1467c478bdstevel@tonic-gate/* location description
1477c478bdstevel@tonic-gate*/
1487c478bdstevel@tonic-gatetypedef struct {
14907dc194Richard Lowe    Dwarf_Addr      ld_lopc;        /* beginning of active range */
15007dc194Richard Lowe    Dwarf_Addr      ld_hipc;        /* end of active range */
15107dc194Richard Lowe    Dwarf_Half      ld_cents;       /* count of location records */
15207dc194Richard Lowe    Dwarf_Loc*      ld_s;           /* pointer to list of same */
15307dc194Richard Lowe    Dwarf_Small     ld_from_loclist;
15407dc194Richard Lowe                      /* non-0 if loclist, else debug_info*/
15507dc194Richard Lowe
15607dc194Richard Lowe    Dwarf_Unsigned  ld_section_offset; /* Section (not CU) offset
15707dc194Richard Lowe                    where loc-expr begins*/
1587c478bdstevel@tonic-gate} Dwarf_Locdesc;
1597c478bdstevel@tonic-gate
16007dc194Richard Lowe/* First appears in DWARF3.
16107dc194Richard Lowe   The dwr_addr1/addr2 data is either an offset (DW_RANGES_ENTRY)
16207dc194Richard Lowe   or an address (dwr_addr2 in DW_RANGES_ADDRESS_SELECTION) or
16307dc194Richard Lowe   both are zero (DW_RANGES_END).
16407dc194Richard Lowe*/
16507dc194Richard Loweenum Dwarf_Ranges_Entry_Type { DW_RANGES_ENTRY,
16607dc194Richard Lowe    DW_RANGES_ADDRESS_SELECTION,
16707dc194Richard Lowe    DW_RANGES_END };
16807dc194Richard Lowetypedef struct {
16907dc194Richard Lowe    Dwarf_Addr dwr_addr1;
17007dc194Richard Lowe    Dwarf_Addr dwr_addr2;
17107dc194Richard Lowe    enum Dwarf_Ranges_Entry_Type  dwr_type;
17207dc194Richard Lowe} Dwarf_Ranges;
17307dc194Richard Lowe
1747c478bdstevel@tonic-gate/* Frame description instructions expanded.
1757c478bdstevel@tonic-gate*/
1767c478bdstevel@tonic-gatetypedef struct {
17707dc194Richard Lowe    Dwarf_Small     fp_base_op;
17807dc194Richard Lowe    Dwarf_Small     fp_extended_op;
17907dc194Richard Lowe    Dwarf_Half      fp_register;
18007dc194Richard Lowe
18107dc194Richard Lowe    /* Value may be signed, depends on op.
18207dc194Richard Lowe           Any applicable data_alignment_factor has
18307dc194Richard Lowe           not been applied, this is the  raw offset. */
18407dc194Richard Lowe    Dwarf_Unsigned  fp_offset;
18507dc194Richard Lowe    Dwarf_Off       fp_instr_offset;
18607dc194Richard Lowe} Dwarf_Frame_Op; /* DWARF2 */
18707dc194Richard Lowe
18807dc194Richard Lowetypedef struct {
18907dc194Richard Lowe    Dwarf_Small     fp_base_op;
19007dc194Richard Lowe    Dwarf_Small     fp_extended_op;
19107dc194Richard Lowe    Dwarf_Half      fp_register;
19207dc194Richard Lowe
19307dc194Richard Lowe    /* Value may be signed, depends on op.
19407dc194Richard Lowe           Any applicable data_alignment_factor has
19507dc194Richard Lowe           not been applied, this is the  raw offset. */
19607dc194Richard Lowe    Dwarf_Unsigned  fp_offset_or_block_len;
19707dc194Richard Lowe    Dwarf_Small     *fp_expr_block;
19807dc194Richard Lowe
19907dc194Richard Lowe    Dwarf_Off       fp_instr_offset;
20007dc194Richard Lowe} Dwarf_Frame_Op3;  /* DWARF3 and DWARF2 compatible */
20107dc194Richard Lowe
20207dc194Richard Lowe/*  ***IMPORTANT NOTE, TARGET DEPENDENCY ****
20307dc194Richard Lowe   DW_REG_TABLE_SIZE must be at least as large as
20407dc194Richard Lowe   the number of registers
20507dc194Richard Lowe   (DW_FRAME_LAST_REG_NUM) as defined in dwarf.h
20607dc194Richard Lowe   Preferably identical to DW_FRAME_LAST_REG_NUM.
20707dc194Richard Lowe   Ensure [0-DW_REG_TABLE_SIZE] does not overlap
20807dc194Richard Lowe   DW_FRAME_UNDEFINED_VAL or DW_FRAME_SAME_VAL.
20907dc194Richard Lowe   Also ensure DW_FRAME_REG_INITIAL_VALUE is set to what
21007dc194Richard Lowe   is appropriate to your cpu.
21107dc194Richard Lowe   For various CPUs  DW_FRAME_UNDEFINED_VAL is correct
21207dc194Richard Lowe   as the value for DW_FRAME_REG_INITIAL_VALUE.
21307dc194Richard Lowe
21407dc194Richard Lowe   For consumer apps, this can be set dynamically: see
21507dc194Richard Lowe   dwarf_set_frame_rule_table_size();
2167c478bdstevel@tonic-gate */
21707dc194Richard Lowe#ifndef DW_REG_TABLE_SIZE
2187c478bdstevel@tonic-gate#define DW_REG_TABLE_SIZE  66
21907dc194Richard Lowe#endif
22007dc194Richard Lowe
22107dc194Richard Lowe/* For MIPS, DW_FRAME_SAME_VAL is the correct default value
22207dc194Richard Lowe   for a frame register value. For other CPUS another value
22307dc194Richard Lowe   may be better, such as DW_FRAME_UNDEFINED_VAL.
22407dc194Richard Lowe   See dwarf_set_frame_rule_table_size
22507dc194Richard Lowe*/
22607dc194Richard Lowe#ifndef DW_FRAME_REG_INITIAL_VALUE
22707dc194Richard Lowe#define DW_FRAME_REG_INITIAL_VALUE DW_FRAME_SAME_VAL
22807dc194Richard Lowe#endif
22907dc194Richard Lowe
23007dc194Richard Lowe/* Taken as meaning 'undefined value', this is not
23107dc194Richard Lowe   a column or register number.
23207dc194Richard Lowe   Only present at libdwarf runtime in the consumer
23307dc194Richard Lowe   interfaces. Never on disk.
23407dc194Richard Lowe   DW_FRAME_* Values present on disk are in dwarf.h
23507dc194Richard Lowe   Ensure this is > DW_REG_TABLE_SIZE (the reg table
23607dc194Richard Lowe   size is changeable at runtime with the *reg3() interfaces,
23707dc194Richard Lowe   and this value must be greater than the reg table size).
23807dc194Richard Lowe*/
23907dc194Richard Lowe#define DW_FRAME_UNDEFINED_VAL          1034
24007dc194Richard Lowe
24107dc194Richard Lowe/* Taken as meaning 'same value' as caller had, not a column
24207dc194Richard Lowe   or register number.
24307dc194Richard Lowe   Only present at libdwarf runtime in the consumer
24407dc194Richard Lowe   interfaces. Never on disk.
24507dc194Richard Lowe   DW_FRAME_* Values present on disk are in dwarf.h
24607dc194Richard Lowe   Ensure this is > DW_REG_TABLE_SIZE (the reg table
24707dc194Richard Lowe   size is changeable at runtime with the *reg3() interfaces,
24807dc194Richard Lowe   and this value must be greater than the reg table size).
24907dc194Richard Lowe*/
25007dc194Richard Lowe#define DW_FRAME_SAME_VAL               1035
25107dc194Richard Lowe
25207dc194Richard Lowe/* For DWARF3 consumer interfaces, make the CFA a column with no
25307dc194Richard Lowe   real table number.  This is what should have been done
25407dc194Richard Lowe   for the DWARF2 interfaces.  This actually works for
25507dc194Richard Lowe   both DWARF2 and DWARF3, but see the libdwarf documentation
25607dc194Richard Lowe   on Dwarf_Regtable3 and  dwarf_get_fde_info_for_reg3()
25707dc194Richard Lowe   and  dwarf_get_fde_info_for_all_regs3()
25807dc194Richard Lowe   Do NOT use this with the older dwarf_get_fde_info_for_reg()
25907dc194Richard Lowe   or dwarf_get_fde_info_for_all_regs() consumer interfaces.
26007dc194Richard Lowe   Must be higher than any register count for *any* ABI
26107dc194Richard Lowe   (ensures maximum applicability with minimum effort).
26207dc194Richard Lowe   Ensure this is > DW_REG_TABLE_SIZE (the reg table
26307dc194Richard Lowe   size is changeable at runtime with the *reg3() interfaces,
26407dc194Richard Lowe   and this value must be greater than the reg table size).
26507dc194Richard Lowe   Only present at libdwarf runtime in the consumer
26607dc194Richard Lowe   interfaces. Never on disk.
26707dc194Richard Lowe*/
26807dc194Richard Lowe#define DW_FRAME_CFA_COL3               1436
26907dc194Richard Lowe
27007dc194Richard Lowe/* The following are all needed to evaluate DWARF3 register rules.
27107dc194Richard Lowe*/
27207dc194Richard Lowe#define DW_EXPR_OFFSET 0  /* DWARF2 only sees this. */
27307dc194Richard Lowe#define DW_EXPR_VAL_OFFSET 1
27407dc194Richard Lowe#define DW_EXPR_EXPRESSION 2
27507dc194Richard Lowe#define DW_EXPR_VAL_EXPRESSION 3
27607dc194Richard Lowe
27707dc194Richard Lowetypedef struct Dwarf_Regtable_Entry_s {
27807dc194Richard Lowe    /*  For each index i (naming a hardware register with dwarf number
27907dc194Richard Lowe            i) the following is true and defines the value of that register:
28007dc194Richard Lowe
28107dc194Richard Lowe           If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
28207dc194Richard Lowe         it is not DWARF register number but
28307dc194Richard Lowe        a place holder indicating the register has no defined value.
28407dc194Richard Lowe           If dw_regnum is Register DW_FRAME_SAME_VAL
28507dc194Richard Lowe           it  is not DWARF register number but
28607dc194Richard Lowe        a place holder indicating the register has the same
28707dc194Richard Lowe                value in the previous frame.
28807dc194Richard Lowe       DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL are
28907dc194Richard Lowe           only present at libdwarf runtime. Never on disk.
29007dc194Richard Lowe           DW_FRAME_* Values present on disk are in dwarf.h
29107dc194Richard Lowe
29207dc194Richard Lowe          Otherwise: the register number is a DWARF register number
29307dc194Richard Lowe          (see ABI documents for how this translates to hardware/
29407dc194Richard Lowe           software register numbers in the machine hardware)
29507dc194Richard Lowe      and the following applies:
29607dc194Richard Lowe
29707dc194Richard Lowe          if dw_value_type == DW_EXPR_OFFSET (the only case for dwarf2):
29807dc194Richard Lowe            If dw_offset_relevant is non-zero, then
29907dc194Richard Lowe                the value is stored at at the address CFA+N where
30007dc194Richard Lowe                N is a signed offset.
30107dc194Richard Lowe                Rule: Offset(N)
30207dc194Richard Lowe            If dw_offset_relevant is zero, then the value of the register
30307dc194Richard Lowe                is the value of (DWARF) register number dw_regnum.
30407dc194Richard Lowe                Rule: register(F)
30507dc194Richard Lowe          Other values of dw_value_type are an error.
30607dc194Richard Lowe        */
30707dc194Richard Lowe    Dwarf_Small         dw_offset_relevant;
30807dc194Richard Lowe
30907dc194Richard Lowe    /* For DWARF2, always 0 */
31007dc194Richard Lowe        Dwarf_Small         dw_value_type;
31107dc194Richard Lowe
31207dc194Richard Lowe    Dwarf_Half          dw_regnum;
31307dc194Richard Lowe
31407dc194Richard Lowe    /* The data type here should  the larger of Dwarf_Addr
31507dc194Richard Lowe           and Dwarf_Unsigned and Dwarf_Signed. */
31607dc194Richard Lowe    Dwarf_Addr          dw_offset;
31707dc194Richard Lowe} Dwarf_Regtable_Entry;
31807dc194Richard Lowe
31907dc194Richard Lowetypedef struct Dwarf_Regtable_s {
32007dc194Richard Lowe    struct Dwarf_Regtable_Entry_s rules[DW_REG_TABLE_SIZE];
3217c478bdstevel@tonic-gate} Dwarf_Regtable;
3227c478bdstevel@tonic-gate
32307dc194Richard Lowe/* opaque type. Functional interface shown later. */
32407dc194Richard Lowestruct Dwarf_Reg_value3_s;
32507dc194Richard Lowetypedef struct Dwarf_Reg_value3_s Dwarf_Reg_Value3;
32607dc194Richard Lowe
32707dc194Richard Lowetypedef struct Dwarf_Regtable_Entry3_s {
32807dc194Richard Lowe    /*  For each index i (naming a hardware register with dwarf number
32907dc194Richard Lowe        i) the following is true and defines the value of that register:
33007dc194Richard Lowe
33107dc194Richard Lowe          If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
33207dc194Richard Lowe             it is not DWARF register number but
33307dc194Richard Lowe             a place holder indicating the register has no defined value.
33407dc194Richard Lowe          If dw_regnum is Register DW_FRAME_SAME_VAL
33507dc194Richard Lowe             it  is not DWARF register number but
33607dc194Richard Lowe             a place holder indicating the register has the same
33707dc194Richard Lowe             value in the previous frame.
33807dc194Richard Lowe           DW_FRAME_UNDEFINED_VAL, DW_FRAME_SAME_VAL and
33907dc194Richard Lowe             DW_FRAME_CFA_COL3 are only present at libdwarf runtime.
34007dc194Richard Lowe             Never on disk.
34107dc194Richard Lowe             DW_FRAME_* Values present on disk are in dwarf.h
34207dc194Richard Lowe           Because DW_FRAME_SAME_VAL and DW_FRAME_UNDEFINED_VAL
34307dc194Richard Lowe           and DW_FRAME_CFA_COL3 are defineable at runtime
34407dc194Richard Lowe           consider the names symbolic in this comment, not absolute.
34507dc194Richard Lowe
34607dc194Richard Lowe          Otherwise: the register number is a DWARF register number
34707dc194Richard Lowe            (see ABI documents for how this translates to hardware/
34807dc194Richard Lowe             software register numbers in the machine hardware)
34907dc194Richard Lowe             and the following applies:
35007dc194Richard Lowe
35107dc194Richard Lowe           In a cfa-defining entry (rt3_cfa_rule) the regnum is the
35207dc194Richard Lowe           CFA 'register number'. Which is some 'normal' register,
35307dc194Richard Lowe           not DW_FRAME_CFA_COL3, nor DW_FRAME_SAME_VAL, nor
35407dc194Richard Lowe           DW_FRAME_UNDEFINED_VAL.
35507dc194Richard Lowe
35607dc194Richard Lowe          If dw_value_type == DW_EXPR_OFFSET (the only  possible case for
35707dc194Richard Lowe             dwarf2):
35807dc194Richard Lowe            If dw_offset_relevant is non-zero, then
35907dc194Richard Lowe               the value is stored at at the address
36007dc194Richard Lowe               CFA+N where N is a signed offset.
36107dc194Richard Lowe               dw_regnum is the cfa register rule which means
36207dc194Richard Lowe               one ignores dw_regnum and uses the CFA appropriately.
36307dc194Richard Lowe               So dw_offset_or_block_len is a signed value, really,
36407dc194Richard Lowe               and must be printed/evaluated as such.
36507dc194Richard Lowe               Rule: Offset(N)
36607dc194Richard Lowe            If dw_offset_relevant is zero, then the value of the register
36707dc194Richard Lowe               is the value of (DWARF) register number dw_regnum.
36807dc194Richard Lowe               Rule: register(R)
36907dc194Richard Lowe          If dw_value_type  == DW_EXPR_VAL_OFFSET
37007dc194Richard Lowe            the  value of this register is CFA +N where N is a signed offset.
37107dc194Richard Lowe            dw_regnum is the cfa register rule which means
37207dc194Richard Lowe            one ignores dw_regnum and uses the CFA appropriately.
37307dc194Richard Lowe            Rule: val_offset(N)
37407dc194Richard Lowe          If dw_value_type  == DW_EXPR_EXPRESSION
37507dc194Richard Lowe            The value of the register is the value at the address
37607dc194Richard Lowe            computed by evaluating the DWARF expression E.
37707dc194Richard Lowe            Rule: expression(E)
37807dc194Richard Lowe            The expression E byte stream is pointed to by dw_block_ptr.
37907dc194Richard Lowe            The expression length in bytes is given by
38007dc194Richard Lowe            dw_offset_or_block_len.
38107dc194Richard Lowe          If dw_value_type  == DW_EXPR_VAL_EXPRESSION
38207dc194Richard Lowe            The value of the register is the value
38307dc194Richard Lowe            computed by evaluating the DWARF expression E.
38407dc194Richard Lowe            Rule: val_expression(E)
38507dc194Richard Lowe            The expression E byte stream is pointed to by dw_block_ptr.
38607dc194Richard Lowe            The expression length in bytes is given by
38707dc194Richard Lowe            dw_offset_or_block_len.
38807dc194Richard Lowe          Other values of dw_value_type are an error.
38907dc194Richard Lowe        */
39007dc194Richard Lowe    Dwarf_Small         dw_offset_relevant;
39107dc194Richard Lowe    Dwarf_Small         dw_value_type;
39207dc194Richard Lowe    Dwarf_Half          dw_regnum;
39307dc194Richard Lowe    Dwarf_Unsigned      dw_offset_or_block_len;
39407dc194Richard Lowe    Dwarf_Ptr           dw_block_ptr;
39507dc194Richard Lowe
39607dc194Richard Lowe}Dwarf_Regtable_Entry3;
39707dc194Richard Lowe
39807dc194Richard Lowe/* For the DWARF3 version, moved the DW_FRAME_CFA_COL
39907dc194Richard Lowe   out of the array and into its own struct.
40007dc194Richard Lowe   Having it part of the array is not very easy to work
40107dc194Richard Lowe   with from a portability point of view: changing
40207dc194Richard Lowe   the number for every architecture is a pain (if one fails
40307dc194Richard Lowe   to set it correctly a register rule gets clobbered when
40407dc194Richard Lowe   setting CFA).  With MIPS it just happened to be easy to use
40507dc194Richard Lowe   DW_FRAME_CFA_COL (it was wrong conceptually but it was easy...).
40607dc194Richard Lowe
40707dc194Richard Lowe   rt3_rules and rt3_reg_table_size must be filled in before
40807dc194Richard Lowe   calling libdwarf.  Filled in with a pointer to an array
40907dc194Richard Lowe   (pointer and array  set up by the calling application)
41007dc194Richard Lowe   of rt3_reg_table_size Dwarf_Regtable_Entry3_s structs.
41107dc194Richard Lowe   libdwarf does not allocate or deallocate space for the
41207dc194Richard Lowe   rules, you must do so.   libdwarf will initialize the
41307dc194Richard Lowe   contents rules array, you do not need to do so (though
41407dc194Richard Lowe   if you choose to initialize the array somehow that is ok:
41507dc194Richard Lowe   libdwarf will overwrite your initializations with its own).
41607dc194Richard Lowe
41707dc194Richard Lowe*/
41807dc194Richard Lowetypedef struct Dwarf_Regtable3_s {
41907dc194Richard Lowe    struct Dwarf_Regtable_Entry3_s   rt3_cfa_rule;
42007dc194Richard Lowe
42107dc194Richard Lowe    Dwarf_Half                       rt3_reg_table_size;
42207dc194Richard Lowe    struct Dwarf_Regtable_Entry3_s * rt3_rules;
42307dc194Richard Lowe} Dwarf_Regtable3;
42407dc194Richard Lowe
42507dc194Richard Lowe
42607dc194Richard Lowe/* Use for DW_EPXR_STANDARD., DW_EXPR_VAL_OFFSET.
42707dc194Richard Lowe   Returns DW_DLV_OK if the value is available.
42807dc194Richard Lowe   If DW_DLV_OK returns the regnum and offset thru the pointers
42907dc194Richard Lowe   (which the consumer must use appropriately).
43007dc194Richard Lowe*/
43107dc194Richard Loweint dwarf_frame_get_reg_register(struct Dwarf_Regtable_Entry3_s *reg_in,
43207dc194Richard Lowe    Dwarf_Small *offset_relevant,
43307dc194Richard Lowe    Dwarf_Half *regnum_out,
43407dc194Richard Lowe    Dwarf_Signed *offset_out);
43507dc194Richard Lowe
43607dc194Richard Lowe/* Use for DW_EXPR_EXPRESSION, DW_EXPR_VAL_EXPRESSION.
43707dc194Richard Lowe   Returns DW_DLV_OK if the value is available.
43807dc194Richard Lowe   The caller must pass in the address of a valid
43907dc194Richard Lowe   Dwarf_Block (the caller need not initialize it).
44007dc194Richard Lowe*/
44107dc194Richard Loweint dwarf_frame_get_reg_expression(struct Dwarf_Regtable_Entry3_s *reg_in,
44207dc194Richard Lowe    Dwarf_Block *block_out);
44307dc194Richard Lowe
44407dc194Richard Lowe
44507dc194Richard Lowe/* For DW_DLC_SYMBOLIC_RELOCATIONS output to caller
4467c478bdstevel@tonic-gate   v2, adding drd_length: some relocations are 4 and
4477c478bdstevel@tonic-gate   some 8 bytes (pointers are 8, section offsets 4) in
4487c478bdstevel@tonic-gate   some dwarf environments. (MIPS relocations are all one
4497c478bdstevel@tonic-gate   size in any given ABI.) Changing drd_type to an unsigned char
4507c478bdstevel@tonic-gate   to keep struct size down.
4517c478bdstevel@tonic-gate*/
4527c478bdstevel@tonic-gateenum Dwarf_Rel_Type {
45307dc194Richard Lowe        dwarf_drt_none,        /* Should not get to caller */
45407dc194Richard Lowe        dwarf_drt_data_reloc,  /* Simple normal relocation. */
45507dc194Richard Lowe        dwarf_drt_segment_rel, /* Special reloc, exceptions. */
45607dc194Richard Lowe        /* dwarf_drt_first_of_length_pair  and drt_second
45707dc194Richard Lowe           are for for the  .word end - begin case. */
45807dc194Richard Lowe        dwarf_drt_first_of_length_pair,
45907dc194Richard Lowe        dwarf_drt_second_of_length_pair
46007dc194Richard Lowe};
46107dc194Richard Lowe
46207dc194Richard Lowetypedef struct Dwarf_P_Marker_s * Dwarf_P_Marker;
46307dc194Richard Lowestruct Dwarf_P_Marker_s {
46407dc194Richard Lowe    Dwarf_Unsigned ma_marker;
46507dc194Richard Lowe    Dwarf_Unsigned ma_offset;
4667c478bdstevel@tonic-gate};
46707dc194Richard Lowe
4687c478bdstevel@tonic-gatetypedef struct Dwarf_Relocation_Data_s  * Dwarf_Relocation_Data;
4697c478bdstevel@tonic-gatestruct Dwarf_Relocation_Data_s {
47007dc194Richard Lowe    unsigned char drd_type;   /* Cast to/from Dwarf_Rel_Type
47107dc194Richard Lowe                               to keep size small in struct. */
47207dc194Richard Lowe    unsigned char drd_length; /* Length in bytes of data being
47307dc194Richard Lowe                               relocated. 4 for 32bit data,
47407dc194Richard Lowe                               8 for 64bit data. */
47507dc194Richard Lowe    Dwarf_Unsigned       drd_offset; /* Where the data to reloc is. */
47607dc194Richard Lowe    Dwarf_Unsigned       drd_symbol_index;
4777c478bdstevel@tonic-gate};
4787c478bdstevel@tonic-gate
47907dc194Richard Lowetypedef struct Dwarf_P_String_Attr_s  * Dwarf_P_String_Attr;
48007dc194Richard Lowestruct Dwarf_P_String_Attr_s {
48107dc194Richard Lowe    Dwarf_Unsigned        sa_offset;  /* Offset of string attribute data */
48207dc194Richard Lowe    Dwarf_Unsigned        sa_nbytes;
48307dc194Richard Lowe};
48407dc194Richard Lowe
48507dc194Richard Lowe
4867c478bdstevel@tonic-gate/* Opaque types for Consumer Library. */
4877c478bdstevel@tonic-gatetypedef struct Dwarf_Debug_s*      Dwarf_Debug;
4887c478bdstevel@tonic-gatetypedef struct Dwarf_Die_s*        Dwarf_Die;
4897c478bdstevel@tonic-gatetypedef struct Dwarf_Line_s*       Dwarf_Line;
4907c478bdstevel@tonic-gatetypedef struct Dwarf_Global_s*     Dwarf_Global;
4917c478bdstevel@tonic-gatetypedef struct Dwarf_Func_s*       Dwarf_Func;
4927c478bdstevel@tonic-gatetypedef struct Dwarf_Type_s*       Dwarf_Type;
4937c478bdstevel@tonic-gatetypedef struct Dwarf_Var_s*        Dwarf_Var;
4947c478bdstevel@tonic-gatetypedef struct Dwarf_Weak_s*       Dwarf_Weak;
4957c478bdstevel@tonic-gatetypedef struct Dwarf_Error_s*      Dwarf_Error;
4967c478bdstevel@tonic-gatetypedef struct Dwarf_Attribute_s*  Dwarf_Attribute;
49707dc194Richard Lowetypedef struct Dwarf_Abbrev_s*       Dwarf_Abbrev;
49807dc194Richard Lowetypedef struct Dwarf_Fde_s*         Dwarf_Fde;
49907dc194Richard Lowetypedef struct Dwarf_Cie_s*         Dwarf_Cie;
50007dc194Richard Lowetypedef struct Dwarf_Arange_s*       Dwarf_Arange;
5017c478bdstevel@tonic-gate
5027c478bdstevel@tonic-gate/* Opaque types for Producer Library. */
50307dc194Richard Lowetypedef struct Dwarf_P_Debug_s*           Dwarf_P_Debug;
50407dc194Richard Lowetypedef struct Dwarf_P_Die_s*           Dwarf_P_Die;
50507dc194Richard Lowetypedef struct Dwarf_P_Attribute_s*    Dwarf_P_Attribute;
50607dc194Richard Lowetypedef struct Dwarf_P_Fde_s*        Dwarf_P_Fde;
50707dc194Richard Lowetypedef struct Dwarf_P_Expr_s*        Dwarf_P_Expr;
50807dc194Richard Lowetypedef Dwarf_Unsigned                Dwarf_Tag;
5097c478bdstevel@tonic-gate
5107c478bdstevel@tonic-gate
5117c478bdstevel@tonic-gate/* error handler function
5127c478bdstevel@tonic-gate*/
5137c478bdstevel@tonic-gatetypedef void  (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/);
5147c478bdstevel@tonic-gate
5157c478bdstevel@tonic-gate
51607dc194Richard Lowe/* Begin libdwarf Object File Interface declarations.
51707dc194Richard Lowe
51807dc194Richard LoweAs of February 2008 there are multiple dwarf_reader object access
51907dc194Richard Loweinitialization methods available:
52007dc194Richard LoweThe traditional dwarf_elf_init() and dwarf_init()  and dwarf_finish()
52107dc194Richard Lowe    which assume libelf and POSIX file access.
52207dc194Richard LoweAn object-file and library agnostic dwarf_object_init() and dwarf_object_finish()
52307dc194Richard Lowe    which allow the coder to provide object access routines
52407dc194Richard Lowe    abstracting away the elf interface.  So there is no dependence in the
52507dc194Richard Lowe    reader code on the object format and no dependence on libelf.
52607dc194Richard Lowe    See the code in dwarf_elf_access.c  and dwarf_original_elf_init.c
52707dc194Richard Lowe    to see an example of initializing the structures mentioned below.
52807dc194Richard Lowe
52907dc194Richard LoweProjects using dwarf_elf_init() or dwarf_init() can ignore
53007dc194Richard Lowethe Dwarf_Obj_Access* structures entirely as all these details
53107dc194Richard Loweare completed for you.
53207dc194Richard Lowe
53307dc194Richard Lowe*/
53407dc194Richard Lowe
53507dc194Richard Lowetypedef struct Dwarf_Obj_Access_Interface_s   Dwarf_Obj_Access_Interface;
53607dc194Richard Lowetypedef struct Dwarf_Obj_Access_Methods_s     Dwarf_Obj_Access_Methods;
53707dc194Richard Lowetypedef struct Dwarf_Obj_Access_Section_s     Dwarf_Obj_Access_Section;
53807dc194Richard Lowe
53907dc194Richard Lowe
54007dc194Richard Lowe/* Used in the get_section interface function
54107dc194Richard Lowe   in Dwarf_Obj_Access_Section_s.  Since libdwarf
54207dc194Richard Lowe   depends on standard DWARF section names an object
54307dc194Richard Lowe   format that has no such names (but has some
54407dc194Richard Lowe   method of setting up 'sections equivalents')
54507dc194Richard Lowe   must arrange to return standard DWARF section
54607dc194Richard Lowe   names in the 'name' field.  libdwarf does
54707dc194Richard Lowe   not free the strings in 'name'. */
54807dc194Richard Lowestruct Dwarf_Obj_Access_Section_s {
54907dc194Richard Lowe    Dwarf_Addr     addr;
55007dc194Richard Lowe    Dwarf_Unsigned size;
55107dc194Richard Lowe    const char*    name;
55207dc194Richard Lowe    /* Set link to zero if it is meaningless.  If non-zero
55307dc194Richard Lowe       it should be a link to a rela section or from symtab
55407dc194Richard Lowe       to strtab.  In Elf it is sh_link. */
55507dc194Richard Lowe    Dwarf_Unsigned link;
55607dc194Richard Lowe};
55707dc194Richard Lowe
55807dc194Richard Lowe/* Returned by the get_endianness function in
55907dc194Richard Lowe   Dwarf_Obj_Access_Methods_s. */
56007dc194Richard Lowetypedef enum {
56107dc194Richard Lowe    DW_OBJECT_MSB,
56207dc194Richard Lowe    DW_OBJECT_LSB
56307dc194Richard Lowe} Dwarf_Endianness;
56407dc194Richard Lowe
56507dc194Richard Lowe/* The functions we need to access object data from libdwarf are declared here.
56607dc194Richard Lowe
56707dc194Richard Lowe   In these function pointer declarations
56807dc194Richard Lowe   'void *obj' is intended to be a pointer (the object field in
56907dc194Richard Lowe   Dwarf_Obj_Access_Interface_s)
57007dc194Richard Lowe   that hides the library-specific and object-specific data that makes
57107dc194Richard Lowe   it possible to handle multiple object formats and multiple libraries.
57207dc194Richard Lowe   It's not required that one handles multiple such in a single libdwarf
57307dc194Richard Lowe   archive/shared-library (but not ruled out either).
57407dc194Richard Lowe   See  dwarf_elf_object_access_internals_t and dwarf_elf_access.c
57507dc194Richard Lowe   for an example.
57607dc194Richard Lowe
57707dc194Richard Lowe*/
57807dc194Richard Lowestruct Dwarf_Obj_Access_Methods_s {
57907dc194Richard Lowe    /**
58007dc194Richard Lowe     * get_section_info
58107dc194Richard Lowe     *
58207dc194Richard Lowe     * Get address, size, and name info about a section.
58307dc194Richard Lowe     *
58407dc194Richard Lowe     * Parameters
58507dc194Richard Lowe     * section_index - Zero-based index.
58607dc194Richard Lowe     * return_section - Pointer to a structure in which section info
58707dc194Richard Lowe     *   will be placed.   Caller must provide a valid pointer to a
58807dc194Richard Lowe     *   structure area.  The structure's contents will be overwritten
58907dc194Richard Lowe     *   by the call to get_section_info.
59007dc194Richard Lowe     * error - A pointer to an integer in which an error code may be stored.
59107dc194Richard Lowe     *
59207dc194Richard Lowe     * Return
59307dc194Richard Lowe     * DW_DLV_OK - Everything ok.
59407dc194Richard Lowe     * DW_DLV_ERROR - Error occurred. Use 'error' to determine the
59507dc194Richard Lowe     *    libdwarf defined error.
59607dc194Richard Lowe     * DW_DLV_NO_ENTRY - No such section.
59707dc194Richard Lowe     */
59807dc194Richard Lowe    int    (*get_section_info)(void* obj, Dwarf_Half section_index,
59907dc194Richard Lowe        Dwarf_Obj_Access_Section* return_section, int* error);
60007dc194Richard Lowe    /**
60107dc194Richard Lowe     * get_byte_order
60207dc194Richard Lowe     *
60307dc194Richard Lowe     * Get whether the object file represented by this interface is big-endian
60407dc194Richard Lowe     * (DW_OBJECT_MSB) or little endian (DW_OBJECT_LSB).
60507dc194Richard Lowe     *
60607dc194Richard Lowe     * Parameters
60707dc194Richard Lowe     * obj - Equivalent to 'this' in OO languages.
60807dc194Richard Lowe     *
60907dc194Richard Lowe     * Return
61007dc194Richard Lowe     * Endianness of object. Cannot fail.
61107dc194Richard Lowe     */
61207dc194Richard Lowe    Dwarf_Endianness  (*get_byte_order)(void* obj);
61307dc194Richard Lowe    /**
61407dc194Richard Lowe     * get_length_size
61507dc194Richard Lowe     *
61607dc194Richard Lowe     * Get the size of a length field in the underlying object file.
61707dc194Richard Lowe     * libdwarf currently supports * 4 and 8 byte sizes, but may
61807dc194Richard Lowe     * support larger in the future.
61907dc194Richard Lowe     * Perhaps the return type should be an enumeration?
62007dc194Richard Lowe     *
62107dc194Richard Lowe     * Parameters
62207dc194Richard Lowe     * obj - Equivalent to 'this' in OO languages.
62307dc194Richard Lowe     *
62407dc194Richard Lowe     * Return
62507dc194Richard Lowe     * Size of length. Cannot fail.
62607dc194Richard Lowe     */
62707dc194Richard Lowe    Dwarf_Small   (*get_length_size)(void* obj);
62807dc194Richard Lowe    /**
62907dc194Richard Lowe     * get_pointer_size
63007dc194Richard Lowe     *
63107dc194Richard Lowe     * Get the size of a pointer field in the underlying object file.
63207dc194Richard Lowe     * libdwarf currently supports  4 and 8 byte sizes.
63307dc194Richard Lowe     * Perhaps the return type should be an enumeration?
63407dc194Richard Lowe
63507dc194Richard Lowe     * Return
63607dc194Richard Lowe     * Size of pointer. Cannot fail.
63707dc194Richard Lowe     */
63807dc194Richard Lowe    Dwarf_Small   (*get_pointer_size)(void* obj);
63907dc194Richard Lowe    /**
64007dc194Richard Lowe     * get_section_count
64107dc194Richard Lowe     *
64207dc194Richard Lowe     * Get the number of sections in the object file.
64307dc194Richard Lowe     *
64407dc194Richard Lowe     * Parameters
64507dc194Richard Lowe     *
64607dc194Richard Lowe     * Return
64707dc194Richard Lowe     * Number of sections
64807dc194Richard Lowe     */
64907dc194Richard Lowe    Dwarf_Unsigned  (*get_section_count)(void* obj);
65007dc194Richard Lowe    /**
65107dc194Richard Lowe     * load_section
65207dc194Richard Lowe     *
65307dc194Richard Lowe     * Get a pointer to an array of bytes that represent the section.
65407dc194Richard Lowe     *
65507dc194Richard Lowe     * Parameters
65607dc194Richard Lowe     * section_index - Zero-based index.
65707dc194Richard Lowe     * return_data - The address of a pointer to which the section data block
65807dc194Richard Lowe     *   will be assigned.
65907dc194Richard Lowe     * error - Pointer to an integer for returning libdwarf-defined
66007dc194Richard Lowe     *   error numbers.
66107dc194Richard Lowe     *
66207dc194Richard Lowe     * Return
66307dc194Richard Lowe     * DW_DLV_OK - No error.
66407dc194Richard Lowe     * DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
66507dc194Richard Lowe     *    error number.
66607dc194Richard Lowe     * DW_DLV_NO_ENTRY - No such section.
66707dc194Richard Lowe     */
66807dc194Richard Lowe    int    (*load_section)(void* obj, Dwarf_Half section_index,
66907dc194Richard Lowe        Dwarf_Small** return_data, int* error);
67007dc194Richard Lowe
67107dc194Richard Lowe   /**
67207dc194Richard Lowe    * relocate_a_section
67307dc194Richard Lowe    * If relocations are not supported leave this pointer NULL.
67407dc194Richard Lowe    *
67507dc194Richard Lowe    * Get a pointer to an array of bytes that represent the section.
67607dc194Richard Lowe    *
67707dc194Richard Lowe    * Parameters
67807dc194Richard Lowe    * section_index - Zero-based index of the section to be relocated.
67907dc194Richard Lowe    * error - Pointer to an integer for returning libdwarf-defined
68007dc194Richard Lowe    *   error numbers.
68107dc194Richard Lowe    *
68207dc194Richard Lowe    * Return
68307dc194Richard Lowe    * DW_DLV_OK - No error.
68407dc194Richard Lowe    * DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
68507dc194Richard Lowe    *    error number.
68607dc194Richard Lowe    * DW_DLV_NO_ENTRY - No such section.
68707dc194Richard Lowe    */
68807dc194Richard Lowe    int    (*relocate_a_section)(void* obj, Dwarf_Half section_index,
68907dc194Richard Lowe         Dwarf_Debug dbg,
69007dc194Richard Lowe         int* error);
69107dc194Richard Lowe
69207dc194Richard Lowe};
69307dc194Richard Lowe
69407dc194Richard Lowe
69507dc194Richard Lowe
69607dc194Richard Lowe/* These structures are allocated and deallocated by your code
69707dc194Richard Lowe   when you are using the libdwarf Object File Interface
69807dc194Richard Lowe   [dwarf_object_init() and dwarf_object_finish()] directly.
69907dc194Richard Lowe   dwarf_object_finish() does not free
70007dc194Richard Lowe   struct Dwarf_Obj_Access_Interface_s or its content.
70107dc194Richard Lowe   (libdwarf does record a pointer to this struct: you must
70207dc194Richard Lowe   ensure that pointer remains valid for as long as
70307dc194Richard Lowe   a libdwarf instance is open (meaning
70407dc194Richard Lowe   after dwarf_init() and before dwarf_finish()).
70507dc194Richard Lowe
70607dc194Richard Lowe   If you are reading Elf objects and libelf use dwarf_init()
70707dc194Richard Lowe   or dwarf_elf_init() which take care of these details.
70807dc194Richard Lowe*/
70907dc194Richard Lowestruct Dwarf_Obj_Access_Interface_s {
71007dc194Richard Lowe    /* object is a void* as it hides the data the object access routines
71107dc194Richard Lowe       need (which varies by library in use and object format).
71207dc194Richard Lowe    */
71307dc194Richard Lowe    void* object;
71407dc194Richard Lowe    const Dwarf_Obj_Access_Methods * methods;
71507dc194Richard Lowe};
71607dc194Richard Lowe
71707dc194Richard Lowe/* End libdwarf Object File Interface */
71807dc194Richard Lowe
7197c478bdstevel@tonic-gate/*
7207c478bdstevel@tonic-gate    Dwarf_dealloc() alloc_type arguments.
7217c478bdstevel@tonic-gate    Argument points to:
7227c478bdstevel@tonic-gate*/
72307dc194Richard Lowe#define DW_DLA_STRING          0x01     /* char* */
72407dc194Richard Lowe#define DW_DLA_LOC             0x02     /* Dwarf_Loc */
72507dc194Richard Lowe#define DW_DLA_LOCDESC         0x03     /* Dwarf_Locdesc */
72607dc194Richard Lowe#define DW_DLA_ELLIST          0x04     /* Dwarf_Ellist (not used)*/
72707dc194Richard Lowe#define DW_DLA_BOUNDS          0x05     /* Dwarf_Bounds (not used) */
72807dc194Richard Lowe#define DW_DLA_BLOCK           0x06     /* Dwarf_Block */
72907dc194Richard Lowe#define DW_DLA_DEBUG           0x07     /* Dwarf_Debug */
73007dc194Richard Lowe#define DW_DLA_DIE             0x08     /* Dwarf_Die */
73107dc194Richard Lowe#define DW_DLA_LINE            0x09     /* Dwarf_Line */
73207dc194Richard Lowe#define DW_DLA_ATTR            0x0a     /* Dwarf_Attribute */
73307dc194Richard Lowe#define DW_DLA_TYPE            0x0b     /* Dwarf_Type  (not used) */
73407dc194Richard Lowe#define DW_DLA_SUBSCR          0x0c     /* Dwarf_Subscr (not used) */
73507dc194Richard Lowe#define DW_DLA_GLOBAL          0x0d     /* Dwarf_Global */
73607dc194Richard Lowe#define DW_DLA_ERROR           0x0e     /* Dwarf_Error */
73707dc194Richard Lowe#define DW_DLA_LIST            0x0f     /* a list */
73807dc194Richard Lowe#define DW_DLA_LINEBUF         0x10     /* Dwarf_Line* (not used) */
73907dc194Richard Lowe#define DW_DLA_ARANGE          0x11     /* Dwarf_Arange */
74007dc194Richard Lowe#define DW_DLA_ABBREV          0x12      /* Dwarf_Abbrev */
74107dc194Richard Lowe#define DW_DLA_FRAME_OP        0x13      /* Dwarf_Frame_Op */
74207dc194Richard Lowe#define DW_DLA_CIE             0x14     /* Dwarf_Cie */
74307dc194Richard Lowe#define DW_DLA_FDE             0x15     /* Dwarf_Fde */
74407dc194Richard Lowe#define DW_DLA_LOC_BLOCK       0x16     /* Dwarf_Loc Block (not used) */
74507dc194Richard Lowe#define DW_DLA_FRAME_BLOCK     0x17     /* Dwarf_Frame Block (not used) */
74607dc194Richard Lowe#define DW_DLA_FUNC            0x18     /* Dwarf_Func */
74707dc194Richard Lowe#define DW_DLA_TYPENAME        0x19     /* Dwarf_Type */
74807dc194Richard Lowe#define DW_DLA_VAR             0x1a     /* Dwarf_Var */
74907dc194Richard Lowe#define DW_DLA_WEAK            0x1b     /* Dwarf_Weak */
75007dc194Richard Lowe#define DW_DLA_ADDR            0x1c     /* Dwarf_Addr sized entries */
75107dc194Richard Lowe#define DW_DLA_RANGES          0x1d     /* Dwarf_Ranges */
7527c478bdstevel@tonic-gate
7537c478bdstevel@tonic-gate/* The augmenter string for CIE */
7547c478bdstevel@tonic-gate#define DW_CIE_AUGMENTER_STRING_V0              "z"
7557c478bdstevel@tonic-gate
7567c478bdstevel@tonic-gate/* dwarf_init() access arguments
7577c478bdstevel@tonic-gate*/
7587c478bdstevel@tonic-gate#define DW_DLC_READ        0        /* read only access */
7597c478bdstevel@tonic-gate#define DW_DLC_WRITE       1        /* write only access */
7607c478bdstevel@tonic-gate#define DW_DLC_RDWR        2        /* read/write access NOT SUPPORTED*/
7617c478bdstevel@tonic-gate
76207dc194Richard Lowe/* pro_init() access flag modifiers
76307dc194Richard Lowe   If HAVE_DWARF2_99_EXTENSION is defined at libdwarf build time
76407dc194Richard Lowe   and DW_DLC_OFFSET_SIZE_64  is passed in pro_init() flags then the DWARF3
76507dc194Richard Lowe   64 bit offset extension is used to generate 64 bit offsets.
7667c478bdstevel@tonic-gate*/
76707dc194Richard Lowe#define DW_DLC_SIZE_64     0x40000000 /* 32-bit address-size target */
76807dc194Richard Lowe#define DW_DLC_SIZE_32     0x20000000 /* 64-bit address-size target */
76907dc194Richard Lowe#define DW_DLC_OFFSET_SIZE_64 0x10000000 /* 64-bit offset-size DWARF */
7707c478bdstevel@tonic-gate
77107dc194Richard Lowe/* dwarf_pro_init() access flag modifiers
7727c478bdstevel@tonic-gate*/
7737c478bdstevel@tonic-gate#define DW_DLC_ISA_MIPS             0x00000000 /* MIPS target */
7747c478bdstevel@tonic-gate#define DW_DLC_ISA_IA64             0x01000000 /* IA64 target */
77507dc194Richard Lowe#define DW_DLC_STREAM_RELOCATIONS   0x02000000 /* Old style binary relocs */
77607dc194Richard Lowe
77707dc194Richard Lowe    /* Usable with assembly output because it is up to the producer to
77807dc194Richard Lowe       deal with locations in whatever manner the producer code wishes.
77907dc194Richard Lowe       Possibly emitting text an assembler will recognize. */
78007dc194Richard Lowe#define DW_DLC_SYMBOLIC_RELOCATIONS 0x04000000
78107dc194Richard Lowe
78207dc194Richard Lowe#define DW_DLC_TARGET_BIGENDIAN     0x08000000 /* Big    endian target */
78307dc194Richard Lowe#define DW_DLC_TARGET_LITTLEENDIAN  0x00100000 /* Little endian target */
78407dc194Richard Lowe
78507dc194Richard Lowe#if 0
78607dc194Richard Lowe  /*
78707dc194Richard Lowe   The libdwarf producer interfaces jumble these two semantics together in
78807dc194Richard Lowe   confusing ways.  We *should* have flags like these...
78907dc194Richard Lowe   But changing the code means a lot of diffs.  So for now,
79007dc194Richard Lowe   we leave things as they are
79107dc194Richard Lowe  */
79207dc194Richard Lowe  #define DW_DLC_SUN_OFFSET32        0x00010000 /* use 32-bit sec offsets */
79307dc194Richard Lowe  #define DW_DLC_SUN_OFFSET64        0x00020000 /* use 64-bit sec offsets */
79407dc194Richard Lowe  #define DW_DLC_SUN_POINTER32        0x00040000 /* use 4 for address_size */
79507dc194Richard Lowe  #define DW_DLC_SUN_POINTER64        0x00080000 /* use 8 for address_size */
79607dc194Richard Lowe#endif
7977c478bdstevel@tonic-gate
7987c478bdstevel@tonic-gate/* dwarf_pcline() slide arguments
7997c478bdstevel@tonic-gate*/
8007c478bdstevel@tonic-gate#define DW_DLS_BACKWARD   -1       /* slide backward to find line */
8017c478bdstevel@tonic-gate#define DW_DLS_NOSLIDE     0       /* match exactly without sliding */
8027c478bdstevel@tonic-gate#define DW_DLS_FORWARD     1       /* slide forward to find line */
8037c478bdstevel@tonic-gate
8047c478bdstevel@tonic-gate/* libdwarf error numbers
8057c478bdstevel@tonic-gate*/
8067c478bdstevel@tonic-gate#define DW_DLE_NE          0     /* no error */
8077c478bdstevel@tonic-gate#define DW_DLE_VMM         1     /* dwarf format/library version mismatch */
8087c478bdstevel@tonic-gate#define DW_DLE_MAP         2     /* memory map failure */
8097c478bdstevel@tonic-gate#define DW_DLE_LEE         3     /* libelf error */
8107c478bdstevel@tonic-gate#define DW_DLE_NDS         4     /* no debug section */
8117c478bdstevel@tonic-gate#define DW_DLE_NLS         5     /* no line section */
8127c478bdstevel@tonic-gate#define DW_DLE_ID          6     /* invalid descriptor for query */
8137c478bdstevel@tonic-gate#define DW_DLE_IOF         7     /* I/O failure */
8147c478bdstevel@tonic-gate#define DW_DLE_MAF         8     /* memory allocation failure */
8157c478bdstevel@tonic-gate#define DW_DLE_IA          9     /* invalid argument */
8167c478bdstevel@tonic-gate#define DW_DLE_MDE         10     /* mangled debugging entry */
8177c478bdstevel@tonic-gate#define DW_DLE_MLE         11     /* mangled line number entry */
8187c478bdstevel@tonic-gate#define DW_DLE_FNO         12     /* file not open */
8197c478bdstevel@tonic-gate#define DW_DLE_FNR         13     /* file not a regular file */
8207c478bdstevel@tonic-gate#define DW_DLE_FWA         14     /* file open with wrong access */
8217c478bdstevel@tonic-gate#define DW_DLE_NOB         15     /* not an object file */
8227c478bdstevel@tonic-gate#define DW_DLE_MOF         16     /* mangled object file header */
8237c478bdstevel@tonic-gate#define DW_DLE_EOLL        17     /* end of location list entries */
8247c478bdstevel@tonic-gate#define DW_DLE_NOLL        18     /* no location list section */
8257c478bdstevel@tonic-gate#define DW_DLE_BADOFF      19     /* Invalid offset */
8267c478bdstevel@tonic-gate#define DW_DLE_EOS         20     /* end of section  */
8277c478bdstevel@tonic-gate#define DW_DLE_ATRUNC      21     /* abbreviations section appears truncated*/
8287c478bdstevel@tonic-gate#define DW_DLE_BADBITC     22     /* Address size passed to dwarf bad*/
82907dc194Richard Lowe                    /* It is not an allowed size (64 or 32) */
8307c478bdstevel@tonic-gate    /* Error codes defined by the current Libdwarf Implementation. */
8317c478bdstevel@tonic-gate#define DW_DLE_DBG_ALLOC                        23
8327c478bdstevel@tonic-gate#define DW_DLE_FSTAT_ERROR                      24
8337c478bdstevel@tonic-gate#define DW_DLE_FSTAT_MODE_ERROR                 25
8347c478bdstevel@tonic-gate#define DW_DLE_INIT_ACCESS_WRONG                26
8357c478bdstevel@tonic-gate#define DW_DLE_ELF_BEGIN_ERROR                  27
8367c478bdstevel@tonic-gate#define DW_DLE_ELF_GETEHDR_ERROR                28
8377c478bdstevel@tonic-gate#define DW_DLE_ELF_GETSHDR_ERROR                29
8387c478bdstevel@tonic-gate#define DW_DLE_ELF_STRPTR_ERROR                 30
8397c478bdstevel@tonic-gate#define DW_DLE_DEBUG_INFO_DUPLICATE             31
8407c478bdstevel@tonic-gate#define DW_DLE_DEBUG_INFO_NULL                  32
8417c478bdstevel@tonic-gate#define DW_DLE_DEBUG_ABBREV_DUPLICATE           33
8427c478bdstevel@tonic-gate#define DW_DLE_DEBUG_ABBREV_NULL                34
8437c478bdstevel@tonic-gate#define DW_DLE_DEBUG_ARANGES_DUPLICATE          35
8447c478bdstevel@tonic-gate#define DW_DLE_DEBUG_ARANGES_NULL               36
8457c478bdstevel@tonic-gate#define DW_DLE_DEBUG_LINE_DUPLICATE             37
8467c478bdstevel@tonic-gate#define DW_DLE_DEBUG_LINE_NULL                  38
8477c478bdstevel@tonic-gate#define DW_DLE_DEBUG_LOC_DUPLICATE              39
8487c478bdstevel@tonic-gate#define DW_DLE_DEBUG_LOC_NULL                   40
8497c478bdstevel@tonic-gate#define DW_DLE_DEBUG_MACINFO_DUPLICATE          41
8507c478bdstevel@tonic-gate#define DW_DLE_DEBUG_MACINFO_NULL               42
8517c478bdstevel@tonic-gate#define DW_DLE_DEBUG_PUBNAMES_DUPLICATE         43
8527c478bdstevel@tonic-gate#define DW_DLE_DEBUG_PUBNAMES_NULL              44
8537c478bdstevel@tonic-gate#define DW_DLE_DEBUG_STR_DUPLICATE              45
8547c478bdstevel@tonic-gate#define DW_DLE_DEBUG_STR_NULL                   46
8557c478bdstevel@tonic-gate#define DW_DLE_CU_LENGTH_ERROR                  47
8567c478bdstevel@tonic-gate#define DW_DLE_VERSION_STAMP_ERROR              48
8577c478bdstevel@tonic-gate#define DW_DLE_ABBREV_OFFSET_ERROR              49
8587c478bdstevel@tonic-gate#define DW_DLE_ADDRESS_SIZE_ERROR               50
8597c478bdstevel@tonic-gate#define DW_DLE_DEBUG_INFO_PTR_NULL              51
8607c478bdstevel@tonic-gate#define DW_DLE_DIE_NULL                         52
8617c478bdstevel@tonic-gate#define DW_DLE_STRING_OFFSET_BAD                53
8627c478bdstevel@tonic-gate#define DW_DLE_DEBUG_LINE_LENGTH_BAD            54
8637c478bdstevel@tonic-gate#define DW_DLE_LINE_PROLOG_LENGTH_BAD           55
8647c478bdstevel@tonic-gate#define DW_DLE_LINE_NUM_OPERANDS_BAD            56
86507dc194Richard Lowe#define DW_DLE_LINE_SET_ADDR_ERROR              57 /* No longer used. */
8667c478bdstevel@tonic-gate#define DW_DLE_LINE_EXT_OPCODE_BAD              58
8677c478bdstevel@tonic-gate#define DW_DLE_DWARF_LINE_NULL                  59
8687c478bdstevel@tonic-gate#define DW_DLE_INCL_DIR_NUM_BAD                 60
8697c478bdstevel@tonic-gate#define DW_DLE_LINE_FILE_NUM_BAD                61
8707c478bdstevel@tonic-gate#define DW_DLE_ALLOC_FAIL                       62
87107dc194Richard Lowe#define DW_DLE_NO_CALLBACK_FUNC                 63
87207dc194Richard Lowe#define DW_DLE_SECT_ALLOC                       64
87307dc194Richard Lowe#define DW_DLE_FILE_ENTRY_ALLOC                 65
87407dc194Richard Lowe#define DW_DLE_LINE_ALLOC                       66
87507dc194Richard Lowe#define DW_DLE_FPGM_ALLOC                       67
87607dc194Richard Lowe#define DW_DLE_INCDIR_ALLOC                     68
87707dc194Richard Lowe#define DW_DLE_STRING_ALLOC                     69
87807dc194Richard Lowe#define DW_DLE_CHUNK_ALLOC                      70
87907dc194Richard Lowe#define DW_DLE_BYTEOFF_ERR                      71
88007dc194Richard Lowe#define DW_DLE_CIE_ALLOC                        72
88107dc194Richard Lowe#define DW_DLE_FDE_ALLOC                        73
88207dc194Richard Lowe#define DW_DLE_REGNO_OVFL                       74
88307dc194Richard Lowe#define DW_DLE_CIE_OFFS_ALLOC                   75
88407dc194Richard Lowe#define DW_DLE_WRONG_ADDRESS                    76
88507dc194Richard Lowe#define DW_DLE_EXTRA_NEIGHBORS                  77
88607dc194Richard Lowe#define    DW_DLE_WRONG_TAG                     78
88707dc194Richard Lowe#define DW_DLE_DIE_ALLOC                        79
88807dc194Richard Lowe#define DW_DLE_PARENT_EXISTS                    80
8897c478bdstevel@tonic-gate#define DW_DLE_DBG_NULL                         81
89007dc194Richard Lowe#define DW_DLE_DEBUGLINE_ERROR                  82
89107dc194Richard Lowe#define DW_DLE_DEBUGFRAME_ERROR                 83
89207dc194Richard Lowe#define DW_DLE_DEBUGINFO_ERROR                  84
89307dc194Richard Lowe#define DW_DLE_ATTR_ALLOC                       85
89407dc194Richard Lowe#define DW_DLE_ABBREV_ALLOC                     86
89507dc194Richard Lowe#define DW_DLE_OFFSET_UFLW                      87
89607dc194Richard Lowe#define DW_DLE_ELF_SECT_ERR                     88
89707dc194Richard Lowe#define DW_DLE_DEBUG_FRAME_LENGTH_BAD           89
89807dc194Richard Lowe#define DW_DLE_FRAME_VERSION_BAD                90
89907dc194Richard Lowe#define DW_DLE_CIE_RET_ADDR_REG_ERROR           91
90007dc194Richard Lowe#define DW_DLE_FDE_NULL                         92
90107dc194Richard Lowe#define DW_DLE_FDE_DBG_NULL                     93
90207dc194Richard Lowe#define DW_DLE_CIE_NULL                         94
90307dc194Richard Lowe#define DW_DLE_CIE_DBG_NULL                     95
90407dc194Richard Lowe#define DW_DLE_FRAME_TABLE_COL_BAD              96
90507dc194Richard Lowe#define DW_DLE_PC_NOT_IN_FDE_RANGE              97
90607dc194Richard Lowe#define DW_DLE_CIE_INSTR_EXEC_ERROR             98
90707dc194Richard Lowe#define DW_DLE_FRAME_INSTR_EXEC_ERROR           99
90807dc194Richard Lowe#define DW_DLE_FDE_PTR_NULL                    100
90907dc194Richard Lowe#define DW_DLE_RET_OP_LIST_NULL                101
91007dc194Richard Lowe#define DW_DLE_LINE_CONTEXT_NULL               102
91107dc194Richard Lowe#define DW_DLE_DBG_NO_CU_CONTEXT               103
91207dc194Richard Lowe#define DW_DLE_DIE_NO_CU_CONTEXT               104
91307dc194Richard Lowe#define DW_DLE_FIRST_DIE_NOT_CU                105
91407dc194Richard Lowe#define DW_DLE_NEXT_DIE_PTR_NULL               106
91507dc194Richard Lowe#define DW_DLE_DEBUG_FRAME_DUPLICATE           107
91607dc194Richard Lowe#define DW_DLE_DEBUG_FRAME_NULL                108
91707dc194Richard Lowe#define DW_DLE_ABBREV_DECODE_ERROR             109
91807dc194Richard Lowe#define DW_DLE_DWARF_ABBREV_NULL               110
91907dc194Richard Lowe#define DW_DLE_ATTR_NULL                       111
92007dc194Richard Lowe#define DW_DLE_DIE_BAD                         112
92107dc194Richard Lowe#define DW_DLE_DIE_ABBREV_BAD                  113
92207dc194Richard Lowe#define DW_DLE_ATTR_FORM_BAD                   114
92307dc194Richard Lowe#define DW_DLE_ATTR_NO_CU_CONTEXT              115
92407dc194Richard Lowe#define DW_DLE_ATTR_FORM_SIZE_BAD              116
92507dc194Richard Lowe#define DW_DLE_ATTR_DBG_NULL                   117
92607dc194Richard Lowe#define DW_DLE_BAD_REF_FORM                    118
92707dc194Richard Lowe#define DW_DLE_ATTR_FORM_OFFSET_BAD            119
92807dc194Richard Lowe#define DW_DLE_LINE_OFFSET_BAD                 120
92907dc194Richard Lowe#define DW_DLE_DEBUG_STR_OFFSET_BAD            121
93007dc194Richard Lowe#define DW_DLE_STRING_PTR_NULL                 122
93107dc194Richard Lowe#define DW_DLE_PUBNAMES_VERSION_ERROR          123
93207dc194Richard Lowe#define DW_DLE_PUBNAMES_LENGTH_BAD             124
93307dc194Richard Lowe#define DW_DLE_GLOBAL_NULL                     125
93407dc194Richard Lowe#define DW_DLE_GLOBAL_CONTEXT_NULL             126
93507dc194Richard Lowe#define DW_DLE_DIR_INDEX_BAD                   127
93607dc194Richard Lowe#define DW_DLE_LOC_EXPR_BAD                    128
93707dc194Richard Lowe#define DW_DLE_DIE_LOC_EXPR_BAD                129
93807dc194Richard Lowe#define DW_DLE_ADDR_ALLOC                      130
93907dc194Richard Lowe#define DW_DLE_OFFSET_BAD                      131
94007dc194Richard Lowe#define DW_DLE_MAKE_CU_CONTEXT_FAIL            132
94107dc194Richard Lowe#define DW_DLE_REL_ALLOC                       133
94207dc194Richard Lowe#define DW_DLE_ARANGE_OFFSET_BAD               134
94307dc194Richard Lowe#define DW_DLE_SEGMENT_SIZE_BAD                135
94407dc194Richard Lowe#define DW_DLE_ARANGE_LENGTH_BAD               136
94507dc194Richard Lowe#define DW_DLE_ARANGE_DECODE_ERROR             137
94607dc194Richard Lowe#define DW_DLE_ARANGES_NULL                    138
94707dc194Richard Lowe#define DW_DLE_ARANGE_NULL                     139
94807dc194Richard Lowe#define DW_DLE_NO_FILE_NAME                    140
94907dc194Richard Lowe#define DW_DLE_NO_COMP_DIR                     141
95007dc194Richard Lowe#define DW_DLE_CU_ADDRESS_SIZE_BAD             142
95107dc194Richard Lowe#define DW_DLE_INPUT_ATTR_BAD                  143
95207dc194Richard Lowe#define DW_DLE_EXPR_NULL                       144
95307dc194Richard Lowe#define DW_DLE_BAD_EXPR_OPCODE                 145
95407dc194Richard Lowe#define DW_DLE_EXPR_LENGTH_BAD                 146
95507dc194Richard Lowe#define DW_DLE_MULTIPLE_RELOC_IN_EXPR          147
95607dc194Richard Lowe#define DW_DLE_ELF_GETIDENT_ERROR              148
95707dc194Richard Lowe#define DW_DLE_NO_AT_MIPS_FDE                  149
95807dc194Richard Lowe#define DW_DLE_NO_CIE_FOR_FDE                  150
95907dc194Richard Lowe#define DW_DLE_DIE_ABBREV_LIST_NULL            151
96007dc194Richard Lowe#define DW_DLE_DEBUG_FUNCNAMES_DUPLICATE       152
96107dc194Richard Lowe#define DW_DLE_DEBUG_FUNCNAMES_NULL            153
96207dc194Richard Lowe#define DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR   154
96307dc194Richard Lowe#define DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD      155
96407dc194Richard Lowe#define DW_DLE_FUNC_NULL                       156
96507dc194Richard Lowe#define DW_DLE_FUNC_CONTEXT_NULL               157
96607dc194Richard Lowe#define DW_DLE_DEBUG_TYPENAMES_DUPLICATE       158
96707dc194Richard Lowe#define DW_DLE_DEBUG_TYPENAMES_NULL            159
96807dc194Richard Lowe#define DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR   160
96907dc194Richard Lowe#define DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD      161
97007dc194Richard Lowe#define DW_DLE_TYPE_NULL                       162
97107dc194Richard Lowe#define DW_DLE_TYPE_CONTEXT_NULL               163
97207dc194Richard Lowe#define DW_DLE_DEBUG_VARNAMES_DUPLICATE        164
97307dc194Richard Lowe#define DW_DLE_DEBUG_VARNAMES_NULL             165
97407dc194Richard Lowe#define DW_DLE_DEBUG_VARNAMES_VERSION_ERROR    166
97507dc194Richard Lowe#define DW_DLE_DEBUG_VARNAMES_LENGTH_BAD       167
97607dc194Richard Lowe#define DW_DLE_VAR_NULL                        168
97707dc194Richard Lowe#define DW_DLE_VAR_CONTEXT_NULL                169
97807dc194Richard Lowe#define DW_DLE_DEBUG_WEAKNAMES_DUPLICATE       170
97907dc194Richard Lowe#define DW_DLE_DEBUG_WEAKNAMES_NULL            171
98007dc194Richard Lowe#define DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR   172
98107dc194Richard Lowe#define DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD      173
98207dc194Richard Lowe#define DW_DLE_WEAK_NULL                       174
98307dc194Richard Lowe#define DW_DLE_WEAK_CONTEXT_NULL               175
98407dc194Richard Lowe#define DW_DLE_LOCDESC_COUNT_WRONG             176
98507dc194Richard Lowe#define DW_DLE_MACINFO_STRING_NULL             177
98607dc194Richard Lowe#define DW_DLE_MACINFO_STRING_EMPTY            178
98707dc194Richard Lowe#define DW_DLE_MACINFO_INTERNAL_ERROR_SPACE    179
98807dc194Richard Lowe#define DW_DLE_MACINFO_MALLOC_FAIL             180
98907dc194Richard Lowe#define DW_DLE_DEBUGMACINFO_ERROR              181
99007dc194Richard Lowe#define DW_DLE_DEBUG_MACRO_LENGTH_BAD          182
99107dc194Richard Lowe#define DW_DLE_DEBUG_MACRO_MAX_BAD             183
99207dc194Richard Lowe#define DW_DLE_DEBUG_MACRO_INTERNAL_ERR        184
99307dc194Richard Lowe#define DW_DLE_DEBUG_MACRO_MALLOC_SPACE        185
99407dc194Richard Lowe#define DW_DLE_DEBUG_MACRO_INCONSISTENT        186
99507dc194Richard Lowe#define DW_DLE_DF_NO_CIE_AUGMENTATION          187
99607dc194Richard Lowe#define DW_DLE_DF_REG_NUM_TOO_HIGH             188
99707dc194Richard Lowe#define DW_DLE_DF_MAKE_INSTR_NO_INIT           189
99807dc194Richard Lowe#define DW_DLE_DF_NEW_LOC_LESS_OLD_LOC         190
99907dc194Richard Lowe#define DW_DLE_DF_POP_EMPTY_STACK              191
100007dc194Richard Lowe#define DW_DLE_DF_ALLOC_FAIL                   192
100107dc194Richard Lowe#define DW_DLE_DF_FRAME_DECODING_ERROR         193
100207dc194Richard Lowe#define DW_DLE_DEBUG_LOC_SECTION_SHORT         194
100307dc194Richard Lowe#define DW_DLE_FRAME_AUGMENTATION_UNKNOWN      195
100407dc194Richard Lowe#define DW_DLE_PUBTYPE_CONTEXT                 196 /* Unused. */
100507dc194Richard Lowe#define DW_DLE_DEBUG_PUBTYPES_LENGTH_BAD       197
100607dc194Richard Lowe#define DW_DLE_DEBUG_PUBTYPES_VERSION_ERROR    198
100707dc194Richard Lowe#define DW_DLE_DEBUG_PUBTYPES_DUPLICATE        199
100807dc194Richard Lowe#define DW_DLE_FRAME_CIE_DECODE_ERROR          200
100907dc194Richard Lowe#define DW_DLE_FRAME_REGISTER_UNREPRESENTABLE  201
101007dc194Richard Lowe#define DW_DLE_FRAME_REGISTER_COUNT_MISMATCH   202
101107dc194Richard Lowe#define DW_DLE_LINK_LOOP                       203
101207dc194Richard Lowe#define DW_DLE_STRP_OFFSET_BAD                 204
101307dc194Richard Lowe#define DW_DLE_DEBUG_RANGES_DUPLICATE          205
101407dc194Richard Lowe#define DW_DLE_DEBUG_RANGES_OFFSET_BAD         206
101507dc194Richard Lowe#define DW_DLE_DEBUG_RANGES_MISSING_END        207
101607dc194Richard Lowe#define DW_DLE_DEBUG_RANGES_OUT_OF_MEM         208
101707dc194Richard Lowe#define DW_DLE_DEBUG_SYMTAB_ERR                209
101807dc194Richard Lowe#define DW_DLE_DEBUG_STRTAB_ERR                210
101907dc194Richard Lowe#define DW_DLE_RELOC_MISMATCH_INDEX            211
102007dc194Richard Lowe#define DW_DLE_RELOC_MISMATCH_RELOC_INDEX      212
102107dc194Richard Lowe#define DW_DLE_RELOC_MISMATCH_STRTAB_INDEX     213
102207dc194Richard Lowe#define DW_DLE_RELOC_SECTION_MISMATCH          214
102307dc194Richard Lowe#define DW_DLE_RELOC_SECTION_MISSING_INDEX     215
102407dc194Richard Lowe#define DW_DLE_RELOC_SECTION_LENGTH_ODD        216
102507dc194Richard Lowe#define DW_DLE_RELOC_SECTION_PTR_NULL          217
102607dc194Richard Lowe#define DW_DLE_RELOC_SECTION_MALLOC_FAIL       218
102707dc194Richard Lowe#define DW_DLE_NO_ELF64_SUPPORT                219
102807dc194Richard Lowe#define DW_DLE_MISSING_ELF64_SUPPORT           220
102907dc194Richard Lowe#define DW_DLE_ORPHAN_FDE                      221
103007dc194Richard Lowe#define DW_DLE_DUPLICATE_INST_BLOCK            222
103107dc194Richard Lowe#define DW_DLE_BAD_REF_SIG8_FORM               223
103207dc194Richard Lowe#define DW_DLE_ATTR_EXPRLOC_FORM_BAD           224
103307dc194Richard Lowe#define DW_DLE_FORM_SEC_OFFSET_LENGTH_BAD      225
103407dc194Richard Lowe#define DW_DLE_NOT_REF_FORM                    226
103507dc194Richard Lowe#define DW_DLE_DEBUG_FRAME_LENGTH_NOT_MULTIPLE 227
103607dc194Richard Lowe
103707dc194Richard Lowe
10387c478bdstevel@tonic-gate
10397c478bdstevel@tonic-gate    /* DW_DLE_LAST MUST EQUAL LAST ERROR NUMBER */
104007dc194Richard Lowe#define DW_DLE_LAST        227
10417c478bdstevel@tonic-gate#define DW_DLE_LO_USER     0x10000
10427c478bdstevel@tonic-gate
104307dc194Richard Lowe   /* Taken as meaning 'undefined value', this is not
104407dc194Richard Lowe      a column or register number.
104507dc194Richard Lowe      Only present at libdwarf runtime. Never on disk.
104607dc194Richard Lowe      DW_FRAME_* Values present on disk are in dwarf.h
104707dc194Richard Lowe   */
10487c478bdstevel@tonic-gate#define DW_FRAME_UNDEFINED_VAL          1034
10497c478bdstevel@tonic-gate
105007dc194Richard Lowe   /* Taken as meaning 'same value' as caller had, not a column
105107dc194Richard Lowe      or register number
105207dc194Richard Lowe      Only present at libdwarf runtime. Never on disk.
105307dc194Richard Lowe      DW_FRAME_* Values present on disk are in dwarf.h
105407dc194Richard Lowe   */
10557c478bdstevel@tonic-gate#define DW_FRAME_SAME_VAL               1035
10567c478bdstevel@tonic-gate
10577c478bdstevel@tonic-gate
10587c478bdstevel@tonic-gate
10597c478bdstevel@tonic-gate/* error return values
10607c478bdstevel@tonic-gate*/
10617c478bdstevel@tonic-gate#define DW_DLV_BADADDR     (~(Dwarf_Addr)0)
106207dc194Richard Lowe    /* for functions returning target address */
10637c478bdstevel@tonic-gate
10647c478bdstevel@tonic-gate#define DW_DLV_NOCOUNT     ((Dwarf_Signed)-1)
106507dc194Richard Lowe    /* for functions returning count */
10667c478bdstevel@tonic-gate
10677c478bdstevel@tonic-gate#define DW_DLV_BADOFFSET   (~(Dwarf_Off)0)
106807dc194Richard Lowe    /* for functions returning offset */
10697c478bdstevel@tonic-gate
10707c478bdstevel@tonic-gate/* standard return values for functions */
10717c478bdstevel@tonic-gate#define DW_DLV_NO_ENTRY -1
10727c478bdstevel@tonic-gate#define DW_DLV_OK        0
10737c478bdstevel@tonic-gate#define DW_DLV_ERROR     1
10747c478bdstevel@tonic-gate
10757c478bdstevel@tonic-gate/* Special values for offset_into_exception_table field of dwarf fde's. */
10767c478bdstevel@tonic-gate/* The following value indicates that there is no Exception table offset
10777c478bdstevel@tonic-gate   associated with a dwarf frame. */
107807dc194Richard Lowe#define DW_DLX_NO_EH_OFFSET         (-1LL)
10797c478bdstevel@tonic-gate/* The following value indicates that the producer was unable to analyse the
10807c478bdstevel@tonic-gate   source file to generate Exception tables for this function. */
10817c478bdstevel@tonic-gate#define DW_DLX_EH_OFFSET_UNAVAILABLE  (-2LL)
10827c478bdstevel@tonic-gate
10837c478bdstevel@tonic-gate
10847c478bdstevel@tonic-gate/*===========================================================================*/
10857c478bdstevel@tonic-gate/*  Dwarf consumer interface initialization and termination operations */
10867c478bdstevel@tonic-gate
108707dc194Richard Lowe/* Initialization based on Unix open fd (using libelf internally). */
108807dc194Richard Loweint dwarf_init(int    /*fd*/,
108907dc194Richard Lowe    Dwarf_Unsigned    /*access*/,
109007dc194Richard Lowe    Dwarf_Handler     /*errhand*/,
109107dc194Richard Lowe    Dwarf_Ptr         /*errarg*/,
109207dc194Richard Lowe    Dwarf_Debug*      /*dbg*/,
109307dc194Richard Lowe    Dwarf_Error*      /*error*/);
10947c478bdstevel@tonic-gate
109507dc194Richard Lowe/* Initialization based on libelf/sgi-fastlibelf open pointer. */
109649d3bc9Richard Loweint dwarf_elf_init(dwarf_elf_handle /*elf*/,
109707dc194Richard Lowe    Dwarf_Unsigned    /*access*/,
109807dc194Richard Lowe    Dwarf_Handler     /*errhand*/,
109907dc194Richard Lowe    Dwarf_Ptr         /*errarg*/,
110007dc194Richard Lowe    Dwarf_Debug*      /*dbg*/,
110107dc194Richard Lowe    Dwarf_Error*      /*error*/);
11027c478bdstevel@tonic-gate
11037c478bdstevel@tonic-gate/* Undocumented function for memory allocator. */
11047c478bdstevel@tonic-gatevoid dwarf_print_memory_stats(Dwarf_Debug  /*dbg*/);
11057c478bdstevel@tonic-gate
11067c478bdstevel@tonic-gateint dwarf_get_elf(Dwarf_Debug /*dbg*/,
110707dc194Richard Lowe    dwarf_elf_handle* /*return_elfptr*/,
110807dc194Richard Lowe    Dwarf_Error*      /*error*/);
11097c478bdstevel@tonic-gate
11107c478bdstevel@tonic-gateint dwarf_finish(Dwarf_Debug /*dbg*/, Dwarf_Error* /*error*/);
11117c478bdstevel@tonic-gate
111207dc194Richard Lowe
111307dc194Richard Loweint dwarf_object_init(Dwarf_Obj_Access_Interface* /* obj */,
111407dc194Richard Lowe    Dwarf_Handler /* errhand */,
111507dc194Richard Lowe    Dwarf_Ptr     /* errarg */,
111607dc194Richard Lowe    Dwarf_Debug*  /* dbg */,
111707dc194Richard Lowe    Dwarf_Error*  /* error */);
111807dc194Richard Lowe
111907dc194Richard Loweint dwarf_object_finish(Dwarf_Debug /* dbg */,
112007dc194Richard Lowe    Dwarf_Error* /* error */);
112107dc194Richard Lowe
11227c478bdstevel@tonic-gate/* die traversal operations */
112307dc194Richard Loweint dwarf_next_cu_header_b(Dwarf_Debug /*dbg*/,
112407dc194Richard Lowe    Dwarf_Unsigned* /*cu_header_length*/,
112507dc194Richard Lowe    Dwarf_Half*     /*version_stamp*/,
112607dc194Richard Lowe    Dwarf_Off*      /*abbrev_offset*/,
112707dc194Richard Lowe    Dwarf_Half*     /*address_size*/,
112807dc194Richard Lowe    Dwarf_Half*     /*length_size*/,
112907dc194Richard Lowe    Dwarf_Half*     /*extension_size*/,
113007dc194Richard Lowe    Dwarf_Unsigned* /*next_cu_header_offset*/,
113107dc194Richard Lowe    Dwarf_Error*    /*error*/);
113207dc194Richard Lowe/* The following is now obsolete, though supported. November 2009. */
11337c478bdstevel@tonic-gateint dwarf_next_cu_header(Dwarf_Debug /*dbg*/,
113407dc194Richard Lowe    Dwarf_Unsigned* /*cu_header_length*/,
113507dc194Richard Lowe    Dwarf_Half*     /*version_stamp*/,
113607dc194Richard Lowe    Dwarf_Off*      /*abbrev_offset*/,
113707dc194Richard Lowe    Dwarf_Half*     /*address_size*/,
113807dc194Richard Lowe    Dwarf_Unsigned* /*next_cu_header_offset*/,
113907dc194Richard Lowe    Dwarf_Error*    /*error*/);
11407c478bdstevel@tonic-gate
11417c478bdstevel@tonic-gateint dwarf_siblingof(Dwarf_Debug /*dbg*/,
114207dc194Richard Lowe    Dwarf_Die        /*die*/,
114307dc194Richard Lowe    Dwarf_Die*       /*return_siblingdie*/,
114407dc194Richard Lowe    Dwarf_Error*     /*error*/);
11457c478bdstevel@tonic-gate
11467c478bdstevel@tonic-gateint dwarf_child(Dwarf_Die /*die*/,
114707dc194Richard Lowe    Dwarf_Die*       /*return_childdie*/,
114807dc194Richard Lowe    Dwarf_Error*     /*error*/);
11497c478bdstevel@tonic-gate
115007dc194Richard Lowe/* Finding die given global (not CU-relative) offset */
11517c478bdstevel@tonic-gateint dwarf_offdie(Dwarf_Debug /*dbg*/,
115207dc194Richard Lowe    Dwarf_Off        /*offset*/,
115307dc194Richard Lowe    Dwarf_Die*       /*return_die*/,
115407dc194Richard Lowe    Dwarf_Error*     /*error*/);
11557c478bdstevel@tonic-gate
115607dc194Richard Lowe/* Higher level functions (Unimplemented) */
11577c478bdstevel@tonic-gateint dwarf_pcfile(Dwarf_Debug /*dbg*/,
115807dc194Richard Lowe    Dwarf_Addr       /*pc*/,
115907dc194Richard Lowe    Dwarf_Die*       /*return_die*/,
116007dc194Richard Lowe    Dwarf_Error*     /*error*/);
11617c478bdstevel@tonic-gate
11627c478bdstevel@tonic-gate/* Unimplemented */
11637c478bdstevel@tonic-gateint dwarf_pcsubr(Dwarf_Debug /*dbg*/,
116407dc194Richard Lowe    Dwarf_Addr       /*pc*/,
116507dc194Richard Lowe    Dwarf_Die*       /*return_die*/,
116607dc194Richard Lowe    Dwarf_Error*     /*error*/);
11677c478bdstevel@tonic-gate
11687c478bdstevel@tonic-gate/* Unimplemented */
11697c478bdstevel@tonic-gateint dwarf_pcscope(Dwarf_Debug /*dbg*/,
117007dc194Richard Lowe    Dwarf_Addr       /*pc*/,
117107dc194Richard Lowe    Dwarf_Die*       /*return_die*/,
117207dc194Richard Lowe    Dwarf_Error*     /*error*/);
11737c478bdstevel@tonic-gate
11747c478bdstevel@tonic-gate/* operations on DIEs */
11757c478bdstevel@tonic-gateint dwarf_tag(Dwarf_Die /*die*/,
117607dc194Richard Lowe    Dwarf_Half*      /*return_tag*/,
117707dc194Richard Lowe    Dwarf_Error*     /*error*/);
11787c478bdstevel@tonic-gate
11797c478bdstevel@tonic-gate/* utility? */
118007dc194Richard Lowe/* dwarf_dieoffset returns the global debug_info
118107dc194Richard Lowe   section offset, not the CU relative offset. */
11827c478bdstevel@tonic-gateint dwarf_dieoffset(Dwarf_Die /*die*/,
118307dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
118407dc194Richard Lowe    Dwarf_Error*     /*error*/);
118507dc194Richard Lowe
118607dc194Richard Lowe/* dwarf_CU_dieoffset_given_die returns
118707dc194Richard Lowe   the global debug_info section offset of the CU die
118807dc194Richard Lowe   that is the CU containing the given_die
118907dc194Richard Lowe   (the passed in DIE can be any DIE).
119007dc194Richard Lowe   This information makes it possible for a consumer to
119107dc194Richard Lowe   find and print CU context information for any die.
119207dc194Richard Lowe   See also dwarf_get_cu_die_offset_given_cu_header_offset(). */
119307dc194Richard Loweint dwarf_CU_dieoffset_given_die(Dwarf_Die /*given_die*/,
119407dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
119507dc194Richard Lowe    Dwarf_Error*     /*error*/);
119607dc194Richard Lowe
119707dc194Richard Lowe/* dwarf_die_CU_offset returns the CU relative offset
119807dc194Richard Lowe   not the global debug_info section offset, given
119907dc194Richard Lowe   any DIE in the CU.  See also dwarf_CU_dieoffset_given_die().
120007dc194Richard Lowe   */
12017c478bdstevel@tonic-gateint dwarf_die_CU_offset(Dwarf_Die /*die*/,
120207dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
120307dc194Richard Lowe    Dwarf_Error*     /*error*/);
120407dc194Richard Lowe
120507dc194Richard Loweint dwarf_die_CU_offset_range(Dwarf_Die /*die*/,
120607dc194Richard Lowe    Dwarf_Off*       /*return_CU_header_offset*/,
120707dc194Richard Lowe    Dwarf_Off*       /*return_CU_length_bytes*/,
120807dc194Richard Lowe    Dwarf_Error*     /*error*/);
12097c478bdstevel@tonic-gate
12107c478bdstevel@tonic-gateint dwarf_attr (Dwarf_Die /*die*/,
121107dc194Richard Lowe    Dwarf_Half        /*attr*/,
121207dc194Richard Lowe    Dwarf_Attribute * /*returned_attr*/,
121307dc194Richard Lowe    Dwarf_Error*      /*error*/);
12147c478bdstevel@tonic-gate
12157c478bdstevel@tonic-gateint dwarf_diename(Dwarf_Die /*die*/,
121607dc194Richard Lowe    char   **        /*diename*/,
121707dc194Richard Lowe    Dwarf_Error*     /*error*/);
121807dc194Richard Lowe
121907dc194Richard Lowe/* Returns the  abbrev code of the die. Cannot fail. */
122007dc194Richard Loweint dwarf_die_abbrev_code(Dwarf_Die /*die */);
122107dc194Richard Lowe
12227c478bdstevel@tonic-gate
12237c478bdstevel@tonic-gate/* convenience functions, alternative to using dwarf_attrlist() */
12247c478bdstevel@tonic-gateint dwarf_hasattr(Dwarf_Die /*die*/,
122507dc194Richard Lowe    Dwarf_Half       /*attr*/,
122607dc194Richard Lowe    Dwarf_Bool *     /*returned_bool*/,
122707dc194Richard Lowe    Dwarf_Error*     /*error*/);
12287c478bdstevel@tonic-gate
122949d3bc9Richard Lowe/* dwarf_loclist_n preferred over dwarf_loclist */
123049d3bc9Richard Loweint dwarf_loclist_n(Dwarf_Attribute /*attr*/,
123107dc194Richard Lowe    Dwarf_Locdesc*** /*llbuf*/,
123207dc194Richard Lowe    Dwarf_Signed *   /*locCount*/,
123307dc194Richard Lowe    Dwarf_Error*     /*error*/);
123449d3bc9Richard Lowe
123549d3bc9Richard Loweint dwarf_loclist(Dwarf_Attribute /*attr*/,  /* inflexible! */
123607dc194Richard Lowe    Dwarf_Locdesc**  /*llbuf*/,
123707dc194Richard Lowe    Dwarf_Signed *   /*locCount*/,
123807dc194Richard Lowe    Dwarf_Error*     /*error*/);
123907dc194Richard Lowe
124007dc194Richard Lowe/* Extracts a dwarf expression from an expression byte stream.
124107dc194Richard Lowe   Useful to get expressions from DW_CFA_def_cfa_expression
124207dc194Richard Lowe   DW_CFA_expression DW_CFA_val_expression expression bytes.
124307dc194Richard Lowe   27 April 2009: dwarf_loclist_from_expr() interface with
124407dc194Richard Lowe   no addr_size is obsolete but supported,
124507dc194Richard Lowe   use dwarf_loclist_from_expr_a() instead.
124607dc194Richard Lowe*/
124707dc194Richard Loweint dwarf_loclist_from_expr(Dwarf_Debug dbg,
124807dc194Richard Lowe    Dwarf_Ptr expression_in,
124907dc194Richard Lowe    Dwarf_Unsigned expression_length,
125007dc194Richard Lowe    Dwarf_Locdesc ** llbuf,
125107dc194Richard Lowe    Dwarf_Signed * listlen, Dwarf_Error * error);
125207dc194Richard Lowe
125307dc194Richard Lowe/* dwarf_loclist_from_expr_a() new 27 Apr 2009: added addr_size argument. */
125407dc194Richard Loweint dwarf_loclist_from_expr_a(Dwarf_Debug dbg,
125507dc194Richard Lowe    Dwarf_Ptr expression_in,
125607dc194Richard Lowe    Dwarf_Unsigned expression_length,
125707dc194Richard Lowe    Dwarf_Half addr_size,
125807dc194Richard Lowe    Dwarf_Locdesc ** llbuf,
125907dc194Richard Lowe    Dwarf_Signed * listlen, Dwarf_Error * error);
12607c478bdstevel@tonic-gate
12617c478bdstevel@tonic-gate/* Unimplemented */
12627c478bdstevel@tonic-gateint dwarf_stringlen(Dwarf_Die /*die*/,
126307dc194Richard Lowe    Dwarf_Locdesc ** /*returned_locdesc*/,
126407dc194Richard Lowe    Dwarf_Error*     /*error*/);
12657c478bdstevel@tonic-gate
12667c478bdstevel@tonic-gate/* Unimplemented */
12677c478bdstevel@tonic-gateint dwarf_subscrcnt(Dwarf_Die /*die*/,
126807dc194Richard Lowe    Dwarf_Signed *   /*returned_count*/,
126907dc194Richard Lowe    Dwarf_Error*     /*error*/);
12707c478bdstevel@tonic-gate
12717c478bdstevel@tonic-gate/* Unimplemented */
12727c478bdstevel@tonic-gateint dwarf_nthsubscr(Dwarf_Die /*die*/,
127307dc194Richard Lowe    Dwarf_Unsigned   /*ssndx*/,
127407dc194Richard Lowe    Dwarf_Die *      /*returned_die*/,
127507dc194Richard Lowe    Dwarf_Error*     /*error*/);
12767c478bdstevel@tonic-gate
12777c478bdstevel@tonic-gateint dwarf_lowpc(Dwarf_Die /*die*/,
127807dc194Richard Lowe    Dwarf_Addr  *    /*returned_addr*/,
127907dc194Richard Lowe    Dwarf_Error*     /*error*/);
12807c478bdstevel@tonic-gate
12817c478bdstevel@tonic-gateint dwarf_highpc(Dwarf_Die /*die*/,
128207dc194Richard Lowe    Dwarf_Addr  *    /*returned_addr*/,
128307dc194Richard Lowe    Dwarf_Error*     /*error*/);
12847c478bdstevel@tonic-gate
12857c478bdstevel@tonic-gateint dwarf_bytesize(Dwarf_Die /*die*/,
128607dc194Richard Lowe    Dwarf_Unsigned * /*returned_size*/,
128707dc194Richard Lowe    Dwarf_Error*     /*error*/);
12887c478bdstevel@tonic-gate
12897c478bdstevel@tonic-gate/* Unimplemented */
12907c478bdstevel@tonic-gateint dwarf_isbitfield(Dwarf_Die /*die*/,
129107dc194Richard Lowe    Dwarf_Bool  *    /*returned_bool*/,
129207dc194Richard Lowe    Dwarf_Error*     /*error*/);
12937c478bdstevel@tonic-gate
12947c478bdstevel@tonic-gateint dwarf_bitsize(Dwarf_Die /*die*/,
129507dc194Richard Lowe    Dwarf_Unsigned * /*returned_size*/,
129607dc194Richard Lowe    Dwarf_Error*     /*error*/);
12977c478bdstevel@tonic-gate
12987c478bdstevel@tonic-gateint dwarf_bitoffset(Dwarf_Die /*die*/,
129907dc194Richard Lowe    Dwarf_Unsigned * /*returned_offset*/,
130007dc194Richard Lowe    Dwarf_Error*     /*error*/);
13017c478bdstevel@tonic-gate
13027c478bdstevel@tonic-gateint dwarf_srclang(Dwarf_Die /*die*/,
130307dc194Richard Lowe    Dwarf_Unsigned * /*returned_lang*/,
130407dc194Richard Lowe    Dwarf_Error*     /*error*/);
13057c478bdstevel@tonic-gate
13067c478bdstevel@tonic-gateint dwarf_arrayorder(Dwarf_Die /*die*/,
130707dc194Richard Lowe    Dwarf_Unsigned * /*returned_order*/,
130807dc194Richard Lowe    Dwarf_Error*     /*error*/);
13097c478bdstevel@tonic-gate
13107c478bdstevel@tonic-gate/* end of convenience function list */
13117c478bdstevel@tonic-gate
13127c478bdstevel@tonic-gate/* this is the main interface to attributes of a DIE */
13137c478bdstevel@tonic-gateint dwarf_attrlist(Dwarf_Die /*die*/,
131407dc194Richard Lowe    Dwarf_Attribute** /*attrbuf*/,
131507dc194Richard Lowe    Dwarf_Signed   * /*attrcount*/,
131607dc194Richard Lowe    Dwarf_Error*     /*error*/);
13177c478bdstevel@tonic-gate
13187c478bdstevel@tonic-gate/* query operations for attributes */
13197c478bdstevel@tonic-gateint dwarf_hasform(Dwarf_Attribute /*attr*/,
132007dc194Richard Lowe    Dwarf_Half       /*form*/,
132107dc194Richard Lowe    Dwarf_Bool *     /*returned_bool*/,
132207dc194Richard Lowe    Dwarf_Error*     /*error*/);
13237c478bdstevel@tonic-gate
13247c478bdstevel@tonic-gateint dwarf_whatform(Dwarf_Attribute /*attr*/,
132507dc194Richard Lowe    Dwarf_Half *     /*returned_form*/,
132607dc194Richard Lowe    Dwarf_Error*     /*error*/);
13277c478bdstevel@tonic-gate
132849d3bc9Richard Loweint dwarf_whatform_direct(Dwarf_Attribute /*attr*/,
132907dc194Richard Lowe    Dwarf_Half *     /*returned_form*/,
133007dc194Richard Lowe    Dwarf_Error*     /*error*/);
133149d3bc9Richard Lowe
13327c478bdstevel@tonic-gateint dwarf_whatattr(Dwarf_Attribute /*attr*/,
133307dc194Richard Lowe    Dwarf_Half *     /*returned_attr_num*/,
133407dc194Richard Lowe    Dwarf_Error*     /*error*/);
13357c478bdstevel@tonic-gate
13367c478bdstevel@tonic-gate/*
13377c478bdstevel@tonic-gate    The following are concerned with the Primary Interface: getting
13387c478bdstevel@tonic-gate    the actual data values. One function per 'kind' of FORM.
13397c478bdstevel@tonic-gate*/
134007dc194Richard Lowe/*  dwarf_formref returns, thru return_offset, a CU-relative offset
134107dc194Richard Lowe    and does not allow DW_FORM_ref_addr*/
13427c478bdstevel@tonic-gateint dwarf_formref(Dwarf_Attribute /*attr*/,
134307dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
134407dc194Richard Lowe    Dwarf_Error*     /*error*/);
134507dc194Richard Lowe/*  dwarf_global_formref returns, thru return_offset,
134607dc194Richard Lowe    a debug_info-relative offset and does allow all reference forms*/
13477c478bdstevel@tonic-gateint dwarf_global_formref(Dwarf_Attribute /*attr*/,
134807dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
134907dc194Richard Lowe    Dwarf_Error*     /*error*/);
135007dc194Richard Lowe
135107dc194Richard Lowe/*  dwarf_formsig8 returns in the caller-provided 8 byte area
135207dc194Richard Lowe    the 8 bytes of a DW_FORM_ref_sig8.  Not a string.  */
135307dc194Richard Loweint dwarf_formsig8(Dwarf_Attribute /*attr*/,
135407dc194Richard Lowe    Dwarf_Sig8 * /*returned sig bytes*/,
135507dc194Richard Lowe    Dwarf_Error*     /*error*/);
13567c478bdstevel@tonic-gate
13577c478bdstevel@tonic-gateint dwarf_formaddr(Dwarf_Attribute /*attr*/,
135807dc194Richard Lowe    Dwarf_Addr   *   /*returned_addr*/,
135907dc194Richard Lowe    Dwarf_Error*     /*error*/);
13607c478bdstevel@tonic-gate
13617c478bdstevel@tonic-gateint dwarf_formflag(Dwarf_Attribute /*attr*/,
136207dc194Richard Lowe    Dwarf_Bool *     /*returned_bool*/,
136307dc194Richard Lowe    Dwarf_Error*     /*error*/);
13647c478bdstevel@tonic-gate
13657c478bdstevel@tonic-gateint dwarf_formudata(Dwarf_Attribute /*attr*/,
136607dc194Richard Lowe    Dwarf_Unsigned  * /*returned_val*/,
136707dc194Richard Lowe    Dwarf_Error*     /*error*/);
13687c478bdstevel@tonic-gate
136907dc194Richard Loweint dwarf_formsdata(Dwarf_Attribute     /*attr*/,
137007dc194Richard Lowe    Dwarf_Signed  *  /*returned_val*/,
137107dc194Richard Lowe    Dwarf_Error*     /*error*/);
13727c478bdstevel@tonic-gate
13737c478bdstevel@tonic-gateint dwarf_formblock(Dwarf_Attribute /*attr*/,
137407dc194Richard Lowe    Dwarf_Block    ** /*returned_block*/,
137507dc194Richard Lowe    Dwarf_Error*     /*error*/);
13767c478bdstevel@tonic-gate
13777c478bdstevel@tonic-gateint dwarf_formstring(Dwarf_Attribute /*attr*/,
137807dc194Richard Lowe    char   **        /*returned_string*/,
137907dc194Richard Lowe    Dwarf_Error*     /*error*/);
138007dc194Richard Lowe
138107dc194Richard Loweint dwarf_formexprloc(Dwarf_Attribute /*attr*/,
138207dc194Richard Lowe    Dwarf_Unsigned * /*return_exprlen*/,
138307dc194Richard Lowe    Dwarf_Ptr  * /*block_ptr*/,
138407dc194Richard Lowe    Dwarf_Error * /*error*/);
138507dc194Richard Lowe
13867c478bdstevel@tonic-gate
13877c478bdstevel@tonic-gate/* end attribute query operations. */
13887c478bdstevel@tonic-gate
13897c478bdstevel@tonic-gate/* line number operations */
13907c478bdstevel@tonic-gate/* dwarf_srclines  is the normal interface */
13917c478bdstevel@tonic-gateint dwarf_srclines(Dwarf_Die /*die*/,
139207dc194Richard Lowe    Dwarf_Line**     /*linebuf*/,
139307dc194Richard Lowe    Dwarf_Signed *   /*linecount*/,
139407dc194Richard Lowe    Dwarf_Error*     /*error*/);
139507dc194Richard Lowe
139607dc194Richard Lowe/* dwarf_srclines_dealloc, created July 2005, is the new
139707dc194Richard Lowe   method for deallocating what dwarf_srclines returns.
139807dc194Richard Lowe   More complete free than using dwarf_dealloc directly. */
139907dc194Richard Lowevoid dwarf_srclines_dealloc(Dwarf_Debug /*dbg*/,
140007dc194Richard Lowe    Dwarf_Line*       /*linebuf*/,
140107dc194Richard Lowe    Dwarf_Signed      /*count */);
140207dc194Richard Lowe
14037c478bdstevel@tonic-gate
14047c478bdstevel@tonic-gateint dwarf_srcfiles(Dwarf_Die /*die*/,
140507dc194Richard Lowe    char***          /*srcfiles*/,
140607dc194Richard Lowe    Dwarf_Signed *   /*filecount*/,
140707dc194Richard Lowe    Dwarf_Error*     /*error*/);
14087c478bdstevel@tonic-gate
14097c478bdstevel@tonic-gate/* Unimplemented. */
14107c478bdstevel@tonic-gateint dwarf_dieline(Dwarf_Die /*die*/,
141107dc194Richard Lowe    Dwarf_Line  *    /*returned_line*/,
141207dc194Richard Lowe    Dwarf_Error *    /*error*/);
14137c478bdstevel@tonic-gate
14147c478bdstevel@tonic-gateint dwarf_linebeginstatement(Dwarf_Line /*line*/,
141507dc194Richard Lowe    Dwarf_Bool  *    /*returned_bool*/,
141607dc194Richard Lowe    Dwarf_Error*     /*error*/);
14177c478bdstevel@tonic-gate
14187c478bdstevel@tonic-gateint dwarf_lineendsequence(Dwarf_Line /*line*/,
141907dc194Richard Lowe    Dwarf_Bool  *    /*returned_bool*/,
142007dc194Richard Lowe    Dwarf_Error*     /*error*/);
14217c478bdstevel@tonic-gate
14227c478bdstevel@tonic-gateint dwarf_lineno(Dwarf_Line /*line*/,
142307dc194Richard Lowe    Dwarf_Unsigned * /*returned_lineno*/,
142407dc194Richard Lowe    Dwarf_Error*     /*error*/);
142507dc194Richard Lowe
142607dc194Richard Loweint dwarf_line_srcfileno(Dwarf_Line /*line*/,
142707dc194Richard Lowe    Dwarf_Unsigned * /*ret_fileno*/,
142807dc194Richard Lowe    Dwarf_Error *    /*error*/);
14297c478bdstevel@tonic-gate
14307c478bdstevel@tonic-gateint dwarf_lineaddr(Dwarf_Line /*line*/,
143107dc194Richard Lowe    Dwarf_Addr *     /*returned_addr*/,
143207dc194Richard Lowe    Dwarf_Error*     /*error*/);
14337c478bdstevel@tonic-gate
14347c478bdstevel@tonic-gateint dwarf_lineoff(Dwarf_Line /*line*/,
143507dc194Richard Lowe    Dwarf_Signed  *  /*returned_lineoffset*/,
143607dc194Richard Lowe    Dwarf_Error*     /*error*/);
14377c478bdstevel@tonic-gate
14387c478bdstevel@tonic-gateint dwarf_linesrc(Dwarf_Line /*line*/,
143907dc194Richard Lowe    char   **        /*returned_name*/,
144007dc194Richard Lowe    Dwarf_Error*     /*error*/);
14417c478bdstevel@tonic-gate
14427c478bdstevel@tonic-gateint dwarf_lineblock(Dwarf_Line /*line*/,
144307dc194Richard Lowe    Dwarf_Bool  *    /*returned_bool*/,
144407dc194Richard Lowe    Dwarf_Error*     /*error*/);
14457c478bdstevel@tonic-gate
14467c478bdstevel@tonic-gate/* tertiary interface to line info */
14477c478bdstevel@tonic-gate/* Unimplemented */
14487c478bdstevel@tonic-gateint dwarf_pclines(Dwarf_Debug /*dbg*/,
144907dc194Richard Lowe    Dwarf_Addr       /*pc*/,
145007dc194Richard Lowe    Dwarf_Line**     /*linebuf*/,
145107dc194Richard Lowe    Dwarf_Signed *   /*linecount*/,
145207dc194Richard Lowe    Dwarf_Signed     /*slide*/,
145307dc194Richard Lowe    Dwarf_Error*     /*error*/);
14547c478bdstevel@tonic-gate/* end line number operations */
14557c478bdstevel@tonic-gate
14567c478bdstevel@tonic-gate/* global name space operations (.debug_pubnames access) */
14577c478bdstevel@tonic-gateint dwarf_get_globals(Dwarf_Debug /*dbg*/,
145807dc194Richard Lowe    Dwarf_Global**   /*globals*/,
145907dc194Richard Lowe    Dwarf_Signed *   /*number_of_globals*/,
146007dc194Richard Lowe    Dwarf_Error*     /*error*/);
146107dc194Richard Lowevoid dwarf_globals_dealloc(Dwarf_Debug /*dbg*/,
146207dc194Richard Lowe    Dwarf_Global*    /*globals*/,
146307dc194Richard Lowe    Dwarf_Signed     /*number_of_globals*/);
14647c478bdstevel@tonic-gate
14657c478bdstevel@tonic-gateint dwarf_globname(Dwarf_Global /*glob*/,
146607dc194Richard Lowe    char   **        /*returned_name*/,
146707dc194Richard Lowe    Dwarf_Error*     /*error*/);
14687c478bdstevel@tonic-gate
14697c478bdstevel@tonic-gateint dwarf_global_die_offset(Dwarf_Global /*global*/,
147007dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
147107dc194Richard Lowe    Dwarf_Error *    /*error*/);
14727c478bdstevel@tonic-gate
147307dc194Richard Lowe/* This returns the CU die global offset if one knows the
147407dc194Richard Lowe   CU header global offset.
147507dc194Richard Lowe   See also dwarf_CU_dieoffset_given_die(). */
14767c478bdstevel@tonic-gateint dwarf_get_cu_die_offset_given_cu_header_offset(
147707dc194Richard Lowe    Dwarf_Debug      /*dbg*/,
147807dc194Richard Lowe    Dwarf_Off        /*in_cu_header_offset*/,
147907dc194Richard Lowe    Dwarf_Off *  /*out_cu_die_offset*/,
148007dc194Richard Lowe    Dwarf_Error *    /*err*/);
14817c478bdstevel@tonic-gate#ifdef __sgi /* pragma is sgi MIPS only */
14827c478bdstevel@tonic-gate#pragma optional dwarf_get_cu_die_offset_given_cu_header_offset
14837c478bdstevel@tonic-gate#endif
14847c478bdstevel@tonic-gate
14857c478bdstevel@tonic-gateint dwarf_global_cu_offset(Dwarf_Global /*global*/,
148607dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
148707dc194Richard Lowe    Dwarf_Error*     /*error*/);
14887c478bdstevel@tonic-gate
14897c478bdstevel@tonic-gateint dwarf_global_name_offsets(Dwarf_Global /*global*/,
149007dc194Richard Lowe    char   **        /*returned_name*/,
149107dc194Richard Lowe    Dwarf_Off*       /*die_offset*/,
149207dc194Richard Lowe    Dwarf_Off*       /*cu_offset*/,
149307dc194Richard Lowe    Dwarf_Error*     /*error*/);
14947c478bdstevel@tonic-gate
14957c478bdstevel@tonic-gate/* Static function name operations.  */
149607dc194Richard Loweint dwarf_get_funcs(Dwarf_Debug    /*dbg*/,
149707dc194Richard Lowe    Dwarf_Func**     /*funcs*/,
149807dc194Richard Lowe    Dwarf_Signed *   /*number_of_funcs*/,
149907dc194Richard Lowe    Dwarf_Error*     /*error*/);
150007dc194Richard Lowevoid dwarf_funcs_dealloc(Dwarf_Debug /*dbg*/,
150107dc194Richard Lowe    Dwarf_Func*      /*funcs*/,
150207dc194Richard Lowe    Dwarf_Signed     /*number_of_funcs*/);
15037c478bdstevel@tonic-gate
15047c478bdstevel@tonic-gateint dwarf_funcname(Dwarf_Func /*func*/,
150507dc194Richard Lowe    char   **        /*returned_name*/,
150607dc194Richard Lowe    Dwarf_Error*     /*error*/);
15077c478bdstevel@tonic-gate
15087c478bdstevel@tonic-gateint dwarf_func_die_offset(Dwarf_Func /*func*/,
150907dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
151007dc194Richard Lowe    Dwarf_Error*     /*error*/);
15117c478bdstevel@tonic-gate
15127c478bdstevel@tonic-gateint dwarf_func_cu_offset(Dwarf_Func /*func*/,
151307dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
151407dc194Richard Lowe    Dwarf_Error*     /*error*/);
15157c478bdstevel@tonic-gate
15167c478bdstevel@tonic-gateint dwarf_func_name_offsets(Dwarf_Func /*func*/,
151707dc194Richard Lowe    char   **        /*returned_name*/,
151807dc194Richard Lowe    Dwarf_Off*       /*die_offset*/,
151907dc194Richard Lowe    Dwarf_Off*       /*cu_offset*/,
152007dc194Richard Lowe    Dwarf_Error*     /*error*/);
152107dc194Richard Lowe
152207dc194Richard Lowe/* User-defined type name operations, SGI IRIX .debug_typenames section.
152307dc194Richard Lowe   Same content as DWARF3 .debug_pubtypes, but defined years before
152407dc194Richard Lowe   .debug_pubtypes was defined.   SGI IRIX only. */
152507dc194Richard Loweint dwarf_get_types(Dwarf_Debug    /*dbg*/,
152607dc194Richard Lowe    Dwarf_Type**     /*types*/,
152707dc194Richard Lowe    Dwarf_Signed *   /*number_of_types*/,
152807dc194Richard Lowe    Dwarf_Error*     /*error*/);
152907dc194Richard Lowevoid dwarf_types_dealloc(Dwarf_Debug /*dbg*/,
153007dc194Richard Lowe    Dwarf_Type*      /*types*/,
153107dc194Richard Lowe    Dwarf_Signed     /*number_of_types*/);
15327c478bdstevel@tonic-gate
15337c478bdstevel@tonic-gate
15347c478bdstevel@tonic-gateint dwarf_typename(Dwarf_Type /*type*/,
153507dc194Richard Lowe    char   **        /*returned_name*/,
153607dc194Richard Lowe    Dwarf_Error*     /*error*/);
15377c478bdstevel@tonic-gate
15387c478bdstevel@tonic-gateint dwarf_type_die_offset(Dwarf_Type /*type*/,
153907dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
154007dc194Richard Lowe    Dwarf_Error*     /*error*/);
15417c478bdstevel@tonic-gate
15427c478bdstevel@tonic-gateint dwarf_type_cu_offset(Dwarf_Type /*type*/,
154307dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
154407dc194Richard Lowe    Dwarf_Error*     /*error*/);
154507dc194Richard Lowe
154607dc194Richard Loweint dwarf_type_name_offsets(Dwarf_Type    /*type*/,
154707dc194Richard Lowe    char   **        /*returned_name*/,
154807dc194Richard Lowe    Dwarf_Off*       /*die_offset*/,
154907dc194Richard Lowe    Dwarf_Off*       /*cu_offset*/,
155007dc194Richard Lowe    Dwarf_Error*     /*error*/);
155107dc194Richard Lowe
155207dc194Richard Lowe/* User-defined type name operations, DWARF3  .debug_pubtypes section.
155307dc194Richard Lowe*/
155407dc194Richard Loweint dwarf_get_pubtypes(Dwarf_Debug    /*dbg*/,
155507dc194Richard Lowe    Dwarf_Type**     /*types*/,
155607dc194Richard Lowe    Dwarf_Signed *   /*number_of_types*/,
155707dc194Richard Lowe    Dwarf_Error*     /*error*/);
155807dc194Richard Lowevoid dwarf_pubtypes_dealloc(Dwarf_Debug /*dbg*/,
155907dc194Richard Lowe    Dwarf_Type*      /*pubtypes*/,
156007dc194Richard Lowe    Dwarf_Signed     /*number_of_pubtypes*/);
15617c478bdstevel@tonic-gate
156207dc194Richard Lowe
156307dc194Richard Loweint dwarf_pubtypename(Dwarf_Type /*type*/,
156407dc194Richard Lowe    char   **        /*returned_name*/,
156507dc194Richard Lowe    Dwarf_Error*     /*error*/);
156607dc194Richard Lowe
156707dc194Richard Loweint dwarf_pubtype_die_offset(Dwarf_Type /*type*/,
156807dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
156907dc194Richard Lowe    Dwarf_Error*     /*error*/);
157007dc194Richard Lowe
157107dc194Richard Loweint dwarf_pubtype_cu_offset(Dwarf_Type /*type*/,
157207dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
157307dc194Richard Lowe    Dwarf_Error*     /*error*/);
157407dc194Richard Lowe
157507dc194Richard Loweint dwarf_pubtype_name_offsets(Dwarf_Type    /*type*/,
157607dc194Richard Lowe    char   **        /*returned_name*/,
157707dc194Richard Lowe    Dwarf_Off*       /*die_offset*/,
157807dc194Richard Lowe    Dwarf_Off*       /*cu_offset*/,
157907dc194Richard Lowe    Dwarf_Error*     /*error*/);
15807c478bdstevel@tonic-gate
15817c478bdstevel@tonic-gate/* File-scope static variable name operations.  */
158207dc194Richard Loweint dwarf_get_vars(Dwarf_Debug    /*dbg*/,
158307dc194Richard Lowe    Dwarf_Var**      /*vars*/,
158407dc194Richard Lowe    Dwarf_Signed *   /*number_of_vars*/,
158507dc194Richard Lowe    Dwarf_Error*     /*error*/);
158607dc194Richard Lowevoid dwarf_vars_dealloc(Dwarf_Debug /*dbg*/,
158707dc194Richard Lowe    Dwarf_Var*       /*vars*/,
158807dc194Richard Lowe    Dwarf_Signed     /*number_of_vars*/);
158907dc194Richard Lowe
15907c478bdstevel@tonic-gate
15917c478bdstevel@tonic-gateint dwarf_varname(Dwarf_Var /*var*/,
159207dc194Richard Lowe    char   **        /*returned_name*/,
159307dc194Richard Lowe    Dwarf_Error*     /*error*/);
15947c478bdstevel@tonic-gate
15957c478bdstevel@tonic-gateint dwarf_var_die_offset(Dwarf_Var /*var*/,
159607dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
159707dc194Richard Lowe    Dwarf_Error*     /*error*/);
15987c478bdstevel@tonic-gate
15997c478bdstevel@tonic-gateint dwarf_var_cu_offset(Dwarf_Var /*var*/,
160007dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
160107dc194Richard Lowe    Dwarf_Error*     /*error*/);
16027c478bdstevel@tonic-gate
16037c478bdstevel@tonic-gateint dwarf_var_name_offsets(Dwarf_Var /*var*/,
160407dc194Richard Lowe    char   **        /*returned_name*/,
160507dc194Richard Lowe    Dwarf_Off*       /*die_offset*/,
160607dc194Richard Lowe    Dwarf_Off*       /*cu_offset*/,
160707dc194Richard Lowe    Dwarf_Error*     /*error*/);
16087c478bdstevel@tonic-gate
16097c478bdstevel@tonic-gate/* weak name operations.  */
161007dc194Richard Loweint dwarf_get_weaks(Dwarf_Debug    /*dbg*/,
161107dc194Richard Lowe    Dwarf_Weak**     /*weaks*/,
161207dc194Richard Lowe    Dwarf_Signed *   /*number_of_weaks*/,
161307dc194Richard Lowe    Dwarf_Error*     /*error*/);
161407dc194Richard Lowevoid dwarf_weaks_dealloc(Dwarf_Debug /*dbg*/,
161507dc194Richard Lowe    Dwarf_Weak*      /*weaks*/,
161607dc194Richard Lowe    Dwarf_Signed     /*number_of_weaks*/);
161707dc194Richard Lowe
16187c478bdstevel@tonic-gate
16197c478bdstevel@tonic-gateint dwarf_weakname(Dwarf_Weak /*weak*/,
162007dc194Richard Lowe    char   **        /*returned_name*/,
162107dc194Richard Lowe    Dwarf_Error*     /*error*/);
16227c478bdstevel@tonic-gate
16237c478bdstevel@tonic-gateint dwarf_weak_die_offset(Dwarf_Weak /*weak*/,
162407dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
162507dc194Richard Lowe    Dwarf_Error*     /*error*/);
16267c478bdstevel@tonic-gate
16277c478bdstevel@tonic-gateint dwarf_weak_cu_offset(Dwarf_Weak /*weak*/,
162807dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
162907dc194Richard Lowe    Dwarf_Error*     /*error*/);
16307c478bdstevel@tonic-gate
163107dc194Richard Loweint dwarf_weak_name_offsets(Dwarf_Weak    /*weak*/,
163207dc194Richard Lowe    char   **        /*returned_name*/,
163307dc194Richard Lowe    Dwarf_Off*       /*die_offset*/,
163407dc194Richard Lowe    Dwarf_Off*       /*cu_offset*/,
163507dc194Richard Lowe    Dwarf_Error*     /*error*/);
16367c478bdstevel@tonic-gate
16377c478bdstevel@tonic-gate/* location list section operation.  (.debug_loc access) */
16387c478bdstevel@tonic-gateint dwarf_get_loclist_entry(Dwarf_Debug /*dbg*/,
163907dc194Richard Lowe    Dwarf_Unsigned   /*offset*/,
164007dc194Richard Lowe    Dwarf_Addr*      /*hipc*/,
164107dc194Richard Lowe    Dwarf_Addr*      /*lopc*/,
164207dc194Richard Lowe    Dwarf_Ptr*       /*data*/,
164307dc194Richard Lowe    Dwarf_Unsigned*  /*entry_len*/,
164407dc194Richard Lowe    Dwarf_Unsigned*  /*next_entry*/,
164507dc194Richard Lowe    Dwarf_Error*     /*error*/);
16467c478bdstevel@tonic-gate
16477c478bdstevel@tonic-gate/* abbreviation section operations */
16487c478bdstevel@tonic-gateint dwarf_get_abbrev(Dwarf_Debug /*dbg*/,
164907dc194Richard Lowe    Dwarf_Unsigned   /*offset*/,
165007dc194Richard Lowe    Dwarf_Abbrev  *  /*returned_abbrev*/,
165107dc194Richard Lowe    Dwarf_Unsigned*  /*length*/,
165207dc194Richard Lowe    Dwarf_Unsigned*  /*attr_count*/,
165307dc194Richard Lowe    Dwarf_Error*     /*error*/);
16547c478bdstevel@tonic-gate
16557c478bdstevel@tonic-gateint dwarf_get_abbrev_tag(Dwarf_Abbrev /*abbrev*/,
165607dc194Richard Lowe    Dwarf_Half*      /*return_tag_number*/,
165707dc194Richard Lowe    Dwarf_Error*     /*error*/);
16587c478bdstevel@tonic-gateint dwarf_get_abbrev_code(Dwarf_Abbrev /*abbrev*/,
165907dc194Richard Lowe    Dwarf_Unsigned*  /*return_code_number*/,
166007dc194Richard Lowe    Dwarf_Error*     /*error*/);
16617c478bdstevel@tonic-gate
16627c478bdstevel@tonic-gateint dwarf_get_abbrev_children_flag(Dwarf_Abbrev /*abbrev*/,
166307dc194Richard Lowe    Dwarf_Signed*    /*return_flag*/,
166407dc194Richard Lowe    Dwarf_Error*     /*error*/);
16657c478bdstevel@tonic-gate
16667c478bdstevel@tonic-gateint dwarf_get_abbrev_entry(Dwarf_Abbrev /*abbrev*/,
166707dc194Richard Lowe    Dwarf_Signed     /*index*/,
166807dc194Richard Lowe    Dwarf_Half  *    /*returned_attr_num*/,
166907dc194Richard Lowe    Dwarf_Signed*    /*form*/,
167007dc194Richard Lowe    Dwarf_Off*       /*offset*/,
167107dc194Richard Lowe    Dwarf_Error*     /*error*/);
16727c478bdstevel@tonic-gate
16737c478bdstevel@tonic-gate/* consumer string section operation */
16747c478bdstevel@tonic-gateint dwarf_get_str(Dwarf_Debug /*dbg*/,
167507dc194Richard Lowe    Dwarf_Off        /*offset*/,
167607dc194Richard Lowe    char**           /*string*/,
167707dc194Richard Lowe    Dwarf_Signed *   /*strlen_of_string*/,
167807dc194Richard Lowe    Dwarf_Error*     /*error*/);
16797c478bdstevel@tonic-gate
16807c478bdstevel@tonic-gate/* Consumer op on  gnu .eh_frame info */
16817c478bdstevel@tonic-gateint dwarf_get_fde_list_eh(
168207dc194Richard Lowe    Dwarf_Debug      /*dbg*/,
168307dc194Richard Lowe    Dwarf_Cie**      /*cie_data*/,
168407dc194Richard Lowe    Dwarf_Signed*    /*cie_element_count*/,
168507dc194Richard Lowe    Dwarf_Fde**      /*fde_data*/,
168607dc194Richard Lowe    Dwarf_Signed*    /*fde_element_count*/,
168707dc194Richard Lowe    Dwarf_Error*     /*error*/);
16887c478bdstevel@tonic-gate
16897c478bdstevel@tonic-gate
16907c478bdstevel@tonic-gate/* consumer operations on frame info: .debug_frame */
16917c478bdstevel@tonic-gateint dwarf_get_fde_list(Dwarf_Debug /*dbg*/,
169207dc194Richard Lowe    Dwarf_Cie**      /*cie_data*/,
169307dc194Richard Lowe    Dwarf_Signed*    /*cie_element_count*/,
169407dc194Richard Lowe    Dwarf_Fde**      /*fde_data*/,
169507dc194Richard Lowe    Dwarf_Signed*    /*fde_element_count*/,
169607dc194Richard Lowe    Dwarf_Error*     /*error*/);
169707dc194Richard Lowe
169807dc194Richard Lowe/* Release storage gotten by dwarf_get_fde_list_eh() or
169907dc194Richard Lowe   dwarf_get_fde_list() */
170007dc194Richard Lowevoid dwarf_fde_cie_list_dealloc(Dwarf_Debug dbg,
170107dc194Richard Lowe    Dwarf_Cie *cie_data,
170207dc194Richard Lowe    Dwarf_Signed cie_element_count,
170307dc194Richard Lowe    Dwarf_Fde *fde_data,
170407dc194Richard Lowe    Dwarf_Signed fde_element_count);
17057c478bdstevel@tonic-gate
17067c478bdstevel@tonic-gate
17077c478bdstevel@tonic-gate
170807dc194Richard Loweint dwarf_get_fde_range(Dwarf_Fde /*fde*/,
170907dc194Richard Lowe    Dwarf_Addr*      /*low_pc*/,
171007dc194Richard Lowe    Dwarf_Unsigned*  /*func_length*/,
171107dc194Richard Lowe    Dwarf_Ptr*       /*fde_bytes*/,
171207dc194Richard Lowe    Dwarf_Unsigned*  /*fde_byte_length*/,
171307dc194Richard Lowe    Dwarf_Off*       /*cie_offset*/,
171407dc194Richard Lowe    Dwarf_Signed*    /*cie_index*/,
171507dc194Richard Lowe    Dwarf_Off*       /*fde_offset*/,
171607dc194Richard Lowe    Dwarf_Error*     /*error*/);
171707dc194Richard Lowe
171807dc194Richard Lowe/*  Useful for IRIX only:  see dwarf_get_cie_augmentation_data()
171907dc194Richard Lowe       dwarf_get_fde_augmentation_data() for GNU .eh_frame. */
17207c478bdstevel@tonic-gateint dwarf_get_fde_exception_info(Dwarf_Fde /*fde*/,
172107dc194Richard Lowe    Dwarf_Signed*    /* offset_into_exception_tables */,
172207dc194Richard Lowe    Dwarf_Error*     /*error*/);
172307dc194Richard Lowe
17247c478bdstevel@tonic-gate
17257c478bdstevel@tonic-gateint dwarf_get_cie_of_fde(Dwarf_Fde /*fde*/,
172607dc194Richard Lowe    Dwarf_Cie *      /*cie_returned*/,
172707dc194Richard Lowe    Dwarf_Error*     /*error*/);
17287c478bdstevel@tonic-gate
17297c478bdstevel@tonic-gateint dwarf_get_cie_info(Dwarf_Cie /*cie*/,
173007dc194Richard Lowe    Dwarf_Unsigned * /*bytes_in_cie*/,
173107dc194Richard Lowe    Dwarf_Small*     /*version*/,
173207dc194Richard Lowe    char        **   /*augmenter*/,
173307dc194Richard Lowe    Dwarf_Unsigned*  /*code_alignment_factor*/,
173407dc194Richard Lowe    Dwarf_Signed*    /*data_alignment_factor*/,
173507dc194Richard Lowe    Dwarf_Half*      /*return_address_register_rule*/,
173607dc194Richard Lowe    Dwarf_Ptr*       /*initial_instructions*/,
173707dc194Richard Lowe    Dwarf_Unsigned*  /*initial_instructions_length*/,
173807dc194Richard Lowe    Dwarf_Error*     /*error*/);
173907dc194Richard Lowe
174007dc194Richard Lowe/* dwarf_get_cie_index new September 2009. */
174107dc194Richard Loweint dwarf_get_cie_index(
174207dc194Richard Lowe    Dwarf_Cie /*cie*/,
174307dc194Richard Lowe    Dwarf_Signed* /*index*/,
174407dc194Richard Lowe    Dwarf_Error* /*error*/ );
174507dc194Richard Lowe
17467c478bdstevel@tonic-gate
17477c478bdstevel@tonic-gateint dwarf_get_fde_instr_bytes(Dwarf_Fde /*fde*/,
174807dc194Richard Lowe    Dwarf_Ptr *      /*outinstrs*/, Dwarf_Unsigned * /*outlen*/,
174907dc194Richard Lowe    Dwarf_Error *    /*error*/);
17507c478bdstevel@tonic-gate
17517c478bdstevel@tonic-gateint dwarf_get_fde_info_for_all_regs(Dwarf_Fde /*fde*/,
175207dc194Richard Lowe    Dwarf_Addr       /*pc_requested*/,
175307dc194Richard Lowe    Dwarf_Regtable*  /*reg_table*/,
175407dc194Richard Lowe    Dwarf_Addr*      /*row_pc*/,
175507dc194Richard Lowe    Dwarf_Error*     /*error*/);
175607dc194Richard Lowe
175707dc194Richard Loweint dwarf_get_fde_info_for_all_regs3(Dwarf_Fde /*fde*/,
175807dc194Richard Lowe    Dwarf_Addr       /*pc_requested*/,
175907dc194Richard Lowe    Dwarf_Regtable3* /*reg_table*/,
176007dc194Richard Lowe    Dwarf_Addr*      /*row_pc*/,
176107dc194Richard Lowe    Dwarf_Error*     /*error*/);
176207dc194Richard Lowe
176307dc194Richard Lowe/* In this older interface DW_FRAME_CFA_COL is a meaningful
176407dc194Richard Lowe    column (which does not work well with DWARF3 or
176507dc194Richard Lowe    non-MIPS architectures). */
17667c478bdstevel@tonic-gateint dwarf_get_fde_info_for_reg(Dwarf_Fde /*fde*/,
176707dc194Richard Lowe    Dwarf_Half       /*table_column*/,
176807dc194Richard Lowe    Dwarf_Addr       /*pc_requested*/,
176907dc194Richard Lowe    Dwarf_Signed*    /*offset_relevant*/,
177007dc194Richard Lowe    Dwarf_Signed*    /*register*/,
177107dc194Richard Lowe    Dwarf_Signed*    /*offset*/,
177207dc194Richard Lowe    Dwarf_Addr*      /*row_pc*/,
177307dc194Richard Lowe    Dwarf_Error*     /*error*/);
177407dc194Richard Lowe
177507dc194Richard Lowe/* See discussion of dw_value_type, libdwarf.h.
177607dc194Richard Lowe   Use of DW_FRAME_CFA_COL is not meaningful in this interface.
177707dc194Richard Lowe   See dwarf_get_fde_info_for_cfa_reg3().
177807dc194Richard Lowe*/
177907dc194Richard Lowe/* dwarf_get_fde_info_for_reg3 is useful on a single column, but
178007dc194Richard Lowe   it is inefficient to iterate across all table_columns using this
178107dc194Richard Lowe   function.  Instead call dwarf_get_fde_info_for_all_regs3() and index
178207dc194Richard Lowe   into the table it fills in. */
178307dc194Richard Loweint dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
178407dc194Richard Lowe    Dwarf_Half       /*table_column*/,
178507dc194Richard Lowe    Dwarf_Addr       /*pc_requested*/,
178607dc194Richard Lowe    Dwarf_Small  *   /*value_type*/,
178707dc194Richard Lowe    Dwarf_Signed *   /*offset_relevant*/,
178807dc194Richard Lowe    Dwarf_Signed*    /*register*/,
178907dc194Richard Lowe    Dwarf_Signed*    /*offset_or_block_len*/,
179007dc194Richard Lowe    Dwarf_Ptr   *    /*block_ptr */,
179107dc194Richard Lowe    Dwarf_Addr*      /*row_pc_out*/,
179207dc194Richard Lowe    Dwarf_Error*     /*error*/);
179307dc194Richard Lowe
179407dc194Richard Lowe/* Use this to get the cfa. */
179507dc194Richard Loweint dwarf_get_fde_info_for_cfa_reg3(Dwarf_Fde /*fde*/,
179607dc194Richard Lowe    Dwarf_Addr       /*pc_requested*/,
179707dc194Richard Lowe    Dwarf_Small  *   /*value_type*/,
179807dc194Richard Lowe    Dwarf_Signed *   /*offset_relevant*/,
179907dc194Richard Lowe    Dwarf_Signed*    /*register*/,
180007dc194Richard Lowe    Dwarf_Signed*    /*offset_or_block_len*/,
180107dc194Richard Lowe    Dwarf_Ptr   *    /*block_ptr */,
180207dc194Richard Lowe    Dwarf_Addr*      /*row_pc_out*/,
180307dc194Richard Lowe    Dwarf_Error*     /*error*/);
18047c478bdstevel@tonic-gate
18057c478bdstevel@tonic-gateint dwarf_get_fde_for_die(Dwarf_Debug /*dbg*/,
180607dc194Richard Lowe    Dwarf_Die        /*subr_die */,
180707dc194Richard Lowe    Dwarf_Fde  *     /*returned_fde*/,
180807dc194Richard Lowe    Dwarf_Error*     /*error*/);
18097c478bdstevel@tonic-gate
18107c478bdstevel@tonic-gateint dwarf_get_fde_n(Dwarf_Fde* /*fde_data*/,
181107dc194Richard Lowe    Dwarf_Unsigned   /*fde_index*/,
181207dc194Richard Lowe    Dwarf_Fde  *     /*returned_fde*/,
181307dc194Richard Lowe    Dwarf_Error*     /*error*/);
18147c478bdstevel@tonic-gate
18157c478bdstevel@tonic-gateint dwarf_get_fde_at_pc(Dwarf_Fde* /*fde_data*/,
181607dc194Richard Lowe    Dwarf_Addr       /*pc_of_interest*/,
181707dc194Richard Lowe    Dwarf_Fde  *     /*returned_fde*/,
181807dc194Richard Lowe    Dwarf_Addr*      /*lopc*/,
181907dc194Richard Lowe    Dwarf_Addr*      /*hipc*/,
182007dc194Richard Lowe    Dwarf_Error*     /*error*/);
182107dc194Richard Lowe
182207dc194Richard Lowe/* GNU .eh_frame augmentation information, raw form, see
182307dc194Richard Lowe   Linux Standard Base Core Specification version 3.0 . */
182407dc194Richard Loweint dwarf_get_cie_augmentation_data(Dwarf_Cie /* cie*/,
182507dc194Richard Lowe    Dwarf_Small **   /* augdata */,
182607dc194Richard Lowe    Dwarf_Unsigned * /* augdata_len */,
182707dc194Richard Lowe    Dwarf_Error*     /*error*/);
182807dc194Richard Lowe/* GNU .eh_frame augmentation information, raw form, see
182907dc194Richard Lowe   Linux Standard Base Core Specification version 3.0 . */
183007dc194Richard Loweint dwarf_get_fde_augmentation_data(Dwarf_Fde /* fde*/,
183107dc194Richard Lowe    Dwarf_Small **   /* augdata */,
183207dc194Richard Lowe    Dwarf_Unsigned * /* augdata_len */,
183307dc194Richard Lowe    Dwarf_Error*     /*error*/);
183407dc194Richard Lowe
183507dc194Richard Loweint dwarf_expand_frame_instructions(Dwarf_Cie /*cie*/,
183607dc194Richard Lowe    Dwarf_Ptr        /*instruction*/,
183707dc194Richard Lowe    Dwarf_Unsigned   /*i_length*/,
183807dc194Richard Lowe    Dwarf_Frame_Op** /*returned_op_list*/,
183907dc194Richard Lowe    Dwarf_Signed*    /*op_count*/,
184007dc194Richard Lowe    Dwarf_Error*     /*error*/);
18417c478bdstevel@tonic-gate
18427c478bdstevel@tonic-gate/* Operations on .debug_aranges. */
18437c478bdstevel@tonic-gateint dwarf_get_aranges(Dwarf_Debug /*dbg*/,
184407dc194Richard Lowe    Dwarf_Arange**   /*aranges*/,
184507dc194Richard Lowe    Dwarf_Signed *   /*arange_count*/,
184607dc194Richard Lowe    Dwarf_Error*     /*error*/);
18477c478bdstevel@tonic-gate
18487c478bdstevel@tonic-gate
18497c478bdstevel@tonic-gate
18507c478bdstevel@tonic-gateint dwarf_get_arange(
185107dc194Richard Lowe    Dwarf_Arange*    /*aranges*/,
185207dc194Richard Lowe    Dwarf_Unsigned   /*arange_count*/,
185307dc194Richard Lowe    Dwarf_Addr       /*address*/,
185407dc194Richard Lowe    Dwarf_Arange *   /*returned_arange*/,
185507dc194Richard Lowe    Dwarf_Error*     /*error*/);
18567c478bdstevel@tonic-gate
18577c478bdstevel@tonic-gateint dwarf_get_cu_die_offset(
185807dc194Richard Lowe    Dwarf_Arange     /*arange*/,
185907dc194Richard Lowe    Dwarf_Off*       /*return_offset*/,
186007dc194Richard Lowe    Dwarf_Error*     /*error*/);
18617c478bdstevel@tonic-gate
18627c478bdstevel@tonic-gateint dwarf_get_arange_cu_header_offset(
186307dc194Richard Lowe    Dwarf_Arange     /*arange*/,
186407dc194Richard Lowe    Dwarf_Off*       /*return_cu_header_offset*/,
186507dc194Richard Lowe    Dwarf_Error*     /*error*/);
18667c478bdstevel@tonic-gate#ifdef __sgi /* pragma is sgi MIPS only */
18677c478bdstevel@tonic-gate#pragma optional dwarf_get_arange_cu_header_offset
18687c478bdstevel@tonic-gate#endif
18697c478bdstevel@tonic-gate
187007dc194Richard Lowe/* DWARF2,3 interface. No longer really adequate (it was never
187107dc194Richard Lowe   right for segmented address spaces, please switch
187207dc194Richard Lowe   to using dwarf_get_arange_info_b instead.
187307dc194Richard Lowe   There is no effective difference between these
187407dc194Richard Lowe   functions  if the address space
187507dc194Richard Lowe   of the target is not segmented.  */
18767c478bdstevel@tonic-gateint dwarf_get_arange_info(
187707dc194Richard Lowe    Dwarf_Arange     /*arange*/,
187807dc194Richard Lowe    Dwarf_Addr*      /*start*/,
187907dc194Richard Lowe    Dwarf_Unsigned*  /*length*/,
188007dc194Richard Lowe    Dwarf_Off*       /*cu_die_offset*/,
188107dc194Richard Lowe    Dwarf_Error*     /*error*/ );
188207dc194Richard Lowe
188307dc194Richard Lowe/* New for DWARF4, entries may have segment information.
188407dc194Richard Lowe   *segment is only meaningful if *segment_entry_size is non-zero. */
188507dc194Richard Loweint dwarf_get_arange_info_b(
188607dc194Richard Lowe    Dwarf_Arange     /*arange*/,
188707dc194Richard Lowe    Dwarf_Unsigned*  /*segment*/,
188807dc194Richard Lowe    Dwarf_Unsigned*  /*segment_entry_size*/,
188907dc194Richard Lowe    Dwarf_Addr    *  /*start*/,
189007dc194Richard Lowe    Dwarf_Unsigned*  /*length*/,
189107dc194Richard Lowe    Dwarf_Off     *  /*cu_die_offset*/,
189207dc194Richard Lowe    Dwarf_Error   *  /*error*/ );
18937c478bdstevel@tonic-gate
18947c478bdstevel@tonic-gate
18957c478bdstevel@tonic-gate/* consumer .debug_macinfo information interface.
18967c478bdstevel@tonic-gate*/
18977c478bdstevel@tonic-gatestruct Dwarf_Macro_Details_s {
189807dc194Richard Lowe    Dwarf_Off    dmd_offset; /* offset, in the section,
18997c478bdstevel@tonic-gate                              of this macro info */
190007dc194Richard Lowe    Dwarf_Small  dmd_type;   /* the type, DW_MACINFO_define etc*/
190107dc194Richard Lowe    Dwarf_Signed dmd_lineno; /* the source line number where
19027c478bdstevel@tonic-gate                              applicable and vend_def # if
19037c478bdstevel@tonic-gate                              vendor_extension op
190407dc194Richard Lowe                             */
19057c478bdstevel@tonic-gate
190607dc194Richard Lowe    Dwarf_Signed dmd_fileindex;/* the source file index:
19077c478bdstevel@tonic-gate                              applies to define undef start_file
190807dc194Richard Lowe                               */
190907dc194Richard Lowe    char *       dmd_macro;  /* macro name (with value for defineop)
19107c478bdstevel@tonic-gate                              string from vendor ext
191107dc194Richard Lowe                             */
19127c478bdstevel@tonic-gate};
19137c478bdstevel@tonic-gate
191407dc194Richard Lowe/* dwarf_print_lines is for use by dwarfdump: it prints
19157c478bdstevel@tonic-gate   line info to stdout.
191607dc194Richard Lowe   The _dwarf name is obsolete. Use dwarf_ instead.
191707dc194Richard Lowe   Added extra argnument 2/2009 for better checking.
191807dc194Richard Lowe*/
191907dc194Richard Loweint _dwarf_print_lines(Dwarf_Die /*cu_die*/,Dwarf_Error * /*error*/);
192007dc194Richard Loweint dwarf_print_lines(Dwarf_Die /*cu_die*/,Dwarf_Error * /*error*/,
192107dc194Richard Lowe   int * /*error_count_out */);
192207dc194Richard Lowe
192307dc194Richard Lowe/* dwarf_check_lineheader lets dwarfdump get detailed messages
192407dc194Richard Lowe   about some compiler errors we detect.
192507dc194Richard Lowe   We return the count of detected errors throught the
192607dc194Richard Lowe   pointer.
19277c478bdstevel@tonic-gate*/
192807dc194Richard Lowevoid dwarf_check_lineheader(Dwarf_Die /*cu_die*/,int *errcount_out);
19297c478bdstevel@tonic-gate
193007dc194Richard Lowe/* dwarf_ld_sort_lines helps SGI IRIX ld
193107dc194Richard Lowe   rearrange lines in .debug_line in a .o created with a text
19327c478bdstevel@tonic-gate   section per function.
193307dc194Richard Lowe        -OPT:procedure_reorder=ON
19347c478bdstevel@tonic-gate   where ld-cord (cord(1)ing by ld,
19357c478bdstevel@tonic-gate   not by cord(1)) may have changed the function order.
193607dc194Richard Lowe   The _dwarf name is obsolete. Use dwarf_ instead.
19377c478bdstevel@tonic-gate*/
19387c478bdstevel@tonic-gateint _dwarf_ld_sort_lines(
193907dc194Richard Lowe    void *         /*orig_buffer*/,
194007dc194Richard Lowe    unsigned long  /* buffer_len*/,
194107dc194Richard Lowe    int            /*is_64_bit*/,
194207dc194Richard Lowe    int *          /*any_change*/,
194307dc194Richard Lowe    int *          /*err_code*/);
194407dc194Richard Loweint dwarf_ld_sort_lines(
194507dc194Richard Lowe    void *         /*orig_buffer*/,
194607dc194Richard Lowe    unsigned long  /*buffer_len*/,
194707dc194Richard Lowe    int            /*is_64_bit*/,
194807dc194Richard Lowe    int *          /*any_change*/,
194907dc194Richard Lowe    int *          /*err_code*/);
195007dc194Richard Lowe
195107dc194Richard Lowe/* Used by dwarfdump -v to print fde offsets from debugging
195207dc194Richard Lowe   info.
195307dc194Richard Lowe   The _dwarf name is obsolete. Use dwarf_ instead.
19547c478bdstevel@tonic-gate*/
195507dc194Richard Loweint _dwarf_fde_section_offset(Dwarf_Debug dbg,
195607dc194Richard Lowe    Dwarf_Fde         /*in_fde*/,
195707dc194Richard Lowe    Dwarf_Off *       /*fde_off*/,
195807dc194Richard Lowe    Dwarf_Off *       /*cie_off*/,
195907dc194Richard Lowe    Dwarf_Error *     /*err*/);
196007dc194Richard Loweint dwarf_fde_section_offset(Dwarf_Debug dbg,
196107dc194Richard Lowe    Dwarf_Fde         /*in_fde*/,
196207dc194Richard Lowe    Dwarf_Off *       /*fde_off*/,
196307dc194Richard Lowe    Dwarf_Off *       /*cie_off*/,
196407dc194Richard Lowe    Dwarf_Error *     /*err*/);
196507dc194Richard Lowe
196607dc194Richard Lowe/* Used by dwarfdump -v to print cie offsets from debugging
196707dc194Richard Lowe   info.
196807dc194Richard Lowe   The _dwarf name is obsolete. Use dwarf_ instead.
19697c478bdstevel@tonic-gate*/
197007dc194Richard Loweint dwarf_cie_section_offset(Dwarf_Debug /*dbg*/,
197107dc194Richard Lowe    Dwarf_Cie     /*in_cie*/,
197207dc194Richard Lowe    Dwarf_Off *   /*cie_off */,
197307dc194Richard Lowe    Dwarf_Error * /*err*/);
197407dc194Richard Loweint _dwarf_cie_section_offset(Dwarf_Debug /*dbg*/,
197507dc194Richard Lowe    Dwarf_Cie     /*in_cie*/,
197607dc194Richard Lowe    Dwarf_Off *   /*cie_off*/,
197707dc194Richard Lowe    Dwarf_Error * /*err*/);
19787c478bdstevel@tonic-gate
19797c478bdstevel@tonic-gatetypedef struct Dwarf_Macro_Details_s Dwarf_Macro_Details;
19807c478bdstevel@tonic-gate
19817c478bdstevel@tonic-gateint dwarf_get_macro(Dwarf_Debug /*dbg*/,
19827c478bdstevel@tonic-gate    char *        /*requested_macro_name*/,
19837c478bdstevel@tonic-gate    Dwarf_Addr    /*pc_of_request*/,
19847c478bdstevel@tonic-gate    char **       /*returned_macro_value*/,
19857c478bdstevel@tonic-gate    Dwarf_Error * /*error*/);
19867c478bdstevel@tonic-gate
19877c478bdstevel@tonic-gateint dwarf_get_all_defined_macros(Dwarf_Debug /*dbg*/,
19887c478bdstevel@tonic-gate    Dwarf_Addr     /*pc_of_request*/,
19897c478bdstevel@tonic-gate    Dwarf_Signed * /*returned_count*/,
19907c478bdstevel@tonic-gate    char ***       /*returned_pointers_to_macros*/,
19917c478bdstevel@tonic-gate    Dwarf_Error *  /*error*/);
19927c478bdstevel@tonic-gate
19937c478bdstevel@tonic-gatechar *dwarf_find_macro_value_start(char * /*macro_string*/);
19947c478bdstevel@tonic-gate
19957c478bdstevel@tonic-gateint dwarf_get_macro_details(Dwarf_Debug /*dbg*/,
199607dc194Richard Lowe    Dwarf_Off            /*macro_offset*/,
199707dc194Richard Lowe    Dwarf_Unsigned       /*maximum_count*/,
19987c478bdstevel@tonic-gate    Dwarf_Signed         * /*entry_count*/,
19997c478bdstevel@tonic-gate    Dwarf_Macro_Details ** /*details*/,
200007dc194Richard Lowe    Dwarf_Error *        /*err*/);
20017c478bdstevel@tonic-gate
20027c478bdstevel@tonic-gate
20037c478bdstevel@tonic-gateint dwarf_get_address_size(Dwarf_Debug /*dbg*/,
200407dc194Richard Lowe    Dwarf_Half  *    /*addr_size*/,
200507dc194Richard Lowe    Dwarf_Error *    /*error*/);
200607dc194Richard Loweint dwarf_get_die_address_size(Dwarf_Die /*die*/,
200707dc194Richard Lowe    Dwarf_Half  *    /*addr_size*/,
200807dc194Richard Lowe    Dwarf_Error *    /*error*/);
200907dc194Richard Lowe
201007dc194Richard Lowe/* The dwarf specification separates FORMs into
201107dc194Richard Lowedifferent classes.  To do the seperation properly
201207dc194Richard Lowerequires 4 pieces of data as of DWARF4 (thus the
201307dc194Richard Lowefunction arguments listed here).
201407dc194Richard LoweThe DWARF4 specification class definition suffices to
201507dc194Richard Lowedescribe all DWARF versions.
201607dc194Richard LoweSee section 7.5.4, Attribute Encodings.
201707dc194Richard LoweA return of DW_FORM_CLASS_UNKNOWN means we could not properly figure
201807dc194Richard Loweout what form-class it is.
201907dc194Richard Lowe
202007dc194Richard Lowe    DW_FORM_CLASS_FRAMEPTR is MIPS/IRIX only, and refers
202107dc194Richard Lowe    to the DW_AT_MIPS_fde attribute (a reference to the
202207dc194Richard Lowe    .debug_frame section).
202307dc194Richard Lowe*/
202407dc194Richard Loweenum Dwarf_Form_Class {
202507dc194Richard Lowe    DW_FORM_CLASS_UNKNOWN,   DW_FORM_CLASS_ADDRESS,
202607dc194Richard Lowe    DW_FORM_CLASS_BLOCK,     DW_FORM_CLASS_CONSTANT,
202707dc194Richard Lowe    DW_FORM_CLASS_EXPRLOC,   DW_FORM_CLASS_FLAG,
202807dc194Richard Lowe    DW_FORM_CLASS_LINEPTR,   DW_FORM_CLASS_LOCLISTPTR,
202907dc194Richard Lowe    DW_FORM_CLASS_MACPTR,    DW_FORM_CLASS_RANGELISTPTR,
203007dc194Richard Lowe    DW_FORM_CLASS_REFERENCE, DW_FORM_CLASS_STRING,
203107dc194Richard Lowe    DW_FORM_CLASS_FRAMEPTR
203207dc194Richard Lowe};
203307dc194Richard Lowe
203407dc194Richard Loweenum Dwarf_Form_Class dwarf_get_form_class(
203507dc194Richard Lowe    Dwarf_Half /* dwversion */,
203607dc194Richard Lowe    Dwarf_Half /* attrnum */,
203707dc194Richard Lowe    Dwarf_Half /*offset_size */,
203807dc194Richard Lowe    Dwarf_Half /*form*/);
20397c478bdstevel@tonic-gate
20407c478bdstevel@tonic-gate/* utility operations */
204107dc194Richard LoweDwarf_Unsigned dwarf_errno(Dwarf_Error     /*error*/);
20427c478bdstevel@tonic-gate
204307dc194Richard Lowechar* dwarf_errmsg(Dwarf_Error    /*error*/);
20447c478bdstevel@tonic-gate
20457c478bdstevel@tonic-gate/* stringcheck zero is default and means do all
20467c478bdstevel@tonic-gate** string length validity checks.
20477c478bdstevel@tonic-gate** Call with parameter value 1 to turn off many such checks (and
20487c478bdstevel@tonic-gate** increase performance).
20497c478bdstevel@tonic-gate** Call with zero for safest running.
20507c478bdstevel@tonic-gate** Actual value saved and returned is only 8 bits! Upper bits
20517c478bdstevel@tonic-gate** ignored by libdwarf (and zero on return).
20527c478bdstevel@tonic-gate** Returns previous value.
20537c478bdstevel@tonic-gate*/
20547c478bdstevel@tonic-gateint dwarf_set_stringcheck(int /*stringcheck*/);
20557c478bdstevel@tonic-gate
205607dc194Richard Lowe/* 'apply' defaults to 1 and means do all
205707dc194Richard Lowe * 'rela' relocations on reading in a dwarf object section with
205807dc194Richard Lowe * such relocations.
205907dc194Richard Lowe * Call with parameter value 0 to turn off application of
206007dc194Richard Lowe * such relocations.
206107dc194Richard Lowe * Since the static linker leaves 'bogus' data in object sections
206207dc194Richard Lowe * with a 'rela' relocation section such data cannot be read
206307dc194Richard Lowe * sensibly without processing the relocations.  Such relocations
206407dc194Richard Lowe * do not exist in executables and shared objects (.so), the
206507dc194Richard Lowe * relocations only exist in plain .o relocatable object files.
206607dc194Richard Lowe * Actual value saved and returned is only 8 bits! Upper bits
206707dc194Richard Lowe * ignored by libdwarf (and zero on return).
206807dc194Richard Lowe * Returns previous value.
206907dc194Richard Lowe * */
207007dc194Richard Loweint dwarf_set_reloc_application(int /*apply*/);
207107dc194Richard Lowe
207207dc194Richard Lowe
20737c478bdstevel@tonic-gate/* Unimplemented */
20747c478bdstevel@tonic-gateDwarf_Handler dwarf_seterrhand(Dwarf_Debug /*dbg*/, Dwarf_Handler /*errhand*/);
20757c478bdstevel@tonic-gate
20767c478bdstevel@tonic-gate/* Unimplemented */
20777c478bdstevel@tonic-gateDwarf_Ptr dwarf_seterrarg(Dwarf_Debug /*dbg*/, Dwarf_Ptr /*errarg*/);
20787c478bdstevel@tonic-gate
20797c478bdstevel@tonic-gatevoid dwarf_dealloc(Dwarf_Debug /*dbg*/, void* /*space*/,
20807c478bdstevel@tonic-gate    Dwarf_Unsigned /*type*/);
20817c478bdstevel@tonic-gate
20827c478bdstevel@tonic-gate/* DWARF Producer Interface */
20837c478bdstevel@tonic-gate
20847c478bdstevel@tonic-gatetypedef int (*Dwarf_Callback_Func)(
208507dc194Richard Lowe    char*           /*name*/,
208607dc194Richard Lowe    int             /*size*/,
208707dc194Richard Lowe    Dwarf_Unsigned  /*type*/,
208807dc194Richard Lowe    Dwarf_Unsigned  /*flags*/,
208907dc194Richard Lowe    Dwarf_Unsigned  /*link*/,
209007dc194Richard Lowe    Dwarf_Unsigned  /*info*/,
209107dc194Richard Lowe    int*            /*sect name index*/,
209207dc194Richard Lowe    int*            /*error*/);
20937c478bdstevel@tonic-gate
20947c478bdstevel@tonic-gateDwarf_P_Debug dwarf_producer_init(
209507dc194Richard Lowe    Dwarf_Unsigned  /*creation_flags*/,
209607dc194Richard Lowe    Dwarf_Callback_Func    /*func*/,
209707dc194Richard Lowe    Dwarf_Handler   /*errhand*/,
209807dc194Richard Lowe    Dwarf_Ptr       /*errarg*/,
209907dc194Richard Lowe    Dwarf_Error*    /*error*/);
21007c478bdstevel@tonic-gate
21017c478bdstevel@tonic-gatetypedef int (*Dwarf_Callback_Func_b)(
210207dc194Richard Lowe    char*           /*name*/,
210307dc194Richard Lowe    int             /*size*/,
210407dc194Richard Lowe    Dwarf_Unsigned  /*type*/,
210507dc194Richard Lowe    Dwarf_Unsigned  /*flags*/,
210607dc194Richard Lowe    Dwarf_Unsigned  /*link*/,
210707dc194Richard Lowe    Dwarf_Unsigned  /*info*/,
210807dc194Richard Lowe    Dwarf_Unsigned* /*sect_name_index*/,
210907dc194Richard Lowe    int*            /*error*/);
21107c478bdstevel@tonic-gate
21117c478bdstevel@tonic-gate
21127c478bdstevel@tonic-gateDwarf_P_Debug dwarf_producer_init_b(
21137c478bdstevel@tonic-gate    Dwarf_Unsigned        /*flags*/,
21147c478bdstevel@tonic-gate    Dwarf_Callback_Func_b /*func*/,
21157c478bdstevel@tonic-gate    Dwarf_Handler         /*errhand*/,
21167c478bdstevel@tonic-gate    Dwarf_Ptr             /*errarg*/,
21177c478bdstevel@tonic-gate    Dwarf_Error *         /*error*/);
21187c478bdstevel@tonic-gate
21197c478bdstevel@tonic-gate
21207c478bdstevel@tonic-gateDwarf_Signed dwarf_transform_to_disk_form(Dwarf_P_Debug /*dbg*/,
212107dc194Richard Lowe    Dwarf_Error*     /*error*/);
21227c478bdstevel@tonic-gate
21237c478bdstevel@tonic-gateDwarf_Ptr dwarf_get_section_bytes(Dwarf_P_Debug /*dbg*/,
212407dc194Richard Lowe    Dwarf_Signed     /*dwarf_section*/,
212507dc194Richard Lowe    Dwarf_Signed*    /*elf_section_index*/,
212607dc194Richard Lowe    Dwarf_Unsigned*  /*length*/,
212707dc194Richard Lowe    Dwarf_Error*     /*error*/);
21287c478bdstevel@tonic-gate
21297c478bdstevel@tonic-gateint  dwarf_get_relocation_info_count(
213007dc194Richard Lowe    Dwarf_P_Debug    /*dbg*/,
213107dc194Richard Lowe    Dwarf_Unsigned * /*count_of_relocation_sections*/,
213207dc194Richard Lowe    int *                /*drd_buffer_version*/,
213307dc194Richard Lowe    Dwarf_Error*     /*error*/);
21347c478bdstevel@tonic-gate
21357c478bdstevel@tonic-gateint dwarf_get_relocation_info(
213607dc194Richard Lowe    Dwarf_P_Debug           /*dbg*/,
213707dc194Richard Lowe    Dwarf_Signed          * /*elf_section_index*/,
213807dc194Richard Lowe    Dwarf_Signed          * /*elf_section_index_link*/,
213907dc194Richard Lowe    Dwarf_Unsigned        * /*relocation_buffer_count*/,
214007dc194Richard Lowe    Dwarf_Relocation_Data * /*reldata_buffer*/,
214107dc194Richard Lowe    Dwarf_Error*            /*error*/);
21427c478bdstevel@tonic-gate
21437c478bdstevel@tonic-gate/* v1:  no drd_length field, enum explicit */
21447c478bdstevel@tonic-gate/* v2:  has the drd_length field, enum value in uchar member */
21457c478bdstevel@tonic-gate#define DWARF_DRD_BUFFER_VERSION 2
21467c478bdstevel@tonic-gate
214707dc194Richard Lowe/* Markers are not written  to DWARF2/3/4, they are user
214807dc194Richard Lowe   defined and may be used for any purpose.
214907dc194Richard Lowe*/
215007dc194Richard LoweDwarf_Signed dwarf_get_die_markers(
215107dc194Richard Lowe    Dwarf_P_Debug     /*dbg*/,
215207dc194Richard Lowe    Dwarf_P_Marker *  /*marker_list*/,
215307dc194Richard Lowe    Dwarf_Unsigned *  /*marker_count*/,
215407dc194Richard Lowe    Dwarf_Error *     /*error*/);
215507dc194Richard Lowe
215607dc194Richard Loweint dwarf_get_string_attributes_count(Dwarf_P_Debug,
215707dc194Richard Lowe    Dwarf_Unsigned *,
215807dc194Richard Lowe    int *,
215907dc194Richard Lowe    Dwarf_Error *);
216007dc194Richard Lowe
216107dc194Richard Loweint dwarf_get_string_attributes_info(Dwarf_P_Debug,
216207dc194Richard Lowe    Dwarf_Signed *,
216307dc194Richard Lowe    Dwarf_Unsigned *,
216407dc194Richard Lowe    Dwarf_P_String_Attr *,
216507dc194Richard Lowe    Dwarf_Error *);
216607dc194Richard Lowe
21677c478bdstevel@tonic-gatevoid dwarf_reset_section_bytes(Dwarf_P_Debug /*dbg*/);
21687c478bdstevel@tonic-gate
21697c478bdstevel@tonic-gateDwarf_Unsigned dwarf_producer_finish(Dwarf_P_Debug /*dbg*/,
21707c478bdstevel@tonic-gate    Dwarf_Error* /*error*/);
21717c478bdstevel@tonic-gate
21727c478bdstevel@tonic-gate/* Producer attribute addition functions. */
21737c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_targ_address(Dwarf_P_Debug /*dbg*/,
217407dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
217507dc194Richard Lowe    Dwarf_Half      /*attr*/,
217607dc194Richard Lowe    Dwarf_Unsigned  /*pc_value*/,
217707dc194Richard Lowe    Dwarf_Signed    /*sym_index*/,
217807dc194Richard Lowe    Dwarf_Error*    /*error*/);
217907dc194Richard Lowe
218007dc194Richard LoweDwarf_P_Attribute dwarf_add_AT_block(Dwarf_P_Debug /*dbg*/,
218107dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
218207dc194Richard Lowe    Dwarf_Half      /*attr*/,
218307dc194Richard Lowe    Dwarf_Small*    /*block_data*/,
218407dc194Richard Lowe    Dwarf_Unsigned  /*block_len*/,
218507dc194Richard Lowe    Dwarf_Error*    /*error*/);
21867c478bdstevel@tonic-gate
21877c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_targ_address_b(Dwarf_P_Debug /*dbg*/,
218807dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
218907dc194Richard Lowe    Dwarf_Half      /*attr*/,
219007dc194Richard Lowe    Dwarf_Unsigned  /*pc_value*/,
219107dc194Richard Lowe    Dwarf_Unsigned  /*sym_index*/,
219207dc194Richard Lowe    Dwarf_Error*    /*error*/);
219307dc194Richard Lowe
219407dc194Richard LoweDwarf_P_Attribute dwarf_add_AT_ref_address(Dwarf_P_Debug /*dbg*/,
219507dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
219607dc194Richard Lowe    Dwarf_Half      /*attr*/,
219707dc194Richard Lowe    Dwarf_Unsigned  /*pc_value*/,
219807dc194Richard Lowe    Dwarf_Unsigned  /*sym_index*/,
219907dc194Richard Lowe    Dwarf_Error*    /*error*/);
22007c478bdstevel@tonic-gate
22017c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_unsigned_const(Dwarf_P_Debug /*dbg*/,
220207dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
220307dc194Richard Lowe    Dwarf_Half      /*attr*/,
220407dc194Richard Lowe    Dwarf_Unsigned  /*value*/,
220507dc194Richard Lowe    Dwarf_Error*    /*error*/);
22067c478bdstevel@tonic-gate
22077c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_signed_const(Dwarf_P_Debug /*dbg*/,
220807dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
220907dc194Richard Lowe    Dwarf_Half      /*attr*/,
221007dc194Richard Lowe    Dwarf_Signed    /*value*/,
221107dc194Richard Lowe    Dwarf_Error*    /*error*/);
22127c478bdstevel@tonic-gate
22137c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_reference(Dwarf_P_Debug /*dbg*/,
221407dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
221507dc194Richard Lowe    Dwarf_Half      /*attr*/,
221607dc194Richard Lowe    Dwarf_P_Die     /*otherdie*/,
221707dc194Richard Lowe    Dwarf_Error*    /*error*/);
221807dc194Richard Lowe
221907dc194Richard LoweDwarf_P_Attribute dwarf_add_AT_dataref(
222007dc194Richard Lowe    Dwarf_P_Debug   /* dbg*/,
222107dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
222207dc194Richard Lowe    Dwarf_Half      /*attr*/,
222307dc194Richard Lowe    Dwarf_Unsigned  /*pcvalue*/,
222407dc194Richard Lowe    Dwarf_Unsigned  /*sym_index*/,
222507dc194Richard Lowe    Dwarf_Error*    /*error*/);
22267c478bdstevel@tonic-gate
22277c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_const_value_string(Dwarf_P_Die /*ownerdie*/,
222807dc194Richard Lowe    char*           /*string_value*/,
222907dc194Richard Lowe    Dwarf_Error*    /*error*/);
22307c478bdstevel@tonic-gate
22317c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_location_expr(Dwarf_P_Debug /*dbg*/,
223207dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
223307dc194Richard Lowe    Dwarf_Half      /*attr*/,
223407dc194Richard Lowe    Dwarf_P_Expr    /*loc_expr*/,
223507dc194Richard Lowe    Dwarf_Error*    /*error*/);
22367c478bdstevel@tonic-gate
22377c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_string(Dwarf_P_Debug /*dbg*/,
223807dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
223907dc194Richard Lowe    Dwarf_Half      /*attr*/,
224007dc194Richard Lowe    char*           /*string*/,
224107dc194Richard Lowe    Dwarf_Error*     /*error*/);
22427c478bdstevel@tonic-gate
22437c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_flag(Dwarf_P_Debug /*dbg*/,
224407dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
224507dc194Richard Lowe    Dwarf_Half      /*attr*/,
224607dc194Richard Lowe    Dwarf_Small     /*flag*/,
224707dc194Richard Lowe    Dwarf_Error*    /*error*/);
22487c478bdstevel@tonic-gate
22497c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_producer(Dwarf_P_Die /*ownerdie*/,
225007dc194Richard Lowe    char*           /*producer_string*/,
225107dc194Richard Lowe    Dwarf_Error*    /*error*/);
22527c478bdstevel@tonic-gate
22537c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
225407dc194Richard Lowe    Dwarf_Signed    /*signed_value*/,
225507dc194Richard Lowe    Dwarf_Error*    /*error*/);
22567c478bdstevel@tonic-gate
22577c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_const_value_unsignedint(
225807dc194Richard Lowe    Dwarf_P_Die     /*ownerdie*/,
225907dc194Richard Lowe    Dwarf_Unsigned  /*unsigned_value*/,
226007dc194Richard Lowe    Dwarf_Error*    /*error*/);
22617c478bdstevel@tonic-gate
22627c478bdstevel@tonic-gateDwarf_P_Attribute dwarf_add_AT_comp_dir(Dwarf_P_Die /*ownerdie*/,
226307dc194Richard Lowe    char*           /*current_working_directory*/,
226407dc194Richard Lowe    Dwarf_Error*    /*error*/);
22657c478bdstevel@tonic-gate
226607dc194Richard LoweDwarf_P_Attribute dwarf_add_AT_name(Dwarf_P_Die    /*die*/,
226707dc194Richard Lowe    char*           /*name*/,
226807dc194Richard Lowe    Dwarf_Error*    /*error*/);
22697c478bdstevel@tonic-gate
22707c478bdstevel@tonic-gate/* Producer line creation functions (.debug_line) */
22717c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_directory_decl(Dwarf_P_Debug /*dbg*/,
227207dc194Richard Lowe    char*           /*name*/,
227307dc194Richard Lowe    Dwarf_Error*    /*error*/);
22747c478bdstevel@tonic-gate
22757c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_file_decl(Dwarf_P_Debug /*dbg*/,
227607dc194Richard Lowe    char*           /*name*/,
227707dc194Richard Lowe    Dwarf_Unsigned  /*dir_index*/,
227807dc194Richard Lowe    Dwarf_Unsigned  /*time_last_modified*/,
227907dc194Richard Lowe    Dwarf_Unsigned  /*length*/,
228007dc194Richard Lowe    Dwarf_Error*    /*error*/);
22817c478bdstevel@tonic-gate
22827c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_line_entry(Dwarf_P_Debug /*dbg*/,
228307dc194Richard Lowe    Dwarf_Unsigned  /*file_index*/,
228407dc194Richard Lowe    Dwarf_Addr      /*code_address*/,
228507dc194Richard Lowe    Dwarf_Unsigned  /*lineno*/,
228607dc194Richard Lowe    Dwarf_Signed    /*column_number*/,
228707dc194Richard Lowe    Dwarf_Bool      /*is_source_stmt_begin*/,
228807dc194Richard Lowe    Dwarf_Bool      /*is_basic_block_begin*/,
228907dc194Richard Lowe    Dwarf_Error*    /*error*/);
22907c478bdstevel@tonic-gate
22917c478bdstevel@tonic-gateDwarf_Unsigned dwarf_lne_set_address(Dwarf_P_Debug /*dbg*/,
229207dc194Richard Lowe    Dwarf_Unsigned  /*offset*/,
229307dc194Richard Lowe    Dwarf_Unsigned  /*symbol_index*/,
229407dc194Richard Lowe    Dwarf_Error*    /*error*/);
22957c478bdstevel@tonic-gate
22967c478bdstevel@tonic-gateDwarf_Unsigned dwarf_lne_end_sequence(Dwarf_P_Debug /*dbg*/,
229707dc194Richard Lowe    Dwarf_Addr      /*end_address*/,
229807dc194Richard Lowe    Dwarf_Error*    /*error*/);
22997c478bdstevel@tonic-gate
23007c478bdstevel@tonic-gate/* Producer .debug_frame functions */
23017c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_frame_cie(Dwarf_P_Debug /*dbg*/,
230207dc194Richard Lowe    char*           /*augmenter*/,
230307dc194Richard Lowe    Dwarf_Small     /*code_alignent_factor*/,
230407dc194Richard Lowe    Dwarf_Small     /*data_alignment_factor*/,
230507dc194Richard Lowe    Dwarf_Small     /*return_address_reg*/,
230607dc194Richard Lowe    Dwarf_Ptr       /*initialization_bytes*/,
230707dc194Richard Lowe    Dwarf_Unsigned  /*init_byte_len*/,
230807dc194Richard Lowe    Dwarf_Error*    /*error*/);
23097c478bdstevel@tonic-gate
23107c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_frame_fde(
231107dc194Richard Lowe    Dwarf_P_Debug   /*dbg*/,
231207dc194Richard Lowe    Dwarf_P_Fde     /*fde*/,
231307dc194Richard Lowe    Dwarf_P_Die     /*corresponding subprogram die*/,
231407dc194Richard Lowe    Dwarf_Unsigned  /*cie_to_use*/,
231507dc194Richard Lowe    Dwarf_Unsigned  /*virt_addr_of_described_code*/,
231607dc194Richard Lowe    Dwarf_Unsigned  /*length_of_code*/,
231707dc194Richard Lowe    Dwarf_Unsigned  /*symbol_index*/,
231807dc194Richard Lowe    Dwarf_Error*    /*error*/);
23197c478bdstevel@tonic-gate
23207c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_frame_fde_b(
232107dc194Richard Lowe    Dwarf_P_Debug  /*dbg*/,
232207dc194Richard Lowe    Dwarf_P_Fde    /*fde*/,
232307dc194Richard Lowe    Dwarf_P_Die    /*die*/,
232407dc194Richard Lowe    Dwarf_Unsigned /*cie*/,
232507dc194Richard Lowe    Dwarf_Addr     /*virt_addr*/,
232607dc194Richard Lowe    Dwarf_Unsigned /*code_len*/,
232707dc194Richard Lowe    Dwarf_Unsigned /*sym_idx*/,
232807dc194Richard Lowe    Dwarf_Unsigned /*sym_idx_of_end*/,
232907dc194Richard Lowe    Dwarf_Addr     /*offset_from_end_sym*/,
233007dc194Richard Lowe    Dwarf_Error*   /*error*/);
23317c478bdstevel@tonic-gate
23327c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_frame_info_b(
23337c478bdstevel@tonic-gate    Dwarf_P_Debug dbg   /*dbg*/,
233407dc194Richard Lowe    Dwarf_P_Fde     /*fde*/,
233507dc194Richard Lowe    Dwarf_P_Die     /*die*/,
233607dc194Richard Lowe    Dwarf_Unsigned  /*cie*/,
233707dc194Richard Lowe    Dwarf_Addr      /*virt_addr*/,
233807dc194Richard Lowe    Dwarf_Unsigned  /*code_len*/,
233907dc194Richard Lowe    Dwarf_Unsigned  /*symidx*/,
234007dc194Richard Lowe    Dwarf_Unsigned  /*end_symbol */,
234107dc194Richard Lowe    Dwarf_Addr      /*offset_from_end_symbol */,
234207dc194Richard Lowe    Dwarf_Signed    /*offset_into_exception_tables*/,
234307dc194Richard Lowe    Dwarf_Unsigned  /*exception_table_symbol*/,
234407dc194Richard Lowe    Dwarf_Error*    /*error*/);
23457c478bdstevel@tonic-gate
23467c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_frame_info(
23477c478bdstevel@tonic-gate    Dwarf_P_Debug dbg   /*dbg*/,
234807dc194Richard Lowe    Dwarf_P_Fde     /*fde*/,
234907dc194Richard Lowe    Dwarf_P_Die     /*die*/,
235007dc194Richard Lowe    Dwarf_Unsigned  /*cie*/,
235107dc194Richard Lowe    Dwarf_Addr      /*virt_addr*/,
235207dc194Richard Lowe    Dwarf_Unsigned  /*code_len*/,
235307dc194Richard Lowe    Dwarf_Unsigned  /*symidx*/,
235407dc194Richard Lowe    Dwarf_Signed    /*offset_into_exception_tables*/,
235507dc194Richard Lowe    Dwarf_Unsigned  /*exception_table_symbol*/,
235607dc194Richard Lowe    Dwarf_Error*    /*error*/);
23577c478bdstevel@tonic-gate
23587c478bdstevel@tonic-gateDwarf_P_Fde dwarf_add_fde_inst(
235907dc194Richard Lowe    Dwarf_P_Fde     /*fde*/,
236007dc194Richard Lowe    Dwarf_Small     /*op*/,
236107dc194Richard Lowe    Dwarf_Unsigned  /*val1*/,
236207dc194Richard Lowe    Dwarf_Unsigned  /*val2*/,
236307dc194Richard Lowe    Dwarf_Error*    /*error*/);
23647c478bdstevel@tonic-gate
236507dc194Richard Lowe/* New September 17, 2009 */
236607dc194Richard Loweint dwarf_insert_fde_inst_bytes(
236707dc194Richard Lowe    Dwarf_P_Debug  /*dbg*/,
236807dc194Richard Lowe    Dwarf_P_Fde    /*fde*/,
236907dc194Richard Lowe    Dwarf_Unsigned /*len*/,
237007dc194Richard Lowe    Dwarf_Ptr      /*ibytes*/,
237107dc194Richard Lowe    Dwarf_Error*   /*error*/);
237207dc194Richard Lowe
237307dc194Richard Lowe
237407dc194Richard LoweDwarf_P_Fde dwarf_new_fde(Dwarf_P_Debug    /*dbg*/, Dwarf_Error* /*error*/);
23757c478bdstevel@tonic-gate
23767c478bdstevel@tonic-gateDwarf_P_Fde dwarf_fde_cfa_offset(
237707dc194Richard Lowe    Dwarf_P_Fde     /*fde*/,
237807dc194Richard Lowe    Dwarf_Unsigned  /*register_number*/,
237907dc194Richard Lowe    Dwarf_Signed    /*offset*/,
238007dc194Richard Lowe    Dwarf_Error*    /*error*/);
23817c478bdstevel@tonic-gate
23827c478bdstevel@tonic-gate/* die creation & addition routines */
23837c478bdstevel@tonic-gateDwarf_P_Die dwarf_new_die(
238407dc194Richard Lowe    Dwarf_P_Debug    /*dbg*/,
238507dc194Richard Lowe    Dwarf_Tag         /*tag*/,
238607dc194Richard Lowe    Dwarf_P_Die     /*parent*/,
238707dc194Richard Lowe    Dwarf_P_Die     /*child*/,
238807dc194Richard Lowe    Dwarf_P_Die     /*left */,
238907dc194Richard Lowe    Dwarf_P_Die     /*right*/,
239007dc194Richard Lowe    Dwarf_Error*    /*error*/);
23917c478bdstevel@tonic-gate
23927c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_die_to_debug(
239307dc194Richard Lowe    Dwarf_P_Debug   /*dbg*/,
239407dc194Richard Lowe    Dwarf_P_Die     /*die*/,
239507dc194Richard Lowe    Dwarf_Error*    /*error*/);
239607dc194Richard Lowe
239707dc194Richard Lowe/* Markers are not written  to DWARF2/3/4, they are user
239807dc194Richard Lowe   defined and may be used for any purpose.
239907dc194Richard Lowe*/
240007dc194Richard LoweDwarf_Unsigned dwarf_add_die_marker(
240107dc194Richard Lowe    Dwarf_P_Debug   /*dbg*/,
240207dc194Richard Lowe    Dwarf_P_Die     /*die*/,
240307dc194Richard Lowe    Dwarf_Unsigned  /*marker*/,
240407dc194Richard Lowe    Dwarf_Error *   /*error*/);
240507dc194Richard Lowe
240607dc194Richard LoweDwarf_Unsigned dwarf_get_die_marker(
240707dc194Richard Lowe    Dwarf_P_Debug   /*dbg*/,
240807dc194Richard Lowe    Dwarf_P_Die     /*die*/,
240907dc194Richard Lowe    Dwarf_Unsigned *  /*marker*/,
241007dc194Richard Lowe    Dwarf_Error *   /*error*/);
24117c478bdstevel@tonic-gate
24127c478bdstevel@tonic-gateDwarf_P_Die dwarf_die_link(
241307dc194Richard Lowe    Dwarf_P_Die     /*die*/,
241407dc194Richard Lowe    Dwarf_P_Die     /*parent*/,
241507dc194Richard Lowe    Dwarf_P_Die     /*child*/,
241607dc194Richard Lowe    Dwarf_P_Die     /*left*/,
241707dc194Richard Lowe    Dwarf_P_Die     /*right*/,
241807dc194Richard Lowe    Dwarf_Error*    /*error*/);
241907dc194Richard Lowe
242007dc194Richard Lowevoid dwarf_dealloc_compressed_block(
242107dc194Richard Lowe    Dwarf_P_Debug,
242207dc194Richard Lowe    void *
242307dc194Richard Lowe);
242407dc194Richard Lowe
242507dc194Richard Lowe/* Call this passing in return value from dwarf_uncompress_integer_block()
242607dc194Richard Lowe * to free the space the decompression allocated. */
242707dc194Richard Lowevoid dwarf_dealloc_uncompressed_block(
242807dc194Richard Lowe    Dwarf_Debug,
242907dc194Richard Lowe    void *
243007dc194Richard Lowe);
243107dc194Richard Lowe
243207dc194Richard Lowevoid * dwarf_compress_integer_block(
243307dc194Richard Lowe    Dwarf_P_Debug,    /* dbg */
243407dc194Richard Lowe    Dwarf_Bool,       /* signed==true (or unsigned) */
243507dc194Richard Lowe    Dwarf_Small,      /* size of integer units: 8, 16, 32, 64 */
243607dc194Richard Lowe    void*,            /* data */
243707dc194Richard Lowe    Dwarf_Unsigned,   /* number of elements */
243807dc194Richard Lowe    Dwarf_Unsigned*,  /* number of bytes in output block */
243907dc194Richard Lowe    Dwarf_Error*      /* error */
244007dc194Richard Lowe);
244107dc194Richard Lowe
244207dc194Richard Lowe/* Decode an array of signed leb integers (so of course the
244307dc194Richard Lowe * array is not composed of fixed length values, but is instead
244407dc194Richard Lowe * a sequence of sleb values).
244507dc194Richard Lowe * Returns a DW_DLV_BADADDR on error.
244607dc194Richard Lowe * Otherwise returns a pointer to an array of 32bit integers.
244707dc194Richard Lowe * The signed argument must be non-zero (the decode
244807dc194Richard Lowe * assumes sleb integers in the input data) at this time.
244907dc194Richard Lowe * Size of integer units must be 32 (32 bits each) at this time.
245007dc194Richard Lowe * Number of bytes in block is a byte count (not array count).
245107dc194Richard Lowe * Returns number of units in output block (ie, number of elements
245207dc194Richard Lowe * of the array that the return value points to) thru the argument.
245307dc194Richard Lowe */
245407dc194Richard Lowevoid * dwarf_uncompress_integer_block(
245507dc194Richard Lowe    Dwarf_Debug,      /* dbg */
245607dc194Richard Lowe    Dwarf_Bool,       /* signed==true (or unsigned) */
245707dc194Richard Lowe    Dwarf_Small,      /* size of integer units: 8, 16, 32, 64 */
245807dc194Richard Lowe    void*,            /* input data */
245907dc194Richard Lowe    Dwarf_Unsigned,   /* number of bytes in input */
246007dc194Richard Lowe    Dwarf_Unsigned*,  /* number of units in output block */
246107dc194Richard Lowe    Dwarf_Error*      /* error */
246207dc194Richard Lowe);
24637c478bdstevel@tonic-gate
24647c478bdstevel@tonic-gate/* Operations to create location expressions. */
24657c478bdstevel@tonic-gateDwarf_P_Expr dwarf_new_expr(Dwarf_P_Debug /*dbg*/, Dwarf_Error* /*error*/);
24667c478bdstevel@tonic-gate
246707dc194Richard Lowevoid dwarf_expr_reset(
246807dc194Richard Lowe    Dwarf_P_Expr      /*expr*/,
246907dc194Richard Lowe    Dwarf_Error*      /*error*/);
247007dc194Richard Lowe
24717c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_expr_gen(
247207dc194Richard Lowe    Dwarf_P_Expr      /*expr*/,
247307dc194Richard Lowe    Dwarf_Small       /*opcode*/,
247407dc194Richard Lowe    Dwarf_Unsigned    /*val1*/,
247507dc194Richard Lowe    Dwarf_Unsigned    /*val2*/,
247607dc194Richard Lowe    Dwarf_Error*      /*error*/);
24777c478bdstevel@tonic-gate
24787c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_expr_addr(
247907dc194Richard Lowe    Dwarf_P_Expr      /*expr*/,
248007dc194Richard Lowe    Dwarf_Unsigned    /*addr*/,
248107dc194Richard Lowe    Dwarf_Signed      /*sym_index*/,
248207dc194Richard Lowe    Dwarf_Error*      /*error*/);
24837c478bdstevel@tonic-gate
24847c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_expr_addr_b(
248507dc194Richard Lowe    Dwarf_P_Expr      /*expr*/,
248607dc194Richard Lowe    Dwarf_Unsigned    /*addr*/,
248707dc194Richard Lowe    Dwarf_Unsigned    /*sym_index*/,
248807dc194Richard Lowe    Dwarf_Error*      /*error*/);
24897c478bdstevel@tonic-gate
24907c478bdstevel@tonic-gateDwarf_Unsigned dwarf_expr_current_offset(
249107dc194Richard Lowe    Dwarf_P_Expr      /*expr*/,
249207dc194Richard Lowe    Dwarf_Error*      /*error*/);
24937c478bdstevel@tonic-gate
24947c478bdstevel@tonic-gateDwarf_Addr dwarf_expr_into_block(
249507dc194Richard Lowe    Dwarf_P_Expr      /*expr*/,
249607dc194Richard Lowe    Dwarf_Unsigned*   /*length*/,
249707dc194Richard Lowe    Dwarf_Error*      /*error*/);
24987c478bdstevel@tonic-gate
24997c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_arange(Dwarf_P_Debug /*dbg*/,
250007dc194Richard Lowe    Dwarf_Addr        /*begin_address*/,
250107dc194Richard Lowe    Dwarf_Unsigned    /*length*/,
250207dc194Richard Lowe    Dwarf_Signed      /*symbol_index*/,
250307dc194Richard Lowe    Dwarf_Error*      /*error*/);
25047c478bdstevel@tonic-gate
25057c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_arange_b(
250607dc194Richard Lowe    Dwarf_P_Debug  /*dbg*/,
250707dc194Richard Lowe    Dwarf_Addr     /*begin_address*/,
250807dc194Richard Lowe    Dwarf_Unsigned /*length*/,
250907dc194Richard Lowe    Dwarf_Unsigned /*symbol_index*/,
251007dc194Richard Lowe    Dwarf_Unsigned /*end_symbol_index*/,
251107dc194Richard Lowe    Dwarf_Addr     /*offset_from_end_symbol*/,
251207dc194Richard Lowe    Dwarf_Error *  /*error*/);
25137c478bdstevel@tonic-gate
25147c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_pubname(
251507dc194Richard Lowe    Dwarf_P_Debug      /*dbg*/,
251607dc194Richard Lowe    Dwarf_P_Die        /*die*/,
251707dc194Richard Lowe    char*              /*pubname_name*/,
251807dc194Richard Lowe    Dwarf_Error*       /*error*/);
25197c478bdstevel@tonic-gate
25207c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_funcname(
252107dc194Richard Lowe    Dwarf_P_Debug      /*dbg*/,
252207dc194Richard Lowe    Dwarf_P_Die        /*die*/,
252307dc194Richard Lowe    char*              /*func_name*/,
252407dc194Richard Lowe    Dwarf_Error*       /*error*/);
25257c478bdstevel@tonic-gate
25267c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_typename(
252707dc194Richard Lowe    Dwarf_P_Debug     /*dbg*/,
252807dc194Richard Lowe    Dwarf_P_Die       /*die*/,
252907dc194Richard Lowe    char*             /*type_name*/,
253007dc194Richard Lowe    Dwarf_Error*      /*error*/);
25317c478bdstevel@tonic-gate
25327c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_varname(
253307dc194Richard Lowe    Dwarf_P_Debug     /*dbg*/,
253407dc194Richard Lowe    Dwarf_P_Die       /*die*/,
253507dc194Richard Lowe    char*             /*var_name*/,
253607dc194Richard Lowe    Dwarf_Error*      /*error*/);
25377c478bdstevel@tonic-gate
25387c478bdstevel@tonic-gateDwarf_Unsigned dwarf_add_weakname(
253907dc194Richard Lowe    Dwarf_P_Debug    /*dbg*/,
254007dc194Richard Lowe    Dwarf_P_Die      /*die*/,
254107dc194Richard Lowe    char*            /*weak_name*/,
254207dc194Richard Lowe    Dwarf_Error*     /*error*/);
25437c478bdstevel@tonic-gate
25447c478bdstevel@tonic-gate/* .debug_macinfo producer functions
25457c478bdstevel@tonic-gate   Functions must be called in right order: the section is output
25467c478bdstevel@tonic-gate   In the order these are presented.
25477c478bdstevel@tonic-gate*/
25487c478bdstevel@tonic-gateint dwarf_def_macro(Dwarf_P_Debug /*dbg*/,
254907dc194Richard Lowe    Dwarf_Unsigned   /*line*/,
255007dc194Richard Lowe    char *           /*macname, with (arglist), no space before (*/,
255107dc194Richard Lowe    char *           /*macvalue*/,
255207dc194Richard Lowe    Dwarf_Error*     /*error*/);
25537c478bdstevel@tonic-gate
25547c478bdstevel@tonic-gateint dwarf_undef_macro(Dwarf_P_Debug /*dbg*/,
255507dc194Richard Lowe    Dwarf_Unsigned   /*line*/,
255607dc194Richard Lowe    char *           /*macname, no arglist, of course*/,
255707dc194Richard Lowe    Dwarf_Error*     /*error*/);
25587c478bdstevel@tonic-gate
25597c478bdstevel@tonic-gateint dwarf_start_macro_file(Dwarf_P_Debug /*dbg*/,
256007dc194Richard Lowe    Dwarf_Unsigned   /*fileindex*/,
256107dc194Richard Lowe    Dwarf_Unsigned   /*linenumber*/,
256207dc194Richard Lowe    Dwarf_Error*     /*error*/);
25637c478bdstevel@tonic-gate
25647c478bdstevel@tonic-gateint dwarf_end_macro_file(Dwarf_P_Debug /*dbg*/,
256507dc194Richard Lowe    Dwarf_Error*     /*error*/);
25667c478bdstevel@tonic-gate
25677c478bdstevel@tonic-gateint dwarf_vendor_ext(Dwarf_P_Debug /*dbg*/,
256807dc194Richard Lowe    Dwarf_Unsigned   /*constant*/,
256907dc194Richard Lowe    char *           /*string*/,
257007dc194Richard Lowe    Dwarf_Error*     /*error*/);
25717c478bdstevel@tonic-gate
25727c478bdstevel@tonic-gate/* end macinfo producer functions */
25737c478bdstevel@tonic-gate
25747c478bdstevel@tonic-gateint dwarf_attr_offset(Dwarf_Die /*die*/,
25757c478bdstevel@tonic-gate    Dwarf_Attribute /*attr of above die*/,
25767c478bdstevel@tonic-gate    Dwarf_Off     * /*returns offset thru this ptr */,
25777c478bdstevel@tonic-gate    Dwarf_Error   * /*error*/);
25787c478bdstevel@tonic-gate
257907dc194Richard Lowe/* This is a hack so clients can verify offsets.
258007dc194Richard Lowe   Added April 2005 so that debugger can detect broken offsets
258107dc194Richard Lowe   (which happened in an IRIX executable larger than 2GB
258207dc194Richard Lowe    with MIPSpro 7.3.1.3 toolchain.).
258307dc194Richard Lowe*/
258407dc194Richard Loweint
258507dc194Richard Lowedwarf_get_section_max_offsets(Dwarf_Debug /*dbg*/,
258607dc194Richard Lowe    Dwarf_Unsigned * /*debug_info_size*/,
258707dc194Richard Lowe    Dwarf_Unsigned * /*debug_abbrev_size*/,
258807dc194Richard Lowe    Dwarf_Unsigned * /*debug_line_size*/,
258907dc194Richard Lowe    Dwarf_Unsigned * /*debug_loc_size*/,
259007dc194Richard Lowe    Dwarf_Unsigned * /*debug_aranges_size*/,
259107dc194Richard Lowe    Dwarf_Unsigned * /*debug_macinfo_size*/,
259207dc194Richard Lowe    Dwarf_Unsigned * /*debug_pubnames_size*/,
259307dc194Richard Lowe    Dwarf_Unsigned * /*debug_str_size*/,
259407dc194Richard Lowe    Dwarf_Unsigned * /*debug_frame_size*/,
259507dc194Richard Lowe    Dwarf_Unsigned * /*debug_ranges_size*/,
259607dc194Richard Lowe    Dwarf_Unsigned * /*debug_pubtypes_size*/);
259707dc194Richard Lowe
259807dc194Richard Lowe/* Multiple releases spelled 'initial' as 'inital' .
259907dc194Richard Lowe   The 'inital' spelling should not be used. */
260007dc194Richard LoweDwarf_Half dwarf_set_frame_rule_inital_value(Dwarf_Debug /*dbg*/,
260107dc194Richard Lowe    Dwarf_Half /*value*/);
260207dc194Richard Lowe/* Additional interface with correct 'initial' spelling. */
260307dc194Richard Lowe/* It is likely you will want to call the following 5 functions
260407dc194Richard Lowe   before accessing any frame information.  All are useful
260507dc194Richard Lowe   to tailor handling of pseudo-registers needed to turn
260607dc194Richard Lowe   frame operation references into simpler forms and to
260707dc194Richard Lowe   reflect ABI specific data.  Of course altering libdwarf.h
260807dc194Richard Lowe   and dwarf.h allow the same capabilities, but such header changes
260907dc194Richard Lowe   do not let one change these values at runtime. */
261007dc194Richard LoweDwarf_Half dwarf_set_frame_rule_initial_value(Dwarf_Debug /*dbg*/,
261107dc194Richard Lowe    Dwarf_Half /*value*/);
261207dc194Richard LoweDwarf_Half dwarf_set_frame_rule_table_size(Dwarf_Debug /*dbg*/,
261307dc194Richard Lowe    Dwarf_Half /*value*/);
261407dc194Richard LoweDwarf_Half dwarf_set_frame_cfa_value(Dwarf_Debug /*dbg*/,
261507dc194Richard Lowe    Dwarf_Half /*value*/);
261607dc194Richard LoweDwarf_Half dwarf_set_frame_same_value(Dwarf_Debug /*dbg*/,
261707dc194Richard Lowe    Dwarf_Half /*value*/);
261807dc194Richard LoweDwarf_Half dwarf_set_frame_undefined_value(Dwarf_Debug /*dbg*/,
261907dc194Richard Lowe    Dwarf_Half /*value*/);
262007dc194Richard Lowe
262107dc194Richard Lowe/* As of April 27, 2009, this version with no diepointer is
262207dc194Richard Lowe   obsolete though supported.  Use dwarf_get_ranges_a() instead. */
262307dc194Richard Loweint dwarf_get_ranges(Dwarf_Debug /*dbg*/,
262407dc194Richard Lowe    Dwarf_Off /*rangesoffset*/,
262507dc194Richard Lowe    Dwarf_Ranges ** /*rangesbuf*/,
262607dc194Richard Lowe    Dwarf_Signed * /*listlen*/,
262707dc194Richard Lowe    Dwarf_Unsigned * /*bytecount*/,
262807dc194Richard Lowe    Dwarf_Error * /*error*/);
262907dc194Richard Lowe
263007dc194Richard Lowe/* This adds the address_size argument. New April 27, 2009 */
263107dc194Richard Loweint dwarf_get_ranges_a(Dwarf_Debug /*dbg*/,
263207dc194Richard Lowe    Dwarf_Off /*rangesoffset*/,
263307dc194Richard Lowe    Dwarf_Die  /* diepointer */,
263407dc194Richard Lowe    Dwarf_Ranges ** /*rangesbuf*/,
263507dc194Richard Lowe    Dwarf_Signed * /*listlen*/,
263607dc194Richard Lowe    Dwarf_Unsigned * /*bytecount*/,
263707dc194Richard Lowe    Dwarf_Error * /*error*/);
263807dc194Richard Lowe
263907dc194Richard Lowevoid dwarf_ranges_dealloc(Dwarf_Debug /*dbg*/,
264007dc194Richard Lowe    Dwarf_Ranges * /*rangesbuf*/,
264107dc194Richard Lowe    Dwarf_Signed /*rangecount*/);
264207dc194Richard Lowe
264307dc194Richard Lowe/* The harmless error list is a circular buffer of
264407dc194Richard Lowe   errors we note but which do not stop us from processing
264507dc194Richard Lowe   the object.  Created so dwarfdump or other tools
264607dc194Richard Lowe   can report such inconsequential errors without causing
264707dc194Richard Lowe   anything to stop early. */
264807dc194Richard Lowe#define DW_HARMLESS_ERROR_CIRCULAR_LIST_DEFAULT_SIZE 4
264907dc194Richard Lowe#define DW_HARMLESS_ERROR_MSG_STRING_SIZE   200
265007dc194Richard Lowe/* User code supplies size of array of pointers errmsg_ptrs_array
265107dc194Richard Lowe    in count and the array of pointers (the pointers themselves
265207dc194Richard Lowe    need not be initialized).
265307dc194Richard Lowe    The pointers returned in the array of pointers
265407dc194Richard Lowe    are invalidated by ANY call to libdwarf.
265507dc194Richard Lowe    Use them before making another libdwarf call!
265607dc194Richard Lowe    The array of string pointers passed in always has
265707dc194Richard Lowe    a final null pointer, so if there are N pointers the
265807dc194Richard Lowe    and M actual strings, then MIN(M,N-1) pointers are
265907dc194Richard Lowe    set to point to error strings.  The array of pointers
266007dc194Richard Lowe    to strings always terminates with a NULL pointer.
266107dc194Richard Lowe    If 'count' is passed in zero then errmsg_ptrs_array
266207dc194Richard Lowe    is not touched.
266307dc194Richard Lowe
266407dc194Richard Lowe    The function returns DW_DLV_NO_ENTRY if no harmless errors
266507dc194Richard Lowe    were noted so far.  Returns DW_DLV_OK if there are errors.
266607dc194Richard Lowe    Never returns DW_DLV_ERROR.
266707dc194Richard Lowe
266807dc194Richard Lowe    Each call empties the error list (discarding all current entries).
266907dc194Richard Lowe    If newerr_count is non-NULL the count of harmless errors
267007dc194Richard Lowe    since the last call is returned through the pointer
267107dc194Richard Lowe    (some may have been discarded or not returned, it is a circular
267207dc194Richard Lowe    list...).
267307dc194Richard Lowe    If DW_DLV_NO_ENTRY is returned none of the arguments
267407dc194Richard Lowe    here are touched or used.
267507dc194Richard Lowe    */
267607dc194Richard Loweint dwarf_get_harmless_error_list(Dwarf_Debug /*dbg*/,
267707dc194Richard Lowe    unsigned  /*count*/,
267807dc194Richard Lowe    const char ** /*errmsg_ptrs_array*/,
267907dc194Richard Lowe    unsigned * /*newerr_count*/);
268007dc194Richard Lowe
268107dc194Richard Lowe/* Insertion is only for testing the harmless error code, it is not
268207dc194Richard Lowe    necessarily useful otherwise. */
268307dc194Richard Lowevoid dwarf_insert_harmless_error(Dwarf_Debug /*dbg*/,
268407dc194Richard Lowe    char * /*newerror*/);
268507dc194Richard Lowe
268607dc194Richard Lowe/* The size of the circular list of strings may be set
268707dc194Richard Lowe   and reset as needed.  If it is shortened excess
268807dc194Richard Lowe   messages are simply dropped.  It returns the previous
268907dc194Richard Lowe   size. If zero passed in the size is unchanged
269007dc194Richard Lowe   and it simply returns the current size  */
269107dc194Richard Loweunsigned dwarf_set_harmless_error_list_size(Dwarf_Debug /*dbg*/,
269207dc194Richard Lowe    unsigned /*maxcount*/);
269307dc194Richard Lowe/* The harmless error strings (if any) are freed when the dbg
269407dc194Richard Lowe   is dwarf_finish()ed. */
269507dc194Richard Lowe
269607dc194Richard Lowe/*  When the val_in is known these dwarf_get_TAG_name (etc)
269707dc194Richard Lowe    functions return the string corresponding to the val_in passed in
269807dc194Richard Lowe    through the pointer s_out and the value returned is DW_DLV_OK.
269907dc194Richard Lowe    The strings are in static storage
270007dc194Richard Lowe    and must not be freed.
270107dc194Richard Lowe    If DW_DLV_NO_ENTRY is returned the val_in is not known and
270207dc194Richard Lowe    *s_out is not set.  DW_DLV_ERROR is never returned.*/
270307dc194Richard Lowe
270407dc194Richard Loweextern int dwarf_get_TAG_name(unsigned int /*val_in*/, const char ** /*s_out */);
270507dc194Richard Loweextern int dwarf_get_children_name(unsigned int /*val_in*/, const char ** /*s_out */);
270607dc194Richard Loweextern int dwarf_get_FORM_name(unsigned int /*val_in*/, const char ** /*s_out */);
270707dc194Richard Loweextern int dwarf_get_AT_name(unsigned int /*val_in*/, const char ** /*s_out */);
270807dc194Richard Loweextern int dwarf_get_OP_name(unsigned int /*val_in*/, const char ** /*s_out */);
270907dc194Richard Loweextern int dwarf_get_ATE_name(unsigned int /*val_in*/, const char ** /*s_out */);
271007dc194Richard Loweextern int dwarf_get_DS_name(unsigned int /*val_in*/, const char ** /*s_out */);
271107dc194Richard Loweextern int dwarf_get_END_name(unsigned int /*val_in*/, const char ** /*s_out */);
271207dc194Richard Loweextern int dwarf_get_ATCF_name(unsigned int /*val_in*/, const char ** /*s_out */);
271307dc194Richard Loweextern int dwarf_get_ACCESS_name(unsigned int /*val_in*/, const char ** /*s_out */);
271407dc194Richard Loweextern int dwarf_get_VIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
271507dc194Richard Loweextern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/, const char ** /*s_out */);
271607dc194Richard Loweextern int dwarf_get_LANG_name(unsigned int /*val_in*/, const char ** /*s_out */);
271707dc194Richard Loweextern int dwarf_get_ID_name(unsigned int /*val_in*/, const char ** /*s_out */);
271807dc194Richard Loweextern int dwarf_get_CC_name(unsigned int /*val_in*/, const char ** /*s_out */);
271907dc194Richard Loweextern int dwarf_get_INL_name(unsigned int /*val_in*/, const char ** /*s_out */);
272007dc194Richard Loweextern int dwarf_get_ORD_name(unsigned int /*val_in*/, const char ** /*s_out */);
272107dc194Richard Loweextern int dwarf_get_DSC_name(unsigned int /*val_in*/, const char ** /*s_out */);
272207dc194Richard Loweextern int dwarf_get_LNS_name(unsigned int /*val_in*/, const char ** /*s_out */);
272307dc194Richard Loweextern int dwarf_get_LNE_name(unsigned int /*val_in*/, const char ** /*s_out */);
272407dc194Richard Loweextern int dwarf_get_MACINFO_name(unsigned int /*val_in*/, const char ** /*s_out */);
272507dc194Richard Loweextern int dwarf_get_CFA_name(unsigned int /*val_in*/, const char ** /*s_out */);
272607dc194Richard Loweextern int dwarf_get_EH_name(unsigned int /*val_in*/, const char ** /*s_out */);
272707dc194Richard Loweextern int dwarf_get_FRAME_name(unsigned int /*val_in*/, const char ** /*s_out */);
272807dc194Richard Loweextern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/, const char ** /*s_out */);
272907dc194Richard Loweextern int dwarf_get_ADDR_name(unsigned int /*val_in*/, const char ** /*s_out */);
27307c478bdstevel@tonic-gate
27317c478bdstevel@tonic-gate#ifdef __cplusplus
27327c478bd