1 /*
2 
3   Copyright (C) 2000,2005 Silicon Graphics, Inc.  All Rights Reserved.
4   Portions Copyright (C) 2008-2012  David Anderson. All Rights Reserved.
5 
6   This program is free software; you can redistribute it and/or modify it
7   under the terms of version 2.1 of the GNU Lesser General Public License
8   as published by the Free Software Foundation.
9 
10   This program is distributed in the hope that it would be useful, but
11   WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14   Further, this software is distributed without any warranty that it is
15   free of the rightful claim of any third person regarding infringement
16   or the like.  Any license provided herein, whether implied or
17   otherwise, applies only to this software file.  Patent licenses, if
18   any, provided herein do not apply to combinations of this program with
19   other software, or any other product whatsoever.
20 
21   You should have received a copy of the GNU Lesser General Public
22   License along with this program; if not, write the Free Software
23   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
24   USA.
25 
26 */
27 
28 #define true                    1
29 #define false                   0
30 
31 /* .debug_addr new in DWARF5 */
32 #define DW_ADDR_VERSION5   5
33 
34 /* To identify a cie. That is, for .debug_frame */
35 #define DW_CIE_ID 		~(0x0)
36 #define DW_CIE_VERSION		1 /* DWARF2 */
37 #define DW_CIE_VERSION3		3 /* DWARF3 */
38 #define DW_CIE_VERSION4		4 /* DWARF4 */
39 #define DW_CIE_VERSION5		5 /* DWARF5 */
40 
41 /*  For .debug_info DWARF2,3,4,5.
42     .debug_types in DWARF4 only,  and gets DW_CU_VERSION4.  */
43 #define DW_CU_VERSION2 2
44 #define DW_CU_VERSION3 3
45 #define DW_CU_VERSION4 4
46 #define DW_CU_VERSION5 5
47 
48 /* DWARF2,3, 4  and 5.*/
49 #define DW_ARANGES_VERSION2 2
50 
51 #define DW_LINE_VERSION2   2
52 #define DW_LINE_VERSION3   3
53 #define DW_LINE_VERSION4   4
54 #define DW_LINE_VERSION5   5
55 
56 /* .debug_line_str (and .dwo) new in DWARF5. */
57 #define DW_LINE_STR_VERSION5   5
58 #define EXPERIMENTAL_LINE_TABLES_VERSION  0xf006 /* Experimental two-level line tables */
59 
60 /* .debug_loc (and .dwo) First header version number is  DWARF5. */
61 #define DW_LOC_VERSION5   5
62 
63 
64 
65 /* .debug_macro (and .dwo) new in DWARF5. */
66 #define DW_MACRO_VERSION5   5
67 /* .debug_names new in DWARF5. */
68 #define DW_NAMES_VERSION5   5
69 
70 /* .debug_pubnames in DWARF2,3,4. */
71 #define DW_PUBNAMES_VERSION2 2
72 /* .debug_pubnames in DWARF3,4. */
73 #define DW_PUBTYPES_VERSION2 2
74 
75 /* .debug_ranges gets a version number in header in DWARF5. */
76 #define DW_RANGES_VERSION5 5
77 
78 
79 /* .debug_str_offsets (and .dwo) new in DWARF5. */
80 #define DW_STR_OFFSETS_VERSION5   5
81 
82 /* .debug_sup new in DWARF5. */
83 #define DW_SUP_VERSION5 5
84 
85 /* .debug_cu_index new in DWARF5. */
86 #define DW_CU_INDEX_VERSION5 5
87 /* .debug_tu_index new in DWARF5. */
88 #define DW_TU_INDEX_VERSION5 5
89 
90 
91 
92 
93 
94 /*  These are allocation type codes for structs that
95     are internal to the Libdwarf Consumer library.  */
96 #define DW_DLA_ABBREV_LIST      0x1e
97 #define DW_DLA_CHAIN            0x1f
98 #define DW_DLA_CU_CONTEXT       0x20
99 #define DW_DLA_FRAME            0x21
100 #define DW_DLA_GLOBAL_CONTEXT   0x22
101 #define DW_DLA_FILE_ENTRY       0x23
102 #define DW_DLA_LINE_CONTEXT     0x24
103 #define DW_DLA_LOC_CHAIN        0x25
104 #define DW_DLA_HASH_TABLE       0x26
105 #define DW_DLA_FUNC_CONTEXT     0x27
106 #define DW_DLA_TYPENAME_CONTEXT 0x28
107 #define DW_DLA_VAR_CONTEXT      0x29
108 #define DW_DLA_WEAK_CONTEXT     0x2a
109 #define DW_DLA_PUBTYPES_CONTEXT 0x2b  /* DWARF3 */
110 #define DW_DLA_HASH_TABLE_ENTRY 0x2c
111 #define DW_DLA_FISSION_PERCU    0x2d
112 #define DW_DLA_CHAIN_2          0x3d
113 /* Thru 0x36 reserved for internal future use. */
114 
115 /*  Maximum number of allocation types for allocation routines.
116     Only used with malloc_check.c and that is basically obsolete. */
117 #define MAX_DW_DLA		0x3a
118 
119 typedef signed char Dwarf_Sbyte;
120 typedef unsigned char Dwarf_Ubyte;
121 typedef signed short Dwarf_Shalf;
122 typedef Dwarf_Small *Dwarf_Byte_Ptr;
123 
124 #define DWARF_HALF_SIZE 2
125 #define DWARF_32BIT_SIZE 4
126 #define DWARF_64BIT_SIZE 8
127 
128 typedef struct Dwarf_Abbrev_List_s *Dwarf_Abbrev_List;
129 typedef struct Dwarf_File_Entry_s *Dwarf_File_Entry;
130 typedef struct Dwarf_CU_Context_s *Dwarf_CU_Context;
131 typedef struct Dwarf_Hash_Table_s *Dwarf_Hash_Table;
132 typedef struct Dwarf_Hash_Table_Entry_s *Dwarf_Hash_Table_Entry;
133 
134 
135 typedef struct Dwarf_Alloc_Hdr_s *Dwarf_Alloc_Hdr;
136