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,46 @@
1
+ #ifndef _DWARF_ELF_PORT_H
2
+ #define _DWARF_ELF_PORT_H
3
+ /*
4
+
5
+ Copyright (C) 2008-2011 David Anderson. All rights reserved.
6
+ Portions Copyright 2008-2010 Arxan Technologies, Inc. All rights reserved.
7
+
8
+ This program is free software; you can redistribute it and/or modify it
9
+ under the terms of version 2.1 of the GNU Lesser General Public License
10
+ as published by the Free Software Foundation.
11
+
12
+ This program is distributed in the hope that it would be useful, but
13
+ WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
+
16
+ Further, this software is distributed without any warranty that it is
17
+ free of the rightful claim of any third person regarding infringement
18
+ or the like. Any license provided herein, whether implied or
19
+ otherwise, applies only to this software file. Patent licenses, if
20
+ any, provided herein do not apply to combinations of this program with
21
+ other software, or any other product whatsoever.
22
+
23
+ You should have received a copy of the GNU Lesser General Public
24
+ License along with this program; if not, write the Free Software
25
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
26
+ USA.
27
+
28
+ */
29
+
30
+
31
+
32
+ /* ELF (usually libelf) object access for the generic object file interface */
33
+
34
+ int
35
+ dwarf_elf_object_access_init(dwarf_elf_handle elf ,
36
+ int libdwarf_owns_elf,
37
+ Dwarf_Obj_Access_Interface** ret_obj,
38
+ int *err );
39
+
40
+ void
41
+ dwarf_elf_object_access_finish(Dwarf_Obj_Access_Interface* obj );
42
+
43
+ /* End ELF object access for the generic object file interface */
44
+
45
+
46
+ #endif
@@ -0,0 +1,492 @@
1
+ /*
2
+
3
+ Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
4
+ Portions Copyright (C) 2008-2014 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
+
29
+
30
+ #include "config.h"
31
+ #include "dwarf_incl.h"
32
+ #ifdef HAVE_ELF_H
33
+ #include <elf.h>
34
+ #endif
35
+
36
+ #include <stdio.h>
37
+ #include <sys/stat.h>
38
+ #include <sys/types.h>
39
+ #include <stdlib.h>
40
+
41
+ /* Array to hold string representation of errors. Any time a
42
+ define is added to the list in libdwarf.h, a string should be
43
+ added to this Array
44
+ */
45
+
46
+ const char *_dwarf_errmsgs[] = {
47
+
48
+ "No error (0)\n",
49
+ "DW_DLE_VMM 1 dwarf format/library version mismatch",
50
+ "DW_DLE_MAP 2 memory map failure",
51
+ "DW_DLE_LEE 3 libelf error",
52
+ "DW_DLE_NDS 4 no debug section",
53
+ "DW_DLE_NLS 5 no line section ",
54
+ "DW_DLE_ID 6 invalid descriptor for query ",
55
+ "DW_DLE_IOF 7 I/O failure ",
56
+ "DW_DLE_MAF 8 memory allocation failure ",
57
+ "DW_DLE_IA 9 invalid argument ",
58
+ "DW_DLE_MDE 10 mangled debugging entry ",
59
+ "DW_DLE_MLE 11 mangled line number entry ",
60
+ "DW_DLE_FNO 12 file not open ",
61
+ "DW_DLE_FNR 13 file not a regular file ",
62
+ "DW_DLE_FWA 14 file open with wrong access ",
63
+ "DW_DLE_NOB 15 not an object file ",
64
+ "DW_DLE_MOF 16 mangled object file header ",
65
+ "DW_DLE_EOLL 17 end of location list entries ",
66
+ "DW_DLE_NOLL 18 no location list section ",
67
+ "DW_DLE_BADOFF 19 Invalid offset ",
68
+ "DW_DLE_EOS 20 end of section ",
69
+ "DW_DLE_ATRUNC 21 abbreviations section appears truncated",
70
+ "DW_DLE_BADBITC 22 Address size passed to dwarf bad",
71
+
72
+ "DW_DLE_DBG_ALLOC 23 Unable to malloc a Dwarf_Debug structure",
73
+ "DW_DLE_FSTAT_ERROR 24 The file fd passed to dwarf_init "
74
+ "cannot be fstat()ed",
75
+ "DW_DLE_FSTAT_MODE_ERROR 25 The file mode bits do not "
76
+ "indicate that the file being opened via "
77
+ "dwarf_init() is a normal file",
78
+ "DW_DLE_INIT_ACCESS_WRONG 26 A call to dwarf_init had an "
79
+ "access of other than DW_DLC_READ",
80
+ "DW_DLE_ELF_BEGIN_ERROR 27 a call to "
81
+ "elf_begin(... ELF_C_READ_MMAP... ) failed",
82
+ "DW_DLE_ELF_GETEHDR_ERROR 28 a call to "
83
+ "elf32_getehdr() or elf64_getehdr() failed",
84
+ "DW_DLE_ELF_GETSHDR_ERROR 29 a call to "
85
+ "elf32_getshdr() or elf64_getshdr() failed",
86
+ "DW_DLE_ELF_STRPTR_ERROR 30 a call to "
87
+ "elf_strptr() failed trying to get a section name",
88
+ "DW_DLE_DEBUG_INFO_DUPLICATE 31 Only one .debug_info "
89
+ "section is allowed",
90
+ "DW_DLE_DEBUG_INFO_NULL 32 .debug_info section present but "
91
+ "elf_getdata() failed or section is zero-length",
92
+ "DW_DLE_DEBUG_ABBREV_DUPLICATE 33 Only one .debug_abbrev "
93
+ "section is allowed",
94
+ "DW_DLE_DEBUG_ABBREV_NULL 34 .debug_abbrev section present but "
95
+ "elf_getdata() failed or section is zero-length",
96
+ "DW_DLE_DEBUG_ARANGES_DUPLICATE 35 Only one .debug_aranges "
97
+ "section is allowed",
98
+ "DW_DLE_DEBUG_ARANGES_NULL 36 .debug_aranges section present but "
99
+ "elf_getdata() failed or section is zero-length",
100
+ "DW_DLE_DEBUG_LINE_DUPLICATE 37 Only one .debug_line "
101
+ "section is allowed",
102
+ "DW_DLE_DEBUG_LINE_NULL (38) .debug_line section present but "
103
+ "elf_getdata() failed or section is zero-length",
104
+ "DW_DLE_DEBUG_LOC_DUPLICATE (39) Only one .debug_loc "
105
+ "section is allowed",
106
+ "DW_DLE_DEBUG_LOC_NULL (40) .debug_loc section present but "
107
+ "elf_getdata() failed or section is zero-length",
108
+ "DW_DLE_DEBUG_MACINFO_DUPLICATE (41) Only one .debug_macinfo "
109
+ "section is allowed",
110
+ "DW_DLE_DEBUG_MACINFO_NULL (42) .debug_macinfo section present but "
111
+ "elf_getdata() failed or section is zero-length",
112
+ "DW_DLE_DEBUG_PUBNAMES_DUPLICATE (43) Only one .debug_pubnames "
113
+ "section is allowed",
114
+ "DW_DLE_DEBUG_PUBNAMES_NULL (44) .debug_pubnames section present but "
115
+ "elf_getdata() failed or section is zero-length",
116
+ "DW_DLE_DEBUG_STR_DUPLICATE (45) Only one .debug_str "
117
+ "section is allowed",
118
+ "DW_DLE_DEBUG_STR_NULL (46) .debug_str section present but "
119
+ "elf_getdata() failed or section is zero-length",
120
+ "DW_DLE_CU_LENGTH_ERROR (47)",
121
+ "DW_DLE_VERSION_STAMP_ERROR (48)",
122
+ "DW_DLE_ABBREV_OFFSET_ERROR (49)",
123
+ "DW_DLE_ADDRESS_SIZE_ERROR (50)",
124
+ "DW_DLE_DEBUG_INFO_PTR_NULL (51)",
125
+ "DW_DLE_DIE_NULL (52)",
126
+ "DW_DLE_STRING_OFFSET_BAD (53)",
127
+ "DW_DLE_DEBUG_LINE_LENGTH_BAD (54)",
128
+ "DW_DLE_LINE_PROLOG_LENGTH_BAD (55)",
129
+ "DW_DLE_LINE_NUM_OPERANDS_BAD",
130
+ "DW_DLE_LINE_SET_ADDR_ERROR",
131
+ "DW_DLE_LINE_EXT_OPCODE_BAD",
132
+ "DW_DLE_DWARF_LINE_NULL",
133
+ "DW_DLE_INCL_DIR_NUM_BAD",
134
+ "DW_DLE_LINE_FILE_NUM_BAD",
135
+ "DW_DLE_ALLOC_FAIL",
136
+ "DW_DLE_NO_CALLBACK_FUNC",
137
+ "DW_DLE_SECT_ALLOC",
138
+ "DW_DLE_FILE_ENTRY_ALLOC",
139
+ "DW_DLE_LINE_ALLOC",
140
+ "DW_DLE_FPGM_ALLOC",
141
+ "DW_DLE_INCDIR_ALLOC",
142
+ "DW_DLE_STRING_ALLOC",
143
+ "DW_DLE_CHUNK_ALLOC",
144
+ "DW_DLE_BYTEOFF_ERR",
145
+ "DW_DLE_CIE_ALLOC",
146
+ "DW_DLE_FDE_ALLOC",
147
+ "DW_DLE_REGNO_OVFL",
148
+ "DW_DLE_CIE_OFFS_ALLOC",
149
+ "DW_DLE_WRONG_ADDRESS",
150
+ "DW_DLE_EXTRA_NEIGHBORS",
151
+ "DW_DLE_WRONG_TAG",
152
+ "DW_DLE_DIE_ALLOC",
153
+ "DW_DLE_PARENT_EXISTS",
154
+ "DW_DLE_DBG_NULL",
155
+ "DW_DLE_DEBUGLINE_ERROR",
156
+ "DW_DLE_DEBUGFRAME_ERROR",
157
+ "DW_DLE_DEBUGINFO_ERROR",
158
+ "DW_DLE_ATTR_ALLOC",
159
+ "DW_DLE_ABBREV_ALLOC",
160
+ "DW_DLE_OFFSET_UFLW",
161
+ "DW_DLE_ELF_SECT_ERR",
162
+ "DW_DLE_DEBUG_FRAME_LENGTH_BAD",
163
+ "DW_DLE_FRAME_VERSION_BAD",
164
+ "DW_DLE_CIE_RET_ADDR_REG_ERROR",
165
+ "DW_DLE_FDE_NULL",
166
+ "DW_DLE_FDE_DBG_NULL",
167
+ "DW_DLE_CIE_NULL",
168
+ "DW_DLE_CIE_DBG_NULL",
169
+ "DW_DLE_FRAME_TABLE_COL_BAD",
170
+ "DW_DLE_PC_NOT_IN_FDE_RANGE",
171
+ "DW_DLE_CIE_INSTR_EXEC_ERROR",
172
+ "DW_DLE_FRAME_INSTR_EXEC_ERROR",
173
+ "DW_DLE_FDE_PTR_NULL",
174
+ "DW_DLE_RET_OP_LIST_NULL",
175
+ "DW_DLE_LINE_CONTEXT_NULL",
176
+ "DW_DLE_DBG_NO_CU_CONTEXT",
177
+ "DW_DLE_DIE_NO_CU_CONTEXT",
178
+ "DW_DLE_FIRST_DIE_NOT_CU",
179
+ "DW_DLE_NEXT_DIE_PTR_NULL",
180
+ "DW_DLE_DEBUG_FRAME_DUPLICATE Only one .debug_frame "
181
+ "section is allowed",
182
+ "DW_DLE_DEBUG_FRAME_NULL .debug_frame section present but "
183
+ "elf_getdata() failed or section is zero-length",
184
+ "DW_DLE_ABBREV_DECODE_ERROR",
185
+ "DW_DLE_DWARF_ABBREV_NULL",
186
+ "DW_DLE_ATTR_NULL",
187
+ "DW_DLE_DIE_BAD",
188
+ "DW_DLE_DIE_ABBREV_BAD",
189
+ "DW_DLE_ATTR_FORM_BAD",
190
+ "DW_DLE_ATTR_NO_CU_CONTEXT",
191
+ "DW_DLE_ATTR_FORM_SIZE_BAD",
192
+ "DW_DLE_ATTR_DBG_NULL",
193
+ "DW_DLE_BAD_REF_FORM",
194
+ "DW_DLE_ATTR_FORM_OFFSET_BAD",
195
+ "DW_DLE_LINE_OFFSET_BAD",
196
+ "DW_DLE_DEBUG_STR_OFFSET_BAD",
197
+ "DW_DLE_STRING_PTR_NULL",
198
+ "DW_DLE_PUBNAMES_VERSION_ERROR",
199
+ "DW_DLE_PUBNAMES_LENGTH_BAD",
200
+ "DW_DLE_GLOBAL_NULL",
201
+ "DW_DLE_GLOBAL_CONTEXT_NULL",
202
+ "DW_DLE_DIR_INDEX_BAD",
203
+ "DW_DLE_LOC_EXPR_BAD",
204
+ "DW_DLE_DIE_LOC_EXPR_BAD",
205
+ "DW_DLE_ADDR_ALLOC",
206
+ "DW_DLE_OFFSET_BAD",
207
+ "DW_DLE_MAKE_CU_CONTEXT_FAIL",
208
+ "DW_DLE_REL_ALLOC",
209
+ "DW_DLE_ARANGE_OFFSET_BAD",
210
+ "DW_DLE_SEGMENT_SIZE_BAD (135) Size of a segment selector should usually be less than 8 (bytes).",
211
+ "DW_DLE_ARANGE_LENGTH_BAD",
212
+ "DW_DLE_ARANGE_DECODE_ERROR",
213
+ "DW_DLE_ARANGES_NULL",
214
+ "DW_DLE_ARANGE_NULL",
215
+ "DW_DLE_NO_FILE_NAME",
216
+ "DW_DLE_NO_COMP_DIR",
217
+ "DW_DLE_CU_ADDRESS_SIZE_BAD",
218
+ "DW_DLE_INPUT_ATTR_BAD",
219
+ "DW_DLE_EXPR_NULL",
220
+ "DW_DLE_BAD_EXPR_OPCODE",
221
+ "DW_DLE_EXPR_LENGTH_BAD",
222
+ "DW_DLE_MULTIPLE_RELOC_IN_EXPR",
223
+ "DW_DLE_ELF_GETIDENT_ERROR",
224
+ "DW_DLE_NO_AT_MIPS_FDE",
225
+ "DW_DLE_NO_CIE_FOR_FDE",
226
+ "DW_DLE_DIE_ABBREV_LIST_NULL",
227
+ "DW_DLE_DEBUG_FUNCNAMES_DUPLICATE",
228
+ "DW_DLE_DEBUG_FUNCNAMES_NULL .debug_funcnames section present but "
229
+ "elf_getdata() failed or section is zero-length",
230
+ "DW_DLE_DEBUG_FUNCNAMES_VERSION_ERROR",
231
+ "DW_DLE_DEBUG_FUNCNAMES_LENGTH_BAD",
232
+ "DW_DLE_FUNC_NULL",
233
+ "DW_DLE_FUNC_CONTEXT_NULL",
234
+ "DW_DLE_DEBUG_TYPENAMES_DUPLICATE",
235
+ "DW_DLE_DEBUG_TYPENAMES_NULL .debug_typenames section present but "
236
+ "elf_getdata() failed or section is zero-length",
237
+ "DW_DLE_DEBUG_TYPENAMES_VERSION_ERROR",
238
+ "DW_DLE_DEBUG_TYPENAMES_LENGTH_BAD",
239
+ "DW_DLE_TYPE_NULL",
240
+ "DW_DLE_TYPE_CONTEXT_NULL",
241
+ "DW_DLE_DEBUG_VARNAMES_DUPLICATE",
242
+ "DW_DLE_DEBUG_VARNAMES_NULL .debug_varnames section present but "
243
+ "elf_getdata() failed or section is zero-length",
244
+ "DW_DLE_DEBUG_VARNAMES_VERSION_ERROR",
245
+ "DW_DLE_DEBUG_VARNAMES_LENGTH_BAD",
246
+ "DW_DLE_VAR_NULL",
247
+ "DW_DLE_VAR_CONTEXT_NULL",
248
+ "DW_DLE_DEBUG_WEAKNAMES_DUPLICATE",
249
+ "DW_DLE_DEBUG_WEAKNAMES_NULL .debug_weaknames section present but "
250
+ "elf_getdata() failed or section is zero-length",
251
+
252
+ "DW_DLE_DEBUG_WEAKNAMES_VERSION_ERROR",
253
+ "DW_DLE_DEBUG_WEAKNAMES_LENGTH_BAD",
254
+ "DW_DLE_WEAK_NULL",
255
+ "DW_DLE_WEAK_CONTEXT_NULL (175)",
256
+ "DW_DLE_LOCDESC_COUNT_WRONG (176)",
257
+ "DW_DLE_MACINFO_STRING_NULL (177)",
258
+ "DW_DLE_MACINFO_STRING_EMPTY (178)",
259
+ "DW_DLE_MACINFO_INTERNAL_ERROR_SPACE (179)",
260
+ "DW_DLE_MACINFO_MALLOC_FAIL (180)",
261
+ "DW_DLE_DEBUGMACINFO_ERROR (181)",
262
+ "DW_DLE_DEBUG_MACRO_LENGTH_BAD (182)",
263
+ "DW_DLE_DEBUG_MACRO_MAX_BAD (183)",
264
+ "DW_DLE_DEBUG_MACRO_INTERNAL_ERR (184)",
265
+ "DW_DLE_DEBUG_MACRO_MALLOC_SPACE (185)",
266
+ "DW_DLE_DEBUG_MACRO_INCONSISTENT (186)",
267
+ "DW_DLE_DF_NO_CIE_AUGMENTATION(187)",
268
+ "DW_DLE_DF_REG_NUM_TOO_HIGH(188)",
269
+ "DW_DLE_DF_MAKE_INSTR_NO_INIT(189)",
270
+ "DW_DLE_DF_NEW_LOC_LESS_OLD_LOC(190)",
271
+ "DW_DLE_DF_POP_EMPTY_STACK(191)",
272
+ "DW_DLE_DF_ALLOC_FAIL(192)",
273
+ "DW_DLE_DF_FRAME_DECODING_ERROR(193)",
274
+ "DW_DLE_DEBUG_LOC_SECTION_SHORT(194)",
275
+ "DW_DLE_FRAME_AUGMENTATION_UNKNOWN(195)",
276
+ "DW_DLE_PUBTYPE_CONTEXT(196)",
277
+ "DW_DLE_DEBUG_PUBTYPES_LENGTH_BAD(197)",
278
+ "DW_DLE_DEBUG_PUBTYPES_VERSION_ERROR(198)",
279
+ "DW_DLE_DEBUG_PUBTYPES_DUPLICATE(199)",
280
+ "DW_DLE_FRAME_CIE_DECODE_ERROR(200)",
281
+ "DW_DLE_FRAME_REGISTER_UNREPRESENTABLE(201)",
282
+ "DW_DLE_FRAME_REGISTER_COUNT_MISMATCH(202)",
283
+ "DW_DLE_LINK_LOOP(203)",
284
+ "DW_DLE_STRP_OFFSET_BAD(204)",
285
+ "DW_DLE_DEBUG_RANGES_DUPLICATE(205)",
286
+ "DW_DLE_DEBUG_RANGES_OFFSET_BAD(206)",
287
+ "DW_DLE_DEBUG_RANGES_MISSING_END(207)",
288
+ "DW_DLE_DEBUG_RANGES_OUT_OF_MEM(208)",
289
+ "DW_DLE_DEBUG_SYMTAB_ERR(209)",
290
+ "DW_DLE_DEBUG_STRTAB_ERR(210)",
291
+ "DW_DLE_RELOC_MISMATCH_INDEX(211)",
292
+ "DW_DLE_RELOC_MISMATCH_RELOC_INDEX(212)",
293
+ "DW_DLE_RELOC_MISMATCH_STRTAB_INDEX(213)",
294
+ "DW_DLE_RELOC_SECTION_MISMATCH(214)",
295
+ "DW_DLE_RELOC_SECTION_MISSING_INDEX(215)",
296
+ "DW_DLE_RELOC_SECTION_LENGTH_ODD(216)",
297
+ "DW_DLE_RELOC_SECTION_PTR_NULL(217)",
298
+ "DW_DLE_RELOC_SECTION_MALLOC_FAIL(218)",
299
+ "DW_DLE_NO_ELF64_SUPPORT(219)",
300
+ "DW_DLE_MISSING_ELF64_SUPPORT(220)",
301
+ "DW_DLE_ORPHAN_FDE(221)",
302
+ "DW_DLE_DUPLICATE_INST_BLOCK(222)",
303
+ "DW_DLE_BAD_REF_SIG8_FORM(223)",
304
+ "DW_DLE_ATTR_EXPRLOC_FORM_BAD(224)",
305
+ "DW_DLE_FORM_SEC_OFFSET_LENGTH_BAD(225)",
306
+ "DW_DLE_NOT_REF_FORM(226)",
307
+ "DW_DLE_DEBUG_FRAME_LENGTH_NOT_MULTIPLE(227)",
308
+ "DW_DLE_REF_SIG8_NOT_HANDLED (228)",
309
+ "DW_DLE_DEBUG_FRAME_POSSIBLE_ADDRESS_BOTCH (229)",
310
+ "DW_DLE_LOC_BAD_TERMINATION (230) the last location operator in an expression is missing some associated data, an operator ended too soon",
311
+ "DW_DLE_SYMTAB_SECTION_LENGTH_ODD (231) so doing relocations seems unsafe",
312
+ "DW_DLE_RELOC_SECTION_SYMBOL_INDEX_BAD (232) so doing a relocation seems unsafe",
313
+ "DW_DLE_RELOC_SECTION_RELOC_TARGET_SIZE_UNKNOWN (233) so doing a relocation is unsafe",
314
+ "DW_DLE_SYMTAB_SECTION_ENTRYSIZE_ZERO(234)",
315
+ "DW_DLE_LINE_NUMBER_HEADER_ERROR (235), a line number program header seems incomplete (perhaps the header_length is wrong?).",
316
+ "DW_DLE_DEBUG_TYPES_NULL (236)",
317
+ "DW_DLE_DEBUG_TYPES_DUPLICATE (237)",
318
+ "DW_DLE_DEBUG_TYPES_ONLY_DWARF4 (238) DW4 and DW5 have types CUs",
319
+ "DW_DLE_DEBUG_TYPEOFFSET_BAD (239)",
320
+ "DW_DLE_GNU_OPCODE_ERROR (240)",
321
+ "DW_DLE_DEBUGPUBTYPES_ERROR (241), could not create pubtypes section",
322
+ "DW_DLE_AT_FIXUP_NULL (242)",
323
+ "DW_DLE_AT_FIXUP_DUP (243)",
324
+ "DW_DLE_BAD_ABINAME (244)",
325
+ "DW_DLE_TOO_MANY_DEBUG(245), too many .debug_* sections present somehow",
326
+ "DW_DLE_DEBUG_STR_OFFSETS_DUPLICATE(246)",
327
+ "DW_DLE_SECTION_DUPLICATION(247)",
328
+ "DW_DLE_SECTION_ERROR(248)",
329
+ "DW_DLE_DEBUG_ADDR_DUPLICATE(249)",
330
+ "DW_DLE_DEBUG_CU_UNAVAILABLE_FOR_FORM(250)",
331
+ "DW_DLE_DEBUG_FORM_HANDLING_INCOMPLETE(251)",
332
+ "DW_DLE_NEXT_DIE_PAST_END(252)",
333
+ "DW_DLE_NEXT_DIE_WRONG_FORM(253)",
334
+ "DW_DLE_NEXT_DIE_NO_ABBREV_LIST(254)",
335
+ "DW_DLE_NESTED_FORM_INDIRECT_ERROR(255)",
336
+ "DW_DLE_CU_DIE_NO_ABBREV_LIST(256)",
337
+ "DW_DLE_MISSING_NEEDED_DEBUG_ADDR_SECTION(257)",
338
+ "DW_DLE_ATTR_FORM_NOT_ADDR_INDEX(258)",
339
+ "DW_DLE_ATTR_FORM_NOT_STR_INDEX(259)",
340
+ "DW_DLE_DUPLICATE_GDB_INDEX(260)",
341
+ "DW_DLE_ERRONEOUS_GDB_INDEX_SECTION(261)",
342
+ "DW_DLE_GDB_INDEX_COUNT_ERROR(262)",
343
+ "DW_DLE_GDB_INDEX_COUNT_ADDR_ERROR(263)",
344
+ "DW_DLE_GDB_INDEX_CUVEC_ERROR(264)",
345
+ "DW_DLE_GDB_INDEX_INDEX_ERROR(264)"
346
+ "DW_DLE_GDB_INDEX_CUVEC_ERROR(265)",
347
+ "DW_DLE_DUPLICATE_CU_INDEX(266)",
348
+ "DW_DLE_DUPLICATE_TU_INDEX(267)",
349
+ "DW_DLE_XU_TYPE_ARG_ERROR(268)",
350
+ "DW_DLE_XU_IMPOSSIBLE_ERROR(269)",
351
+ "DW_DLE_XU_NAME_COL_ERROR(270)",
352
+ "DW_DLE_XU_HASH_ROW_ERROR(271)",
353
+ "DW_DLE_XU_HASH_INDEX_ERROR(272)",
354
+ "DW_DLE_FAILSAFE_ERRVAL(273)",
355
+ "DW_DLE_ARANGE_ERROR(274) producer problem in object generation",
356
+ "DW_DLE_PUBNAMES_ERROR(275) producer problem in object generation",
357
+ "DW_DLE_FUNCNAMES_ERROR(276) producer problem in object generation",
358
+ "DW_DLE_TYPENAMES_ERROR(277) producer problem in object generation",
359
+ "DW_DLE_VARNAMES_ERROR(278) producer problem in object generation",
360
+ "DW_DLE_WEAKNAMES_ERROR(279) producer problem in object generation",
361
+ "DW_DLE_RELOCS_ERROR(280) producer problem in object generation",
362
+ "DW_DLE_DW_DLE_ATTR_OUTSIDE_SECTION(281)",
363
+ "DW_DLE_FISSION_INDEX_WRONG(282)",
364
+ "DW_DLE_FISSION_VERSION_ERROR(283)",
365
+ "DW_DLE_NEXT_DIE_LOW_ERROR(284) corrupted DIE tree",
366
+ "DW_DLE_CU_UT_TYPE_ERROR(285) not a valid DW_UT_* value",
367
+ "DW_DLE_NO_SUCH_SIGNATURE_FOUND(286) CU signature not in the index",
368
+ "DW_DLE_SIGNATURE_SECTION_NUMBER_WRONG(287) libdwarf software error",
369
+ "DW_DLE_ATTR_FORM_NOT_DATA8(288) wanted an 8 byte signature",
370
+ "DW_DLE_SIG_TYPE_WRONG_STRING (289) expected tu or cu",
371
+ "DW_DLE_MISSING_REQUIRED_TU_OFFSET_HASH(290) is a broken dwp package file",
372
+ "DW_DLE_MISSING_REQUIRED_CU_OFFSET_HASH(291) is a broken dwp package file",
373
+ "DW_DLE_DWP_MISSING_DWO_ID(292)",
374
+ "DW_DLE_DWP_SIBLING_ERROR(293)",
375
+ "DW_DLE_DEBUG_FISSION_INCOMPLETE(294)",
376
+ "DW_DLE_FISSION_SECNUM_ERR(295) internal libdwarf error",
377
+ "DW_DLE_DEBUG_MACRO_DUPLICATE(296)",
378
+ "DW_DLE_DEBUG_NAMES_DUPLICATE(297)",
379
+ "DW_DLE_DEBUG_LINE_STR_DUPLICATE(298)",
380
+ "DW_DLE_DEBUG_SUP_DUPLICATE(299)",
381
+ "DW_DLE_NO_SIGNATURE_TO_LOOKUP(300)",
382
+ "DW_DLE_NO_TIED_ADDR_AVAILABLE(301)",
383
+ "DW_DLE_NO_TIED_SIG_AVAILABLE(302)",
384
+ "DW_DLE_STRING_NOT_TERMINATED(303) section data may be corrupted",
385
+ "DW_DLE_BAD_LINE_TABLE_OPERATION(304) two-level line table botch",
386
+ "DW_DLE_LINE_CONTEXT_BOTCH(305) call is wrong or memory corruption",
387
+ "DW_DLE_LINE_CONTEXT_INDEX_WRONG(306)",
388
+ "DW_DLE_NO_TIED_STRING_AVAILABLE(307) tied file does not have the string",
389
+ "DW_DLE_NO_TIED_FILE_AVAILABLE(308) see dwarf_set_tied_dbg()",
390
+ "DW_DLE_CU_TYPE_MISSING(309) libdwarf bug or data corruption",
391
+ "DW_DLE_LLE_CODE_UNKNOWN(310) libdwarf bug or data corruption",
392
+ "DW_DLE_LOCLIST_INTERFACE_ERROR(311) interface cannot do location or DW_OP*",
393
+ "DW_DLE_LOCLIST_INDEX_ERROR(312)",
394
+ "DW_DLE_INTERFACE_NOT_SUPPORTED(313)",
395
+ };
396
+
397
+
398
+
399
+
400
+ /* This function performs error handling as described in the
401
+ libdwarf consumer document section 3. Dbg is the Dwarf_debug
402
+ structure being processed. Error is a pointer to the pointer
403
+ to the error descriptor that will be returned. Errval is an
404
+ error code listed in dwarf_error.h.
405
+
406
+ If the malloc arena is exhausted we return a pointer to
407
+ a special static error record. This special singleton
408
+ is mostly ignored by dwarf_dealloc().
409
+ Users should not be storing Dwarf_Error pointers
410
+ for long so this singleton is only going to cause
411
+ confusion when callers try to save an out-of-memory
412
+ Dwarf_Error pointer.
413
+ The _dwarf_failsafe_error is intended to
414
+ be an improvement over an abort() call.
415
+ The failsafe means we will not abort due to
416
+ a Dwarf_Error struct creation.
417
+ */
418
+ void
419
+ _dwarf_error(Dwarf_Debug dbg, Dwarf_Error * error, Dwarf_Sword errval)
420
+ {
421
+ Dwarf_Error errptr;
422
+
423
+ /* Allow NULL dbg on entry, since sometimes that can happen and we
424
+ want to report the upper-level error, not this one. */
425
+ if (error != NULL) {
426
+ /* If dbg is NULL, use the alternate error struct. However,
427
+ this will overwrite the earlier error. */
428
+ if (dbg != NULL) {
429
+ errptr =
430
+ (Dwarf_Error) _dwarf_get_alloc(dbg, DW_DLA_ERROR, 1);
431
+ if (errptr == NULL) {
432
+ errptr = &_dwarf_failsafe_error;
433
+ errptr->er_static_alloc = 1;
434
+ }
435
+ } else {
436
+ /* We have no dbg to work with. dwarf_init failed. We hack
437
+ up a special area. */
438
+ errptr = _dwarf_special_no_dbg_error_malloc();
439
+ if (errptr == NULL) {
440
+ errptr = &_dwarf_failsafe_error;
441
+ errptr->er_static_alloc = 1;
442
+ }
443
+ }
444
+
445
+ errptr->er_errval = errval;
446
+ *error = errptr;
447
+ return;
448
+ }
449
+
450
+ if (dbg != NULL && dbg->de_errhand != NULL) {
451
+ errptr = (Dwarf_Error) _dwarf_get_alloc(dbg, DW_DLA_ERROR, 1);
452
+ if (errptr == NULL) {
453
+ errptr = &_dwarf_failsafe_error;
454
+ errptr->er_static_alloc = 1;
455
+ }
456
+ errptr->er_errval = errval;
457
+ dbg->de_errhand(errptr, dbg->de_errarg);
458
+ return;
459
+ }
460
+ fprintf(stderr,
461
+ "abort() in libdwarf. No error argument, no handler.\n");
462
+ abort();
463
+ }
464
+
465
+
466
+ Dwarf_Unsigned
467
+ dwarf_errno(Dwarf_Error error)
468
+ {
469
+ if (error == NULL) {
470
+ return (0);
471
+ }
472
+
473
+ return (error->er_errval);
474
+ }
475
+
476
+
477
+ /*
478
+ */
479
+ char *
480
+ dwarf_errmsg(Dwarf_Error error)
481
+ {
482
+ if (error == NULL) {
483
+ return "Dwarf_Error is NULL";
484
+ }
485
+
486
+ if (error->er_errval >=
487
+ (Dwarf_Signed)(sizeof(_dwarf_errmsgs) / sizeof(char *))) {
488
+ return "Dwarf_Error value out of range";
489
+ }
490
+
491
+ return ((char *) _dwarf_errmsgs[error->er_errval]);
492
+ }