rdwarf 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +28 -0
  6. data/README.md +39 -0
  7. data/Rakefile +8 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +7 -0
  10. data/ext/rdwarf/depend +5 -0
  11. data/ext/rdwarf/extconf.rb +29 -0
  12. data/ext/rdwarf/libdwarf/CHANGES +102 -0
  13. data/ext/rdwarf/libdwarf/CODINGSTYLE +71 -0
  14. data/ext/rdwarf/libdwarf/COPYING +28 -0
  15. data/ext/rdwarf/libdwarf/ChangeLog +619 -0
  16. data/ext/rdwarf/libdwarf/ChangeLog2006 +835 -0
  17. data/ext/rdwarf/libdwarf/ChangeLog2007 +217 -0
  18. data/ext/rdwarf/libdwarf/ChangeLog2008 +263 -0
  19. data/ext/rdwarf/libdwarf/ChangeLog2009 +348 -0
  20. data/ext/rdwarf/libdwarf/ChangeLog2010 +175 -0
  21. data/ext/rdwarf/libdwarf/ChangeLog2011 +297 -0
  22. data/ext/rdwarf/libdwarf/ChangeLog2012 +131 -0
  23. data/ext/rdwarf/libdwarf/ChangeLog2013 +238 -0
  24. data/ext/rdwarf/libdwarf/ChangeLog2014 +399 -0
  25. data/ext/rdwarf/libdwarf/LGPL.txt +504 -0
  26. data/ext/rdwarf/libdwarf/LIBDWARFCOPYRIGHT +40 -0
  27. data/ext/rdwarf/libdwarf/Makefile.in +220 -0
  28. data/ext/rdwarf/libdwarf/NEWS +535 -0
  29. data/ext/rdwarf/libdwarf/README +235 -0
  30. data/ext/rdwarf/libdwarf/checkexamples.c +1179 -0
  31. data/ext/rdwarf/libdwarf/cmplrs/dwarf_addr_finder.h +55 -0
  32. data/ext/rdwarf/libdwarf/common.c +62 -0
  33. data/ext/rdwarf/libdwarf/common.h +38 -0
  34. data/ext/rdwarf/libdwarf/config.h.in +146 -0
  35. data/ext/rdwarf/libdwarf/configure +5581 -0
  36. data/ext/rdwarf/libdwarf/configure.in +167 -0
  37. data/ext/rdwarf/libdwarf/dw-linetableheader.txt +39 -0
  38. data/ext/rdwarf/libdwarf/dwarf.h +1342 -0
  39. data/ext/rdwarf/libdwarf/dwarf_abbrev.c +291 -0
  40. data/ext/rdwarf/libdwarf/dwarf_abbrev.h +45 -0
  41. data/ext/rdwarf/libdwarf/dwarf_addr_finder.c +676 -0
  42. data/ext/rdwarf/libdwarf/dwarf_alloc.c +685 -0
  43. data/ext/rdwarf/libdwarf/dwarf_alloc.h +38 -0
  44. data/ext/rdwarf/libdwarf/dwarf_arange.c +595 -0
  45. data/ext/rdwarf/libdwarf/dwarf_arange.h +62 -0
  46. data/ext/rdwarf/libdwarf/dwarf_base_types.h +157 -0
  47. data/ext/rdwarf/libdwarf/dwarf_die_deliv.c +1802 -0
  48. data/ext/rdwarf/libdwarf/dwarf_die_deliv.h +46 -0
  49. data/ext/rdwarf/libdwarf/dwarf_elf_access.c +1348 -0
  50. data/ext/rdwarf/libdwarf/dwarf_elf_access.h +46 -0
  51. data/ext/rdwarf/libdwarf/dwarf_error.c +492 -0
  52. data/ext/rdwarf/libdwarf/dwarf_error.h +53 -0
  53. data/ext/rdwarf/libdwarf/dwarf_form.c +1302 -0
  54. data/ext/rdwarf/libdwarf/dwarf_frame.c +2454 -0
  55. data/ext/rdwarf/libdwarf/dwarf_frame.h +418 -0
  56. data/ext/rdwarf/libdwarf/dwarf_frame2.c +1533 -0
  57. data/ext/rdwarf/libdwarf/dwarf_frame3.c +282 -0
  58. data/ext/rdwarf/libdwarf/dwarf_funcs.c +123 -0
  59. data/ext/rdwarf/libdwarf/dwarf_funcs.h +33 -0
  60. data/ext/rdwarf/libdwarf/dwarf_gdbindex.c +520 -0
  61. data/ext/rdwarf/libdwarf/dwarf_gdbindex.h +97 -0
  62. data/ext/rdwarf/libdwarf/dwarf_global.c +612 -0
  63. data/ext/rdwarf/libdwarf/dwarf_global.h +117 -0
  64. data/ext/rdwarf/libdwarf/dwarf_harmless.c +228 -0
  65. data/ext/rdwarf/libdwarf/dwarf_harmless.h +31 -0
  66. data/ext/rdwarf/libdwarf/dwarf_incl.h +61 -0
  67. data/ext/rdwarf/libdwarf/dwarf_init_finish.c +1263 -0
  68. data/ext/rdwarf/libdwarf/dwarf_leb.c +159 -0
  69. data/ext/rdwarf/libdwarf/dwarf_line.c +1822 -0
  70. data/ext/rdwarf/libdwarf/dwarf_line.h +446 -0
  71. data/ext/rdwarf/libdwarf/dwarf_line2.c +98 -0
  72. data/ext/rdwarf/libdwarf/dwarf_line_table_reader_common.c +1583 -0
  73. data/ext/rdwarf/libdwarf/dwarf_loc.c +1525 -0
  74. data/ext/rdwarf/libdwarf/dwarf_loc.h +149 -0
  75. data/ext/rdwarf/libdwarf/dwarf_loc2.c +833 -0
  76. data/ext/rdwarf/libdwarf/dwarf_macro.c +479 -0
  77. data/ext/rdwarf/libdwarf/dwarf_macro.h +35 -0
  78. data/ext/rdwarf/libdwarf/dwarf_opaque.h +778 -0
  79. data/ext/rdwarf/libdwarf/dwarf_original_elf_init.c +219 -0
  80. data/ext/rdwarf/libdwarf/dwarf_print_lines.c +631 -0
  81. data/ext/rdwarf/libdwarf/dwarf_pubtypes.c +132 -0
  82. data/ext/rdwarf/libdwarf/dwarf_query.c +1594 -0
  83. data/ext/rdwarf/libdwarf/dwarf_ranges.c +194 -0
  84. data/ext/rdwarf/libdwarf/dwarf_reloc_arm.h +308 -0
  85. data/ext/rdwarf/libdwarf/dwarf_reloc_mips.h +117 -0
  86. data/ext/rdwarf/libdwarf/dwarf_reloc_ppc.h +242 -0
  87. data/ext/rdwarf/libdwarf/dwarf_reloc_ppc64.h +272 -0
  88. data/ext/rdwarf/libdwarf/dwarf_reloc_x86_64.h +127 -0
  89. data/ext/rdwarf/libdwarf/dwarf_sort_line.c +665 -0
  90. data/ext/rdwarf/libdwarf/dwarf_string.c +82 -0
  91. data/ext/rdwarf/libdwarf/dwarf_stubs.c +38 -0
  92. data/ext/rdwarf/libdwarf/dwarf_tied.c +423 -0
  93. data/ext/rdwarf/libdwarf/dwarf_tsearch.h +125 -0
  94. data/ext/rdwarf/libdwarf/dwarf_tsearchhash.c +675 -0
  95. data/ext/rdwarf/libdwarf/dwarf_types.c +121 -0
  96. data/ext/rdwarf/libdwarf/dwarf_types.h +32 -0
  97. data/ext/rdwarf/libdwarf/dwarf_util.c +913 -0
  98. data/ext/rdwarf/libdwarf/dwarf_util.h +324 -0
  99. data/ext/rdwarf/libdwarf/dwarf_vars.c +125 -0
  100. data/ext/rdwarf/libdwarf/dwarf_vars.h +29 -0
  101. data/ext/rdwarf/libdwarf/dwarf_weaks.c +123 -0
  102. data/ext/rdwarf/libdwarf/dwarf_weaks.h +29 -0
  103. data/ext/rdwarf/libdwarf/dwarf_xu_index.c +579 -0
  104. data/ext/rdwarf/libdwarf/dwarf_xu_index.h +68 -0
  105. data/ext/rdwarf/libdwarf/dwgetopt.c +181 -0
  106. data/ext/rdwarf/libdwarf/dwgetopt.h +51 -0
  107. data/ext/rdwarf/libdwarf/gennames.c +531 -0
  108. data/ext/rdwarf/libdwarf/install.sh +119 -0
  109. data/ext/rdwarf/libdwarf/libdwarf.h.in +3746 -0
  110. data/ext/rdwarf/libdwarf/libdwarf2.1.mm +9805 -0
  111. data/ext/rdwarf/libdwarf/libdwarf2.1.pdf +0 -0
  112. data/ext/rdwarf/libdwarf/libdwarf2p.1.mm +2807 -0
  113. data/ext/rdwarf/libdwarf/libdwarf2p.1.pdf +0 -0
  114. data/ext/rdwarf/libdwarf/libdwarfdefs.h +81 -0
  115. data/ext/rdwarf/libdwarf/malloc_check.c +327 -0
  116. data/ext/rdwarf/libdwarf/malloc_check.h +52 -0
  117. data/ext/rdwarf/libdwarf/mips_extensions.mm +1266 -0
  118. data/ext/rdwarf/libdwarf/mips_extensions.pdf +0 -0
  119. data/ext/rdwarf/libdwarf/pro_alloc.c +179 -0
  120. data/ext/rdwarf/libdwarf/pro_alloc.h +33 -0
  121. data/ext/rdwarf/libdwarf/pro_arange.c +310 -0
  122. data/ext/rdwarf/libdwarf/pro_arange.h +51 -0
  123. data/ext/rdwarf/libdwarf/pro_die.c +431 -0
  124. data/ext/rdwarf/libdwarf/pro_die.h +59 -0
  125. data/ext/rdwarf/libdwarf/pro_encode_nm.c +108 -0
  126. data/ext/rdwarf/libdwarf/pro_encode_nm.h +39 -0
  127. data/ext/rdwarf/libdwarf/pro_error.c +96 -0
  128. data/ext/rdwarf/libdwarf/pro_error.h +43 -0
  129. data/ext/rdwarf/libdwarf/pro_expr.c +575 -0
  130. data/ext/rdwarf/libdwarf/pro_expr.h +36 -0
  131. data/ext/rdwarf/libdwarf/pro_finish.c +45 -0
  132. data/ext/rdwarf/libdwarf/pro_forms.c +1271 -0
  133. data/ext/rdwarf/libdwarf/pro_frame.c +572 -0
  134. data/ext/rdwarf/libdwarf/pro_frame.h +120 -0
  135. data/ext/rdwarf/libdwarf/pro_funcs.c +50 -0
  136. data/ext/rdwarf/libdwarf/pro_incl.h +91 -0
  137. data/ext/rdwarf/libdwarf/pro_init.c +327 -0
  138. data/ext/rdwarf/libdwarf/pro_line.c +373 -0
  139. data/ext/rdwarf/libdwarf/pro_line.h +112 -0
  140. data/ext/rdwarf/libdwarf/pro_macinfo.c +457 -0
  141. data/ext/rdwarf/libdwarf/pro_macinfo.h +31 -0
  142. data/ext/rdwarf/libdwarf/pro_opaque.h +513 -0
  143. data/ext/rdwarf/libdwarf/pro_pubnames.c +60 -0
  144. data/ext/rdwarf/libdwarf/pro_reloc.c +253 -0
  145. data/ext/rdwarf/libdwarf/pro_reloc.h +38 -0
  146. data/ext/rdwarf/libdwarf/pro_reloc_stream.c +256 -0
  147. data/ext/rdwarf/libdwarf/pro_reloc_stream.h +52 -0
  148. data/ext/rdwarf/libdwarf/pro_reloc_symbolic.c +245 -0
  149. data/ext/rdwarf/libdwarf/pro_reloc_symbolic.h +45 -0
  150. data/ext/rdwarf/libdwarf/pro_section.c +2233 -0
  151. data/ext/rdwarf/libdwarf/pro_section.h +100 -0
  152. data/ext/rdwarf/libdwarf/pro_types.c +274 -0
  153. data/ext/rdwarf/libdwarf/pro_types.h +34 -0
  154. data/ext/rdwarf/libdwarf/pro_util.h +38 -0
  155. data/ext/rdwarf/libdwarf/pro_vars.c +52 -0
  156. data/ext/rdwarf/libdwarf/pro_weaks.c +51 -0
  157. data/ext/rdwarf/rdwarf.c +765 -0
  158. data/ext/rdwarf/rdwarf.h +52 -0
  159. data/ext/rdwarf/rdwarf_names_gen.rb +109 -0
  160. data/lib/rdwarf.rb +181 -0
  161. data/lib/rdwarf/version.rb +3 -0
  162. data/rdwarf.gemspec +30 -0
  163. metadata +251 -0
@@ -0,0 +1,31 @@
1
+ /*
2
+
3
+ Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
4
+
5
+ This program is free software; you can redistribute it and/or modify it
6
+ under the terms of version 2.1 of the GNU Lesser General Public License
7
+ as published by the Free Software Foundation.
8
+
9
+ This program is distributed in the hope that it would be useful, but
10
+ WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
+
13
+ Further, this software is distributed without any warranty that it is
14
+ free of the rightful claim of any third person regarding infringement
15
+ or the like. Any license provided herein, whether implied or
16
+ otherwise, applies only to this software file. Patent licenses, if
17
+ any, provided herein do not apply to combinations of this program with
18
+ other software, or any other product whatsoever.
19
+
20
+ You should have received a copy of the GNU Lesser General Public
21
+ License along with this program; if not, write the Free Software
22
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
23
+ USA.
24
+
25
+ */
26
+
27
+
28
+
29
+
30
+ int _dwarf_pro_transform_macro_info_to_disk(Dwarf_P_Debug dbg,
31
+ Dwarf_Error * error);
@@ -0,0 +1,513 @@
1
+ /*
2
+
3
+ Copyright (C) 2000,2002,2004 Silicon Graphics, Inc. All Rights Reserved.
4
+ Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved.
5
+ Portions Copyright 2011-2014 David Anderson. All Rights Reserved.
6
+
7
+ This program is free software; you can redistribute it and/or modify it
8
+ under the terms of version 2.1 of the GNU Lesser General Public License
9
+ as published by the Free Software Foundation.
10
+
11
+ This program is distributed in the hope that it would be useful, but
12
+ WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
+
15
+ Further, this software is distributed without any warranty that it is
16
+ free of the rightful claim of any third person regarding infringement
17
+ or the like. Any license provided herein, whether implied or
18
+ otherwise, applies only to this software file. Patent licenses, if
19
+ any, provided herein do not apply to combinations of this program with
20
+ other software, or any other product whatsoever.
21
+
22
+ You should have received a copy of the GNU Lesser General Public
23
+ License along with this program; if not, write the Free Software
24
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
25
+ USA.
26
+
27
+ */
28
+
29
+
30
+ #include <stddef.h>
31
+
32
+ /*
33
+ Sgidefs included to define __uint32_t,
34
+ a guaranteed 4-byte quantity.
35
+ */
36
+ #include "libdwarfdefs.h"
37
+
38
+ #define true 1
39
+ #define false 0
40
+
41
+ /* to identify a cie */
42
+ #define DW_CIE_ID ~(0x0)
43
+ #define DW_CIE_VERSION 1
44
+
45
+ /*Dwarf_Word is unsigned word usable for index, count in memory */
46
+ /*Dwarf_Sword is signed word usable for index, count in memory */
47
+ /* The are 32 or 64 bits depending if 64 bit longs or not, which
48
+ ** fits the ILP32 and LP64 models
49
+ ** These work equally well with ILP64.
50
+ */
51
+
52
+ typedef unsigned long Dwarf_Word;
53
+ typedef long Dwarf_Sword;
54
+
55
+
56
+ typedef signed char Dwarf_Sbyte;
57
+ typedef unsigned char Dwarf_Ubyte;
58
+ typedef signed short Dwarf_Shalf;
59
+
60
+ /*
61
+ On any change that makes libdwarf producer
62
+ incompatible, increment this number.
63
+ 1->2->3 ... */
64
+ #define PRO_VERSION_MAGIC 0xdead1
65
+
66
+
67
+ /* these 2 are fixed sizes which must not vary with the
68
+ ** ILP32/LP64 model. These two stay at 32 bit.
69
+ */
70
+ typedef __uint32_t Dwarf_ufixed;
71
+ typedef __int32_t Dwarf_sfixed;
72
+
73
+ /*
74
+ producer:
75
+ This struct is used to hold information about all
76
+ debug* sections. On creating a new section, section
77
+ names and indices are added to this struct
78
+ definition in pro_section.h */
79
+ typedef struct Dwarf_P_Section_Data_s *Dwarf_P_Section_Data;
80
+
81
+ /*
82
+ producer:
83
+ This struct is used to hold entries in the include directories
84
+ part of statement prologue. Definition in pro_line.h
85
+ */
86
+ typedef struct Dwarf_P_Inc_Dir_s *Dwarf_P_Inc_Dir;
87
+
88
+ /*
89
+ producer:
90
+ This struct holds file entries for the statement prologue.
91
+ Defined in pro_line.h
92
+ */
93
+ typedef struct Dwarf_P_F_Entry_s *Dwarf_P_F_Entry;
94
+
95
+ /*
96
+ producer:
97
+ This struct holds information for each cie. Defn in pro_frame.h
98
+ */
99
+ typedef struct Dwarf_P_Cie_s *Dwarf_P_Cie;
100
+
101
+ /*
102
+ producer:
103
+ Struct to hold line number information, different from
104
+ Dwarf_Line opaque type.
105
+ */
106
+ typedef struct Dwarf_P_Line_s *Dwarf_P_Line;
107
+
108
+ /*
109
+ producer:
110
+ Struct to hold information about address ranges.
111
+ */
112
+ typedef struct Dwarf_P_Simple_nameentry_s *Dwarf_P_Simple_nameentry;
113
+ typedef struct Dwarf_P_Simple_name_header_s *Dwarf_P_Simple_name_header;
114
+ typedef struct Dwarf_P_Arange_s *Dwarf_P_Arange;
115
+ typedef struct Dwarf_P_Per_Reloc_Sect_s *Dwarf_P_Per_Reloc_Sect;
116
+ typedef struct Dwarf_P_Per_Sect_String_Attrs_s *Dwarf_P_Per_Sect_String_Attrs;
117
+
118
+ /* Defined to get at the elf section numbers and section name
119
+ indices in symtab for the dwarf sections
120
+ Must match .rel.* names in _dwarf_rel_section_names
121
+ exactly.
122
+ */
123
+ #define DEBUG_INFO 0
124
+ #define DEBUG_LINE 1
125
+ #define DEBUG_ABBREV 2
126
+ #define DEBUG_FRAME 3
127
+ #define DEBUG_ARANGES 4
128
+ #define DEBUG_PUBNAMES 5
129
+ #define DEBUG_STR 6
130
+ #define DEBUG_FUNCNAMES 7
131
+ #define DEBUG_TYPENAMES 8
132
+ #define DEBUG_VARNAMES 9
133
+ #define DEBUG_WEAKNAMES 10
134
+ #define DEBUG_MACINFO 11
135
+ #define DEBUG_LOC 12
136
+ #define DEBUG_RANGES 13
137
+ #define DEBUG_TYPES 14
138
+ #define DEBUG_PUBTYPES 15
139
+
140
+ /* Maximum number of debug_* sections not including the relocations */
141
+ #define NUM_DEBUG_SECTIONS 16
142
+
143
+ /* Describes the data needed to generate line table header info
144
+ so we can vary the init at runtime. */
145
+ struct Dwarf_P_Line_Inits_s {
146
+ unsigned pi_version; /* line table version number */
147
+ unsigned pi_default_is_stmt; /* default value for is_stmt */
148
+
149
+ /* Size of the smallest instruction, in bytes. */
150
+ unsigned pi_minimum_instruction_length;
151
+
152
+ /* Make this >1 for VLIW machines. */
153
+ unsigned pi_maximum_operations_per_instruction;
154
+
155
+ /* Normally opcode_base is determined by pi_version, but we
156
+ allow manual setting here so we can generate data like
157
+ GNU with a DWARF3 opcode base in a DWARF2 section.
158
+ This determines how much of the header_opcode_lengths
159
+ table is emitted in the line table header */
160
+ unsigned pi_opcode_base;
161
+
162
+ int pi_line_base; /* For line table header. */
163
+ int pi_line_range; /* For line table header. */
164
+ };
165
+
166
+
167
+ struct Dwarf_P_Die_s {
168
+ Dwarf_Unsigned di_offset; /* offset in debug info */
169
+ char *di_abbrev; /* abbreviation */
170
+ Dwarf_Word di_abbrev_nbytes; /* # of bytes in abbrev */
171
+ Dwarf_Tag di_tag;
172
+ Dwarf_P_Die di_parent; /* parent of current die */
173
+ Dwarf_P_Die di_child; /* first child */
174
+ /* The last child field makes linking up children an O(1) operation,
175
+ See pro_die.c. */
176
+ Dwarf_P_Die di_last_child;
177
+ Dwarf_P_Die di_left; /* left sibling */
178
+ Dwarf_P_Die di_right; /* right sibling */
179
+ Dwarf_P_Attribute di_attrs; /* list of attributes */
180
+ Dwarf_P_Attribute di_last_attr; /* last attribute */
181
+ int di_n_attr; /* number of attributes */
182
+ Dwarf_P_Debug di_dbg; /* For memory management */
183
+ Dwarf_Unsigned di_marker; /* used to attach symbols to dies */
184
+ };
185
+
186
+
187
+ /* producer fields */
188
+ struct Dwarf_P_Attribute_s {
189
+ Dwarf_Half ar_attribute; /* Attribute Value. */
190
+ Dwarf_Half ar_attribute_form; /* Attribute Form. */
191
+ Dwarf_P_Die ar_ref_die; /* die pointer if form ref */
192
+ char *ar_data; /* data, format given by form */
193
+ Dwarf_Unsigned ar_nbytes; /* no. of bytes of data */
194
+ Dwarf_Unsigned ar_rel_symidx; /* when attribute has a
195
+ relocatable value, holds
196
+ index of symbol in SYMTAB */
197
+ Dwarf_Ubyte ar_rel_type; /* relocation type */
198
+ Dwarf_Word ar_rel_offset; /* Offset of relocation within block */
199
+ char ar_reloc_len; /* Number of bytes that relocation
200
+ applies to. 4 or 8. Unused and may
201
+ be 0 if if ar_rel_type is
202
+ R_MIPS_NONE */
203
+ Dwarf_P_Attribute ar_next;
204
+ };
205
+
206
+ /* A block of .debug_macinfo data: this forms a series of blocks.
207
+ ** Each macinfo input is compressed immediately and put into
208
+ ** the current block if room, else a newblock allocated.
209
+ ** The space allocation is such that the block and the macinfo
210
+ ** data are one malloc block: free with a pointer to this and the
211
+ ** mb_data is freed automatically.
212
+ ** Like the struct hack, but legal ANSI C.
213
+ */
214
+ struct dw_macinfo_block_s {
215
+ struct dw_macinfo_block_s *mb_next;
216
+ unsigned long mb_avail_len;
217
+ unsigned long mb_used_len;
218
+ unsigned long mb_macinfo_data_space_len;
219
+ char *mb_data;/* original malloc ptr. */
220
+ };
221
+
222
+ /* dwarf_sn_kind is for the array of similarly-treated
223
+ name -> cu ties
224
+ */
225
+ enum dwarf_sn_kind { dwarf_snk_pubname, /* .debug_pubnames */
226
+ dwarf_snk_funcname, /* SGI extension. */
227
+ dwarf_snk_weakname, /* SGI extension. */
228
+ dwarf_snk_typename, /* SGI extension. */
229
+ dwarf_snk_varname, /* SGI extension. */
230
+ dwarf_snk_pubtype, /* .debug_pubtypes */
231
+ dwarf_snk_entrycount /* this one must be last */
232
+ };
233
+
234
+
235
+
236
+ /* The calls to add a varname etc use a list of
237
+ these as the list.
238
+ */
239
+ struct Dwarf_P_Simple_nameentry_s {
240
+ Dwarf_P_Die sne_die;
241
+ char *sne_name;
242
+ int sne_name_len;
243
+ Dwarf_P_Simple_nameentry sne_next;
244
+ };
245
+
246
+ /* An array of these, each of which heads a list
247
+ of Dwarf_P_Simple_nameentry
248
+ */
249
+ struct Dwarf_P_Simple_name_header_s {
250
+ Dwarf_P_Simple_nameentry sn_head;
251
+ Dwarf_P_Simple_nameentry sn_tail;
252
+ Dwarf_Signed sn_count;
253
+
254
+ /* Length that will be generated, not counting fixed header or
255
+ trailer */
256
+ Dwarf_Signed sn_net_len;
257
+ };
258
+ typedef int (*_dwarf_pro_reloc_name_func_ptr) (Dwarf_P_Debug dbg,
259
+ int sec_index,
260
+ Dwarf_Unsigned offset,/* r_offset */
261
+ Dwarf_Unsigned symidx,
262
+ enum Dwarf_Rel_Type type,
263
+ int reltarget_length);
264
+
265
+ typedef int (*_dwarf_pro_reloc_length_func_ptr) (Dwarf_P_Debug dbg,
266
+ int sec_index, Dwarf_Unsigned offset,/* r_offset */
267
+ Dwarf_Unsigned start_symidx,
268
+ Dwarf_Unsigned end_symidx,
269
+ enum Dwarf_Rel_Type type,
270
+ int reltarget_length);
271
+ typedef int (*_dwarf_pro_transform_relocs_func_ptr) (Dwarf_P_Debug dbg,
272
+ Dwarf_Signed *
273
+ new_sec_count);
274
+
275
+ /*
276
+ Each slot in a block of slots could be:
277
+ a binary stream relocation entry (32 or 64bit relocation data)
278
+ a SYMBOLIC relocation entry.
279
+ During creation sometimes we create multiple chained blocks,
280
+ but sometimes we create a single long block.
281
+ Before returning reloc data to caller,
282
+ we switch to a single, long-enough,
283
+ block.
284
+
285
+ We make counters here Dwarf_Unsigned so that we
286
+ get sufficient alignment. Since we use space after
287
+ the struct (at malloc time) for user data which
288
+ must have Dwarf_Unsigned alignment, this
289
+ struct must have that alignment too.
290
+ */
291
+ struct Dwarf_P_Relocation_Block_s {
292
+ Dwarf_Unsigned rb_slots_in_block; /* slots in block, as created */
293
+ Dwarf_Unsigned rb_next_slot_to_use; /* counter, start at 0. */
294
+ struct Dwarf_P_Relocation_Block_s *rb_next;
295
+ char *rb_where_to_add_next; /* pointer to next slot (might be past
296
+ end, depending on
297
+ rb_next_slot_to_use) */
298
+ char *rb_data; /* data area */
299
+ };
300
+
301
+ /* One of these per potential relocation section
302
+ So one per actual dwarf section.
303
+ Left zeroed when not used (some sections have
304
+ no relocations).
305
+ */
306
+ struct Dwarf_P_Per_Reloc_Sect_s {
307
+ unsigned long pr_reloc_total_count; /* total number of entries
308
+ across all blocks */
309
+
310
+ unsigned long pr_slots_per_block_to_alloc; /* at Block alloc, this
311
+ is the default number of slots to use */
312
+
313
+ int pr_sect_num_of_reloc_sect; /* sect number returned by
314
+ de_callback_func() or de_callback_func_b() or_c()
315
+ call, this is the sect
316
+ number of the relocation section. */
317
+
318
+ /* singly-linked list. add at and ('last') with count of blocks */
319
+ struct Dwarf_P_Relocation_Block_s *pr_first_block;
320
+ struct Dwarf_P_Relocation_Block_s *pr_last_block;
321
+ unsigned long pr_block_count;
322
+ };
323
+
324
+ #define DEFAULT_SLOTS_PER_BLOCK 3
325
+
326
+ typedef struct memory_list_s {
327
+ struct memory_list_s *prev;
328
+ struct memory_list_s *next;
329
+ } memory_list_t;
330
+
331
+ struct Dwarf_P_Per_Sect_String_Attrs_s {
332
+ int sect_sa_section_number;
333
+ unsigned sect_sa_n_alloc;
334
+ unsigned sect_sa_n_used;
335
+ Dwarf_P_String_Attr sect_sa_list;
336
+ };
337
+
338
+ /* Fields used by producer */
339
+ struct Dwarf_P_Debug_s {
340
+ /* Used to catch dso passing dbg to another DSO with incompatible
341
+ version of libdwarf See PRO_VERSION_MAGIC */
342
+ int de_version_magic_number;
343
+
344
+ Dwarf_Handler de_errhand;
345
+ /* de_user_data is provided so users can use it to readily tie
346
+ a callback to anything they desire. The contents are not
347
+ used by libdwarf except to pass the data as a callback
348
+ argument. New in June 2011. Available in
349
+ dwarf_pro_init_c() and its callback function. */
350
+ void * de_user_data;
351
+ Dwarf_Ptr de_errarg;
352
+
353
+ /* Call back function, used to create .debug* sections. Provided
354
+ By user. */
355
+ Dwarf_Callback_Func de_callback_func;
356
+
357
+ /* Flags from producer_init call */
358
+ Dwarf_Unsigned de_flags;
359
+
360
+ /* This holds information on debug section stream output, including
361
+ the stream data */
362
+ Dwarf_P_Section_Data de_debug_sects;
363
+
364
+ /* Pointer to the 'current active' section */
365
+ Dwarf_P_Section_Data de_current_active_section;
366
+
367
+ /* Number of debug data streams globs. */
368
+ Dwarf_Word de_n_debug_sect;
369
+
370
+ /* File entry information, null terminated singly-linked list */
371
+ Dwarf_P_F_Entry de_file_entries;
372
+ Dwarf_P_F_Entry de_last_file_entry;
373
+ Dwarf_Unsigned de_n_file_entries;
374
+
375
+ /* Has the directories used to search for source files */
376
+ Dwarf_P_Inc_Dir de_inc_dirs;
377
+ Dwarf_P_Inc_Dir de_last_inc_dir;
378
+ Dwarf_Unsigned de_n_inc_dirs;
379
+
380
+ /* Has all the line number info for the stmt program */
381
+ Dwarf_P_Line de_lines;
382
+ Dwarf_P_Line de_last_line;
383
+
384
+ /* List of cie's for the debug unit */
385
+ Dwarf_P_Cie de_frame_cies;
386
+ Dwarf_P_Cie de_last_cie;
387
+ Dwarf_Unsigned de_n_cie;
388
+
389
+ /* Singly-linked list of fde's for the debug unit */
390
+ Dwarf_P_Fde de_frame_fdes;
391
+ Dwarf_P_Fde de_last_fde;
392
+ Dwarf_Unsigned de_n_fde;
393
+
394
+ /* First die, leads to all others */
395
+ Dwarf_P_Die de_dies;
396
+
397
+ /* Pointer to list of strings */
398
+ char *de_strings;
399
+
400
+ /* Pointer to chain of aranges */
401
+ Dwarf_P_Arange de_arange;
402
+ Dwarf_P_Arange de_last_arange;
403
+ Dwarf_Sword de_arange_count;
404
+
405
+ /* macinfo controls. */
406
+ /* first points to beginning of the list during creation */
407
+ struct dw_macinfo_block_s *de_first_macinfo;
408
+
409
+ /* current points to the current, unfilled, block */
410
+ struct dw_macinfo_block_s *de_current_macinfo;
411
+
412
+ /* Pointer to the first section, to support reset_section_bytes */
413
+ Dwarf_P_Section_Data de_first_debug_sect;
414
+
415
+ /* Handles pubnames, weaknames, etc. See dwarf_sn_kind in
416
+ pro_opaque.h */
417
+ struct Dwarf_P_Simple_name_header_s
418
+ de_simple_name_headers[dwarf_snk_entrycount];
419
+
420
+ /* Relocation data. not all sections will actally have relocation
421
+ info, of course */
422
+ struct Dwarf_P_Per_Reloc_Sect_s de_reloc_sect[NUM_DEBUG_SECTIONS];
423
+ int de_reloc_next_to_return; /* iterator on reloc sections
424
+ (SYMBOLIC output) */
425
+
426
+ /* used in remembering sections */
427
+ int de_elf_sects[NUM_DEBUG_SECTIONS]; /* elf sect number of
428
+ the section itself, DEBUG_LINE for example */
429
+
430
+ Dwarf_Unsigned de_sect_name_idx[NUM_DEBUG_SECTIONS]; /* section
431
+ name index or handle for the name of the symbol for
432
+ DEBUG_LINE for example */
433
+
434
+ int de_offset_reloc; /* offset reloc type, R_MIPS_32 for
435
+ example. Specific to the ABI being
436
+ produced. Relocates offset size
437
+ field */
438
+ int de_exc_reloc; /* reloc type specific to exception
439
+ table relocs. */
440
+ int de_ptr_reloc; /* standard reloc type, R_MIPS_32 for
441
+ example. Specific to the ABI being
442
+ produced. relocates pointer size
443
+ field */
444
+ unsigned char de_irix_exc_augmentation; /* If non-zero means
445
+ that producing an IRIX exception-table offset in a CIE header
446
+ is allowed (depending on the augmentation string). */
447
+
448
+ unsigned char de_offset_size; /* section offset. Here to
449
+ avoid test of abi in macro
450
+ at run time MIPS -n32 4,
451
+ -64 8. */
452
+
453
+ unsigned char de_pointer_size; /* size of pointer in target.
454
+ Here to avoid test of abi in
455
+ macro at run time MIPS -n32
456
+ 4, -64 is 8. */
457
+
458
+ unsigned char de_relocation_record_size; /* reloc record size
459
+ varies by ABI and
460
+ relocation-output
461
+ method (stream or
462
+ symbolic) */
463
+
464
+ unsigned char de_64bit_extension;/* non-zero if creating 64 bit
465
+ offsets using dwarf2-99
466
+ extension proposal */
467
+
468
+ int de_output_version; /* 2,3,4, or 5. The version number
469
+ of the output. (not necessarily that of each section). */
470
+
471
+ int de_ar_data_attribute_form; /* data8, data4 abi &version dependent */
472
+ int de_ar_ref_attr_form; /* ref8 ref4 , abi dependent */
473
+
474
+ /* simple name relocations */
475
+ _dwarf_pro_reloc_name_func_ptr de_reloc_name;
476
+
477
+ /* relocations for a length, requiring a pair of symbols */
478
+ _dwarf_pro_reloc_length_func_ptr de_reloc_pair;
479
+
480
+ _dwarf_pro_transform_relocs_func_ptr de_transform_relocs_to_disk;
481
+
482
+ /* following used for macro buffers */
483
+ unsigned long de_compose_avail;
484
+ unsigned long de_compose_used_len;
485
+
486
+ unsigned char de_same_endian;
487
+ void *(*de_copy_word) (void *, const void *, size_t);
488
+
489
+ /* Add new fields at the END of this struct to preserve some hope
490
+ of sensible behavior on dbg passing between DSOs linked with
491
+ mismatched libdwarf producer versions. */
492
+
493
+ Dwarf_P_Marker de_markers; /* pointer to array of markers */
494
+ unsigned de_marker_n_alloc;
495
+ unsigned de_marker_n_used;
496
+ int de_sect_sa_next_to_return; /* Iterator on sring attrib sects */
497
+ /* String attributes data of each section. */
498
+ struct Dwarf_P_Per_Sect_String_Attrs_s de_sect_string_attr[NUM_DEBUG_SECTIONS];
499
+ /* Hold data needed to init new line output flexibly. */
500
+ struct Dwarf_P_Line_Inits_s de_line_inits;
501
+ };
502
+
503
+ #define CURRENT_VERSION_STAMP 2
504
+
505
+ Dwarf_Unsigned _dwarf_add_simple_name_entry(Dwarf_P_Debug dbg,
506
+ Dwarf_P_Die die,
507
+ char *entry_name,
508
+ enum dwarf_sn_kind
509
+ entrykind,
510
+ Dwarf_Error * error);
511
+
512
+
513
+ #define DISTINGUISHED_VALUE 0xffffffff /* 64bit extension flag */