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,219 @@
1
+ /*
2
+ Copyright (C) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
3
+ Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
4
+ Portions Copyright 2008-2010 Arxan Technologies, Inc. All rights reserved.
5
+ Portions Copyright 2011-2015 David Anderson. All rights reserved.
6
+ Portions Copyright 2012 SN Systems Ltd. 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
+ #include "config.h"
31
+ #include "dwarf_incl.h"
32
+ #include "dwarf_elf_access.h"
33
+
34
+ #ifdef HAVE_ELF_H
35
+ #include <elf.h>
36
+ #endif
37
+ #ifdef HAVE_LIBELF_H
38
+ #include <libelf.h>
39
+ #else
40
+ #ifdef HAVE_LIBELF_LIBELF_H
41
+ #include <libelf/libelf.h>
42
+ #endif
43
+ #endif
44
+
45
+ #include <stdio.h>
46
+ #include <sys/stat.h>
47
+ #include <sys/types.h>
48
+ #include <string.h>
49
+ #include <stdlib.h>
50
+
51
+ #define DWARF_DBG_ERROR(dbg,errval,retval) \
52
+ _dwarf_error(dbg, error, errval); return(retval);
53
+
54
+ #define FALSE 0
55
+ #define TRUE 1
56
+
57
+ static int
58
+ dwarf_elf_init_file_ownership(dwarf_elf_handle elf_file_pointer,
59
+ int libdwarf_owns_elf,
60
+ Dwarf_Unsigned access,
61
+ Dwarf_Handler errhand,
62
+ Dwarf_Ptr errarg,
63
+ Dwarf_Debug * ret_dbg,
64
+ Dwarf_Error * error);
65
+
66
+
67
+ /* The basic dwarf initializer function for consumers using
68
+ libelf.
69
+ Return a libdwarf error code on error, return DW_DLV_OK
70
+ if this succeeds. */
71
+ int
72
+ dwarf_init(int fd,
73
+ Dwarf_Unsigned access,
74
+ Dwarf_Handler errhand,
75
+ Dwarf_Ptr errarg, Dwarf_Debug * ret_dbg, Dwarf_Error * error)
76
+ {
77
+ struct stat fstat_buf;
78
+ dwarf_elf_handle elf_file_pointer = 0;
79
+ /* ELF_C_READ is a portable value */
80
+ Elf_Cmd what_kind_of_elf_read = ELF_C_READ;
81
+
82
+ #if !defined(S_ISREG)
83
+ #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
84
+ #endif
85
+ if (fstat(fd, &fstat_buf) != 0) {
86
+ DWARF_DBG_ERROR(NULL, DW_DLE_FSTAT_ERROR, DW_DLV_ERROR);
87
+ }
88
+ if (!S_ISREG(fstat_buf.st_mode)) {
89
+ DWARF_DBG_ERROR(NULL, DW_DLE_FSTAT_MODE_ERROR, DW_DLV_ERROR);
90
+ }
91
+
92
+ if (access != DW_DLC_READ) {
93
+ DWARF_DBG_ERROR(NULL, DW_DLE_INIT_ACCESS_WRONG, DW_DLV_ERROR);
94
+ }
95
+
96
+ elf_version(EV_CURRENT);
97
+ /* Changed to mmap request per bug 281217. 6/95 */
98
+ #ifdef HAVE_ELF_C_READ_MMAP
99
+ /* ELF_C_READ_MMAP is an SGI IRIX specific enum value from IRIX
100
+ libelf.h meaning read but use mmap.
101
+ It is never necessary -- it is just a convenience.
102
+ HAVE_ELF_C_READ_MMAP has not been in config.h via
103
+ configure since 2004 at least. */
104
+ what_kind_of_elf_read = ELF_C_READ_MMAP;
105
+ #endif /* !HAVE_ELF_C_READ_MMAP */
106
+
107
+ elf_file_pointer = elf_begin(fd, what_kind_of_elf_read, 0);
108
+ if (elf_file_pointer == NULL) {
109
+ DWARF_DBG_ERROR(NULL, DW_DLE_ELF_BEGIN_ERROR, DW_DLV_ERROR);
110
+ }
111
+ return dwarf_elf_init_file_ownership(elf_file_pointer,
112
+ TRUE, access, errhand, errarg, ret_dbg, error);
113
+ }
114
+
115
+ /* An alternate dwarf setup call for consumers using
116
+ libelf.
117
+ When the caller has opened libelf already, so the
118
+ caller must free libelf. */
119
+ int
120
+ dwarf_elf_init(dwarf_elf_handle elf_file_pointer,
121
+ Dwarf_Unsigned access,
122
+ Dwarf_Handler errhand,
123
+ Dwarf_Ptr errarg,
124
+ Dwarf_Debug * ret_dbg, Dwarf_Error * error)
125
+ {
126
+ return dwarf_elf_init_file_ownership(elf_file_pointer,
127
+ FALSE, access, errhand, errarg, ret_dbg, error);
128
+ }
129
+
130
+
131
+ /* Initialize the ELF object access for libdwarf. */
132
+ static int
133
+ dwarf_elf_init_file_ownership(dwarf_elf_handle elf_file_pointer,
134
+ int libdwarf_owns_elf,
135
+ Dwarf_Unsigned access,
136
+ Dwarf_Handler errhand,
137
+ Dwarf_Ptr errarg,
138
+ Dwarf_Debug * ret_dbg,
139
+ Dwarf_Error * error)
140
+ {
141
+ /* ELF is no longer tied to libdwarf. */
142
+ Dwarf_Obj_Access_Interface *binary_interface = 0;
143
+ int res = DW_DLV_OK;
144
+ int localerrnum = 0;
145
+
146
+ if (access != DW_DLC_READ) {
147
+ DWARF_DBG_ERROR(NULL, DW_DLE_INIT_ACCESS_WRONG, DW_DLV_ERROR);
148
+ }
149
+
150
+ /* This allocates and fills in *binary_interface. */
151
+ res = dwarf_elf_object_access_init(
152
+ elf_file_pointer,
153
+ libdwarf_owns_elf,
154
+ &binary_interface,
155
+ &localerrnum);
156
+ if (res != DW_DLV_OK) {
157
+ if (res == DW_DLV_NO_ENTRY) {
158
+ return res;
159
+ }
160
+ DWARF_DBG_ERROR(NULL, localerrnum, DW_DLV_ERROR);
161
+ }
162
+
163
+ /* This mallocs space and returns pointer thru ret_dbg,
164
+ saving the binary interface in 'ret-dbg' */
165
+ res = dwarf_object_init(binary_interface, errhand, errarg,
166
+ ret_dbg, error);
167
+ if (res != DW_DLV_OK){
168
+ dwarf_elf_object_access_finish(binary_interface);
169
+ }
170
+ return res;
171
+ }
172
+
173
+
174
+ /*
175
+ Frees all memory that was not previously freed
176
+ by dwarf_dealloc.
177
+ Aside from certain categories.
178
+
179
+ This is only applicable when dwarf_init() or dwarf_elf_init()
180
+ was used to init 'dbg'.
181
+ */
182
+ int
183
+ dwarf_finish(Dwarf_Debug dbg, Dwarf_Error * error)
184
+ {
185
+ if(!dbg) {
186
+ DWARF_DBG_ERROR(NULL, DW_DLE_DBG_NULL, DW_DLV_ERROR);
187
+ }
188
+ dwarf_elf_object_access_finish(dbg->de_obj_file);
189
+
190
+ return dwarf_object_finish(dbg, error);
191
+ }
192
+
193
+ /*
194
+ tieddbg should be the executable or .o
195
+ that has the .debug_addr section that
196
+ the base dbg refers to. See Split Objects in DWARF5.
197
+
198
+ Allows setting to NULL (NULL is the default
199
+ of de_tied_data.td_tied_object).
200
+ New September 2015.
201
+ */
202
+ int
203
+ dwarf_set_tied_dbg(Dwarf_Debug dbg, Dwarf_Debug tieddbg,Dwarf_Error*error)
204
+ {
205
+ dbg->de_tied_data.td_tied_object = tieddbg;
206
+ if (tieddbg) {
207
+ tieddbg->de_tied_data.td_is_tied_object = TRUE;
208
+ }
209
+ return DW_DLV_OK;
210
+ }
211
+
212
+ /* Unsure of the use-case of this.
213
+ New September 2015. */
214
+ int
215
+ dwarf_get_tied_dbg(Dwarf_Debug dbg, Dwarf_Debug *tieddbg_out, Dwarf_Error*error)
216
+ {
217
+ *tieddbg_out = dbg->de_tied_data.td_tied_object;
218
+ return DW_DLV_OK;
219
+ }
@@ -0,0 +1,631 @@
1
+ /*
2
+ Copyright (C) 2000,2002,2004,2005,2006 Silicon Graphics, Inc. All Rights Reserved.
3
+ Portions Copyright (C) 2007-2013 David Anderson. All Rights Reserved.
4
+ Portions Copyright 2012 SN Systems Ltd. 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
+ #include "config.h"
29
+ #include "dwarf_incl.h"
30
+ #include <stdio.h>
31
+ #include <stdlib.h>
32
+ #include <time.h>
33
+ #include "dwarf_line.h"
34
+
35
+ #define PRINTING_DETAILS 1
36
+
37
+ static void
38
+ print_line_header(Dwarf_Debug dbg,
39
+ Dwarf_Bool is_single_tab,
40
+ Dwarf_Bool is_actuals_tab)
41
+ {
42
+ if (!is_single_tab) {
43
+ /* Ugly indenting follows, it makes lines shorter to see them better. */
44
+ if (is_actuals_tab) {
45
+ dwarf_printf(dbg,"\nActuals Table\n");
46
+ dwarf_printf(dbg,
47
+ " be\n"
48
+ " ls\n"
49
+ " ce\n"
50
+ " section op kq\n"
51
+ " offset code address/index row isa ??\n");
52
+ return;
53
+ } else {
54
+ dwarf_printf(dbg,"\nLogicals Table\n");
55
+ dwarf_printf(dbg,
56
+ " s pe\n"
57
+ " tirp\n"
58
+ " msoi\n"
59
+ " section op tall\n"
60
+ " offset row code address/indx fil lne col disc cntx subp ????\n");
61
+ return;
62
+ }
63
+ }
64
+ /* Single level table */
65
+ dwarf_printf(dbg,
66
+ " s b e p e i d\n"
67
+ " t l s r p s i\n"
68
+ " m c e o i a s\n"
69
+ " section op col t k q l l c\n"
70
+ " offset code address file line umn ? ? ? ? ? \n");
71
+ }
72
+
73
+ static void
74
+ print_line_detail(
75
+ Dwarf_Debug dbg,
76
+ const char *prefix,
77
+ int opcode,
78
+ unsigned curr_line,
79
+ struct Dwarf_Line_Registers_s * regs,
80
+ Dwarf_Bool is_single_table, Dwarf_Bool is_actuals_table)
81
+ {
82
+ if(!is_single_table && is_actuals_table) {
83
+ dwarf_printf(dbg,
84
+ "%-15s %3d 0x%" DW_PR_XZEROS DW_PR_DUx
85
+ "/%01u"
86
+ " %5lu" /* lr_line, really logical row */
87
+ " %3d" /* isa */
88
+ " %1d"
89
+ "%1d\n",
90
+ prefix,
91
+ (int) opcode,
92
+ (Dwarf_Unsigned) regs->lr_address,
93
+ (unsigned) regs->lr_op_index,
94
+ (unsigned long) regs->lr_line, /*logical row */
95
+ regs->lr_isa,
96
+ (int) regs->lr_basic_block,
97
+ (int) regs->lr_end_sequence);
98
+ return;
99
+ }
100
+ if(!is_single_table && !is_actuals_table) {
101
+ dwarf_printf(dbg,
102
+ "[%3d] " /* row number */
103
+ "%-15s %3d x%" DW_PR_XZEROS DW_PR_DUx "/%01u"
104
+ " %2lu %4lu %1lu",
105
+ curr_line,
106
+ prefix,
107
+ (int) opcode,
108
+ (Dwarf_Unsigned) regs->lr_address,
109
+ (unsigned) regs->lr_op_index,
110
+ (unsigned long) regs->lr_file,
111
+ (unsigned long) regs->lr_line,
112
+ (unsigned long) regs->lr_column);
113
+ if (regs->lr_discriminator ||
114
+ regs->lr_prologue_end ||
115
+ regs->lr_epilogue_begin ||
116
+ regs->lr_isa ||
117
+ regs->lr_is_stmt ||
118
+ regs->lr_call_context ||
119
+ regs->lr_subprogram) {
120
+ dwarf_printf(dbg,
121
+ " x%02" DW_PR_DUx , regs->lr_discriminator); /* DWARF4 */
122
+ dwarf_printf(dbg,
123
+ " x%02" DW_PR_DUx , regs->lr_call_context); /* EXPERIMENTAL */
124
+ dwarf_printf(dbg,
125
+ " x%02" DW_PR_DUx , regs->lr_subprogram); /* EXPERIMENTAL */
126
+ dwarf_printf(dbg,
127
+ " %1d", (int) regs->lr_is_stmt);
128
+ dwarf_printf(dbg,
129
+ "%1d", (int) regs->lr_isa);
130
+ dwarf_printf(dbg,
131
+ "%1d", regs->lr_prologue_end); /* DWARF3 */
132
+ dwarf_printf(dbg,
133
+ "%1d", regs->lr_epilogue_begin); /* DWARF3 */
134
+ }
135
+ dwarf_printf(dbg, "\n");
136
+ return;
137
+ }
138
+ /* In the first quoted line below:
139
+ 3d looks better than 2d, but best to do that as separate
140
+ change and test from two-level-line-tables. */
141
+ dwarf_printf(dbg,
142
+ "%-15s %2d 0x%" DW_PR_XZEROS DW_PR_DUx " "
143
+ "%2lu %4lu %2lu %1d %1d %1d",
144
+ prefix,
145
+ (int) opcode,
146
+ (Dwarf_Unsigned) regs->lr_address,
147
+ (unsigned long) regs->lr_file,
148
+ (unsigned long) regs->lr_line,
149
+ (unsigned long) regs->lr_column,
150
+ (int) regs->lr_is_stmt,
151
+ (int) regs->lr_basic_block,
152
+ (int) regs->lr_end_sequence);
153
+ if (regs->lr_discriminator ||
154
+ regs->lr_prologue_end ||
155
+ regs->lr_epilogue_begin ||
156
+ regs->lr_isa) {
157
+ dwarf_printf(dbg,
158
+ " %1d", regs->lr_prologue_end); /* DWARF3 */
159
+ dwarf_printf(dbg,
160
+ " %1d", regs->lr_epilogue_begin); /* DWARF3 */
161
+ dwarf_printf(dbg,
162
+ " %1d", regs->lr_isa); /* DWARF3 */
163
+ dwarf_printf(dbg,
164
+ " 0x%" DW_PR_DUx , regs->lr_discriminator); /* DWARF4 */
165
+ }
166
+ dwarf_printf(dbg, "\n");
167
+ }
168
+
169
+
170
+ #include "dwarf_line_table_reader_common.c"
171
+
172
+ void
173
+ _dwarf_print_line_context_record(Dwarf_Debug dbg,
174
+ Dwarf_Line_Context line_context)
175
+ {
176
+ return;
177
+ }
178
+
179
+ /* return DW_DLV_OK if ok. else DW_DLV_NO_ENTRY or DW_DLV_ERROR
180
+ If err_count_out is non-NULL, this is a special 'check'
181
+ call. */
182
+ static int
183
+ _dwarf_internal_printlines(Dwarf_Die die,
184
+ Dwarf_Error * error,
185
+ int * err_count_out,
186
+ int only_line_header)
187
+ {
188
+ /* This pointer is used to scan the portion of the .debug_line
189
+ section for the current cu. */
190
+ Dwarf_Small *line_ptr = 0;
191
+ Dwarf_Small *orig_line_ptr = 0;
192
+
193
+ /* Pointer to a DW_AT_stmt_list attribute in case it exists in the
194
+ die. */
195
+ Dwarf_Attribute stmt_list_attr = 0;
196
+
197
+ /* Pointer to DW_AT_comp_dir attribute in die. */
198
+ Dwarf_Attribute comp_dir_attr = 0;
199
+
200
+ /* Pointer to name of compilation directory. */
201
+ Dwarf_Small *comp_dir = NULL;
202
+
203
+ /* Offset into .debug_line specified by a DW_AT_stmt_list
204
+ attribute. */
205
+ Dwarf_Unsigned line_offset = 0;
206
+
207
+ Dwarf_Sword i=0;
208
+ Dwarf_Word u=0;
209
+
210
+ /* These variables are used to decode leb128 numbers. Leb128_num
211
+ holds the decoded number, and leb128_length is its length in
212
+ bytes. */
213
+ Dwarf_Half attrform = 0;
214
+
215
+ /* In case there are wierd bytes 'after' the line table
216
+ prologue this lets us print something. This is a gcc
217
+ compiler bug and we expect the bytes count to be 12. */
218
+ Dwarf_Small* bogus_bytes_ptr = 0;
219
+ Dwarf_Unsigned bogus_bytes_count = 0;
220
+ Dwarf_Half address_size = 0;
221
+ Dwarf_Unsigned fission_offset = 0;
222
+
223
+
224
+ /* The Dwarf_Debug this die belongs to. */
225
+ Dwarf_Debug dbg=0;
226
+ Dwarf_CU_Context cu_context = 0;
227
+ Dwarf_Line_Context line_context = 0;
228
+ int resattr = DW_DLV_ERROR;
229
+ int lres = DW_DLV_ERROR;
230
+ int res = DW_DLV_ERROR;
231
+ Dwarf_Small *line_ptr_actuals = 0;
232
+ Dwarf_Small *line_ptr_end = 0;
233
+ Dwarf_Small *section_start = 0;
234
+
235
+ /* ***** BEGIN CODE ***** */
236
+
237
+ if (error != NULL) {
238
+ *error = NULL;
239
+ }
240
+
241
+ CHECK_DIE(die, DW_DLV_ERROR);
242
+ cu_context = die->di_cu_context;
243
+ dbg = cu_context->cc_dbg;
244
+
245
+ res = _dwarf_load_section(dbg, &dbg->de_debug_line,error);
246
+ if (res != DW_DLV_OK) {
247
+ return res;
248
+ }
249
+ if (!dbg->de_debug_line.dss_size) {
250
+ return (DW_DLV_NO_ENTRY);
251
+ }
252
+
253
+ address_size = _dwarf_get_address_size(dbg, die);
254
+ resattr = dwarf_attr(die, DW_AT_stmt_list, &stmt_list_attr, error);
255
+ if (resattr != DW_DLV_OK) {
256
+ return resattr;
257
+ }
258
+
259
+
260
+ /* The list of relevant FORMs is small.
261
+ DW_FORM_data4, DW_FORM_data8, DW_FORM_sec_offset
262
+ */
263
+ lres = dwarf_whatform(stmt_list_attr,&attrform,error);
264
+ if (lres != DW_DLV_OK) {
265
+ return lres;
266
+ }
267
+ if (attrform != DW_FORM_data4 && attrform != DW_FORM_data8 &&
268
+ attrform != DW_FORM_sec_offset ) {
269
+ _dwarf_error(dbg, error, DW_DLE_LINE_OFFSET_BAD);
270
+ return (DW_DLV_ERROR);
271
+ }
272
+ lres = dwarf_global_formref(stmt_list_attr, &line_offset, error);
273
+ if (lres != DW_DLV_OK) {
274
+ return lres;
275
+ }
276
+
277
+ if (line_offset >= dbg->de_debug_line.dss_size) {
278
+ _dwarf_error(dbg, error, DW_DLE_LINE_OFFSET_BAD);
279
+ return (DW_DLV_ERROR);
280
+ }
281
+ {
282
+ Dwarf_Unsigned fission_size = 0;
283
+ int res = _dwarf_get_fission_addition_die(die, DW_SECT_LINE,
284
+ &fission_offset,&fission_size,error);
285
+ if(res != DW_DLV_OK) {
286
+ return res;
287
+ }
288
+ }
289
+
290
+ section_start = dbg->de_debug_line.dss_data;
291
+ orig_line_ptr = section_start + line_offset + fission_offset;
292
+ line_ptr = orig_line_ptr;
293
+ dwarf_dealloc(dbg, stmt_list_attr, DW_DLA_ATTR);
294
+
295
+ /* If die has DW_AT_comp_dir attribute, get the string that names
296
+ the compilation directory. */
297
+ resattr = dwarf_attr(die, DW_AT_comp_dir, &comp_dir_attr, error);
298
+ if (resattr == DW_DLV_ERROR) {
299
+ return resattr;
300
+ }
301
+ if (resattr == DW_DLV_OK) {
302
+ int cres = DW_DLV_ERROR;
303
+ char *cdir = 0;
304
+
305
+ cres = dwarf_formstring(comp_dir_attr, &cdir, error);
306
+ if (cres == DW_DLV_ERROR) {
307
+ return cres;
308
+ } else if (cres == DW_DLV_OK) {
309
+ comp_dir = (Dwarf_Small *) cdir;
310
+ }
311
+ }
312
+ if (resattr == DW_DLV_OK) {
313
+ dwarf_dealloc(dbg, comp_dir_attr, DW_DLA_ATTR);
314
+ }
315
+ line_context = (Dwarf_Line_Context)
316
+ _dwarf_get_alloc(dbg, DW_DLA_LINE_CONTEXT, 1);
317
+ if (line_context == NULL) {
318
+ _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
319
+ return (DW_DLV_ERROR);
320
+ }
321
+ {
322
+ Dwarf_Small *newlinep = 0;
323
+ int dres = _dwarf_read_line_table_header(dbg,
324
+ cu_context,
325
+ line_ptr,dbg->de_debug_line.dss_size,
326
+ &newlinep,
327
+ line_context,
328
+ &bogus_bytes_ptr,
329
+ &bogus_bytes_count,
330
+ error,
331
+ err_count_out);
332
+ if (dres == DW_DLV_ERROR) {
333
+ dwarf_srclines_dealloc_b(line_context);
334
+ return dres;
335
+ }
336
+ if (dres == DW_DLV_NO_ENTRY) {
337
+ dwarf_srclines_dealloc_b(line_context);
338
+ return dres;
339
+ }
340
+ line_ptr_end = line_context->lc_line_ptr_end;
341
+ line_ptr = newlinep;
342
+ if (line_context->lc_actuals_table_offset > 0) {
343
+ line_ptr_actuals = line_context->lc_line_prologue_start +
344
+ line_context->lc_actuals_table_offset;
345
+ }
346
+ }
347
+ line_context->lc_compilation_directory = comp_dir;
348
+ if (only_line_header) {
349
+ /* Just checking for header errors, nothing more here.*/
350
+ dwarf_srclines_dealloc_b(line_context);
351
+ return DW_DLV_OK;
352
+ }
353
+
354
+ dwarf_printf(dbg,
355
+ "total line info length %ld bytes,"
356
+ " line offset 0x%" DW_PR_XZEROS DW_PR_DUx
357
+ " %" DW_PR_DUu "\n",
358
+ (long) line_context->lc_total_length,
359
+ line_context->lc_section_offset,
360
+ line_context->lc_section_offset);
361
+ if (line_context->lc_version_number <= DW_LINE_VERSION5) {
362
+ dwarf_printf(dbg,
363
+ "line table version %d\n",(int) line_context->lc_version_number);
364
+ } else {
365
+ dwarf_printf(dbg,
366
+ "line table version 0x%x\n",(int) line_context->lc_version_number);
367
+ }
368
+ dwarf_printf(dbg,
369
+ "line table length field length %d prologue length %d\n",
370
+ (int)line_context->lc_length_field_length,
371
+ (int)line_context->lc_prologue_length);
372
+ dwarf_printf(dbg,
373
+ "compilation_directory %s\n",
374
+ comp_dir ? ((char *) comp_dir) : "");
375
+
376
+ dwarf_printf(dbg,
377
+ " min instruction length %d\n",
378
+ (int) line_context->lc_minimum_instruction_length);
379
+ if (line_context->lc_version_number == EXPERIMENTAL_LINE_TABLES_VERSION) {
380
+ dwarf_printf(dbg, " actuals table offset "
381
+ "0x%" DW_PR_XZEROS DW_PR_DUx
382
+ " logicals table offset "
383
+ "0x%" DW_PR_XZEROS DW_PR_DUx "\n",
384
+ line_context->lc_actuals_table_offset,
385
+ line_context->lc_logicals_table_offset);
386
+ }
387
+ if (line_context->lc_version_number == DW_LINE_VERSION5) {
388
+ dwarf_printf(dbg,
389
+ " segment selector size %d\n",
390
+ (int) line_context->lc_segment_selector_size);
391
+ dwarf_printf(dbg,
392
+ " address size %d\n",
393
+ (int) line_context->lc_address_size);
394
+ }
395
+ dwarf_printf(dbg,
396
+ " default is stmt %d\n",(int)line_context->lc_default_is_stmt);
397
+ dwarf_printf(dbg,
398
+ " line base %d\n",(int)line_context->lc_line_base);
399
+ dwarf_printf(dbg,
400
+ " line_range %d\n",(int)line_context->lc_line_range);
401
+ dwarf_printf(dbg,
402
+ " opcode base %d\n",(int)line_context->lc_opcode_base);
403
+ dwarf_printf(dbg,
404
+ " standard opcode count %d\n",(int)line_context->lc_std_op_count);
405
+
406
+ for (i = 1; i < line_context->lc_opcode_base; i++) {
407
+ dwarf_printf(dbg,
408
+ " opcode[%2d] length %d\n", (int) i,
409
+ (int) line_context->lc_opcode_length_table[i - 1]);
410
+ }
411
+ dwarf_printf(dbg,
412
+ " include directories count %d\n",
413
+ (int) line_context->lc_include_directories_count);
414
+ for (u = 0; u < line_context->lc_include_directories_count; ++u) {
415
+ dwarf_printf(dbg,
416
+ " include dir[%u] %s\n",
417
+ (int) u, line_context->lc_include_directories[u]);
418
+ }
419
+ dwarf_printf(dbg,
420
+ " files count %d\n",
421
+ (int) line_context->lc_file_entry_count);
422
+
423
+ if (line_context->lc_file_entry_count) {
424
+ Dwarf_File_Entry fe = line_context->lc_file_entries;
425
+ Dwarf_File_Entry fe2 = fe;
426
+ unsigned u = 0;
427
+ for (u = 0 ; fe2 ; fe2 = fe->fi_next,++u ) {
428
+ Dwarf_Unsigned tlm2 = 0;
429
+ Dwarf_Unsigned di = 0;
430
+ Dwarf_Unsigned fl = 0;
431
+
432
+ fe = fe2;
433
+ tlm2 = fe->fi_time_last_mod;
434
+ di = fe->fi_dir_index;
435
+ fl = fe->fi_file_length;
436
+
437
+ dwarf_printf(dbg,
438
+ " file[%u] %s (file-number: %u) \n",
439
+ (unsigned) u, (char *) fe->fi_file_name,
440
+ (unsigned)(u+1));
441
+ dwarf_printf(dbg,
442
+ " dir index %d\n", (int) di);
443
+ {
444
+ time_t tt = (time_t) tlm2;
445
+
446
+ /* ctime supplies newline */
447
+ dwarf_printf(dbg,
448
+ " last time 0x%x %s",
449
+ (unsigned) tlm2, ctime(&tt));
450
+ }
451
+ dwarf_printf(dbg,
452
+ " file length %ld 0x%lx\n",
453
+ (long) fl, (unsigned long) fl);
454
+ }
455
+ }
456
+
457
+ if (line_context->lc_version_number == EXPERIMENTAL_LINE_TABLES_VERSION) {
458
+ /* Print the subprograms list. */
459
+ Dwarf_Unsigned count = line_context->lc_subprogs_count;
460
+ Dwarf_Unsigned u = 0;
461
+ Dwarf_Subprog_Entry sub = line_context->lc_subprogs;
462
+ dwarf_printf(dbg," subprograms count"
463
+ " %" DW_PR_DUu "\n",count);
464
+ if (count > 0) {
465
+ dwarf_printf(dbg," indx file line name\n");
466
+ }
467
+ for (u = 0 ; u < count ; u++,sub++) {
468
+ dwarf_printf(dbg," [%2" DW_PR_DUu "] %4" DW_PR_DUu
469
+ " %4" DW_PR_DUu " %s\n",
470
+ u+1,
471
+ sub->ds_decl_file,
472
+ sub->ds_decl_line,
473
+ sub->ds_subprog_name);
474
+ }
475
+ }
476
+ {
477
+ Dwarf_Unsigned offset = 0;
478
+ if (bogus_bytes_count > 0) {
479
+ Dwarf_Unsigned wcount = bogus_bytes_count;
480
+ Dwarf_Unsigned boffset = bogus_bytes_ptr - section_start;
481
+ dwarf_printf(dbg,
482
+ "*** DWARF CHECK: the line table prologue header_length "
483
+ " is %" DW_PR_DUu " too high, we pretend it is smaller."
484
+ "Section offset: 0x%" DW_PR_XZEROS DW_PR_DUx
485
+ " (%" DW_PR_DUu ") ***\n",
486
+ wcount, boffset,boffset);
487
+ *err_count_out += 1;
488
+ }
489
+ offset = line_ptr - section_start;
490
+ dwarf_printf(dbg,
491
+ " statement prog offset in section: 0x%"
492
+ DW_PR_XZEROS DW_PR_DUx " (%" DW_PR_DUu ")\n",
493
+ offset, offset);
494
+ }
495
+
496
+ {
497
+ Dwarf_Bool doaddrs = false;
498
+ Dwarf_Bool dolines = true;
499
+
500
+ _dwarf_print_line_context_record(dbg,line_context);
501
+ if (!line_ptr_actuals) {
502
+ /* Normal single level line table. */
503
+
504
+ Dwarf_Bool is_single_table = true;
505
+ Dwarf_Bool is_actuals_table = false;
506
+ print_line_header(dbg, is_single_table, is_actuals_table);
507
+ res = read_line_table_program(dbg,
508
+ line_ptr, line_ptr_end, orig_line_ptr,
509
+ section_start,
510
+ line_context,
511
+ address_size, doaddrs, dolines,
512
+ is_single_table,
513
+ is_actuals_table,
514
+ error,
515
+ err_count_out);
516
+ if (res != DW_DLV_OK) {
517
+ dwarf_srclines_dealloc_b(line_context);
518
+ return res;
519
+ }
520
+ } else {
521
+ Dwarf_Bool is_single_table = false;
522
+ Dwarf_Bool is_actuals_table = false;
523
+ if (line_context->lc_version_number !=
524
+ EXPERIMENTAL_LINE_TABLES_VERSION) {
525
+ dwarf_srclines_dealloc_b(line_context);
526
+ _dwarf_error(dbg, error, DW_DLE_VERSION_STAMP_ERROR);
527
+ return (DW_DLV_ERROR);
528
+ }
529
+ /* Read Logicals */
530
+ print_line_header(dbg, is_single_table, is_actuals_table);
531
+ res = read_line_table_program(dbg,
532
+ line_ptr, line_ptr_actuals, orig_line_ptr,
533
+ section_start,
534
+ line_context,
535
+ address_size, doaddrs, dolines,
536
+ is_single_table,
537
+ is_actuals_table,
538
+ error,err_count_out);
539
+ if (res != DW_DLV_OK) {
540
+ dwarf_srclines_dealloc_b(line_context);
541
+ return res;
542
+ }
543
+ if (line_context->lc_actuals_table_offset > 0) {
544
+ is_actuals_table = true;
545
+ /* Read Actuals */
546
+
547
+ print_line_header(dbg, is_single_table, is_actuals_table);
548
+ res = read_line_table_program(dbg,
549
+ line_ptr_actuals, line_ptr_end, orig_line_ptr,
550
+ section_start,
551
+ line_context,
552
+ address_size, doaddrs, dolines,
553
+ is_single_table,
554
+ is_actuals_table,
555
+ error,
556
+ err_count_out);
557
+ if (res != DW_DLV_OK) {
558
+ dwarf_srclines_dealloc_b(line_context);
559
+ return res;
560
+ }
561
+ }
562
+ }
563
+ }
564
+ dwarf_srclines_dealloc_b(line_context);
565
+ return DW_DLV_OK;
566
+ }
567
+
568
+
569
+
570
+ /* This is support for dwarfdump: making it possible
571
+ for clients wanting line detail info on stdout
572
+ to get that detail without including internal libdwarf
573
+ header information.
574
+ Caller passes in compilation unit DIE.
575
+ The _dwarf_ version is obsolete (though supported for
576
+ compatibility).
577
+ The dwarf_ version is preferred.
578
+ The functions are intentionally identical: having
579
+ _dwarf_print_lines call dwarf_print_lines might
580
+ better emphasize they are intentionally identical, but
581
+ that seemed slightly silly given how short the functions are.
582
+ Interface adds error_count (output value) February 2009.
583
+
584
+ These *print_lines() functions print two-level tables in full
585
+ even when the user is not asking for both (ie, when
586
+ the caller asked for dwarf_srclines().
587
+ It was an accident, but after a short reflection
588
+ this seems like a good idea for -vvv. */
589
+ int
590
+ dwarf_print_lines(Dwarf_Die die, Dwarf_Error * error,int *error_count)
591
+ {
592
+ int only_line_header = 0;
593
+ int res = _dwarf_internal_printlines(die, error,
594
+ error_count,
595
+ only_line_header);
596
+ if (res != DW_DLV_OK) {
597
+ return res;
598
+ }
599
+ return res;
600
+ }
601
+ int
602
+ _dwarf_print_lines(Dwarf_Die die, Dwarf_Error * error)
603
+ {
604
+ int only_line_header = 0;
605
+ int err_count = 0;
606
+ int res = _dwarf_internal_printlines(die, error,
607
+ &err_count,
608
+ only_line_header);
609
+ /* No way to get error count back in this interface */
610
+ if (res != DW_DLV_OK) {
611
+ return res;
612
+ }
613
+ return res;
614
+ }
615
+
616
+ /* The check is in case we are not printing full line data,
617
+ this gets some of the issues noted with .debug_line,
618
+ but not all. Call dwarf_print_lines() to get all issues.
619
+ Intended for apps like dwarfdump.
620
+ */
621
+ void
622
+ dwarf_check_lineheader(Dwarf_Die die, int *err_count_out)
623
+ {
624
+ Dwarf_Error err;
625
+ int only_line_header = 1;
626
+ _dwarf_internal_printlines(die, &err,err_count_out,
627
+ only_line_header);
628
+ return;
629
+ }
630
+
631
+