xref: /illumos-gate/usr/src/lib/libdwarf/common/dwarf_base_types.h (revision bc1f688b4872ace323eaddbb1a6365d054e7bf56)
1 /*
2 
3   Copyright (C) 2000,2005 Silicon Graphics, Inc.  All Rights Reserved.
4   Portions Copyright (C) 2008-2010  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   Contact information:  Silicon Graphics, Inc., 1500 Crittenden Lane,
27   Mountain View, CA 94043, or:
28 
29   http://www.sgi.com
30 
31   For further information regarding this notice, see:
32 
33   http://oss.sgi.com/projects/GenInfo/NoticeExplan
34 
35 */
36 
37 
38 
39 #include "libdwarfdefs.h"
40 
41 #define true                    1
42 #define false                   0
43 
44 /* to identify a cie */
45 #define DW_CIE_ID 		~(0x0)
46 #define DW_CIE_VERSION		1 /* DWARF2 */
47 #define DW_CIE_VERSION3		3 /* DWARF3 */
48 #define DW_CIE_VERSION4		4 /* DWARF4 */
49 
50 #define DW_CU_VERSION2 2
51 #define DW_CU_VERSION3 3
52 #define DW_CU_VERSION4 4
53 
54 /* DWARF2,3 and 4 */
55 #define DW_ARANGES_VERSION2 2
56 
57 #define DW_LINE_VERSION2   2
58 #define DW_LINE_VERSION3   3
59 #define DW_LINE_VERSION4   4
60 
61 
62 /*
63     These are allocation type codes for structs that
64     are internal to the Libdwarf Consumer library.
65 */
66 #define DW_DLA_ABBREV_LIST	DW_DLA_RANGES + 1
67 #define DW_DLA_CHAIN		DW_DLA_RANGES + 2
68 #define DW_DLA_CU_CONTEXT	DW_DLA_RANGES + 3
69 #define DW_DLA_FRAME		DW_DLA_RANGES + 4
70 #define DW_DLA_GLOBAL_CONTEXT	DW_DLA_RANGES + 5
71 #define DW_DLA_FILE_ENTRY	DW_DLA_RANGES + 6
72 #define DW_DLA_LINE_CONTEXT	DW_DLA_RANGES + 7
73 #define DW_DLA_LOC_CHAIN	DW_DLA_RANGES + 8
74 #define DW_DLA_HASH_TABLE	DW_DLA_RANGES + 9
75 #define DW_DLA_FUNC_CONTEXT	DW_DLA_RANGES + 10
76 #define DW_DLA_TYPENAME_CONTEXT	DW_DLA_RANGES + 11
77 #define DW_DLA_VAR_CONTEXT	DW_DLA_RANGES + 12
78 #define DW_DLA_WEAK_CONTEXT	DW_DLA_RANGES + 13
79 #define DW_DLA_PUBTYPES_CONTEXT	DW_DLA_RANGES + 14 /* DWARF3 */
80 #define DW_DLA_HASH_TABLE_ENTRY	DW_DLA_RANGES + 15
81 
82 /* Maximum number of allocation types for allocation routines. */
83 #define MAX_DW_DLA		DW_DLA_HASH_TABLE_ENTRY
84 
85 /*Dwarf_Word  is unsigned word usable for index, count in memory */
86 /*Dwarf_Sword is   signed word usable for index, count in memory */
87 /* The are 32 or 64 bits depending if 64 bit longs or not, which
88 ** fits the  ILP32 and LP64 models
89 ** These work equally well with ILP64.
90 */
91 
92 typedef unsigned long Dwarf_Word;
93 typedef signed long Dwarf_Sword;
94 
95 typedef signed char Dwarf_Sbyte;
96 typedef unsigned char Dwarf_Ubyte;
97 typedef signed short Dwarf_Shalf;
98 typedef Dwarf_Small *Dwarf_Byte_Ptr;
99 
100 /* these 2 are fixed sizes which must not vary with the
101 ** ILP32/LP64 model. Between these two, stay at 32 bit.
102 */
103 typedef __uint32_t Dwarf_ufixed;
104 typedef __int32_t Dwarf_sfixed;
105 
106 /*
107         In various places the code mistakenly associates
108         forms 8 bytes long with Dwarf_Signed or Dwarf_Unsigned
109 	This is not a very portable assumption.
110         The following should be used instead for 64 bit integers.
111 */
112 typedef __uint64_t Dwarf_ufixed64;
113 typedef __int64_t Dwarf_sfixed64;
114 
115 
116 typedef struct Dwarf_Abbrev_List_s *Dwarf_Abbrev_List;
117 typedef struct Dwarf_File_Entry_s *Dwarf_File_Entry;
118 typedef struct Dwarf_CU_Context_s *Dwarf_CU_Context;
119 typedef struct Dwarf_Hash_Table_s *Dwarf_Hash_Table;
120 typedef struct Dwarf_Hash_Table_Entry_s *Dwarf_Hash_Table_Entry;
121 
122 
123 typedef struct Dwarf_Alloc_Hdr_s *Dwarf_Alloc_Hdr;
124