Codebase list dwarfutils / 6cd6979
New upstream version 20201201 Fabian Wolff 3 years ago
132 changed file(s) with 6942 addition(s) and 3411 deletion(s). Raw diff Collapse all Expand all
159159 NOT HAVE_LIBELF_H AND
160160 NOT HAVE_LIBELF_LIBELF_H)
161161 set(DWARF_WITH_LIBELF OFF)
162 set(HAVE_ELF_H OFF)
163 elseif (NOT DWARF_WITH_LIBELF)
164 set(HAVE_ELF_H OFF)
165 set(HAVE_LIBELF_LIBELF_H OFF)
166 set(HAVE_LIBELF_H OFF)
167 set(HAVE_ELF64_GETSHDR OFF)
168 set(HAVE_ELF64_GETEHDR OFF)
162169 endif ()
163170
164171 if (DWARF_WITH_LIBELF)
219226 int i = 12;
220227 return 0;
221228 }" HAVE_STRUCT_UNDERSCORE_ELF)
229 else()
222230 endif()
223231 message(STATUS "Assuming struct Elf for the default libdwarf.h")
224232 # Because cmake treats ; in an interesting way attempting
229237 message(STATUS "Using struct _Elf in libdwarf.h")
230238 configure_file(libdwarf/generated_libdwarf.h.in
231239 libdwarf/libdwarf.h COPYONLY)
232 else()
240 elseif(NOT DWARF_WITH_LIBELF)
233241 configure_file(libdwarf/libdwarf.h.in
234242 libdwarf/libdwarf.h COPYONLY)
235243 message(STATUS "${JUST_LIBELF} does not have struct _Elf")
236 message(STATUS "Using struct Elf in libdwarf.h")
244 message(STATUS "Using struct Elf in libdwarf.h, no actual elf.h used")
237245 endif()
238246
239247 check_c_source_runs("
300308 }
301309 return 0;
302310 } ]=] HAVE_ZLIB )
311 check_c_source_compiles( [=[
312 #include "zlib.h"
313 int main()
314 {
315 Bytef dest[100];
316 uLongf destlen = 100;
317 Bytef *src = 0;
318 uLong srclen = 3;
319 int res = uncompress(dest,&destlen,src,srclen);
320 if (res == Z_OK) {
321 /* ALL IS WELL */
322 }
323 return 0;
324 } ]=] HAVE_ZLIB_H )
303325 set(CMAKE_REQUIRED_LIBRARIES)
304326 if (HAVE_ZLIB)
305327 # For linking in libz
408430
409431 message(STATUS "Install prefix ... ${CMAKE_INSTALL_PREFIX}" )
410432 add_custom_target(dd DEPENDS ${DWARF_TARGETS} dwarfdump)
433 # installation
434 install(TARGETS ${DWARF_TARGETS} EXPORT libdwarfTargets ARCHIVE DESTINATION lib)
435 install(EXPORT libdwarfTargets
436 FILE libdwarf-targets.cmake
437 NAMESPACE libdwarf::
438 DESTINATION lib/cmake/libdwarf
439 )
440 install(
441 FILES cmake/libdwarf-config.cmake
442 DESTINATION lib/cmake/libdwarf
443 )
444 install(DIRECTORY libdwarf DESTINATION include/
445 FILES_MATCHING PATTERN "*.h")
446 install(
447 FILES ${CMAKE_CURRENT_BINARY_DIR}/libdwarf/libdwarf.h
448 DESTINATION include/libdwarf
449 )
0 2020-11-25 David Anderson
1 * configure.ac: Now version 20201201.
2 * configure: Regenerated.
3 2020-11-25 David Anderson
4 * configure.ac: Modified to make build endianness visible
5 to dwarfexample 'make check' runtests.sh
6 so make check can pass building on a big-endian host.
7 * Makefile.in: Regenerated.
8 * configure: Regenerated.
9 2020-11-25 David Anderson
10 * configure.ac: Now version 20201125.
11 * configure: Regenerated.
12 2020-11-24 David Anderson
13 * CMakeLists.txt: now supports -DDWARF_WITH_LIBELF=OFF
14 (which it was supposed to do...)
15 2020-11-23 David Anderson
16 * configure.ac: Now version 20201123.
17 * configure: Regenerated.
18 2020-11-09 David Anderson
19 * configure.ac: Now version 20201100
20 * configure: Regenerated.
21 2020-11-05 David Anderson
22 * CMakeLists.txt,configure.ac: Modified so we set both
23 HAVE_ZLIB and HAVE_ZLIB_H as we should have done
24 long ago.
25 * config.h.in,configure: Regenerated.
26 2020-11-03 David Anderson
27 * configure.ac: Now version 20201103
28 * configure: Regenerated.
029 2020-10-20 David Anderson
1 * configure.ac: Now version 20201020
30 * configure.ac: Now version 20201029
231 * configure: Regenerated.
332 2020-10-11 David Anderson
433 * configure.ac: Now version 20201011
241241 DLLTOOL = @DLLTOOL@
242242 DSYMUTIL = @DSYMUTIL@
243243 DUMPBIN = @DUMPBIN@
244 DWARF_BIGENDIAN = @DWARF_BIGENDIAN@
244245 DWARF_CFLAGS_WARN = @DWARF_CFLAGS_WARN@
245246 DWARF_CXXFLAGS_WARN = @DWARF_CXXFLAGS_WARN@
246247 DWARF_LIBS = @DWARF_LIBS@
+26
-12
NEWS less more
0 2020-11-21:
1 dwarfdump now prints DWARF expression operators each on
2 its own line. This makes viewing DWARF expressions much
3 nicer given the increased use of much longer expressions.
4 Those expression operators that reference DIES are now
5 followed, verified, and the target DW_TAG and DW_AT_name
6 are printed. A new dwarfdump.conf command 'option:' lets
7 one specify option: --format-expr-ops-joined in case you
8 want the old style DWARF expression operators-on-one-line.
9 Where the DWARF DIE children nest > nine-deep dwarfdump
10 switches from indentation by spaces to a nest-level number.
11
012 2020-09-08:
1 libdwarf/dwarfdump work well with DWARF4 and
2 DWARF5, including DWP files.
13 libdwarf/dwarfdump work well with DWARF4 and DWARF5,
14 including DWP files.
15
316 2020-07-08:
417 libdwarf now reads .debug_gnu_pubtypes & pubnames
5 (non-standard but gcc creates them in DWARF5)
6 via a small number of new functions
7 and dwarfdump --print-debug-gnu prints both sections.
8 Verifying the .debug_info offsets is not yet done.
18 (non-standard but gcc creates them in DWARF5) via a small
19 number of new functions and dwarfdump --print-debug-gnu
20 prints both sections. Verifying the .debug_info offsets
21 is not yet done.
22
923 2020-06-29:
1024 Dwarfdump now dumps DWARF5 .debug_rnglists and
11 .debug_loclists. To handle DWARF5 there are
12 a small number of new functions. All existing
13 functions are still supported, but
14 to read DWARF5 some small changes are required.
15 In libdwarf see libdwarf2.1.pdf and also see
16 libdwarf/ChangeLog for details.
25 .debug_loclists. To handle DWARF5 there are a small
26 number of new functions. All existing functions are
27 still supported, but to read DWARF5 some small changes
28 are required. In libdwarf see libdwarf2.1.pdf and also
29 see libdwarf/ChangeLog for details.
30
1731 2020-05-23:
1832 dwarfdump now takes much less malloc() to work, as measured
1933 by valgrind --tool=massif and massif-visualizer.
0
1 id: DW202010-003
2 cve: a cve id requested 29 Oct 2020
3 datereported: 2020-10-27
4 reportedby: Casper Sun
5 vulnerability: Passing null to %s due to corrupt line table header.
6 product: libdwarf
7 description: If a DWARF5 line table header has an invalid
8 FORM for a pathname, the fi_file_name field may be null
9 and printing it via %s can result in referencing memory
10 at address 0, possibly generating segmentation
11 violation or application crash. Now in case of null
12 we provide a fixed string of <no file name>
13 and for the form code we print the value and <unknown form>
14 so there are no unpredictable effects.
15 datefixed: 2020-10-28
16 references: regressiontests/c-sun2/nullpointer
17 gitfixid: faf99408e3f9f706fc3809dd400e831f989778d3
18 tarrelease:
19 endrec: DW202010-003
20
21
22 id: DW202010-002
23 cve: a cve id requested 29 Oct 2020
24 datereported: 2020-10-27
25 reportedby: Casper Sun
26 vulnerability: A very deep DIE tree can corrupt random data.
27 product: dwarfdump
28 description: An object file where the DIEs depth of
29 nesting exceeds the limit of 800 levels
30 due to corruption or a compiler bug
31 can result in exhausting the die stack array and
32 writing past its end.
33 A segmentation fault is possible.
34 The code at the point of error was not adjusting
35 the array index properly
36 so an invalid dereference could occur.
37 Now the test code is correct and the array overflow
38 is detected resulting in a normal error return.
39 Additional places where this could occur were
40 identified and the proper test added.
41 datefixed: 2020-10-28
42 references: regressiontests/c-sun2/globaloverflow
43 gitfixid: a7fa8edd640b74daf8e7a442dcec96640875b4fb
44 tarrelease:
45 endrec: DW202010-002
046
147 id: DW202010-001
248 cve: waiting for cve id to be granted
0 Latest update: 30 March 2018
0 Latest update: 3 November 2020
11 Adapted from the Cairo coding style document
22
33 Libdwarf/dwarfdump coding style.
2222
2323 Indentation
2424 -----------
25 Each new level is indented 4 more spaces than the previous level:
25 Each new level is indented 4 more spaces than the previous level,
26 and an if is followed by a space and a left-paren:
2627
2728 if (condition) {
2829 do_something();
3031 Done solely with space characters. The simple project on
3132 sourceforge.net, dicheck-da, detects all instances of tabs,
3233 improper indentation and line-ending whitespace.
34
35 Similarly, for is to have a single space after the r followed by
36 a left_paren.
37 for (v; condition; v2) {
38 do_something();
39 }
3340
3441 Tab characters
3542 --------------
134134 /* Set to 1 if zlib decompression is available. */
135135 #undef HAVE_ZLIB
136136
137 /* Define to 1 if you have the <zlib.h> header file. */
137 /* Set to 1 if zlib.h header file is available. */
138138 #undef HAVE_ZLIB_H
139139
140140 /* Define to the sub-directory where libtool stores uninstalled libraries. */
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.69 for libdwarf 20201020.
2 # Generated by GNU Autoconf 2.69 for libdwarf 20201201.
33 #
44 # Report bugs to <libdwarf-list -at- linuxmail -dot- org>.
55 #
589589 # Identity of this package.
590590 PACKAGE_NAME='libdwarf'
591591 PACKAGE_TARNAME='libdwarf'
592 PACKAGE_VERSION='20201020'
593 PACKAGE_STRING='libdwarf 20201020'
592 PACKAGE_VERSION='20201201'
593 PACKAGE_STRING='libdwarf 20201201'
594594 PACKAGE_BUGREPORT='libdwarf-list -at- linuxmail -dot- org'
595595 PACKAGE_URL=''
596596
638638 ALLOCA
639639 DWARF_CFLAGS_WARN
640640 DWARF_CXXFLAGS_WARN
641 DWARF_BIGENDIAN
641642 struct_elf
642643 DWARF_LIBS
643644 CXXCPP
810811 CXXFLAGS
811812 CCC
812813 CXXCPP
813 DWARF_LIBS'
814 DWARF_LIBS
815 DWARF_BIGENDIAN'
814816
815817
816818 # Initialize some variables set by options.
13611363 # Omit some internal or obsolete options to make the list less imposing.
13621364 # This message is too long to be a string in the A/UX 3.1 sh.
13631365 cat <<_ACEOF
1364 \`configure' configures libdwarf 20201020 to adapt to many kinds of systems.
1366 \`configure' configures libdwarf 20201201 to adapt to many kinds of systems.
13651367
13661368 Usage: $0 [OPTION]... [VAR=VALUE]...
13671369
14321434
14331435 if test -n "$ac_init_help"; then
14341436 case $ac_init_help in
1435 short | recursive ) echo "Configuration of libdwarf 20201020:";;
1437 short | recursive ) echo "Configuration of libdwarf 20201201:";;
14361438 esac
14371439 cat <<\_ACEOF
14381440
14981500 CXXFLAGS C++ compiler flags
14991501 CXXCPP C++ preprocessor
15001502 DWARF_LIBS linker flags when linking libdwarf
1503 DWARF_BIGENDIAN
1504 big endian yes/no needed for dwarfexample test
15011505
15021506 Use these variables to override the choices made by `configure' or to help
15031507 it to find libraries and programs with nonstandard names/locations.
15651569 test -n "$ac_init_help" && exit $ac_status
15661570 if $ac_init_version; then
15671571 cat <<\_ACEOF
1568 libdwarf configure 20201020
1572 libdwarf configure 20201201
15691573 generated by GNU Autoconf 2.69
15701574
15711575 Copyright (C) 2012 Free Software Foundation, Inc.
21092113 This file contains any messages produced by compilers while
21102114 running configure, to aid debugging if configure makes a mistake.
21112115
2112 It was created by libdwarf $as_me 20201020, which was
2116 It was created by libdwarf $as_me 20201201, which was
21132117 generated by GNU Autoconf 2.69. Invocation command line was
21142118
21152119 $ $0 $@
43414345
43424346 # Define the identity of the package.
43434347 PACKAGE='libdwarf'
4344 VERSION='20201020'
4348 VERSION='20201201'
43454349
43464350
43474351 cat >>confdefs.h <<_ACEOF
1809718101 esac
1809818102
1809918103
18104 DWARF_BIGENDIAN=${ac_cv_c_bigendian}
18105
18106
18107
1810018108 # gcc accepts even totally bogus -Wno flags. Other compilers..no
1810118109 # -Wno-long-long suppresses warnings on 'long long'
1810218110 # -Wno-pedantic-ms-format (which only exists in mingw)
1879318801 have_zlib="yes"
1879418802
1879518803 $as_echo "#define HAVE_ZLIB 1" >>confdefs.h
18804
18805
18806 $as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h
1879618807
1879718808
1879818809 else
1940219413 # report actual input values of CONFIG_FILES etc. instead of their
1940319414 # values after options handling.
1940419415 ac_log="
19405 This file was extended by libdwarf $as_me 20201020, which was
19416 This file was extended by libdwarf $as_me 20201201, which was
1940619417 generated by GNU Autoconf 2.69. Invocation command line was
1940719418
1940819419 CONFIG_FILES = $CONFIG_FILES
1946819479 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1946919480 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1947019481 ac_cs_version="\\
19471 libdwarf config.status 20201020
19482 libdwarf config.status 20201201
1947219483 configured by $0, generated by GNU Autoconf 2.69,
1947319484 with options \\"\$ac_cs_config\\"
1947419485
1515
1616 ### Sets the release name.
1717 ###m4_define([v_date], [m4_esyscmd_s([date "+%Y%m%d"])])
18 m4_define([v_date], [20201020])])
18 m4_define([v_date], [20201201])])
1919
2020 AC_PREREQ([2.52])
2121 ### 2nd arg to AC_INIT is the version 'number'.
465465
466466 AC_C_BIGENDIAN([AC_DEFINE([WORDS_BIGENDIAN], [1], [Set to 1 if bigendian build])],,)
467467
468 AC_SUBST([DWARF_BIGENDIAN],[${ac_cv_c_bigendian}])
469 AC_ARG_VAR([DWARF_BIGENDIAN], [big endian yes/no needed for dwarfexample test])
470
468471 # gcc accepts even totally bogus -Wno flags. Other compilers..no
469472 # -Wno-long-long suppresses warnings on 'long long'
470473 # -Wno-pedantic-ms-format (which only exists in mingw)
586589 [
587590 have_zlib="yes"
588591 AC_DEFINE([HAVE_ZLIB], [1], [Set to 1 if zlib decompression is available.])
592 AC_DEFINE([HAVE_ZLIB_H], [1], [Set to 1 if zlib.h header file is available.])
589593 ],
590594 [
591595 have_zlib="no"
1212 print_llex_codes.c print_origloclist_codes.c
1313 print_loclists_codes.c
1414 print_locs.c print_loclists.c
15 print_macro.c print_macros.c
15 print_macro.c print_macinfo.c
1616 print_pubnames.c print_ranges.c
1717 print_rnglists.c print_reloc.c
1818 print_str_offsets.c
171171 set(peobj "${CMAKE_SOURCE_DIR}/dwarfdump/testobjLE32PE.exe")
172172 set(pebase "${CMAKE_SOURCE_DIR}/dwarfdump/testobjLE32PE.base")
173173 set(execpedd "${CMAKE_BINARY_DIR}/dwarfdump/dwarfdump")
174 add_test(NAME selfdwarfdumppe COMMAND sh -c "${execpedd} ${peobj} | head -500 >junk.testoutpe ; diff ${pebase} junk.testoutpe" )
174 add_test(NAME selfdwarfdumppe COMMAND sh -c "${execpedd} -vvv -a ${peobj} | head -700 >junk.testoutpe ; diff ${pebase} junk.testoutpe" )
175175 endif()
176176
177177 if (DO_TESTING)
178178 set(elfobj "${CMAKE_SOURCE_DIR}/dwarfdump/testuriLE64ELf.obj")
179179 set(elfbase "${CMAKE_SOURCE_DIR}/dwarfdump/testuriLE64ELf.base")
180180 set(execelfdd "${CMAKE_BINARY_DIR}/dwarfdump/dwarfdump")
181 add_test(NAME selfdwarfdumpelf COMMAND sh -c "${execelfdd} ${elfobj} | head -500 > junk.testoutelf ; diff ${elfbase} junk.testoutelf" )
181 add_test(NAME selfdwarfdumpelf COMMAND sh -c "${execelfdd} -vvv -a ${elfobj} | head -700 > junk.testoutelf ; diff ${elfbase} junk.testoutelf" )
182182 endif()
183183
184184 if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
0 2020-11-30 David Anderson
1 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
2 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
3 dwarfdump-tt-table.h: Regenerated with latest
4 version string.
5 2020-11-26 David Anderson
6 * print_debug_gnu.c: In current compilers the blocks
7 have a CU offset to the skeleton DIEs (when
8 is split dwarf) so we print some data on
9 each CU DIE now.
10 2020-11-25 David Anderson
11 * Makefile.in: Regenerated from configure.ac.
12 To support data needed for dwarfexample make check.
13 2020-11-25: David Anderson
14 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
15 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
16 dwarfdump-tt-table.h: Regenerated with latest
17 version string.
18 2020-11-23: David Anderson
19 * CMakeLists.txt: now -D-DDWARF_WITH_LIBELF=OFF works
20 2020-11-23: David Anderson
21 * glflags.h, glflags.c: Added field glflags.gf_max_space_indent
22 with value 10 so that really deep TAG nesting does not
23 result in mostly blank thousand-character lines.
24 If there is a call for it, the value could be supplied
25 by a new dwarfdump option.
26 * globals.h: Removed two functions defined and
27 only used in print_die.c.
28 * print_die.c: Too deep nesting is unreadable so now
29 when 10 or more deep the output uses for example ...100...
30 instead of hundreds of spaces to indicate depth.
31 Indentation of DW_OP output changed in some cases.
32 2020-11-22: David Anderson
33 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
34 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
35 dwarfdump-tt-table.h: Regenerated with latest
36 version string.
37 2020-11-22: David Anderson
38 * print_frames.c: The refactoring left old dealloc
39 in place that are no longer appropriate. Removed them.
40 * print_die.c: DW_FORM_exprloc was, when printing FORMs,
41 printing the FORM later than desired. Now shows
42 up in the right place.
43 2020-11-22: David Anderson
44 * print_die.c: When an attribute expression DW_OP is
45 a DWARF5 reference to a DW_TAG the details of the
46 reference are indented a little and printed on
47 the line after the DW_OP itself.
48 Seems easier to read that way.
49 2020-11-22: David Anderson
50 * command_options.c: The option is now
51 --format-expr-ops-joined
52 * dwarfdump.1,dwarfdump.conf,testdwarfdump.conf: Reflects
53 the new option.
54 * dwconf.c,glflags.c,glflags.h: Reflects the new option.
55 * print_die.c: Reflects the new option.
56 2020-11-21: David Anderson
57 * dwconf.c: Error message needed a slight wording change
58 when we discover the abi requested does not exist.
59 2020-11-21: David Anderson
60 * command_options.c: Added a new option, but it will be
61 removed shortly as not needed.
62 * dwconf.c: Clarified the code with a more complete
63 set of return values.
64 * dwconf.h: Macro defines for the new return values.
65 * print_die.c: Now allows printing expression operations
66 one per line. Which will be the default very soon.
67 2020-11-21: David Anderson
68 * print_frames.c: Error message improvements and
69 refactored fde/cie printing to make it easier
70 to follow. Now if fde printing errors-out
71 we continue on to attempting to print cies.
72 2020-11-20: David Anderson
73 * print_frames.c: A better indent for expression ops
74 from frames. More detailed error message too.
75 2020-11-17: David Anderson
76 * command_options.c: Minor line shortening.
77 * dwconf.c: Previous commit introduced a few bugs.
78 Fixed, and clearer now.
79 2020-11-16: David Anderson
80 * command_options.c: Now accepts --format-expr-op-per-line
81 * dwarfdump.1: Mentions the option.
82 * dwarfdump.c: Small changes passing die_indent_level
83 around so formatting looks sensible with the new option.
84 * dwconf.c: Now deals with
85 option: --format-expr-op-per-line
86 in dwarfdump.conf. the option: command must preceed every
87 beginabi: command.
88 * esb_using_functions.h: Adding die_indent level to another
89 function prototype.
90 * glflags.c,glflags.h: Renamed the flag for the option to
91 gf_expr_op_per_line.
92 * print_die.c,print_frames.c,print_frames.h,
93 print_hipc_lopc_attr.c,print_locs.c: Now passing
94 die_indent_level anywhere needed.
95 2020-11-15: David Anderson
96 * testdwarfdump.conf: A special version to test
97 the 'option:' command.
98 2020-11-15: David Anderson
99 * esb_using_functions.h: Add Dwarf_Die arg to
100 dwarfdump_print_location_operations().
101 * glflags.h, glflags.c: Adding gf_multi_line_expr. Not used yet.
102 * globals.h: Adding Dwarf_Die to check_die_expr_op_basic_data().
103 * print_die.c: Now printing references to DIEs in
104 DWARF expressions.
105 * print_frames.c,print_frames.h,print_locs.c: Adding Dwarf_Die
106 to arg lists. Some reformatting to libdwarf coding style.
107 2020-11-12: David Anderson
108 * dwarfdump.1: Clarified the role of the --verbose
109 option and corrected spelling and formatting errors.
110 * print_lines.c: Revised one glflags.verbose test so it
111 reads the same way as other verbose tests. Fixed
112 various lines to meet the libdwarf coding style.
113 * tag_attr.c,tag_tree.c: Changed to meet the
114 libdwarf coding style.
115 2020-11-11: David Anderson
116 * print_abbrevs.c: Fixing a mistake in the
117 new code. The error lead to an
118 erroneous error being reported
119 in objects where the compiler left off the final
120 zero in the .debug_abbrev section.
121 2020-11-09: David Anderson
122 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
123 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
124 dwarfdump-tt-table.h: Regenerated with latest
125 version string.
126 2020-11-08: David Anderson
127 * globals.h: Declaring new function print_all_abbrevs_for_cu()
128 * print_abbrevs.c: Refactored to allow printing abbrevs
129 for a single CU and/or all abbreves at once.
130 * print_die.c: If -vvvv and printing .debug_info/.debug_types
131 print the abbrev section applying to each CU reported.
132 If checking (as with -ka) check for errors in
133 the abbrevs of each CU (no -v required for checking).
134 2020-11-05: David Anderson
135 * dwarf_tsearchbal.c,dwarfdump.c,print_lines.c,tag_attr.c:
136 These had some #include not protected by the HAVE_*H
137 config.h (and cmake) provide. Fixed.
138 * testobjLE32PE.base: baseline update to match current
139 output.
140
141 2020-11-04: David Anderson
142 * globals.h,print_lines.c,print_die.c: Adding arguments for a
143 srcfiles array for the CU to
144 to print_line_numbers_this_cu(). Now, with -vvv
145 just printing line tables will print the dwarf_srcfiles
146 array of strings.
147 2020-11-03: David Anderson
148 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
149 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
150 dwarfdump-tt-table.h: Regenerated with latest
151 version string.
152 2020-11-03: David Anderson
153 * Makefile.am, CMakeLists.txt: print_macros.c renamed
154 to print_macinfo.c for clarity in naming.
155 * Makefile.in: Regenerated.
156 * globals.h: Added Dwarf_Die argument to
157 print_macinfo_by_offset().
158 Added srccfiles, count argument to
159 print_macros_5style_this_cu().
160 * print_die.c: Renamed macro_check_cu() to
161 print_macinfo_for_cu() for clarity in naming.
162 print_macinfo_for_cu() now prints the file name
163 (from srcfiles list) if it is DW_MACINFO_start_file.
164 * print_macinfo.c: Nowuses passed-in srcfiles
165 to get the full path for the file index
166 DW_MACINFO_start_file.
167 * print_macro.c: Prints the DWARF5 set_file macro
168 correctly with name.
169 * runtests.sh: 'make check' baselines made a bit
170 larger and added -vvv to the dwarfdump command
171 generating those baselines.
172 * test-mach-o-32.base,testobjLE32PE.base,
173 testobjLE32PE.base,testuriLE64ELf.base: New baselines
174 with additional content per CU and more lines.
175 2020-11-01: David Anderson
176 * print_die.c: With -vvv dwarfdump now prints
177 the array dwarf_srcfiles generates so library
178 users can compare the compilation unit, its
179 line table header, and what dwarf_srcfile()
180 provides. DW_AT_decl_file and DW_AT_call_file
181 now result (in printing attributes) in the right
182 source file printing.
183 2020-10-30: David Anderson
184 * esb.c,esb.h,uri.c: Removed trailing whitespace,
185 shortened a few lines.
186 2020-10-29: David Anderson
187 * command_options.c,print_die.c: Fix indents, remove
188 trailing whitespace.
189 * In this ChangeLog some of the August lines
190 had tabs and the lines were kind of messed up.
191 Fixed.
192 2020-10-29: David Anderson
193 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
194 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
195 dwarfdump-tt-table.h: Regenerated with latest
196 version string.
197 2020-10-29: David Anderson
198 * print_die.c: Factored out the indent-spaces code
199 into static function print_indent_prefix().
200 For now there is no change in output format,
201 though for large indents (greater than around 6)
202 the spacing gets so large the output becomes
203 unreadable.
204 2020-10-28: David Anderson
205 * print_die.c: Dwarfbug DW202010-002. In case of
206 a circular DIE tree memory outside of the target
207 DIE stack array would be written to and
208 referenced. Now we test at all the places
209 the stack index is incremented and print
210 a useful error message.
211 * print_section_groups.c: #if 0 code updating
212 glftab as the table data has never been used.
213 2020-10-22: David Anderson
214 * command_options.c,dwarfdump.1: The man
215 page and the -h (help) output spelled the long-form
216 option for seeing Elf Section Group DWARF data
217 incorrectly as --format-group=<n> but the real option
218 has always been --format-group-number=<n> . To see
219 any section groups and the number libdwarf assigns
220 to them do dwarfdump -i -vv <object name> Most object
221 will have just section group 1 and dwarfdump/libdwarf
222 handle that automatically. Groupnumber support was
223 added in May 2017. See dwarf_init_path() page 34
224 and Section 6.3 Page 46 in libdwarf2.1.pdf .
0225 2020-10-20: David Anderson
1226 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
2227 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
14239 to your terminal window.
15240 * esb.c: Remove #if 0 and the code for a function
16241 that was not a good idea: esb_constructor_rigid().
17 * glflags.c: Adding glflags.gf_no_sanitize_strings
18 initializer (used to use a global not in
19 glflags).
20 * glflags.c: Adding boolean gf_no_sanitize_strings
242 * glflags.c: Adding glflags.gf_no_sanitize_strings
243 initializer (used to use a global not in glflags).
244 * glflags.c: Adding boolean gf_no_sanitize_strings
21245 declaration.
22246 * print_frames.c(print_location_operations): Remove
23247 unwanted code #if 0 through #endif
24248 * print_macro.c(print_macros_5style_this_cu): #if 0
25 code removed. So deleted duplicate die printing calls.
249 code removed. So deleted duplicate die printing
250 calls.
26251 * print_pubnames.c: deal_with_name_offset_err()
27252 has not been used in a long time. Deleted.
28 * sanitized.c(sanitized): add includes to allow glflags.h
29 and use glflags.gf_no_sanitize_strings for
30 checking whether to sanitize.
253 * sanitized.c(sanitized): add includes to allow
254 glflags.h
255 and use glflags.gf_no_sanitize_strings for checking
256 whether to sanitize.
31257 2020-10-19: David Anderson
32258 * dwarfdump.c,getopttest.c,print_lines.c,
33 testobjLE32PE.test.c: Fixed indents and
259 testobjLE32PE.test.c: Fixed indents and
34260 removed trailing whitespace.
35261 2020-10-19: David Anderson
36262 * *.c *.h: No license terms changed but nearly
37 all the copyright notices are now reformatted
38 to line lengths appropriate for dwarfdump.
263 all the copyright notices are now reformatted to
264 line lengths appropriate for dwarfdump.
39265 2020-10-18: David Anderson
40 * tag_attr.list: Added standard tag-attribute relationships
266 * tag_attr.list: Added standard tag-attribute
267 relationships
41268 that are being used now.
42269 * tag_tree.list: Added standard tag-tag relationships
43270 that are being used now.
44 * dwarfdump-ta-table.h: Regenerated.
271 * dwarfdump-ta-table.h: Regenerated.
45272 * dwarfdump-tt-table.h: Regenerated.
46273 2020-10-17: David Anderson
47274 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
50277 version string.
51278 2020-10-15: David Anderson
52279 * print_lines.c(print_line_context_record): Fixed the
53 comments about DWARF4 vs 5.
280 comments about DWARF4 vs 5.
54281 2020-10-13: David Anderson
55282 * print_macro.c: Added the required check for 0
56 opcode and print appropriately (it's the null
57 byte at end of macro operands).
283 opcode and print appropriately (it's the null byte
284 at end of macro operands).
58285 2020-10-12: David Anderson
59286 * dwarfdump.c: Now printf callbacks from libdwarf
60287 are sanitized() to prevent corrupted line data from
66293 dwarfdump-tt-table.h: Regenerated with latest
67294 version string.
68295 2020-10-11: David Anderson
69 * command_options.c: Refined a wordy comment.
296 * command_options.c: Refined a wordy comment.
70297 * dwarfdump.1: Document the new ability to
71298 get to GNU debuglink files automatically.
72299 * dwarfdump.c: Implement support for reading GNU
75302 * command_options.c: Implemented first part of
76303 making GNU debuglink options work.
77304 * dwarfdump.c: Now using dwarf_init_path()
78 working toward
79 making GNU debuglink options work.
305 working toward making GNU debuglink options work.
80306 * glflags.h: Commented gf_debug_names_flag
81307 to avoid confusing it with debuglink.
82308 2020-10-03: David Anderson
83 * Makefile.in: Autoreconf using Ubuntu 20.04
309 * Makefile.in: Autoreconf using Ubuntu 20.04
84310 made small changes.
85 * COPYING: Corrected the references to the BSD copyright
311 * COPYING: Corrected the references to the BSD
312 copyright
86313 to use "two-clause BSD license".
87314 2020-10-02: David Anderson
88315 * command_options.c,glflags.h,print_frames.c: Remove
90317 2020-10-02: David Anderson
91318 * command_options.c: New options --no-follow-debuglink
92319 and --add-debuglink_path=<text> for working with
93 GNU debuglink.
320 GNU debuglink.
94321 * glflags.h: Added gf_no_follow_debuglink and
95 gf_global_debuglink_paths and gf_global_debuglink_count.
322 gf_global_debuglink_paths and
323 gf_global_debuglink_count.
96324 2020-09-30: David Anderson
97325 * command_options.c: If more than one non-dash
98 word is at the end of the dwarfdump command
99 it used to complain no object name given.
100 Now in that case it complains that more than
101 one was given. Slightly more sensible.
326 word is at the end of the dwarfdump command it used
327 to complain no object name given. Now in that case
328 it complains that more than one was given. Slightly
329 more sensible.
102330 2020-09-27: David Anderson
103331 * dwarfdump.c: --print-gnu_debuglink output wording
104332 made clearer.
106334 * dwarfdump.c: Now --print-gnu_debuglink also
107335 indicates what files it found in the paths
108336 calculated, making --print-gnu_debuglink more useful.
109 * command_options.c: Corrected a typo in a comment about
337 * command_options.c: Corrected a typo in a comment
338 about
110339 the option --print-gnu_debuglink.
111340 2020-09-26: David Anderson
112341 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
123352 2020-09-17: David Anderson
124353 * print_frames.c: A very old typgraphical error
125354 meant that in rare circumstances memory leakage
126 of a few bytes was possible with option
355 of a few bytes was possible with option
127356 --suppress-de-alloc-tree.
128357 2020-09-10: David Anderson
129 * esb_using_functions.h: Adding new argument to
358 * esb_using_functions.h: Adding new argument to
130359 the print_ranges_list_to_extra() prototype.
131360 * print_die.c: Using that new argument to
132361 pass the true offset to the printing code.
133 * print_ranges.c: Updated the printing to make it clearer
134 it clearer the .debug_ranges offset is using
135 a base address (when there is one).
362 * print_ranges.c: Updated the printing to make it
363 clearer
364 it clearer the .debug_ranges offset is using a base
365 address (when there is one).
136366 2020-09-10: David Anderson
137367 * dwarfdump.c: Remove trailing whitespace.
138368 2020-09-08: David Anderson
139369 * dwarfdump.c: Now cleans up terminating DW_DLV_ERROR
140 allocation even when the object cannot finish dwarf_init*().
141 Fixes print_error() so it works right with dbg null.
370 allocation even when the object cannot finish
371 dwarf_init*(). Fixes print_error() so it works
372 right with dbg null.
142373 2020-09-08: David Anderson
143374 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
144375 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
145376 dwarfdump-tt-table.h: Regenerated with latest
146377 version string.
147378 2020-09-07: David Anderson
148 * glflags.h,print_die.c: Fixed idents and trailing whitespace.
379 * glflags.h,print_die.c: Fixed idents and trailing
380 whitespace.
149381 2020-09-06: David Anderson
150382 * globals.h: print_die_and_children() declaration
151383 removed, the function is now static in print_die.c.
152 * print_die.c: On an error following a call to dwarf_child
153 (but where dwarf_child() succeeded) we were failing to
154 dwarf_dealloc_die(child). And even the main path
384 * print_die.c: On an error following a call to
385 dwarf_child
386 (but where dwarf_child() succeeded) we were failing
387 to dwarf_dealloc_die(child). And even the main path
155388 (no error from dwarf_child) failed to dealloc child.
156389 2020-09-05: David Anderson
157390 * print_die.c: In a couple error messages spell the
160393 * print_die.c: Fixed indent and trailing whitespace.
161394 2020-08-27: David Anderson
162395 * dwarfdump.c: Fix some warnings counted as errors
163 by ensuring the ERROR string is in them (they
164 just flag in particular situations that the DW_AT_producer
396 by ensuring the ERROR string is in them (they just
397 flag in particular situations that the DW_AT_producer
165398 attribute is missing on the Compilation Unit).
166399 * print_die.c: Fix places where we double-counted
167400 errors.
168401 * print_frames.c: Annotate an existing ERROR so that
169402 it is counted in the ERROR count.
170403 * print_llex_codes.c, print_origloclist_codes.c,
171 print_ranges.c,print_reloc.c: Fix
172 double-counts of errors.
404 print_ranges.c,print_reloc.c: Fix double-counts
405 of errors.
173406 * print_reloc_decls.h: Just do a printf, no reason
174407 to use struct esb_s here.
175408 2020-08-23: David Anderson
176409 * compiler_info.c: Now we apply sanitized() to all
177 the printed strings (just in case an object file
178 is corrupted or maybe not plain ascii strings).
410 the printed strings (just in case an object file is
411 corrupted or maybe not plain ascii strings).
179412 2020-08-23: David Anderson
180 * dwarfdump-ta-ext-table.h: Regenerated
413 * dwarfdump-ta-ext-table.h: Regenerated
181414 * tag_attr_ext.list: Added DW_AT_GNU_macros
182415 to the known-extensions list.
183416 2020-08-23: David Anderson
189422 * checkutil.c,dwarfdump.c,print_die.c: Removed trailing
190423 whitespace, fixed indents.
191424 2020-08-23: David Anderson
192 * checkutil.c: Removed #if 0 lines from previous commit.
425 * checkutil.c: Removed #if 0 lines from previous
426 commit.
193427 * dwarfdump.c: Removed debug printf lines.
194428 * print_die.c: Removed debug printf lines.
195429 2020-08-22: David Anderson
196 * checkutil.c: Temporary debug printf.
430 * checkutil.c: Temporary debug printf.
197431 * dwarfdump.c: Revised pRangesInfo reset
198 when we have a tied dbg, as in that case
199 we often miss function/scope address ranges.
200 Temporary debug printf too.
432 when we have a tied dbg, as in that case we often
433 miss function/scope address ranges. Temporary debug
434 printf too.
201435 * globals.h: Adding a Dwarf_Debug argument to
202436 tag_specific_checks_setup() for when tied file
203437 present.
204438 * print_abbreves.c: Temporary debug.
205439 New arglist for tag_specific_checks_setup()
206440 * print_die.c: Get the text section bounds
207 set (from tied object, if any) so checks
208 of address will not incorrectly fail.
441 set (from tied object, if any) so checks of address
442 will not incorrectly fail.
209443 2020-08-22: David Anderson
210444 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
211 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
212 dwarfdump-tt-table.h: Regenerated with latest
445 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
446 dwarfdump-tt-table.h: Regenerated with latest
213447 version string.
214448 2020-08-10: David Anderson
215449 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
216 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
217 dwarfdump-tt-table.h: Updated version string, regenerated
218 files using it.
450 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
451 dwarfdump-tt-table.h: Updated version string,
452 regenerated files using it.
219453 2020-08-02: David Anderson
220454 * print_die.c: Now with Additional checking of DW_LKIND
221 values and an error report if one tries to use the original
222 location interface with newer DWARF location data.
223 * print_frames.c: Added short comments for clarity.
455 values and an error report if one tries to use
456 the original location interface with newer DWARF
457 location data.
458 * print_frames.c: Added short comments for clarity.
224459 2020-07-28: David Anderson
225 * dwarf_names.c: Regenerated.
460 * dwarf_names.c: Regenerated.
226461 * print_die.c: Added DW_OP_GNU_variable_value to the table.
227462 2020-07-19: David Anderson
228463 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
229 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
230 dwarfdump-tt-table.h: Regenerated with latest
464 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
465 dwarfdump-tt-table.h: Regenerated with latest
231466 version string.
232467 2020-07-16: David Anderson
233468 * tag_attr.list: Added some normal standard TAG/ATTR
234469 combinations (some new in DWARF5)
235 * tag_attr_ext.list: Added some normal GNU
470 * tag_attr_ext.list: Added some normal GNU
236471 TAG/ATTR usages.
237472 * tag_tree.list: Added some normal standard TAG/TAG
238473 relationships.
239474 * tag_common.h: Increased a row maximum by one
240475 to match the increase in the lists.
241476 * dwarfdump.1: Improved the wording for -kt -kr
242 and the modifier -C (they have longopts names
243 too).
477 and the modifier -C (they have longopts names too).
244478 * dwarfdump-ta-ext-table.h,dwarfdump-ta-table.h,
245479 dwarfdump-tt-table.h: Regenerated
246480 * print_hipc_lopc_attr.c: Fixed indents and
253487 * dwarfdump-ta-ext-table.h,dwarfdump-ta-table.h,
254488 dwarfdump-tt-table.h: Regenerated
255489 2020-07-16: David Anderson
256 * globals.h,print_die.c: Revised a key function name,
490 * globals.h,print_die.c: Revised a key function name,
257491 yesterdays name was excessively long. New name is
258492 dd_get_integer_and_name().
259493 * print_hipc_lopc_attr.c: That name changed here too.
260494 and a blob of code was factored out into a new
261495 function update_cu_base_addresses() which just
262 establishes names used in presenting details
263 in case of errors (a function with no side effects
264 but setting the glflags fields for use in error reports).
496 establishes names used in presenting details in
497 case of errors (a function with no side effects but
498 setting the glflags fields for use in error reports).
265499 2020-07-15: David Anderson
266 * CMakeLists.txt,Makefile.am: Added print_hipc_lopc_attr.c.
500 * CMakeLists.txt,Makefile.am: Added print_hipc_lopc_attr.c.
267501 * Makefile.in: Regenerated.
268502 * print_die.c: Moved print_hipc_lopc_attribute() from
269 here to print_hipc_lopc_attr.c.
270 Moved file-static variables bSawLow bSawHigh lowAddr
271 highAddr to print_one_die(), no need to be global.
503 here to print_hipc_lopc_attr.c. Moved file-static
504 variables bSawLow bSawHigh lowAddr highAddr
505 to print_one_die(), no need to be global.
272506 get_small_encoding_integer_and_name() renamed.
273507 * print_hipc_lopc_attr.c: New. Holds the larg-ish
274508 function print_hipc_lopc_attribute() from .
275 * globals.h: Now _dwarf_get_small_encoding_integer_and_name()
509 * globals.h: Now
510 _dwarf_get_small_encoding_integer_and_name()
276511 can be called from more than one file in libdwarf.
277512 Added print_hipc_lopc_attribute() declaration as it
278513 is moved to its own source file.
279 * glflags.h: Added new member in_valid_code.
514 * glflags.h: Added new member in_valid_code.
280515 * glflags.c: Added glflags.in_valid_code = FALSE,
281516 a new global-like variable to replace the old
282 print_die.c static variable in_valid_code.
283 Adds a bit of clarity.
517 print_die.c static variable in_valid_code. Adds a
518 bit of clarity.
284519 * dwarfdump.c(tag_specific_checks_setup): Added new
285 DWARF5 CU DIE tags here.
286 * print_debug_sup.c: Fixed indent and trailing whitespace.
520 DWARF5 CU DIE tags here.
521 * print_debug_sup.c: Fixed indent and trailing
522 whitespace.
287523 2020-07-14: David Anderson
288524 * print_die.c: Moved 4 variables, including
289525 bSawLow and bSawHigh from static to being local
292528 2020-07-14: David Anderson
293529 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
294530 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
295 dwarfdump-tt-table.h: Regenerated with new
296 version string.
531 dwarfdump-tt-table.h: Regenerated with new version
532 string.
297533 2020-07-13: David Anderson
298 * CMAkeLists.txt: Adding print_debug_sup.c .
299 * Makefile.am: Adding print_debug_sup.c .
300 * Makefile.in: Regenerated.
301 * command_options.c: Added flag gf_debug_sup_flag
534 * CMAkeLists.txt: Adding print_debug_sup.c .
535 * Makefile.am: Adding print_debug_sup.c .
536 * Makefile.in: Regenerated.
537 * command_options.c: Added
538 flag gf_debug_sup_flag
302539 amd --print-debug-sup options.
303 * dwarf_names.c: Regenerated. Reflects the correction of
540 * dwarf_names.c: Regenerated. Reflects the correction
541 of
304542 DW_GNUIVIS_static value for the .debug_sup section.
305543 * dwarfdump.c: Adds check of gf_debug_sup_flag and
306544 call of print_debug_sup().
307 * glflags.h: Adds boolean gf_debug_sup_flag.
308 * globals.h: Adds print_debug_sup() declaration.
545 * glflags.h: Adds boolean gf_debug_sup_flag.
546 * globals.h: Adds print_debug_sup() declaration.
309547 * print_debug_sup.c: new to print .debug_sup.
310548 2020-07-11: David Anderson
311 * print_debug_gnu.c: After printing the section
549 * print_debug_gnu.c: After printing the section
312550 added the dwarf_gnu_index_dealloc() to immediately
313551 free the data allocated for printing the section.
314552 2020-07-08: David Anderson
315553 * dwarfdump.1: Mentioning new print options (the
316 latest additions to dwarfdump) and suggesting
317 that -v -G and -M are sometimes helpful.
554 latest additions to dwarfdump) and suggesting that
555 -v -G and -M are sometimes helpful.
318556 2020-07-08: David Anderson
319557 * print_debug_gnu.c,print_die.c: Fixed indents and
320558 removed trailing whitespace.
321559 2020-07-08: David Anderson
322560 * command_options.c: Misspelled argname in a comment.
323561 * print_debug_gnu.c: Added minor checking for errors,
324 there is more to come in error checking.
562 there is more to come in error checking.
325563 2020-07-06: David Anderson
326564 * dwarf_names.c, dwarf_names.h: Regenerated,
327 Adding the non-standard dwarf
328 prefixes DW_GNUIVIS* and DW_GNUIKIND* in support
329 of .debug_gnu_pubtypes and .debug_gnu_pubnames.
565 Adding the non-standard dwarf prefixes
566 DW_GNUIVIS* and DW_GNUIKIND* in support of
567 .debug_gnu_pubtypes and .debug_gnu_pubnames.
330568 The first support for these sections.
331 DW_DLE_GNU_PUBNAMES_ERROR
332 DW_DLE_GNU_PUBTYPES_ERROR
569 DW_DLE_GNU_PUBNAMES_ERROR DW_DLE_GNU_PUBTYPES_ERROR
333570 DW_DLE_DUPLICATE_GNU_DEBUG_PUBNAMES
334571 DW_DLE_DUPLICATE_GNU_DEBUG_PUBTYPES
335 * Makefile.am: Adding print_debug_gnu.[ch] to the files list.
336 * Makefile.in: Regenerated.
572 * Makefile.am: Adding print_debug_gnu.[ch] to
573 the files list.
574 * Makefile.in: Regenerated.
337575 * command_options.c: Add --print-debug-gnu option
338576 to print these sections.
339577 * dwarfdump.c: Implement printing of these sections.
341579 --print-debug-gnu option.
342580 * print_debug_gnu.c: Now prints these sections.
343581 2020-07-04: David Anderson
344 * print_die.c(dot_ok_in_identifier): Removed unused argument.
582 * print_die.c(dot_ok_in_identifier): Removed unused
583 argument.
345584 Added DW_TAG_skeleton_unit to the if condition.
346585 This function affects only whether a CHECK message
347 reports a warning, it has no effect when printing.
586 reports a warning, it has no effect when printing.
348587 2020-07-04: David Anderson
349588 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
350589 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
351 dwarfdump-tt-table.h: Regenerated with new
352 version string.
590 dwarfdump-tt-table.h: Regenerated with new version
591 string.
353592 2020-07-03: David Anderson
354 * CMakeLists.txt, Makefile.am: Renamed print_dnames.c to
593 * CMakeLists.txt, Makefile.am: Renamed print_dnames.c
594 to
355595 print_debug_names.c
356 * Makefile.in: Regenerated.
596 * Makefile.in: Regenerated.
357597 * command_options.c: Corrected the help text for
358 --print-fission. Added --print-debug_names,
359 which does not yet do anything useful.
598 --print-fission. Added --print-debug_names, which
599 does not yet do anything useful.
360600 2020-07-01: David Anderson
361 * esb.h: Make debug-only locals unsigned long instead of long.
362 * print_die.c: Where there is a N iteration loop adding
363 to esb strings use N and an estimate of per-loop text size
364 request a sensible space increment
365 to ensure there is enough space that completing
366 the set of strings will not need another malloc.
367 Saved about 1% of cputime in full regression test.
601 * esb.h: Make debug-only locals unsigned long instead
602 of long. * print_die.c: Where there is a N iteration
603 loop adding
604 to esb strings use N and an estimate of per-loop text
605 size request a sensible space increment to ensure
606 there is enough space that completing the set of
607 strings will not need another malloc. Saved about 1%
608 of cputime in full regression test.
368609 2020-06-29: David Anderson
369610 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
370611 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
371 dwarfdump-tt-table.h: Regenerated with new
372 version string.
612 dwarfdump-tt-table.h: Regenerated with new version
613 string.
373614 2020-06-29: David Anderson
374615 * print_die.c: Fixed a minor formatting error on
375616 DW_AT_location and related attributes.
379620 * dwarfdump-ta-ext-table.h,dwarfdump-ta-table.h,
380621 dwarfdump-tt-table.h: Regenerated.
381622 2020-06-26: David Anderson
382 * print_die.c (print_attribute): Increased the stack
383 alloc of a string so that even fairly long
384 loclists/rangelists won't require malloc.
385 A tiny indent and trailing whitespace instance fixed too.
623 * print_die.c (print_attribute): Increased the stack
624 alloc of a string so that even fairly long
625 loclists/rangelists won't require malloc. A tiny
626 indent and trailing whitespace instance fixed too.
386627 * test-mach-o-32.base: Updated baseline so make check
387628 passes again.
388629 2020-06-25: David Anderson
389 * checkutil.c: Removed trailing whitespace.
390 * command_options.c:
391 * dwarfdump.1: Making the -C option intent
630 * checkutil.c: Removed trailing whitespace. *
631 command_options.c: * dwarfdump.1: Making the -C
632 option intent
392633 clearer.
393634 * dwarfdump.c: Fixed trailing whitespace and indents.
394 * naming.c: Fixed trailing whitespace.
395 * print_die.c: Removed dead code. Corrected printing
396 if rnglists, ranges, loclists locations. Corrected
635 * naming.c: Fixed trailing whitespace. * print_die.c:
636 Removed dead code. Corrected printing
637 if rnglists, ranges, loclists locations. Corrected
397638 handling of the output with -k detected an error.
398639 Ensured a couple esb_s variables get destructed
399640 in case of error. Added explanation how the
400641 print_attribute() code actually works.
401 * print_frames.c: Corrected handling location operations
642 * print_frames.c: Corrected handling location
643 operations
402644 when checking (-k options).
403645 * print_llex_codes.c,print_loclists_codes.c,
404 print_origloclist_codes.c: Corrected handling
646 print_origloclist_codes.c: Corrected handling
405647 location data when checking (-k options).
406648 * tag_attr_ext_list.c: Added DW_AT_MIPS_linkage_name
407649 as a common extension on a couple TAGs.
408650 2020-06-22: David Anderson
409 * checkutil.c: Document a bit more about how this works.
410 * dwarfdump-ta-ext-table.h,dwarfdump-ta-table.h,
651 * checkutil.c: Document a bit
652 more about how this works. *
653 dwarfdump-ta-ext-table.h,dwarfdump-ta-table.h,
411654 dwarfdump-tt-table.h: regenerated
412655 * dwarfdump.c: Doing a slightly better job identifying
413656 the true range of text addresses in the object file,
414657 which matters for some -k (checking) options.
415658 * globals.h: Revised some argument lists for nicer
416659 reporting of errors found with -k options.
417 * naming.c: regenerated.
418 * print_die.c: Certain names revised for greater
660 * naming.c: regenerated. * print_die.c: Certain names
661 revised for greater
419662 clarity of intent. print_information ->
420 print_else_name_match which at least hints
421 at what the variable is doing.
663 print_else_name_match which at least hints at what
664 the variable is doing.
422665 * print_frames.c: Suppresses some output when checking.
423 * print_llex_codes.c: When checking suppress some output.
424 * print_loclists.c: Removed pointless {}.
666 * print_llex_codes.c: When checking suppress some
667 output.
668 * print_loclists.c: Removed pointless {}.
425669 * print_loclists_codes.c,print_orginal_loclist_linecodes.c:
426670 Suppresses some output when checking.
427671 * print_rnglists.c: Clarify which routines apply solely
428672 to printing raw rangelists.
429 * tag_attr_ext.list: Added DW_AT_encoding to common extentions
430 * tag_common.h: Incremeneted EXT_ATTR_TABLE_ROWS 16
673 * tag_attr_ext.list: Added DW_AT_encoding to
674 common extentions
675 * tag_common.h: Incremeneted
676 EXT_ATTR_TABLE_ROWS 16
431677 so the tables can be rebuilt.
432678 2020-06-22: David Anderson
433679 * dwarfdump.c: Fixing some old formatting mistakes.
434680 NOT TO BE USED Yet.
435681 2020-06-20: David Anderson
436682 * tag_attr.c,tag_attr.list,tag_common.h: Adding in
437 DWARF5 TAG ATTR combinations required raising
438 hard coded value, and improving one of the
439 error messages appearing with the wrong limit.
683 DWARF5 TAG ATTR combinations required raising hard
684 coded value, and improving one of the error messages
685 appearing with the wrong limit.
440686 2020-06-20: David Anderson
441687 * tag_attr.list: Added DW_AT_loclists_base,
442688 DW_AT_alignment,DW_AT_call_all_calls,DW_AT_noreturn
443689 with the TAGs they go with.
444690 2020-06-17: David Anderson
445 * Makefile.am, CMakeLists.txt: Renamed
691 * Makefile.am, CMakeLists.txt: Renamed
446692 print_loclist_original.c -> print_origloclist_codes.c
447 so the three distinct format loclist
448 printers all end in codes.c.
693 so the three distinct format loclist printers all
694 end in codes.c.
449695 * Makefile.in: Regenerated
450696 2020-06-17: David Anderson
451697 * print_loclists.c: Improve the formatting
454700 the formatting of the raw report.
455701 2020-06-17: David Anderson
456702 * globals.h: Some args now just values, not pointers,
457 the Dwarf_Addr * hipc in
458 print_llex_linecodes() was a holdover from past
459 versions. Not needed.
703 the Dwarf_Addr * hipc in print_llex_linecodes()
704 was a holdover from past versions. Not needed.
460705 * print_die.c,print_llex_codes.c,print_loclist_original.c,
461706 print_loclists_codes.c: Similarly.
462707 2020-06-12: David Anderson
464709 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
465710 dwarfdump-tt-table.h : updated version string.
466711 2020-06-12: David Anderson
467 * dwarfdump.c, globals.h,print_die.c,print_llex_codes.c,
712 * dwarfdump.c,
713 globals.h,print_die.c,print_llex_codes.c,
468714 print_loclist_original.c,print_loclists.c,
469715 print_loclists_codes.c,print_rnglists.c: Fix indents
470716 and remove trailing whitespace.
471717 2020-06-10: David Anderson
472 * CMakeLists.txt: Added print_loclists.c to the C file list.
473 * runtests.sh: Changed the generated (temporary) filenames
474 so it is easier to understand where to copy the
475 new baseline result to update the right baseline.
718 * CMakeLists.txt: Added print_loclists.c to the C
719 file list.
720 * runtests.sh: Changed the generated
721 (temporary) filenames
722 so it is easier to understand where to copy the new
723 baseline result to update the right baseline.
476724 * testobjLE32PE.base: New baseline, needed as loclist
477725 output changed.
478726 * print_frames.c: Calling loclist dealloc on
482730 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
483731 dwarfdump-tt-table.h : Updated version string
484732 2020-06-09: David Anderson
485 * Makefile.am: New files due to refactoring.
486 * Makefile.in: Regenerated.
733 * Makefile.am: New files due to refactoring.
734 * Makefile.in: Regenerated.
487735 * command_options.c: Added --print-raw-loclists
488 which prints all the details of .debug_lists
489 but does not do any reference to .debug_info
490 or .debug_addr (for example).
736 which prints all the details of .debug_lists but does
737 not do any reference to .debug_info or .debug_addr
738 (for example).
491739 * dwarfdump.c: Deals with --print-raw-loclists by
492740 calling new function print_raw_all_loclists()
493741 * esb_using_functions.c: Minor change to support
500748 supported: DWARF 3, GNU Dwarf4 dwo extension,
501749 and DWARF5.
502750 * print_die.c: Added die_indent_level a few places
503 for loclist printing. Significant changes to
504 support the loclist details.
505 Some renaming of things (data, functions) whose
506 purpose was obfuscated by the name.
507 Using new libdwarf interfaces that support
508 the new data in libdwarf.
509 Some significat refactoring so the structure
510 of what is being done can be easily seen.
511 No longer computes final loclist low/high addr
512 as libdwarf does that for us now.
751 for loclist printing. Significant changes to support
752 the loclist details. Some renaming of things (data,
753 functions) whose purpose was obfuscated by the name.
754 Using new libdwarf interfaces that support the new
755 data in libdwarf. Some significat refactoring so the
756 structure of what is being done can be easily seen.
757 No longer computes final loclist low/high addr as
758 libdwarf does that for us now.
513759 * print_frames.c: Reflects the revised function
514760 naming.
515761 * print_frames.h: Reflects the revised function name.
516762 * print_llex_codes.c: Factored out of print_die.c
517 and heavily revised to reflect the new location
518 data.
763 and heavily revised to reflect the new location data.
519764 * print_loclist_original.c: Factored out of print_die.c
520 and heavily revised to reflect the new location
521 data.
522 * print_loclists.c: All new, this does the .debug_loclists
765 and heavily revised to reflect the new location data.
766 * print_loclists.c: All new, this does the
767 .debug_loclists
523768 specific printing.
524769 * print_loclists_codes.c: All new. Prints DWARF5
525770 loclists data properly.
526 * print_locs.c: Reflects a revised function name.
527 * print_rnglists.c: Corrected an out of date comment.
771 * print_locs.c: Reflects a revised function name. *
772 print_rnglists.c: Corrected an out of date comment.
528773 * uri.c: 'unsigned int' instead of 'unsigned' for a
529774 picky compiler.
530775 2020-05-23: David Anderson
531776 * dwarf_globals.h: Define ESB_FIXED_ALLOC_SIZE 380.
532 * print_die.c,print_lines.c,print_pubnames.c: Now using
777 * print_die.c,print_lines.c,print_pubnames.c: Now using
533778 ESB_FIXED_ALLOC_SIZE in many places to (mostly)
534779 avoid any need for malloc/free by the esb functions.
535780 2020-05-21: David Anderson
539784 * dwarf_globals.h: Extra parens in DROP_ERROR_INSTANCE
540785 for readability, and using dwarf_dealloc_error()
541786 in it for type-checking.
542 * print_die.c: Using dwarf_dealloc_attribute()
787 * print_die.c: Using dwarf_dealloc_attribute()
543788 and dwarf_dealloc_die() now.
544789 * print_frames.c: Now we call DROP_ERROR_INSTANCE
545 with the proper arguments as the compiler can type-check
546 that sort of thing. And fixed code to honor
547 its invariants (a function that should not return
548 DW_DLV_ERROR now avoids doing so).
790 with the proper arguments as the compiler can
791 type-check that sort of thing. And fixed code to
792 honor its invariants (a function that should not
793 return DW_DLV_ERROR now avoids doing so).
549794 * print_lines.c: Also using DROP_ERROR_INSTANCE now.
550795 * print_macro.c: Now using DROP_ERROR_INSTANCE
551796 and dwarf_dealloc_attribute().
552797 2020-05-19: David Anderson
553 * print_die.c: In an error case failed to dealloc the rnglists head.
798 * print_die.c: In an error case failed to dealloc the
799 rnglists head.
554800 2020-05-19: David Anderson
555 * dwarf_names.c,dwarf_names.h, dwarfdump-ta-ext-table.h,
801 * dwarf_names.c,dwarf_names.h,
802 dwarfdump-ta-ext-table.h,
556803 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
557804 dwarfdump-tt-table.h: New version string.
558805 2020-05-19: David Anderson
559 * print_die.c: Removed arguments that were not needed from
806 * print_die.c: Removed arguments that were not
807 needed from
560808 a couple of libdwarf rnglists functions and changed
561809 code here to match.
562810 * print_rnglists.c: Fix trailing whitespace.
563 Turn on printing range lists
564 and offset table entries (if any)
565 with --print-raw-rnglists
566 even if no -v.
811 Turn on printing range lists and offset table entries
812 (if any) with --print-raw-rnglists even if no -v.
567813 2020-05-17: David Anderson
568 * globals.h: Remove trailing whitespace.
569 * print_die.c: Now prints DWARF5 .debug_rnglists section.
570 Fixes issues with handling certain attributes with new
571 FORMs in DWARF5.
572 * print_frames.c: Avoids terminating frame printing when
814 * globals.h: Remove trailing whitespace. *
815 print_die.c: Now prints DWARF5 .debug_rnglists section.
816 Fixes issues with handling certain attributes with
817 new FORMs in DWARF5.
818 * print_frames.c: Avoids terminating frame printing
819 when
573820 errors are seen attempting to get a function name
574821 for an fde.
575 * print_rnglists.c: New. Implements the details of reading
822 * print_rnglists.c: New. Implements the details
823 of reading
576824 the .debug_rnglists section.
577825 * dwarf_alloc.c: Added new type, DW_DLA_RNGLISTS_HEAD.
578 * dwarf_die_deliv.c: Now reads all the DWARF5 CU DIE fields
579 that are needed to evaluate FORMs and section references.
826 * dwarf_die_deliv.c: Now reads all the DWARF5 CU
827 DIE fields
828 that are needed to evaluate FORMs and section
829 references.
580830 2020-05-04: David Anderson
581831 * print_rnglists.c: Completing the code to print
582 all the details of the raw content of the
583 DWARF5 .debug_rnglists section.
832 all the details of the raw content of the DWARF5
833 .debug_rnglists section.
584834 2020-05-02: David Anderson
585 * CMakeLists.txt: Added print_rnglists.c.
586 * Makefile.am: Added print_rnglists.c.
587 * Makefile.in: Regenerated.
588 * command_options.c: Added a new option --print-raw-rnglists.
589 * dwarfdump.c: Implemented printing raw rangelists, but
835 * CMakeLists.txt: Added print_rnglists.c. *
836 Makefile.am: Added print_rnglists.c. * Makefile.in:
837 Regenerated. * command_options.c: Added a new option
838 --print-raw-rnglists. * dwarfdump.c: Implemented
839 printing raw rangelists, but
590840 not yet completely.
591841 * gflags.c: Added a new flag gf_print_raw_rnglists.
592842 * print_rnglists.c: Prints an initial partial
596846 comments. No change.
597847 2020-04-28: David Anderson
598848 * dwarfdump.c,print_die.c,print_frames.c: Removed
599 the use of tab chars in the output and use a space
600 or two instead. This greatly shortens the line
601 length needed when printing frame information details.
849 the use of tab chars in the output and use a space or
850 two instead. This greatly shortens the line length
851 needed when printing frame information details.
602852 Looks better without the 16 or 24 leading blanks on
603 all those lines too.
604 The tab characters elsewhere were removed long ago.
853 all those lines too. The tab characters elsewhere
854 were removed long ago.
605855 2020-04-26: David Anderson
606856 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
607857 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
608858 dwarfdump-tt-table.h: Updated version string.
609859 2020-04-25: David Anderson
610 * print_die.c: Fix indents and remove trailing whitespace.
611 * print_frames.c: Rearranged what was local Dwarf_Error
612 and what was local. Fixed a dwarf_dealloc to
613 say DW_DLA_ERROR, not DW_DLV_ERROR. Yikes.
860 * print_die.c: Fix indents and remove trailing
861 whitespace. * print_frames.c: Rearranged what was
862 local Dwarf_Error
863 and what was local. Fixed a dwarf_dealloc to say
864 DW_DLA_ERROR, not DW_DLV_ERROR. Yikes.
614865 * print_lines.c: Changed a local variable name,
615 filename->lsrc_filename so searches were
616 more meaningful. Added missing dwarf_dealloc
617 to clear dead data when appropriate.
618 2020-04-24 David Anderson
866 filename->lsrc_filename so searches were more
867 meaningful. Added missing dwarf_dealloc to clear
868 dead data when appropriate.
869 2020-04-24 David Anderson
619870 * dwarf_names.c, dwarf_names.h: Updated version string.
620871 * dwarfdump-ta-ext-table.h,dwarfdump-ta-table.h,
621872 dwarfdump-tt-ext-table.h,dwarfdump-tt-table.h:
622873 Updated version string.
623 2020-04-23 David Anderson
874 2020-04-23 David Anderson
624875 * print_aranges.c: Remove a debugging printf.
625876 Delete duplicate dealloc calls.
626877 * print_lines.c: clarify what the dealloc's do
627878 so we don't call dealloc on something already
628879 cleared.
629 2020-04-23 David Anderson
880 2020-04-23 David Anderson
630881 * dwarfdump.c: Added in dealloc to prevent leaks.
631882 * print_aranges.c: More thorough doing dealloc
632883 as soon as appropriate.
633884 * print_die.c,print_frames.c,print_lines.c: Doing
634885 appropriate early dealloc in the necessary places.
635 2020-04-22 David Anderson
636 * command_options.c: Added to a stderr warning (longer message).
637 * dwarfdump.1: Removed SELECTIVE ENTRY PRINTING
886 2020-04-22 David Anderson
887 * command_options.c: Added to a stderr warning
888 (longer message). * dwarfdump.1: Removed SELECTIVE
889 ENTRY PRINTING
638890 section in favor of the new URI-STYLE INPUT/OUTPUT
639891 and the SELECTIVE* data renamed as LIMITING OUTPUT.
640 * dwarfdump.c: Now everywhere expects to get back status
892 * dwarfdump.c: Now everywhere expects to get back
893 status
641894 from printing DWARF section data, reports on it if
642895 there as an error , and continues.
643896 * esb_using_functions.h: Various functions now have
649902 like more or less everything else.
650903 * print_die.c: Major revision to now return on error
651904 with DW_DLV_* instead of printf followed by exit().
652 * print_frames.c: New local function dealloc_loc_atlist()
653 to clean up on-the-spot. Reintroduced load_CU_error_data()
654 to amplify the information reported on error.
905 * print_frames.c: New local function
906 dealloc_loc_atlist()
907 to clean up on-the-spot. Reintroduced
908 load_CU_error_data() to amplify the information
909 reported on error.
655910 * print_lines.c: Line formatting corrected.
656911 * print_macro.c: Line formatting corrected.
657 * print_pubnames.c: Reflects new arglist to get_producer_name().
658 * print_ranges.c: Line formatting corrected.
659 * dwarf_errmsg_list.h: Added DW_DLE_USER_DECLARED_ERROR so
912 * print_pubnames.c: Reflects new arglist to
913 get_producer_name().
914 * print_ranges.c: Line
915 formatting corrected.
916 * dwarf_errmsg_list.h: Added
917 DW_DLE_USER_DECLARED_ERROR so
660918 dwarfdump can declare an error on its own.
661 * dwarf_error.c: Added dwarf_error_creation() to allow dwarfdump
919 * dwarf_error.c: Added dwarf_error_creation() to
920 allow dwarfdump
662921 to create an error with a detailed explanation.
663 * dwarf_form.c: declared a DW_FORM_rnglistx to be used soon.
664 * dwarf_ranges.c: Comments about the missing .debug_rnglists
922 * dwarf_form.c: declared a DW_FORM_rnglistx to be
923 used soon.
924 * dwarf_ranges.c: Comments about the
925 missing .debug_rnglists
665926 section support (coming soon).
666 2020-04-22 David Anderson
667 * dwarfdump-ta-ext-table.h: regenerated
668 * tag_attr_ext.list: Added to common extensions list .
669 DW_AT_GNU_pubnames
670 DW_AT_GNU_pubtypes
671 DW_AT_GNU_dwo_name
672 DW_AT_GNU_ranges_base
927 2020-04-22 David Anderson
928 * dwarfdump-ta-ext-table.h: regenerated
929 * tag_attr_ext.list: Added to common extensions list
930 DW_AT_GNU_pubnames DW_AT_GNU_pubtypes
931 DW_AT_GNU_dwo_name DW_AT_GNU_ranges_base
673932 DW_AT_GNU_addr_base
674 2020-04-17 David Anderson
933 2020-04-17 David Anderson
675934 * dwarfdump.c: Clarified some error messages and
676935 changed the should_skip_this_cu() from a predicate
677936 function to one in the standard form returning
678 a DW_DLV_* value with a boolean pointer and a Dwarf_Error*
679 * globals.h: Now should_skip_this_cu and
937 a DW_DLV_* value with a boolean pointer and a
938 Dwarf_Error*
939 * globals.h: Now should_skip_this_cu and
680940 print_section_groups_data are in standard form for
681941 calling libdwarf functions, returning a DW_DLV*.
682942 * print_die.c, print_aranges.c, print_pubmames.c,
683 print_ranges.c,print_section_groups.c: Now with
684 the standard form returning a DW_DLV* and no
685 longer call print_error
686 so returns on error, does not exit().
687 Also fixed a lack of a dealloc of cu_die2 in print_die.c.
943 print_ranges.c,print_section_groups.c: Now with the
944 standard form returning a DW_DLV* and no longer call
945 print_error so returns on error, does not exit().
946 Also fixed a lack of a dealloc of cu_die2 in
947 print_die.c.
688948 * print_macro.c: Deleted dwarf_dealloc() that are
689 no longer appropriate given we don't
690 just call exit(). These were not allocated
691 by the function that was dealloc-ing so
692 removed the deallocs here: Let higher levels
693 do it when we return the DW_DLV_ERROR.
694 2020-04-16 David Anderson
695 * globals.h:prototypes of print_line_numbers_this_cu and
949 no longer appropriate given we don't just call
950 exit(). These were not allocated by the function that
951 was dealloc-ing so removed the deallocs here: Let
952 higher levels do it when we return the DW_DLV_ERROR.
953 2020-04-16 David Anderson
954 * globals.h:prototypes of print_line_numbers_this_cu
955 and
696956 print_macros_5style_this_cu changed to the new style
697957 with int return and Dwarf_Error *argument.
698 * dwarf_macrocheck.c: Added a comment line.
699 * print_die.c(print_one_die_section): Calls the
700 revised section prints per-CU- so errors are
701 passed back and dealt with.
958 * dwarf_macrocheck.c: Added a comment line. *
959 print_die.c(print_one_die_section): Calls the
960 revised section prints per-CU- so errors are passed
961 back and dealt with.
702962 * print_lines.c: Now functions return int instead
703 of print_error and exit. Various errors
704 get more detailed output too.
963 of print_error and exit. Various errors get more
964 detailed output too.
705965 * print_macro.c: Now with the new style of returning
706966 errors up to caller.
707 2020-04-14 David Anderson
967 2020-04-14 David Anderson
708968 * globals.h: Deleted unused function prototype.
709 Updated print_macinfo_by_offset() to the new
710 style of returning a DW_DLV*.
969 Updated print_macinfo_by_offset() to the new style
970 of returning a DW_DLV*.
711971 * print_die.c: Now a couple of places we avoid
712972 calling print_error() as it exits and deal sensibly
713973 with return values.
714974 * print_macros.c: The printing of DWARF2,3,4 macro data
715975 is now updated to avoid print_error() and to print
716 more details about problems. And report output
717 now looks more regular.
718 * print_abbrevs.c: Fixed indents and trailing whitespace.
719 2020-04-13 David Anderson
720 * dwarfdump.c,globals.h, print_abbrevs.c: print_abbrevs()
976 more details about problems. And report output now
977 looks more regular.
978 * print_abbrevs.c: Fixed indents and trailing
979 whitespace.
980 2020-04-13 David Anderson
981 * dwarfdump.c,globals.h, print_abbrevs.c:
982 print_abbrevs()
721983 now returns an error properly with the details so
722984 dwarfdump can deal with it properly.
723 2020-04-10 David Anderson
724 * dwarfdump.c: Printing gdb_index and debugfission index
985 2020-04-10 David Anderson
986 * dwarfdump.c: Printing gdb_index and debugfission
987 index
725988 code now all returns DW_DLV* in the new style.
726 * globals.h: print_gdb_index() and print_debugfission_index()
989 * globals.h: print_gdb_index() and
990 print_debugfission_index()
727991 get updated prototypes.
728992 * print_debugfission.c: Code to match the new protypes,
729993 passig errors back up. Revised formatting a bit
733997 * print_gdbindex.c: Improved various error messages.
734998 Updated print_gdb_index() to the new return-on-error
735999 approach.
736 2020-04-07 David Anderson
1000 2020-04-07 David Anderson
7371001 * compiler_info.c: Clarified a comment and
7381002 split a too-long line.
7391003 * dwarfdump.c: Now handles a print_pubnames that
7401004 returns a DW_DLV* and deals with it. Made
741 a dwarf_dealloc conditional on a non-null
1005 a dwarf_dealloc conditional on a non-null
7421006 cu_die_for_print_frames. get_producer_name()
743 now always returns and avoids leaks.
744 We add DEBUG_PUBNAMES to the list wh print CU data
745 on error (It knows the CU-DIE)
1007 now always returns and avoids leaks. We add
1008 DEBUG_PUBNAMES to the list wh print CU data on error
1009 (It knows the CU-DIE)
7461010 * gflags.c: Reformatted to avoid a too-long line.
7471011 * globals.h: Revised prototype for print_pubnames().
7481012 * print_aranges.c: Removed too early destructor
7491013 on producer_name.
750 * print_die.c: Fixed a too-long-comment-line.
751 * print_frames.c: Moved a check for DW_DLV_ERROR up
1014 * print_die.c: Fixed a too-long-comment-line. *
1015 print_frames.c: Moved a check for DW_DLV_ERROR up
7521016 a few lines so we don't check gf_check_frames()
7531017 when not needed.
7541018 * print_pubnames.c: Removed deal_with_name_offset_err()
7551019 as not the right thing to do. Now print_pubnames
756 accepts a Dwarf_Error * argument and always
757 returns a DW_DLV* result.
758 2020-04-03 David Anderson
759 * print_aranges.c: Fixed trailing whitespace and indents.
760 2020-04-03 David Anderson
761 * dwarfdump.c: Now print_strings() and print_macro_statistics()
762 take Dwarf_Error * as argument and return a DW_DLV* value.
763 * globals.h: prototype of print_strings altered.
764 * macrocheck.c(print_macro_statistics): Using esb_s to
765 more detailed messages and returning a DW_DLV* value..
766 * macrocheck.h: Updated prototype for print_macro_statistics().
767 * print_frames.c: Deleted many #if 0/#endif and their
1020 accepts a Dwarf_Error * argument and always returns
1021 a DW_DLV* result.
1022 2020-04-03 David Anderson
1023 * print_aranges.c: Fixed trailing whitespace and
1024 indents.
1025 2020-04-03 David Anderson
1026 * dwarfdump.c: Now print_strings() and
1027 print_macro_statistics()
1028 take Dwarf_Error * as argument and return a DW_DLV*
1029 value.
1030 * globals.h: prototype of print_strings altered. *
1031 macrocheck.c(print_macro_statistics): Using esb_s to
1032 more detailed messages and returning a DW_DLV*
1033 value..
1034 * macrocheck.h: Updated prototype for
1035 print_macro_statistics(). * print_frames.c: Deleted
1036 many #if 0/#endif and their
7681037 debug printf-s.
7691038 * print_strings.c: Now uses get_true_section_name() so
7701039 we report on any compression used.
771 2020-04-03 David Anderson
772 * runtests.sh: Added esb to the build of selfmc as macro check
773 now uses esb.c. Made the dwarfdump tests mention of update 'mv'
774 commands be conditional on having actually found a difference
775 (having them show when no difference was pointlessly confusing).
776 2020-04-03 David Anderson
777 * dwarfdump.c: print_aranges() now uses the new form and returns
1040 2020-04-03 David Anderson
1041 * runtests.sh: Added esb to the build of selfmc as
1042 macro check
1043 now uses esb.c. Made the dwarfdump tests mention
1044 of update 'mv' commands be conditional on having
1045 actually found a difference (having them show when
1046 no difference was pointlessly confusing).
1047 2020-04-03 David Anderson
1048 * dwarfdump.c: print_aranges() now uses the new form
1049 and returns
7781050 a DW_DLV_* value.
779 * globals.h: print_aranges returns a value and has a Dwarf_Error*
1051 * globals.h: print_aranges returns a value and has
1052 a Dwarf_Error*
7801053 second argument now.
781 * print_aranges.c: No longer calls print_error() but instead
782 returns a DW_DLV to dwarfdump.c.
783 2020-04-03 David Anderson
784 * dwarfdump.c,glflags.h,globals.h,print_die.c,print_frames.c,
1054 * print_aranges.c: No longer calls print_error()
1055 but instead
1056 returns a DW_DLV to dwarfdump.c.
1057 2020-04-03 David Anderson
1058 *
1059 dwarfdump.c,glflags.h,globals.h,print_die.c,print_frames.c,
7851060 print_locs.c,print_reloc.c,print_reloc_decls.h,print_static_funcs.c:
7861061 Fix indent errors and remove trailing whitespace.
787 2020-04-02 David Anderson
788 * addrmap.c: Ensure it wn't try to use a null input to addr_map_destroy().
789 * dwarfdump.1: Add documentation on running dwarfdump on split-dwarf
1062 2020-04-02 David Anderson
1063 * addrmap.c: Ensure it wn't try to use a null input to
1064 addr_map_destroy(). * dwarfdump.1: Add documentation
1065 on running dwarfdump on split-dwarf
7901066 objects (See DWARF5 standard, section 6.3).
791 * dwarfdump.c (process_one_file):Applyingthe new error-return scheme
792 to dwarf_frames.c required serious revisions and refactoring.
793 * dwconf_using_functions.h: The declaration of print_frames()
1067 * dwarfdump.c (process_one_file):Applyingthe new
1068 error-return scheme
1069 to dwarf_frames.c required serious revisions and
1070 refactoring.
1071 * dwconf_using_functions.h: The declaration of
1072 print_frames()
7941073 changed.
7951074 * glflags.h: gf_debug_addr_missing_search_by_address,
7961075 gf_error_code_in_name_search_by_address, and
797 gf_all_cus_seen_search_by_address are here now instead of
798 being hard to reason about global/local data.
1076 gf_all_cus_seen_search_by_address are here now
1077 instead of being hard to reason about global/local
1078 data.
7991079 * glflags.c: Initializes the three fields.
8001080 * globals.h: Revised declaration of print_frames() and
801 get_proc_name.
802 Removed the declaration of current_cu_die_for_print_frames.
803 * print_die.c(print_attribute): Properly use the return value
1081 get_proc_name. Removed the declaration of
1082 current_cu_die_for_print_frames.
1083 * print_die.c(print_attribute): Properly use the
1084 return value
8041085 of dwarfdump function get_proc_name_by_die().
805 Also renamed a small number of local variables in
806 print_exprloc_content() to make the code more
1086 Also renamed a small number of local variables
1087 in print_exprloc_content() to make the code more
8071088 readable( tempud -> exprlength, tempud->fileindex);
8081089 * print frames.c: Major revisions to clarify
809 data lifetimes and to return DW_DLV_ERROR
1090 data lifetimes and to return DW_DLV_ERROR
8101091 to let higher levels clean up for themselves.
811 Stop returning true/false and return DW_DLV_OK
812 or DW_DLV_NO_ENTRY with respect to finding
813 procedure names from code addresses`.
1092 Stop returning true/false and return DW_DLV_OK or
1093 DW_DLV_NO_ENTRY with respect to finding procedure
1094 names from code addresses`.
8141095 * print_locs.c: Added an accidentally-omitted
8151096 esb_constructor for secname.`
8161097 * print_ranges.c: Move acquiring section name down
817 after the first call of dwarf_get_ranges() so
818 we get the true name with any compression involed
819 reported.
820 * print_sections.c: Removed Dwarf_Die current_cu_die_for_print_frames,
1098 after the first call of dwarf_get_ranges() so we get
1099 the true name with any compression involed reported.
1100 * print_sections.c: Removed Dwarf_Die
1101 current_cu_die_for_print_frames,
8211102 it is no longer needed.
8221103 * print_reloc.c: Was failing to free locally allocated
8231104 space in some places in print_relocinfo_32().
824 2020-03-30 David Anderson
1105 2020-03-30 David Anderson
8251106 * dwarfdump.c,dwconf_using_functions.h,
8261107 globals.h,print_die.c,print_frames.c,print_frames.h,
8271108 print_locs.c: Applyingthe new error-return scheme
828 to print_locs.c involves a number of changes
829 beyond print_locs.c itself.
830 2020-03-29 David Anderson
1109 to print_locs.c involves a number of changes beyond
1110 print_locs.c itself.
1111 2020-03-29 David Anderson
8311112 * dwarfdump.c: Change several section reports to the
8321113 new approach of errors propagating back to dwarfdump
8331114 process_one_file().
8361117 print_attributes_encoding() all now return status
8371118 DW_DLV_OK etc as appropriate.
8381119 * print_die.c(print_attributes_encoding,
839 print_tag_attributes_usage): Implement passing status back
840 to process_one_file().
841 * print_dnames.c,print_reloc.c,print_reloc_decls.h:
842 Implement passing status back
843 to process_one_file().
844 2020-03-28 David Anderson
1120 print_tag_attributes_usage): Implement passing status
1121 back to process_one_file().
1122 * print_dnames.c,print_reloc.c,print_reloc_decls.h:
1123 Implement passing status back to process_one_file().
1124 2020-03-28 David Anderson
8451125 * dwarfdump.c: print debuglink and print str_offsets
8461126 now getting dwarf status and Dwarf_Error back.
847 * dwarf_globals.h: Revised prototype for
1127 * dwarf_globals.h: Revised prototype for
8481128 print_str_offsets_section().
8491129 * print_str_offsets.c: Now returns libdwarf status
8501130 and lets dwarfdump print the error if there is one.
851 2020-03-28 David Anderson
1131 2020-03-28 David Anderson
8521132 * dwarfdump.c(process_one_file): Beginning a
853 project to pass libdwarf status all the way back
854 to dwarfdump.c. Enables more flexibility in
855 printing and better ability to dealloc memory.
1133 project to pass libdwarf status all the way back to
1134 dwarfdump.c. Enables more flexibility in printing
1135 and better ability to dealloc memory.
8561136 * globals.h: print_static_funcs(), print_static_vars(),
8571137 print_types(), and print_weaknames() now return int
8581138 and pass in a Dwarf_Error.
8591139 * print_static_funcs.c,print_static_vars.c,
8601140 print_types.c, print_weaknames.c: Implement
861 passing back (to dwarfdump.c) of
862 libdwarf status and Dwarf_Error by returning
863 as required when DW_DLV_ERROR encountered.
864 2020-03-27 David Anderson
865 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
866 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
867 dwarfdump-tt-table.h: regenerated with latest
868 version date string.
869 2020-03-27 David Anderson
1141 passing back (to dwarfdump.c) of libdwarf status
1142 and Dwarf_Error by returning as required when
1143 DW_DLV_ERROR encountered.
1144 2020-03-27 David Anderson
1145 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
1146 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
1147 dwarfdump-tt-table.h: regenerated with latest version
1148 date string.
1149 2020-03-27 David Anderson
8701150 * print_die.c: Cleaned trailing whitespace and an
8711151 indent error.
872 2020-03-27 David Anderson
1152 2020-03-27 David Anderson
8731153 * print_die.c: Now does a better job of cleaning
874 up libdwarf data it requested when there is
875 a serious DWARF error.
876 2020-03-26 David Anderson
877 * print_ranges.c: For a particular serious error/corruption
878 print a detailed error message,
879 dwarf_dealloc() the Dwarf_Error instance
880 and skip to the next
881 section to continue.
882 2020-03-26 David Anderson
1154 up libdwarf data it requested when there is a serious
1155 DWARF error.
1156 2020-03-26 David Anderson
1157 * print_ranges.c: For a particular serious
1158 error/corruption
1159 print a detailed error message, dwarf_dealloc() the
1160 Dwarf_Error instance and skip to the next section
1161 to continue.
1162 2020-03-26 David Anderson
8831163 * dwarfdump.c: Now calls the new free_all_dwconf()
8841164 to avoid leaking memory. should_skip_this_cu()
8851165 ensures it does not leak.
8861166 * dwconf.c: Use struct esb to build a string, avoid
8871167 leaving a static string pointer around.
888 Add free_all_dwconf() so the dwconf malloc
889 space can be cleaned up at end of run.
890 * dwconf.h: Declare free_all_dwconf().
891 * print_frames.c(get_proc_name): Add loopok variable so the loop
892 on cu contexts can stop early when a serious
893 error is encountered. The procedure name is not
894 very critical, just nice to have.
895 Ensured no leaks in dwarfdump here.
1168 Add free_all_dwconf() so the dwconf malloc space
1169 can be cleaned up at end of run.
1170 * dwconf.h: Declare free_all_dwconf(). *
1171 print_frames.c(get_proc_name): Add loopok variable so
1172 the loop
1173 on cu contexts can stop early when a serious error
1174 is encountered. The procedure name is not very
1175 critical, just nice to have. Ensured no leaks in
1176 dwarfdump here.
8961177 * print_lines.c: When an error but we wish to continue
8971178 ensure the Dwarf_Error is dealloc-d.
898 * print_pubnames.c: Ensure no leaks on error from libdwarf.
899 2020-03-25 David Anderson
1179 * print_pubnames.c: Ensure no leaks on error from
1180 libdwarf.
1181 2020-03-25 David Anderson
9001182 * print_die.c,print_lines.c,print_pubnames.c:
9011183 Fix indents and remove trailing whitespace.
9021184 * print_frames.c : Fix whitespace and ensure
903 a return of DW_DLV_ERROR (which will
904 basically be ignored anyway) gets a dwarf_dealloc
905 applied to the Dwarf_Error argument.
906 2020-03-24 David Anderson
1185 a return of DW_DLV_ERROR (which will basically be
1186 ignored anyway) gets a dwarf_dealloc applied to the
1187 Dwarf_Error argument.
1188 2020-03-24 David Anderson
9071189 * print_lines.c: Added a dwarf_dealloc DW DLA STRING
9081190 that had been overlooked.
9091191 2020-03-24 David Anderson
9101192 * print_die.c: Ensuring that when an error is
9111193 created it gets dealloc-d.
912 * print_gdbindex.c(print_gdb_index): It was failing to dealloc
1194 * print_gdbindex.c(print_gdb_index): It was failing
1195 to dealloc
9131196 the data it requested from libdwarf.
9141197 2020-03-23 David Anderson
915 * print_die.c: More cases trying to continue after error.
1198 * print_die.c: More cases trying to continue after
1199 error.
9161200 And ensuring no dwarf leakages.
917 * print_frames.c: More accurate error report (one place).
918 * print_pubnames.c: Fixing leaks and making some error
1201 * print_frames.c: More accurate error report (one
1202 place). * print_pubnames.c: Fixing leaks and making
1203 some error
9191204 message more precise (showing values).
9201205 2020-03-21 David Anderson
9211206 * dwarfdump.c:Add flag_data_post_cleanup() in a few
9221207 more places early termination situations.
9231208 * print_abbrevs.c: Move some variables to the most
924 local scope. Revise the while loop so we can
925 ensure local alloc cleaned up in case of error.
926 Remove pointless duplicate tests for zero abbrev_code.
1209 local scope. Revise the while loop so we can ensure
1210 local alloc cleaned up in case of error. Remove
1211 pointless duplicate tests for zero abbrev_code.
9271212 * print_die_stack: Refactor, adding dealloc_die_stack()
9281213 and calling it where needed to free up local malloc
9291214 data.
9351220 2020-03-20 David Anderson
9361221 * print_frames.c,print_dgbindex.c,print_macros.c,
9371222 print_pubnames.c,print_ranges.c,print_reloc.c,
938 sanitized.c,tag_attr.c,testesb.c,
939 uri.c: Remove use of esb_append_printf()
940 and use esb_append_printf_i etc instead.
941 Then null device will never be set up.
1223 sanitized.c,tag_attr.c,testesb.c, uri.c: Remove use
1224 of esb_append_printf() and use esb_append_printf_i
1225 etc instead. Then null device will never be set up.
9421226 2020-03-19 David Anderson
9431227 * globals.h: Using parens in the DROP_ERROR_INSTANCE
9441228 macro to avoid accidental side effects.
9451229 * print_die.c: Now uses more localized pointers
946 where possible to make understanding the code simpler.
947 Much more careful to dwarf_dealloc things in
948 the face of errors in the DWARF and early
1230 where possible to make understanding the code
1231 simpler. Much more careful to dwarf_dealloc
1232 things in the face of errors in the DWARF and early
9491233 termination of dwarfdump.
9501234 * print_lines.c: Much more careful to dwarf_dealloc
9511235 things in case of error.
9571241 * print_pubnames.c: Revise certain if/then/else
9581242 to make the flow clearer.
9591243 2020-03-16: David Anderson
960 * print_ranges.c: Added a dealloc of rangeset,DW_DLA_RANGES.
1244 * print_ranges.c: Added a dealloc of
1245 rangeset,DW_DLA_RANGES.
9611246 2020-03-15: David Anderson
9621247 * glflags.c: Now defaults to not printing the global
963 alloc sums. Use --print-alloc-sums option to dwarfdump
964 to print them (ensure GLOBAL_ALLOC_SUMS defined
965 in libdwarf/dwarf_alloc.c).
1248 alloc sums. Use --print-alloc-sums option to
1249 dwarfdump to print them (ensure GLOBAL_ALLOC_SUMS
1250 defined in libdwarf/dwarf_alloc.c).
9661251 2020-03-15: David Anderson
9671252 * print_pubnames.c: Reformat a too-long line.
9681253 2020-03-14: David Anderson
969 * dwarfdump.c: Changed an argument name in the print_error*
1254 * dwarfdump.c: Changed an argument name in the
1255 print_error*
9701256 group of functions to reflect the real meaning,
9711257 dwarf_code -> dwarf_ret_val.
972 * print_aranges.c (print_aranges): Only call dwarf_dealloc() in
1258 * print_aranges.c (print_aranges): Only call
1259 dwarf_dealloc() in
9731260 case pa_error is non-null.
9741261 * print_die: Initialize no_of_elements at long last.
975 * print_pubnames.c: A code line was ... long. 2 lines now.
1262 * print_pubnames.c: A code line was ... long. 2
1263 lines now.
9761264 2020-03-12: David Anderson
9771265 * print_abbrevs.c: Add zero of dealloc'd pointer.
9781266 2020-03-12: David Anderson
9791267 * dwarfdump.c: Simplified check_for_major_errors().
9801268 Deleted some #if 0 code.
9811269 * print_die.c: Fiexed indent and trailing whitespace.
982 * print_macro.c: Deleted a bogus
1270 * print_macro.c: Deleted a bogus
9831271 dwarf_dealloc_macro_context() call.
9841272 2020-03-12: David Anderson
9851273 * print_die.c: Small changes to cleanup DIE allocations
9861274 so not relying on de_alloc_tree.
9871275 2020-03-12: David Anderson
988 * print_aranges.c: Fixed trailing whitespace and indents.
1276 * print_aranges.c: Fixed trailing whitespace and
1277 indents.
9891278 2020-03-12: David Anderson
990 * esb.c, dwarfdump.c: Fixed trailing whitespace and indents.
1279 * esb.c, dwarfdump.c: Fixed trailing whitespace and
1280 indents.
9911281 2020-03-12: David Anderson
9921282 * print_str_offsets.c: Clean up by doing
993 proper dealloc calls instead of relying
994 on de_alloc_tree to clean up.
1283 proper dealloc calls instead of relying on
1284 de_alloc_tree to clean up.
9951285 2020-03-12: David Anderson
9961286 * print_pubnames.c: Clean up by doing
997 proper dealloc calls instead of relying
998 on de_alloc_tree to clean up.
1287 proper dealloc calls instead of relying on
1288 de_alloc_tree to clean up.
9991289 2020-03-12: David Anderson
10001290 * print_macro.c: Clean up by doing
1001 proper dealloc calls instead of relying
1002 on de_alloc_tree to clean up.
1291 proper dealloc calls instead of relying on
1292 de_alloc_tree to clean up.
10031293 2020-03-12: David Anderson
10041294 * print_lines.c: Eliminate leaks that relied
10051295 on de_alloc_tree to clean up.
10131303 on de_alloc_tree to clean up.
10141304 2020-03-12: David Anderson
10151305 * command_options.h, command_options.c: Adds
1016 uri_data_constructor() and uri_data_destructor()
1017 to avoid an old memory leak (called from dwarfdump.c).
1306 uri_data_constructor() and uri_data_destructor() to
1307 avoid an old memory leak (called from dwarfdump.c).
10181308 2020-03-12: David Anderson
10191309 * dwarfdump.c: Cleans up old and small memory
10201310 leaks and simplifies the code as well.
10211311 2020-03-09: David Anderson
1022 * command_options.c: Implements two options primarily for
1023 dwarfdump developers: --suppress-de-alloc-tree
1024 and --print-alloc-sums.
1025 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
1026 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
1027 dwarfdump-tt-table.h: regenerated with latest
1028 version date string.
1029 * dwarfdump.c: Implements the two new options.
1030 * glflags.c,glflags.h: declares and instantiates
1031 a new global flag gf_print_alloc_sums for the new option
1312 * command_options.c: Implements two options primarily
1313 for
1314 dwarfdump developers: --suppress-de-alloc-tree and
10321315 --print-alloc-sums.
1316 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
1317 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
1318 dwarfdump-tt-table.h: regenerated with latest version
1319 date string.
1320 * dwarfdump.c: Implements the two new options. *
1321 glflags.c,glflags.h: declares and instantiates
1322 a new global flag gf_print_alloc_sums for the new
1323 option --print-alloc-sums.
10331324 * print_die.c: Arranged correct dwarf_dealloc of
1034 DW_DLA_ERROR errors when calling dwarf_formudata/sdata
1035 and discarding errors.
1325 DW_DLA_ERROR errors when calling
1326 dwarf_formudata/sdata and discarding errors.
10361327 2020-02-25: David Anderson
10371328 * dwarf_names.c,dwarf_names.h,dwarfdump-ta-ext-table.h,
1038 dwarfdump-ta-table.h dwarfdump-tt-ext-table.h dwarfdump-tt-table.h:
1039 updated date string.
1329 dwarfdump-ta-table.h dwarfdump-tt-ext-table.h
1330 dwarfdump-tt-table.h: updated date string.
10401331 2020-02-25: David Anderson
1041 * esb.c: Slight corrections so a %-12s will ignore the -12
1042 if the string to be inserted is more than 11 bytes long.
1043 Allowed use of UNUSEDARG.
1332 * esb.c: Slight corrections so a %-12s will ignore
1333 the -12
1334 if the string to be inserted is more than 11 bytes
1335 long. Allowed use of UNUSEDARG.
10441336 * runtests.sh: Restore the running of the testesb.c
10451337 test program.
10461338 * testesb.c: Added a new test case specifically for
1047 testing the change in esb.c. Eliminated the
1048 unneeded tests on allocation-size, that was not
1049 helpful, yet was tedious to make meaningful.
1339 testing the change in esb.c. Eliminated the unneeded
1340 tests on allocation-size, that was not helpful,
1341 yet was tedious to make meaningful.
10501342 2020-02-20: David Anderson
10511343 * print_die.c: Removed the last snprintf the required
10521344 fixed spaces and now use esb functions to do the
10531345 message creation.
10541346 2020-02-19: David Anderson
1055 * checkutil.c,common.c,naming.c,print_abbrevs.c,print_die.c,
1056 print_lines.c: Removed the ORIGINAL_SPRINTF
1057 versions in favor
1058 of esb_append_printf_[usi] versions.
1059 We have not been using the s[n]printf
1060 versions for a while now.
1347 *
1348 checkutil.c,common.c,naming.c,print_abbrevs.c,print_die.c,
1349 print_lines.c: Removed the ORIGINAL_SPRINTF versions
1350 in favor of esb_append_printf_[usi] versions.
1351 We have not been using the s[n]printf versions for
1352 a while now.
10611353 2020-02-16: David Anderson
10621354 * globals.h: Adds DWVERSION5 to use with testing for
1063 version number details (which matters when calling
1355 version number details (which matters when calling
10641356 dwarf_srcfiles())
10651357 * print_die.c: Now recognizes that DWARF5 is different
10661358 from earlier versions in the way dwarf_srcfiles()
1067 array of string pointers is to be used.
1068 Refactored the srcfiles checking to its own
1069 function to simplify reading the code.
1359 array of string pointers is to be used. Refactored
1360 the srcfiles checking to its own function to simplify
1361 reading the code.
10701362 2020-02-13: David Anderson
10711363 * dwarf_names.c dwarf_names.c,dwarfdump-ta-ext-table.h,
10721364 dwarfdump-ta-table.h,dwarfdump-tt-ext-table.h,
1073 dwarfdump-tt-table.h: regenerated with new
1074 date string.
1365 dwarfdump-tt-table.h: regenerated with new date
1366 string.
10751367 2020-01-27: David Anderson
10761368 * print_die.c: Now attributes the correct actual form
10771369 in more places (meaning in error messages, here and
10931385 2020-01-05:
10941386 * dwconf.c: Fix CoveritySan CID 206594 resource leak
10951387 if an error reading dwarfdump.conf.
1096 * sanitized.c(no_questionable_chars): Fixed CoverityScan
1097 CID 206595. The code was
1098 failing to sanitize % characters: the test for %
1099 has been moved up a few lines.
1100 do_sanity_insert() had the same problem with %. Fixed.
1101 And do_sanity_insert() had a final line of unreachable
1102 code; now fixed by simplifying the code (an ASSERT
1103 added in a comment). Coverity Scan CID 206596.
1388 * sanitized.c(no_questionable_chars): Fixed
1389 CoverityScan
1390 CID 206595. The code was failing to sanitize %
1391 characters: the test for % has been moved up a
1392 few lines. do_sanity_insert() had the same problem
1393 with %. Fixed. And do_sanity_insert() had a final
1394 line of unreachable code; now fixed by simplifying
1395 the code (an ASSERT added in a comment). Coverity
1396 Scan CID 206596.
11041397 * print_die.c(traverse_one_die): Was failing to check
1105 for the normal dwarf return int and letting
1106 next code deal with the fallout (and leak an error
1107 record). Now we check and avoid any leak or surprise.
1398 for the normal dwarf return int and letting next
1399 code deal with the fallout (and leak an error
1400 record). Now we check and avoid any leak or surprise.
11081401 Coverity Scan CID 20659
11091402
11101403
6464 print_loclists.c \
6565 print_loclists_codes.c \
6666 print_locs.c \
67 print_macinfo.c \
6768 print_macro.c \
68 print_macros.c \
6969 print_pubnames.c \
7070 print_ranges.c \
7171 print_rnglists.c \
133133 dwarfdump-print_origloclist_codes.$(OBJEXT) \
134134 dwarfdump-print_loclists.$(OBJEXT) \
135135 dwarfdump-print_loclists_codes.$(OBJEXT) \
136 dwarfdump-print_locs.$(OBJEXT) dwarfdump-print_macro.$(OBJEXT) \
137 dwarfdump-print_macros.$(OBJEXT) \
136 dwarfdump-print_locs.$(OBJEXT) \
137 dwarfdump-print_macinfo.$(OBJEXT) \
138 dwarfdump-print_macro.$(OBJEXT) \
138139 dwarfdump-print_pubnames.$(OBJEXT) \
139140 dwarfdump-print_ranges.$(OBJEXT) \
140141 dwarfdump-print_rnglists.$(OBJEXT) \
205206 ./$(DEPDIR)/dwarfdump-print_loclists.Po \
206207 ./$(DEPDIR)/dwarfdump-print_loclists_codes.Po \
207208 ./$(DEPDIR)/dwarfdump-print_locs.Po \
209 ./$(DEPDIR)/dwarfdump-print_macinfo.Po \
208210 ./$(DEPDIR)/dwarfdump-print_macro.Po \
209 ./$(DEPDIR)/dwarfdump-print_macros.Po \
210211 ./$(DEPDIR)/dwarfdump-print_origloclist_codes.Po \
211212 ./$(DEPDIR)/dwarfdump-print_pubnames.Po \
212213 ./$(DEPDIR)/dwarfdump-print_ranges.Po \
506507 DLLTOOL = @DLLTOOL@
507508 DSYMUTIL = @DSYMUTIL@
508509 DUMPBIN = @DUMPBIN@
510 DWARF_BIGENDIAN = @DWARF_BIGENDIAN@
509511 DWARF_CFLAGS_WARN = @DWARF_CFLAGS_WARN@
510512 DWARF_CXXFLAGS_WARN = @DWARF_CXXFLAGS_WARN@
511513 DWARF_LIBS = @DWARF_LIBS@
671673 print_loclists.c \
672674 print_loclists_codes.c \
673675 print_locs.c \
676 print_macinfo.c \
674677 print_macro.c \
675 print_macros.c \
676678 print_pubnames.c \
677679 print_ranges.c \
678680 print_rnglists.c \
883885 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_loclists.Po@am__quote@ # am--include-marker
884886 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_loclists_codes.Po@am__quote@ # am--include-marker
885887 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_locs.Po@am__quote@ # am--include-marker
888 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_macinfo.Po@am__quote@ # am--include-marker
886889 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_macro.Po@am__quote@ # am--include-marker
887 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_macros.Po@am__quote@ # am--include-marker
888890 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_origloclist_codes.Po@am__quote@ # am--include-marker
889891 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_pubnames.Po@am__quote@ # am--include-marker
890892 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfdump-print_ranges.Po@am__quote@ # am--include-marker
13821384 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
13831385 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -c -o dwarfdump-print_locs.obj `if test -f 'print_locs.c'; then $(CYGPATH_W) 'print_locs.c'; else $(CYGPATH_W) '$(srcdir)/print_locs.c'; fi`
13841386
1387 dwarfdump-print_macinfo.o: print_macinfo.c
1388 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -MT dwarfdump-print_macinfo.o -MD -MP -MF $(DEPDIR)/dwarfdump-print_macinfo.Tpo -c -o dwarfdump-print_macinfo.o `test -f 'print_macinfo.c' || echo '$(srcdir)/'`print_macinfo.c
1389 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dwarfdump-print_macinfo.Tpo $(DEPDIR)/dwarfdump-print_macinfo.Po
1390 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='print_macinfo.c' object='dwarfdump-print_macinfo.o' libtool=no @AMDEPBACKSLASH@
1391 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1392 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -c -o dwarfdump-print_macinfo.o `test -f 'print_macinfo.c' || echo '$(srcdir)/'`print_macinfo.c
1393
1394 dwarfdump-print_macinfo.obj: print_macinfo.c
1395 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -MT dwarfdump-print_macinfo.obj -MD -MP -MF $(DEPDIR)/dwarfdump-print_macinfo.Tpo -c -o dwarfdump-print_macinfo.obj `if test -f 'print_macinfo.c'; then $(CYGPATH_W) 'print_macinfo.c'; else $(CYGPATH_W) '$(srcdir)/print_macinfo.c'; fi`
1396 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dwarfdump-print_macinfo.Tpo $(DEPDIR)/dwarfdump-print_macinfo.Po
1397 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='print_macinfo.c' object='dwarfdump-print_macinfo.obj' libtool=no @AMDEPBACKSLASH@
1398 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1399 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -c -o dwarfdump-print_macinfo.obj `if test -f 'print_macinfo.c'; then $(CYGPATH_W) 'print_macinfo.c'; else $(CYGPATH_W) '$(srcdir)/print_macinfo.c'; fi`
1400
13851401 dwarfdump-print_macro.o: print_macro.c
13861402 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -MT dwarfdump-print_macro.o -MD -MP -MF $(DEPDIR)/dwarfdump-print_macro.Tpo -c -o dwarfdump-print_macro.o `test -f 'print_macro.c' || echo '$(srcdir)/'`print_macro.c
13871403 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dwarfdump-print_macro.Tpo $(DEPDIR)/dwarfdump-print_macro.Po
13951411 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='print_macro.c' object='dwarfdump-print_macro.obj' libtool=no @AMDEPBACKSLASH@
13961412 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
13971413 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -c -o dwarfdump-print_macro.obj `if test -f 'print_macro.c'; then $(CYGPATH_W) 'print_macro.c'; else $(CYGPATH_W) '$(srcdir)/print_macro.c'; fi`
1398
1399 dwarfdump-print_macros.o: print_macros.c
1400 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -MT dwarfdump-print_macros.o -MD -MP -MF $(DEPDIR)/dwarfdump-print_macros.Tpo -c -o dwarfdump-print_macros.o `test -f 'print_macros.c' || echo '$(srcdir)/'`print_macros.c
1401 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dwarfdump-print_macros.Tpo $(DEPDIR)/dwarfdump-print_macros.Po
1402 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='print_macros.c' object='dwarfdump-print_macros.o' libtool=no @AMDEPBACKSLASH@
1403 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1404 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -c -o dwarfdump-print_macros.o `test -f 'print_macros.c' || echo '$(srcdir)/'`print_macros.c
1405
1406 dwarfdump-print_macros.obj: print_macros.c
1407 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -MT dwarfdump-print_macros.obj -MD -MP -MF $(DEPDIR)/dwarfdump-print_macros.Tpo -c -o dwarfdump-print_macros.obj `if test -f 'print_macros.c'; then $(CYGPATH_W) 'print_macros.c'; else $(CYGPATH_W) '$(srcdir)/print_macros.c'; fi`
1408 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dwarfdump-print_macros.Tpo $(DEPDIR)/dwarfdump-print_macros.Po
1409 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='print_macros.c' object='dwarfdump-print_macros.obj' libtool=no @AMDEPBACKSLASH@
1410 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
1411 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -c -o dwarfdump-print_macros.obj `if test -f 'print_macros.c'; then $(CYGPATH_W) 'print_macros.c'; else $(CYGPATH_W) '$(srcdir)/print_macros.c'; fi`
14121414
14131415 dwarfdump-print_pubnames.o: print_pubnames.c
14141416 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dwarfdump_CPPFLAGS) $(CPPFLAGS) $(dwarfdump_CFLAGS) $(CFLAGS) -MT dwarfdump-print_pubnames.o -MD -MP -MF $(DEPDIR)/dwarfdump-print_pubnames.Tpo -c -o dwarfdump-print_pubnames.o `test -f 'print_pubnames.c' || echo '$(srcdir)/'`print_pubnames.c
20452047 -rm -f ./$(DEPDIR)/dwarfdump-print_loclists.Po
20462048 -rm -f ./$(DEPDIR)/dwarfdump-print_loclists_codes.Po
20472049 -rm -f ./$(DEPDIR)/dwarfdump-print_locs.Po
2050 -rm -f ./$(DEPDIR)/dwarfdump-print_macinfo.Po
20482051 -rm -f ./$(DEPDIR)/dwarfdump-print_macro.Po
2049 -rm -f ./$(DEPDIR)/dwarfdump-print_macros.Po
20502052 -rm -f ./$(DEPDIR)/dwarfdump-print_origloclist_codes.Po
20512053 -rm -f ./$(DEPDIR)/dwarfdump-print_pubnames.Po
20522054 -rm -f ./$(DEPDIR)/dwarfdump-print_ranges.Po
21412143 -rm -f ./$(DEPDIR)/dwarfdump-print_loclists.Po
21422144 -rm -f ./$(DEPDIR)/dwarfdump-print_loclists_codes.Po
21432145 -rm -f ./$(DEPDIR)/dwarfdump-print_locs.Po
2146 -rm -f ./$(DEPDIR)/dwarfdump-print_macinfo.Po
21442147 -rm -f ./$(DEPDIR)/dwarfdump-print_macro.Po
2145 -rm -f ./$(DEPDIR)/dwarfdump-print_macros.Po
21462148 -rm -f ./$(DEPDIR)/dwarfdump-print_origloclist_codes.Po
21472149 -rm -f ./$(DEPDIR)/dwarfdump-print_pubnames.Po
21482150 -rm -f ./$(DEPDIR)/dwarfdump-print_ranges.Po
0 November 16, 2020
1 dwarfdump now prints DWARF expression ops
2 on indivdidual lines which makes it much easier to read the
3 contents of a DWARF expression.
4 dwarfdump.conf now implements support of
5 'option: --format-expr-ops-joined' which gets you
6 the older format without specifying --format-expr-ops-joined
7 on the command line.
08 May 23, 2020
19 dwarfdump now takes much less malloc() to work, as measured
210 by valgrind --tool=massif and massif-visualizer.
336336 static void arg_format_attr_name(void);
337337 static void arg_format_dense(void);
338338 static void arg_format_ellipsis(void);
339 static void arg_format_expr_ops_joined(void);
339340 static void arg_format_extensions(void);
340341 static void arg_format_global_offsets(void);
341342 static void arg_format_loc(void);
586587 "-e --format-ellipsis Short names for tags, attrs etc.",
587588 "-G --format-global-offsets Show global die offsets",
588589 "-g --format-loc (Was loclist support. Do not use.)",
590 " --format-expr-ops-joined Print each group of DWARF DW_OPs",
591 " on one line rather than one per line.",
589592 "-R --format-registers Print frame register names as r33 etc",
590593 " and allow up to 1200 registers.",
591594 " Print using a 'generic' register set.",
611614 "----------------------------------------------------------------------",
612615 "-u<file> --format-file=<file> Print only specified file (CU name)",
613616 "-cg --format-gcc Check only GCC compiler objects",
614 "-x groupnumber=<n> --format-group=<n> Groupnumber to print",
617 "-x groupnumber=<n> ",
618 " --format-group-number=<n> Groupnumber to print",
615619 "-H<num> --format-limit=<num> Limit output to the first <num>",
616620 " major units.",
617621 " Stop after <num> compilation units",
740744 OPT_FORMAT_ATTR_NAME, /* -M --format-attr-name */
741745 OPT_FORMAT_DENSE, /* -d --format-dense */
742746 OPT_FORMAT_ELLIPSIS, /* -e --format-ellipsis */
747 OPT_FORMAT_EXPR_OPS_JOINED, /* --format-expr-ops-joined */
743748 OPT_FORMAT_EXTENSIONS, /* -C --format-extensions */
744749 OPT_FORMAT_GLOBAL_OFFSETS, /* -G --format-global-offsets */
745750 OPT_FORMAT_LOC, /* -g --format-loc */
748753 OPT_FORMAT_SUPPRESS_GROUP , /* -x --format-suppress-group */
749754 OPT_FORMAT_SUPPRESS_LOOKUP, /* -n --format-suppress-lookup */
750755 OPT_FORMAT_SUPPRESS_OFFSETS, /* -D --format-suppress-offsets */
751 OPT_FORMAT_SUPPRESS_SANITIZE, /* -x no-sanitize-strings --format-suppress-sanitize */
756 OPT_FORMAT_SUPPRESS_SANITIZE, /* -x no-sanitize-strings --format-suppress-sanitize */
752757 OPT_FORMAT_SUPPRESS_URI, /* -U --format-suppress-uri */
753758 OPT_FORMAT_SUPPRESS_URI_MSG, /* -q --format-suppress-uri-msg */
754759
896901 {"format-attr-name", dwno_argument, 0, OPT_FORMAT_ATTR_NAME },
897902 {"format-dense", dwno_argument, 0, OPT_FORMAT_DENSE },
898903 {"format-ellipsis", dwno_argument, 0, OPT_FORMAT_ELLIPSIS },
904 {"format-expr-ops-joined", dwno_argument, 0, OPT_FORMAT_EXPR_OPS_JOINED },
899905 {"format-extensions", dwno_argument, 0, OPT_FORMAT_EXTENSIONS },
900906 {"format-global-offsets", dwno_argument, 0, OPT_FORMAT_GLOBAL_OFFSETS },
901907 {"format-loc", dwno_argument, 0, OPT_FORMAT_LOC },
10961102 }
10971103 }
10981104
1105 /* Option '--format-expr-ops-joined'
1106 restoring pre- December 2020 expression block printing */
1107 void arg_format_expr_ops_joined(void)
1108 {
1109 glflags.gf_expr_ops_joined = TRUE;
1110 }
10991111 /* Option '-C' */
11001112 void arg_format_extensions(void)
11011113 {
25222534 case OPT_FILE_USE_NO_LIBELF: arg_file_use_no_libelf(); break;
25232535
25242536 /* Print Output Qualifiers. */
2525 case OPT_FORMAT_ATTR_NAME: arg_format_attr_name(); break;
2526 case OPT_FORMAT_DENSE: arg_format_dense(); break;
2527 case OPT_FORMAT_ELLIPSIS: arg_format_ellipsis(); break;
2528 case OPT_FORMAT_EXTENSIONS: arg_format_extensions(); break;
2529 case OPT_FORMAT_GLOBAL_OFFSETS: arg_format_global_offsets(); break;
2530 case OPT_FORMAT_LOC: arg_format_loc(); break;
2531 case OPT_FORMAT_REGISTERS: arg_format_registers(); break;
2532 case OPT_FORMAT_SUPPRESS_DATA: arg_format_suppress_data(); break;
2533 case OPT_FORMAT_SUPPRESS_GROUP: arg_format_suppress_group(); break;
2534 case OPT_FORMAT_SUPPRESS_OFFSETS: arg_format_suppress_offsets(); break;
2535 case OPT_FORMAT_SUPPRESS_LOOKUP: arg_format_suppress_lookup(); break;
2536 case OPT_FORMAT_SUPPRESS_SANITIZE:arg_format_suppress_sanitize();break;
2537 case OPT_FORMAT_SUPPRESS_URI: arg_format_suppress_uri(); break;
2538 case OPT_FORMAT_SUPPRESS_URI_MSG: arg_format_suppress_uri_msg(); break;
2537 case OPT_FORMAT_ATTR_NAME:
2538 arg_format_attr_name(); break;
2539 case OPT_FORMAT_DENSE:
2540 arg_format_dense(); break;
2541 case OPT_FORMAT_ELLIPSIS:
2542 arg_format_ellipsis(); break;
2543 case OPT_FORMAT_EXPR_OPS_JOINED:
2544 arg_format_expr_ops_joined(); break;
2545 case OPT_FORMAT_EXTENSIONS:
2546 arg_format_extensions(); break;
2547 case OPT_FORMAT_GLOBAL_OFFSETS:
2548 arg_format_global_offsets(); break;
2549 case OPT_FORMAT_LOC:
2550 arg_format_loc(); break;
2551 case OPT_FORMAT_REGISTERS:
2552 arg_format_registers(); break;
2553 case OPT_FORMAT_SUPPRESS_DATA:
2554 arg_format_suppress_data(); break;
2555 case OPT_FORMAT_SUPPRESS_GROUP:
2556 arg_format_suppress_group(); break;
2557 case OPT_FORMAT_SUPPRESS_OFFSETS:
2558 arg_format_suppress_offsets(); break;
2559 case OPT_FORMAT_SUPPRESS_LOOKUP:
2560 arg_format_suppress_lookup(); break;
2561 case OPT_FORMAT_SUPPRESS_SANITIZE:
2562 arg_format_suppress_sanitize();break;
2563 case OPT_FORMAT_SUPPRESS_URI:
2564 arg_format_suppress_uri(); break;
2565 case OPT_FORMAT_SUPPRESS_URI_MSG:
2566 arg_format_suppress_uri_msg(); break;
25392567
25402568 /* Print Output Limiters. */
25412569 case OPT_FORMAT_FILE: arg_format_file(); break;
26802708
26812709 /* Process the arguments and sets the appropiated option */
26822710 set_command_options(argc, argv);
2683
2684 init_conf_file_data(glflags.config_file_data);
26852711 if (config_file_abi && glflags.gf_generic_1200_regs) {
26862712 printf("Specifying both -R and -x abi= is not allowed. Use one "
26872713 "or the other. -x abi= ignored.\n");
2688 config_file_abi = FALSE;
2689 }
2690 if (glflags.gf_generic_1200_regs) {
2691 init_generic_config_1200_regs(glflags.config_file_data);
2692 }
2693 if (config_file_abi &&
2694 (glflags.gf_frame_flag || glflags.gf_eh_frame_flag)) {
2714 config_file_abi = 0;
2715 }
2716 { /* even with no abi we look as there may be
2717 a dwarfdump option there we know about. */
26952718 int res = 0;
26962719 res = find_conf_file_and_read_config(
26972720 esb_get_string(glflags.config_file_path),
26982721 config_file_abi,
26992722 config_file_defaults,
27002723 glflags.config_file_data);
2701
2702 if (res > 0) {
2703 printf
2704 ("Frame not configured due to error(s). Giving up.\n");
2724 if (res == FOUND_ERROR) {
2725 printf("Frame not configured due to error(s)."
2726 " using generic 100 registers.\n");
27052727 glflags.gf_eh_frame_flag = FALSE;
27062728 glflags.gf_frame_flag = FALSE;
2729 } else if (res == FOUND_DONE || res == FOUND_OPTION) {
2730 if (glflags.gf_generic_1200_regs) {
2731 init_generic_config_1200_regs(glflags.config_file_data);
2732 }
2733 } else {
2734 /* FOUND_ABI_START nothing to do. */
27072735 }
27082736 }
27092737 if (arg_usage_error ) {
00 /* Generated routines, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
00 /* Generated routines, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
6363 #else
6464 #define UNUSEDARG
6565 #endif
66 #ifdef HAVE_STDLIB_H
6667 #include "stdlib.h" /* for free() */
68 #endif /* HAVE_STDLIB_H */
6769 #ifdef HAVE_STDINT_H
6870 #include <stdint.h> /* For uintptr_t */
6971 #endif /* HAVE_STDINT_H */
00 /* Generated code, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
00 /* Generated code, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
00 /* Generated code, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
00 /* Generated code, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
4646 .BR \--format-dense\ (\-d)
4747 option is useful.
4848 .PP
49 As of December 2020 DWARF expressions
50 are broken out to print each expression
51 (DW_OP_plus for example) in a block
52 on a separate line.
53 To restore the previous behavior, sort
54 of like \--format-dense but only applying
55 to blocks of DWARF expression operators
56 (DW_OP*).
57 the
58 .BR \--format-expr-ops-joined
59 is useful.
60 If the option is placed in the dwarfdump.conf
61 file (see the file itself for the format)
62 it will apply without needing to put it
63 on the command line.
64
65 .PP
4966 Not all sections actually exist in any given object file.
5067 .PP
5168 The output format may change from release to release, so it is
6178 from an executable/shared-object.
6279 One is DWARF5 Split Dwarf (the \--file-tied
6380 option is useful for these). Another
64 ls GNU debuglink (libdwarf automatically
81 is GNU debuglink (libdwarf automatically
6582 finds the DWARF when given the name
6683 of the executable, use \--no-follow-debuglink
6784 to suppress this and make possible printing
7390 .PP
7491 In many cases one can get additional detail
7592 by specifying \-v (sometimes \-v \-v gets
76 even more). When printing DIEs (Debugging
93 even more, see the --verbose
94 discussion below).
95 When printing DIEs (Debugging
7796 Information Entries) the options \-G
7897 (showing global offsets)
7998 and \-M (naming the DW_FORM* of attributes)
199218 (making finding
200219 URI sequences silent) give finer control of URI interpretation.
201220 .PP
202 As an example, to get a string'a b' make the string 'a%20b'
221 As an example, to get a string 'a b' make the string 'a%20b'
203222 (here the quote (') is for exposition not part of the string, though
204223 quote is certainly problematic in a name).
205 Instead of escaping " quotes in the string, type %25, as in
206 'a "b' should be typed 'a%20%25b'
224 Instead of escaping " quotes in the string, type %25, as
225 in 'a "b' should be typed 'a%20%25b'.
207226 Any characters can be typed in URI style, not just characters
208227 which are problematic to the shell or getopt.
209228 We strongly suggest you not type URI-style characters where
425444 gaps are not an error, just a waste of space).
426445 .TP
427446 .BR \--check-unique\ (\-kG)
428 Print only unique errors. Error lines are simpified
447 Print only unique errors. Error lines are simplified
429448 (hex numbers removed, for example) and when
430449 a given message string would otherwise appear
431450 again it is suppressed.
525544 (as with grep) much simpler as the entire DIE is on one line.
526545
527546 .TP
528 .BR \--format-supress-offsets\ (\-D)
547 .BR \--format-suppress-offsets\ (\-D)
529548 Turns off the display of section offsets
530549 and attribute values in printed output.
531550 So the .debug_info output is just TAGs and Attributes.
606625 equivalently, '--file-abi=ppc'
607626
608627 .TP
609 .BR \--version\ (\-v)
628 .BR \--verbose\ (\-v)
610629 Increases the detail shown when printing.
611630 In some sections, using more -v options
612 will increase the detail (one to three are useful) or may
631 will increase the detail (one to four are useful) or may
613632 change the report to show, for example, the actual
614633 line-data-commands instead of the resultant line-table.
634 Two to four -v options make a difference when
635 printing DIEs and rnglists (-i),
636 lines (-l), frames (-f,-F), gdb_index(-I).
637 Additional -v beyond four do not currently
638 add-to or change the output.
615639
616640 .SH LIMITING OUTPUT
617641
618642 .PP
619 The simplist limiting option is to stop the
643 The simplest limiting option is to stop the
620644 examination/printing after <num> compilation units.
621645 See -H and --format-limit above.
622646 This option also limits the number of FDEs
624648 section.
625649
626650 .PP
627 The --search (-S) options stand alone and
628 basic print information about the compilation
651 The --search (-S) options
652 print information about the compilation
629653 unit and DIE where the string(s) appear.
654 These cannot be combined with other options.
630655 At most one of each of the following
631656 is effective (so for example
632657 one can only have one 'match', but one can
644669 DWARF information output by -i is multiple
645670 gigabytes of data.
646671
647 If v is added to the -S option, the
672 If -Sv used instead of -S , the
648673 number of occurrences is printed.
649674 (see below for an example).
650675
676701 .TP
677702 .BR \--search-regex-count=string\ (\-Svregex=string)
678703 When printing DIEs
679 for each tag value or attribute name where the 'string' reqular
704 for each tag value or attribute name where the 'string' regular
680705 expression matches print the compilation unit information
681706 and its section offset.
682707 Any CU with no match is not printed.
774799 The abi is read as a URI string.
775800
776801 .TP
777 .BR \--format-group=<n>\ (\-x\ groupnumber=<n>)
802 .BR \--format-group-number=<n>\ (\-x\ groupnumber=<n>)
778803 For an object file with both DWARF5 split
779804 dwarf (.debug_info.dwo
780805 for example) and ordinary
781806 DWARF sections (.debug_info for example)
782807 in the single object file
783808 one must use
784 .BR \--format-group=2
809 .BR \--format-group-number=2
785810 to print the dwo sections.
786811 Adding
787812 .BR \--file-tied=<path>
891916 .SH NOTES
892917 In some cases compilers use DW_FORM_data1 (for example)
893918 and in such cases the signedness of the value must be taken
894 from context. Rather than attempt to determine the
895 context, dwarfdump prints the value with both signednesses
919 from context.
920 Rather than attempt to determine the
921 context, dwarfdump prints the value with both signedness
896922 whenever there is ambiguity about the correct interpretation.
897923 For example,
898924 "DW_AT_const_value 176(as signed = -80)".
901927 the ambiguity for dwarfdump is due to dwarfdump evaluating
902928 DIEs in a simple order and not keeping track of much context.
903929 .SH BUGS
904 Support for DWARF5 is being completed but may not be complete.
930 Support for printing certain DWARF5 location expressions is
931 incomplete.
932 Report problems to libdwarf-list -at- linuxmail -dot- org
3232 Boston, MA 02110-1301, USA.
3333 SGI has moved from the Crittenden Lane address.
3434 */
35
3635 #include "globals.h"
3736 /* for 'open' */
37 #ifdef SYS_TYPES_H
3838 #include <sys/types.h>
39 #endif /* SYS_TYPES_H */
40 #ifdef SYS_STAT_H
3941 #include <sys/stat.h>
42 #endif /* SYS_STAT_H */
4043 #include <fcntl.h>
4144 #include <limits.h>
4245 #ifdef HAVE_UNISTD_H
19881991
19891992 esb_empty_string(&esb_long_cu_name);
19901993 ares = get_attr_value(dbg, DW_TAG_compile_unit,
1991 cu_die, dieprint_cu_offset,
1994 cu_die, /* die_indent */ 0, dieprint_cu_offset,
19921995 name_attr, NULL, 0, &esb_long_cu_name,
19931996 0 /*show_form_used*/,0 /* verbose */,lerr);
19941997 if (ares != DW_DLV_OK) {
20532056 }
20542057 /* DW_DLV_OK */
20552058 ares = get_attr_value(dbg, DW_TAG_compile_unit,
2056 cu_die, dieprint_cu_offset,
2059 cu_die,/* die_indent*/ 0, dieprint_cu_offset,
20572060 producer_attr, NULL, 0, producernameout,
20582061 0 /*show_form_used*/,0 /* verbose */,err);
20592062 dwarf_dealloc_attribute(producer_attr);
00 # MIPS/IRIX ISA/ABI
11 # Used to configure dwarfdump printing of .debug_frame and
22 # .eh_frame.
3
4 # To always format DWARF expressions blocks as all operations on
5 # one line (a limited version of -d (--format-dense))
6 # without needing to use the dwarfdump option
7 # --format-expr-ops-joined explicitly,
8 # remove the # from the following line.
9 #option: --format-expr-ops-joined
310
411 # Any number of abi's can be described. Only one can be selected
512 # in a given dwarfdump run (see dwarfdump options)
2626
2727 */
2828
29 /* Windows specific */
3029 #include "config.h"
30 #include "globals.h"
3131 #include "esb.h"
3232
3333 /* Windows specific header files */
7171 LT_REG_TABLE_SIZE,
7272 LT_ADDRESS_SIZE,
7373 LT_INCLUDEABI,
74 LT_ENDABI
74 LT_ENDABI,
75 LT_OPTION
7576 };
7677
7778 struct comtable_s {
9495 static char name_address_size[] = "address_size:";
9596 static char name_includeabi[] = "includeabi:";
9697 static char name_endabi[] = "endabi:";
98 static char name_option[] = "option:";
9799
98100 /* The namelen field is filled in at runtime with
99101 the correct value. Filling in a fake '1' avoids
110112 {LT_ADDRESS_SIZE, name_address_size,1},
111113 {LT_INCLUDEABI, name_includeabi,1},
112114 {LT_ENDABI, name_endabi,1},
115 {LT_OPTION, name_option,1},
113116 };
114117
115118 struct conf_internal_s {
145148 s->conf_out = conf_out;
146149 }
147150
148 static unsigned size_of_comtable = sizeof(comtable) / sizeof(comtable[0]);
151 static unsigned size_of_comtable = sizeof(comtable) /
152 sizeof(comtable[0]);
149153
150154 static FILE *find_a_file(const char *named_file, char **defaults,
151155 const char** name_used);
152 static int find_abi_start(FILE * stream, const char *abi_name, long *offset,
156 static int find_abi_start(FILE * stream, const char *abi_name,
157 long *offset,
153158 unsigned long *lineno_out);
154 static int parse_abi(FILE * stream, const char *fname, const char *abiname,
155 struct conf_internal_s *out, unsigned long lineno, unsigned nest_level);
159 static int parse_abi(FILE * stream, const char *fname,
160 const char *abiname,
161 struct conf_internal_s *out, unsigned long lineno,
162 unsigned nest_level);
156163 static char *get_token(char *cp, struct token_s *outtok);
157164
158165 /* This finds a dwarfdump.conf file and
164171 If the first file it finds does not have that ABI entry it
165172 gives up.
166173
167 It would also be reasonable to search every 'dwarfdump.conf'
168 it finds for the abi. But we stop at the first dwarfdump.conf
174 It would also be reasonable to search every
175 'dwarfdump.conf'
176 it finds for the abi.
177 But we stop at the first dwarfdump.conf
169178 we find.
170 This is the internal call to get the conf data to implement
179 This is the internal call to get the
180 conf data to implement
171181 a crude 'includeabi' feature.
182
183 Each call here starts at offset 0 of
184 a new stream.
172185
173186 Returns 0 if no errors found, else returns > 0.
174187 */
187200
188201 errcount = 0;
189202
190 conf_stream = find_a_file(named_file, conf_internal->conf_defaults,
203 conf_stream = find_a_file(named_file,
204 conf_internal->conf_defaults,
191205 &name_used);
192206 if (!conf_stream) {
193207 ++errcount;
194208 printf("dwarfdump found no file %s!\n",
195209 named_file ? named_file : "readable for configuration. "
196210 "(add options -v -v to see what file names tried)\n");
197 return errcount;
198 }
199 if (glflags.verbose > 1) {
211 return FOUND_ERROR;
212 }
213 if (glflags.verbose > 6) {
200214 printf("dwarfdump using configuration file %s\n", name_used);
201215 }
202216 conf_internal->conf_name_used = name_used;
203217
218 /* And option: lines must come before any abi data. */
204219 res = find_abi_start(conf_stream, named_abi, &offset, &lineno);
205 if (errcount > 0 || res == FALSE) {
220 if (res == FOUND_DONE ||res == FOUND_OPTION) {
221 /* nothing more to do */
222 fclose(conf_stream);
223 return FOUND_DONE;
224 }
225 if (res == FOUND_ERROR) {
206226 ++errcount;
207227 fclose(conf_stream);
208 printf("dwarfdump found no ABI %s in file %s.\n",
209 named_abi, name_used);
210 return errcount;
211 }
228 printf("dwarfdump found no usable abi %s in file %s.\n",
229 named_abi?named_abi:"<not looking for abi>",
230 name_used);
231 return FOUND_ERROR;
232 }
233 /* res == FOUND_ABI_START */
212234 res = fseek(conf_stream, offset, SEEK_SET);
213235 if (res != 0) {
214236 ++errcount;
215237 fclose(conf_stream);
216238 printf("dwarfdump seek to %ld offset in %s failed!\n",
217239 offset, name_used);
218 return errcount;
240 return FOUND_ERROR;
219241 }
220242 parse_abi(conf_stream, name_used, named_abi,
221243 conf_internal, lineno,
222244 nest_level);
223245 fclose(conf_stream);
224 return errcount;
246 if (errcount) {
247 return FOUND_ERROR;
248 }
249 return FOUND_ABI_START;
225250 }
226251
227252 /* This is the external-facing call to get the conf data. */
370395 #endif /* BUILD_FOR_TEST */
371396
372397 if (lname && (strlen(lname) > 0)) {
373 /* Name given, just assume it is fully correct, try no other. */
398 /* Name given, just assume it is fully correct,
399 try no other. */
400 #ifdef BUILD_FOR_TEST
401 #endif /* BUILD_FOR_TEST */
402 printf("dwarfdump looking for"
403 " configuration as %s\n", lname);
404 #if 0
374405 if (glflags.verbose > 1) {
375 printf("dwarfdump looking for configuration as %s\n",
376 lname);
377 }
406 }
407 #endif
378408 fin = fopen(lname, type);
379409 if (fin) {
380410 *name_used = lname;
423453 }
424454 }
425455 #endif /* _WIN32 */
456 #ifdef BUILD_FOR_TEST
457 printf("dwarfdump looking for"
458 " configuration as %s\n", lname);
459 #endif /* BUILD_FOR_TEST */
460 #if 0
426461 if (glflags.verbose > 1) {
427 printf("dwarfdump looking for configuration as %s\n",
428 lname);
429 }
462 }
463 #endif
430464 fin = fopen(lname, type);
431465 if (fin) {
432466 *name_used = lname;
501535 unsigned long lineno = 0;
502536
503537 for (; !feof(stream);) {
504
505538 struct token_s tok;
506539 char *line = 0;
507540 long loffset = ftell(stream);
509542 line = fgets(buf, sizeof(buf), stream);
510543 ++lineno;
511544 if (!line) {
545 if (!abi_name) {
546 return FOUND_DONE;
547 }
512548 ++errcount;
513 return FALSE;
514 }
515
549 return FOUND_ERROR;
550 }
516551 line = get_token(buf, &tok);
517
518 if (strcmp(tok.tk_data, name_begin_abi) != 0) {
552 if (!strcmp(tok.tk_data, "option:")) {
553 get_token(line, &tok);
554 if (tok.tk_data && !strcmp(tok.tk_data,
555 "--format-expr-ops-joined")) {
556 /* print expr ops joined onto one line:
557 matching historical behavior. */
558 glflags.gf_expr_ops_joined = TRUE;
559 } else {
560 printf("ERROR: option command %s is not understood"
561 " giving up\n",tok.tk_data);
562 ++errcount;
563 return FOUND_ERROR;
564 }
519565 continue;
520566 }
567 if (strcmp(tok.tk_data, "beginabi:")) {
568 continue;
569 }
570 /* Is beginabi: */
571 if (!abi_name) {
572 continue;
573 }
521574 get_token(line, &tok);
522 if (strcmp(tok.tk_data, abi_name) != 0) {
575 if (strcmp(tok.tk_data, abi_name)) {
523576 continue;
524577 }
525
526578 *offset = loffset;
527579 *lineno_out = lineno;
528 return TRUE;
529 }
530
580 return FOUND_ABI_START;
581 }
582 if (!abi_name) {
583 /* All is ok */
584 return FOUND_DONE;
585 }
531586 ++errcount;
532587 return FALSE;
533588 }
613668 return LT_ERROR;
614669 }
615670
671 static int
672 parseoption(char *cp, const char *fname,unsigned long lineno,
673 struct comtable_s *comtab)
674 {
675 size_t clen = comtab->namelen;
676 struct token_s tok;
677
678 cp = cp + clen + 1;
679 cp = skipwhite(cp);
680 get_token(cp, &tok);
681 if (!tok.tk_data) {
682 printf("ERROR: empty option: command is ignored");
683 return FALSE;
684 }
685 ensure_has_no_more_tokens(cp + tok.tk_len, fname, lineno);
686 if (!strcmp(tok.tk_data,"--format-expr-ops-joined")) {
687 glflags.gf_expr_ops_joined = TRUE;
688 } else {
689 printf("ERROR: option command %s is not understood"
690 " and is ignored",tok.tk_data);
691 return FALSE;
692 }
693 return TRUE;
694
695 }
616696 /* We are promised it's an abiname: command
617697 find the name on the line.
618698 */
629709 cp = skipwhite(cp);
630710 get_token(cp, &tok);
631711 if (tok.tk_len != abinamelen ||
632 strncmp(cp, abiname, abinamelen) != 0) {
712 strncmp(cp, abiname, abinamelen)) {
633713 printf("dwarfdump internal error: "
634 "mismatch %s with %s %s line %lu\n",
714 "mismatch \"%s\" with \"%s\" \"%s\" line %lu\n",
635715 cp, tok.tk_data, fname, lineno);
636716 ++errcount;
637717 return FALSE;
10451125 cp = cp + clen + 1;
10461126 cp = get_token(cp, &tok);
10471127 name = makename(tok.tk_data);
1048
10491128 *abiname_out = name;
10501129 res = ensure_has_no_more_tokens(cp, fname, lineno);
10511130 return res;
10771156 struct dwconf_s *localconf = conf_internal->conf_out;
10781157 char buf[1000];
10791158 int comtype = 0;
1080
10811159 static int first_time_done = 0;
10821160 struct comtable_s *comtabp = 0;
1161 int inourabi = FALSE;
10831162
10841163 if (nest_level > MAX_NEST_LEVEL) {
10851164 ++errcount;
1086 printf("dwarfdump.conf: includeabi nest too deep in %s at line %lu\n",
1165 printf("dwarfdump.conf: includeabi nest "
1166 "too deep in %s at line %lu\n",
10871167 fname, lineno);
10881168 return FALSE;
10891169 }
11011181 line = fgets(buf, sizeof(buf), stream);
11021182 if (!line) {
11031183 ++errcount;
1104 printf
1105 ("dwarfdump: end of file or error before endabi: in %s, line %lu\n",
1184 printf("dwarfdump: end of file or error"
1185 " before endabi: in %s, line %lu\n",
11061186 fname, lineno);
11071187 return FALSE;
11081188 }
11101190 line = skipwhite(line);
11111191 comtype = which_command(line, &comtabp);
11121192 switch (comtype) {
1193 case LT_OPTION:
1194 if (!inourabi) break;
1195 parseoption(line, fname, lineno,comtabp);
1196 break;
11131197 case LT_ERROR:
11141198 ++errcount;
11151199 printf
11291213 lineno, conf_internal->beginabi_lineno);
11301214 }
11311215 conf_internal->beginabi_lineno = lineno;
1132 parsebeginabi(line, fname, abiname, lineno, comtabp);
1216 inourabi = parsebeginabi(line, fname,
1217 abiname, lineno, comtabp);
11331218 break;
11341219
11351220 case LT_REG:
1221 if (!inourabi) break;
11361222 parsereg(line, fname, lineno, conf_internal, comtabp);
11371223 conf_internal->regcount++;
11381224 break;
11391225 case LT_FRAME_INTERFACE:
1226 if (!inourabi) break;
11401227 if (conf_internal->frame_interface_lineno > 0) {
11411228 ++errcount;
11421229 printf
11491236 lineno, conf_internal, comtabp);
11501237 break;
11511238 case LT_CFA_REG:
1239 if (!inourabi) break;
11521240 if (conf_internal->cfa_reg_lineno > 0) {
11531241 printf("dwarfdump: Encountered duplicate cfa_reg: "
11541242 "%s line %lu previous cfa_reg line %lu\n",
11591247 parsecfa_reg(line, fname, lineno, conf_internal, comtabp);
11601248 break;
11611249 case LT_INITIAL_REG_VALUE:
1250 if (!inourabi) break;
11621251 if (conf_internal->initial_reg_value_lineno > 0) {
11631252 printf
11641253 ("dwarfdump: Encountered duplicate initial_reg_value: "
11711260 lineno, conf_internal, comtabp);
11721261 break;
11731262 case LT_SAME_VAL_REG:
1263 if (!inourabi) break;
11741264 if (conf_internal->same_val_reg_lineno > 0) {
11751265 ++errcount;
11761266 printf
11831273 lineno, conf_internal, comtabp);
11841274 break;
11851275 case LT_UNDEFINED_VAL_REG:
1276 if (!inourabi) break;
11861277 if (conf_internal->undefined_val_reg_lineno > 0) {
11871278 ++errcount;
11881279 printf
11901281 "%s line %lu previous initial_reg_value: line %lu\n",
11911282 fname, lineno, conf_internal->initial_reg_value_lineno);
11921283 }
1284 if (!inourabi) break;
11931285 conf_internal->undefined_val_reg_lineno = lineno;
11941286 parseundefined_val_reg(line, fname,
11951287 lineno, conf_internal, comtabp);
11961288 break;
11971289 case LT_REG_TABLE_SIZE:
1290 if (!inourabi) break;
11981291 if (conf_internal->reg_table_size_lineno > 0) {
11991292 printf("dwarfdump: duplicate reg_table_size: "
12001293 "%s line %lu previous reg_table_size: line %lu\n",
12061299 lineno, conf_internal, comtabp);
12071300 break;
12081301 case LT_ENDABI:
1302 if (!inourabi) break;
12091303 parseendabi(line, fname, abiname, lineno, comtabp);
1210
1211 if (conf_internal->regcount > localconf->cf_table_entry_count) {
1304 if (conf_internal->regcount >
1305 localconf->cf_table_entry_count) {
12121306 printf("dwarfdump: more registers named than "
1213 " in %s ( %lu named vs %s %lu) %s line %lu\n",
1307 " in %s ( %lu named vs %s %lu)"
1308 " %s line %lu\n",
12141309 abiname, (unsigned long) conf_internal->regcount,
12151310 name_reg_table_size,
12161311 (unsigned long) localconf->cf_table_entry_count,
12171312 fname, (unsigned long) lineno);
12181313 ++errcount;
12191314 }
1315 inourabi = FALSE;
12201316 return TRUE;
12211317 case LT_ADDRESS_SIZE:
1318 if (!inourabi) break;
12221319 if (conf_internal->address_size_lineno > 0) {
12231320 printf("dwarfdump: duplicate address_size: "
1224 "%s line %lu previous address_size: line %lu\n",
1225 fname, lineno, conf_internal->address_size_lineno);
1321 "%s line %lu previous address_size:"
1322 " line %lu\n",
1323 fname, lineno,
1324 conf_internal->address_size_lineno);
12261325 ++errcount;
12271326 }
12281327 conf_internal->address_size_lineno = lineno;
12331332 char *abiname_inner = 0;
12341333 unsigned long abilno = conf_internal->beginabi_lineno;
12351334 int ires = 0;
1236 ires = parseincludeabi(line,fname,lineno, &abiname_inner,comtabp);
1335
1336 if (!inourabi) break;
1337 ires = parseincludeabi(line,fname,lineno,
1338 &abiname_inner,comtabp);
12371339 if (ires == FALSE) {
12381340 return FALSE;
12391341 }
1240 /* For the nested abi read, the abi line number must be
1241 set as if not-yet-read, and then restored. */
1342 /* For the nested abi read, the abi line
1343 number must be set as if not-yet-read
1344 and then restored. */
12421345 conf_internal->beginabi_lineno = 0;
1243 find_conf_file_and_read_config_inner(
1346 ires = find_conf_file_and_read_config_inner(
12441347 conf_internal->conf_name_used,
12451348 abiname_inner, conf_internal,nest_level+1);
1349 if (ires == FOUND_ERROR) {
1350 return ires;
1351 }
12461352 conf_internal->beginabi_lineno = abilno;
12471353 }
12481354 break;
12491355 default:
1250 printf
1251 ("dwarfdump internal error, impossible line type %d %s %lu \n",
1356 printf("dwarfdump internal error,"
1357 " impossible line type %d %s %lu \n",
12521358 (int) comtype, fname, lineno);
12531359 exit(1);
1254
12551360 }
12561361 }
12571362 ++errcount;
13151420 config_file_data->cf_config_file_path = "";
13161421 config_file_data->cf_interface_number = 3;
13171422 config_file_data->cf_table_entry_count = 100;
1423 #if 0
1424 printf("dadebug init generic 100 table entries\n");
1425 #endif
13181426 config_file_data->cf_initial_rule_value = DW_FRAME_UNDEFINED_VAL;
13191427 config_file_data->cf_cfa_reg = DW_FRAME_CFA_COL3;
13201428 config_file_data->cf_address_size = 0;
3131 #ifdef __cplusplus
3232 extern "C" {
3333 #endif /* __cplusplus */
34
35 #define FOUND_ABI_START 1
36 #define FOUND_OPTION 2
37 #define FOUND_ERROR 3
38 #define FOUND_DONE 4
3439
3540 /* Declarations helping configure the frame reader.
3641 We are not allowing negative register numbers.
200200 For strlen(in_string) > len bytes we take the initial len bytes.
201201 len does not include the trailing NUL. */
202202 static void
203 esb_appendn_internal(struct esb_s *data, const char * in_string, size_t len)
203 esb_appendn_internal(struct esb_s *data,
204 const char * in_string, size_t len)
204205 {
205206 size_t remaining = 0;
206207 size_t needed = len;
234235
235236 /* len >= strlen(in_string) */
236237 void
237 esb_appendn(struct esb_s *data, const char * in_string, size_t len)
238 esb_appendn(struct esb_s *data,
239 const char * in_string, size_t len)
238240 {
239241 size_t full_len = strlen(in_string);
240242
360362 static void
361363 esb_appendn_internal_spaces(struct esb_s *data,size_t l)
362364 {
363 static char spacebuf[] = {" "};
365 static char spacebuf[] =
366 {" "};
364367 size_t charct = sizeof(spacebuf)-1;
365368 while (l > charct) {
366369 esb_appendn_internal(data,spacebuf,charct);
373376 static void
374377 esb_appendn_internal_zeros(struct esb_s *data,size_t l)
375378 {
376 static char zeros[] = {"0000000000000000000000000000000000000000"};
379 static char zeros[] =
380 {"0000000000000000000000000000000000000000"};
377381 size_t charct = sizeof(zeros)-1;
378382 while (l > charct) {
379383 esb_appendn_internal(data,zeros,charct);
384388 }
385389
386390 void
387 esb_append_printf_s(struct esb_s *data,const char *format,const char *s)
391 esb_append_printf_s(struct esb_s *data,
392 const char *format,const char *s)
388393 {
389394 size_t stringlen = strlen(s);
390395 size_t next = 0;
479484 %u %5u %05u (and ld and lld too).
480485 %x %5x %05x (and ld and lld too). */
481486 void
482 esb_append_printf_u(struct esb_s *data,const char *format,esb_unsigned v)
487 esb_append_printf_u(struct esb_s *data,
488 const char *format,esb_unsigned v)
483489 {
484490 size_t next = 0;
485491 long val = 0;
653659 /* We deal with formats like:
654660 %d %5d %05d %+d %+5d (and ld and lld too). */
655661 void
656 esb_append_printf_i(struct esb_s *data,const char *format,esb_int v)
662 esb_append_printf_i(struct esb_s *data,
663 const char *format,esb_int v)
657664 {
658665 size_t next = 0;
659666 long val = 0;
828835 esb_appendn_internal(data,"-",1);
829836 esb_appendn_internal_zeros(data,prefixcount);
830837 digptr++;
831 esb_appendn_internal(data,digptr,digcharlen-1);
838 esb_appendn_internal(data,
839 digptr,digcharlen-1);
832840 } else if (*digptr == '+') {
833841 esb_appendn_internal(data,"+",1);
834842 esb_appendn_internal_zeros(data,prefixcount);
835843 digptr++;
836 esb_appendn_internal(data,digptr,digcharlen-1);
844 esb_appendn_internal(data,
845 digptr,digcharlen-1);
837846 } else {
838847 esb_appendn_internal_zeros(data,prefixcount);
839848 esb_appendn_internal(data,digptr,digcharlen);
9797 void esb_append(struct esb_s *data, const char * in_string);
9898
9999 /* The 'len' is believed. Do not pass in strings < len bytes long. */
100 void esb_appendn(struct esb_s *data, const char * in_string, size_t len);
100 void esb_appendn(struct esb_s *data,
101 const char * in_string, size_t len);
101102
102103 /* Always returns an empty string or a non-empty string. Never 0. */
103104 char * esb_get_string(struct esb_s *data);
116117 /* *data is presumed to contain garbage, not values, and
117118 is properly initialized. */
118119 void esb_constructor(struct esb_s *data);
119 void esb_constructor_rigid(struct esb_s *data,char *buf,size_t buflen);
120 void esb_constructor_fixed(struct esb_s *data,char *buf,size_t buflen);
120 void esb_constructor_rigid(struct esb_s *data,
121 char *buf,size_t buflen);
122 void esb_constructor_fixed(struct esb_s *data,
123 char *buf,size_t buflen);
121124
122125 void esb_force_allocation(struct esb_s *data, size_t minlen);
123126
126129
127130
128131 /* To get all paths in the code tested, this sets the
129 allocation/reallocation to the given value, which can be quite small
132 allocation/reallocation to the given value,
133 which can be quite small
130134 but must not be zero. */
131135 void esb_alloc_size(size_t size);
132136 size_t esb_get_allocated_size(struct esb_s *data);
133137
134138 /* Append a formatted string */
135139 void esb_append_printf(struct esb_s *data,const char *format, ...);
136 void esb_append_printf_s(struct esb_s *data,const char *format,const char *s);
137 void esb_append_printf_i(struct esb_s *data,const char *format,esb_int);
138 void esb_append_printf_u(struct esb_s *data,const char *format,esb_unsigned);
140 void esb_append_printf_s(struct esb_s *data,
141 const char *format,const char *s);
142 void esb_append_printf_i(struct esb_s *data,
143 const char *format,esb_int);
144 void esb_append_printf_u(struct esb_s *data,
145 const char *format,esb_unsigned);
139146
140147 /* Get a copy of the internal data buffer */
141148 char * esb_get_copy(struct esb_s *data);
4646
4747 int get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
4848 Dwarf_Die die,
49 int die_indent_level,
4950 Dwarf_Off die_cu_offset,
5051 Dwarf_Attribute attrib,
5152 char **srcfiles,
5657 void format_sig8_string(Dwarf_Sig8 *data,struct esb_s *out);
5758
5859 int dwarfdump_print_location_operations(Dwarf_Debug dbg,
60 Dwarf_Die die,
61 int die_indent_level,
5962 Dwarf_Locdesc * llbuf, /* 2014 interface */
6063 Dwarf_Locdesc_c locs, /* 2015 interface */
6164 Dwarf_Unsigned llent, /* Which locdesc is this */
6265 Dwarf_Unsigned entrycount, /* count of DW_OP operators */
6366 Dwarf_Small lkind,
64 int die_indent_level,
67 int no_ending_newlines,
6568 Dwarf_Addr baseaddr,
6669 struct esb_s *string_out,
6770 Dwarf_Error *err);
7578 #ifdef __cplusplus
7679 }
7780 #endif
78 #endif /* ESB_USING_FUNCTIONS_H */
81 #endif /* ESi_USING_FUNCTIONS_H */
142142
143143 glflags.gf_print_unique_errors = FALSE;
144144 glflags.gf_found_error_message = FALSE;
145 glflags.gf_print_raw_rnglists = FALSE;
146
147
145
146 /* if TRUE, use old behavior of all expr ops joined on one line*/
147 glflags.gf_expr_ops_joined = FALSE;
148
149 glflags.gf_print_raw_rnglists = FALSE;
148150 glflags.gf_check_names = FALSE;
149151
150152 /* During '-k' mode, display errors */
182184 glflags.gf_display_children_tree = FALSE;
183185 glflags.gf_stop_indent_level = 0;
184186
187 /* 10 is sort of arbitrary, it tries to keep
188 the indentation sane ( a 500 level DIE tree
189 is just too much to represent with prefix
190 spaces).*/
191 glflags.gf_max_space_indent = 10;
185192 /* Print search results in wide format? */
186193 glflags.gf_search_wide_format = FALSE;
187194 /* -S option: strings for 'any' and 'match' */
225225 /* Avoid some unneccesary work lookup by address. */
226226 char gf_all_cus_seen_search_by_address;
227227
228 /* Die indents >= this prefix an indent count instead
229 of actual spaces. */
230 int gf_max_space_indent;
231
228232 /* ====End searching for function name. */
229233
230234 /* Print search results in wide format? */
238242 boolean gf_show_global_offsets;
239243 boolean gf_display_offsets;
240244 boolean gf_print_str_offsets;
241
245 boolean gf_expr_ops_joined;
242246 boolean gf_print_raw_rnglists;
243247 boolean gf_print_raw_loclists;
244248
130130 extern void print_error (Dwarf_Debug dbg, const char * msg,int res, Dwarf_Error err);
131131
132132 extern int print_line_numbers_this_cu (Dwarf_Debug dbg,
133 Dwarf_Die in_die,Dwarf_Error *err);
133 Dwarf_Die in_die,
134 char **srcfiles,
135 Dwarf_Signed cnt,
136 Dwarf_Error *err);
134137
135138 extern int print_frames (Dwarf_Debug dbg,int want_eh,
136139 struct dwconf_s *,
154157 extern int print_weaknames(Dwarf_Debug dbg, Dwarf_Error *);
155158 extern int print_debug_names(Dwarf_Debug dbg,Dwarf_Error *);
156159 int print_debug_sup(Dwarf_Debug dbg, Dwarf_Error *error);
160 int print_all_abbrevs_for_cu(Dwarf_Debug dbg,
161 Dwarf_Unsigned offset,
162 Dwarf_Unsigned abbrev_num_in,
163 Dwarf_Unsigned *length_out,
164 Dwarf_Unsigned *abbrev_num_out,
165 Dwarf_Error *error);
166
157167
158168 int print_all_pubnames_style_records(Dwarf_Debug dbg,
159169 const char * linetitle,
223233 extern void DWARF_CHECK_ERROR3(Dwarf_Check_Categories category,
224234 const char *str1, const char *str2, const char *strexpl);
225235
226 extern int print_macinfo_by_offset(Dwarf_Debug dbg,Dwarf_Unsigned offset,Dwarf_Error *);
236 extern int print_macinfo_by_offset(Dwarf_Debug dbg,
237 Dwarf_Die cudie,Dwarf_Unsigned offset,Dwarf_Error *);
227238
228239 void ranges_esb_string_destructor(void);
229240 void destruct_abbrev_array(void);
244255 void safe_strcpy(char *out, long outlen, const char *in, long inlen);
245256
246257 int print_macros_5style_this_cu(Dwarf_Debug dbg, Dwarf_Die cu_die,
258 char **srcfiles,
259 Dwarf_Signed cnt,
247260 Dwarf_Bool in_import_list, Dwarf_Unsigned offset,Dwarf_Error *);
248261
249262 /* Detailed attributes encoding space */
266279 int line, char *filename);
267280
268281 int _dwarf_print_one_expr_op(Dwarf_Debug dbg,
282 Dwarf_Die die,
283 int die_indent_level,
269284 Dwarf_Loc* expr,
270285 Dwarf_Locdesc_c exprc,
271286 int index,
343358 int print_hipc_lopc_attribute(Dwarf_Debug dbg,
344359 Dwarf_Half tag,
345360 Dwarf_Die die,
361 int die_indent_level,
346362 Dwarf_Unsigned dieprint_cu_goffset,
347363 char ** srcfiles,
348364 Dwarf_Signed cnt,
356372 struct esb_s *valname,
357373 Dwarf_Error *err);
358374
359
360
361
362375 #ifdef __cplusplus
363376 }
364377 #endif
4646
4747 /* The following relevent for one specific Linker. */
4848 #define SNLINKER_MAX_ATTRIB_COUNT 16
49 /* a warning limit which is arbitrary but leaves a bit more flexibility. */
49 /* a warning limit which is arbitrary but
50 leaves a bit more flexibility. */
5051 #define GENERAL_MAX_ATTRIB_COUNT 32
5152
5253 /* Print data in .debug_abbrev
154155 "Duplicated attribute in abbrevs ");
155156 esb_destructor(&msg);
156157 }
157
158 extern int
158 static int
159 print_one_abbrev_for_cu(Dwarf_Debug dbg,
160 Dwarf_Unsigned offset,
161 Dwarf_Unsigned abbrev_num_in,
162 Dwarf_Unsigned *length_out,
163 Dwarf_Unsigned *abbrev_num_out,
164 Dwarf_Error * error)
165 {
166 const char *tagname = "";
167 struct abbrev_entry_s *entryarray =0;
168 unsigned entryarray_size = 0;
169 Dwarf_Unsigned abbrev_entry_count = 0;
170 Dwarf_Unsigned abbrev_code = 0;
171 Dwarf_Half tag = 0;
172 Dwarf_Unsigned length = 0;
173 int acres = 0;
174 Dwarf_Abbrev ab = 0;
175 int tres = 0;
176 Dwarf_Unsigned abbrev_num = abbrev_num_in;
177 Dwarf_Signed child_flag = 0;
178 int abres = 0;
179 Dwarf_Unsigned i = 0;
180
181 abres = dwarf_get_abbrev(dbg, offset, &ab,
182 &length, &abbrev_entry_count, error);
183 if (abres == DW_DLV_ERROR) {
184 return abres;
185 }
186 if (abres == DW_DLV_NO_ENTRY) {
187 return abres;
188 }
189 /* Here offset is the global offset in .debug_abbrev.
190 The abbrev_num is a relatively worthless counter
191 of all abbreviations. */
192 tres = dwarf_get_abbrev_tag(ab, &tag, error);
193 if (tres == DW_DLV_ERROR) {
194 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
195 print_error_and_continue(dbg,
196 "Error reading abbreviation Tag", tres, *error);
197 return tres;
198 }
199 tres = dwarf_get_abbrev_code(ab, &abbrev_code, error);
200 if (tres != DW_DLV_OK) {
201 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
202 print_error_and_continue(dbg,
203 "Error reading abbreviation code",
204 tres, *error);
205 return tres;
206 }
207 if (!tag) {
208 /* This means we are done with this abbrev set,
209 abbrev for entire CU. */
210 tagname = "Abbrev 0: null abbrev entry";
211 } else {
212 tagname = get_TAG_name(tag,dwarf_names_print_on_error);
213 }
214 if ( glflags.gf_do_print_dwarf) {
215 if (glflags.dense) {
216 printf("<%" DW_PR_DUu "><0x%" DW_PR_XZEROS DW_PR_DUx
217 "><code: %" DW_PR_DUu ">",
218 abbrev_num, offset,abbrev_code);
219 if (glflags.verbose) {
220 printf("<length: 0x%" DW_PR_XZEROS DW_PR_DUx ">",
221 length);
222 }
223 printf(" %s", tagname);
224 }
225 else {
226 printf("<%5" DW_PR_DUu "><0x%" DW_PR_XZEROS DW_PR_DUx
227 "><code: %3" DW_PR_DUu ">",
228 abbrev_num, offset, abbrev_code);
229 if (glflags.verbose) {
230 printf("<length: 0x%" DW_PR_XZEROS DW_PR_DUx ">",
231 length);
232 }
233 printf(" %-27s", tagname);
234 }
235 }
236 /* Process specific TAGs specially. */
237 tag_specific_checks_setup(dbg,tag,0);
238 ++abbrev_num;
239 acres = dwarf_get_abbrev_children_flag(ab, &child_flag,
240 error);
241 if (acres == DW_DLV_ERROR) {
242 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
243 print_error_and_continue(dbg,
244 "Error reading abbreviation children flag",
245 acres, *error);
246 return acres;
247 }
248 if (acres == DW_DLV_NO_ENTRY) {
249 child_flag = 0;
250 }
251 /* If tag is zero, it is a null byte, not a real abbreviation,
252 so there is no 'children' flag to print. */
253 if (tag && glflags.gf_do_print_dwarf) {
254 const char * child_name = 0;
255
256 child_name = get_children_name(child_flag,
257 dwarf_names_print_on_error);
258 printf(" %s", child_name);
259 }
260 if (!glflags.dense) {
261 if ( glflags.gf_do_print_dwarf) {
262 printf("\n");
263 }
264 }
265 if (abbrev_entry_count < 1) {
266 if (tag && glflags.gf_do_print_dwarf) {
267 printf(" This abbreviation code has no entries\n");
268 }
269 if (length == 0 || length == 1 ) {
270 if ( glflags.gf_do_print_dwarf && glflags.dense ) {
271 printf("\n");
272 }
273 *length_out = length;
274 *abbrev_num_out = abbrev_num;
275 /* printed null abrev name above */
276 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
277 return DW_DLV_OK;
278 }
279 }
280 /* Abbrev contains the format of a die,
281 which debug_info then points to with the
282 real data. So here we just print the
283 given format. */
284 entryarray_size = abbrev_entry_count;
285 entryarray = calloc(entryarray_size,
286 sizeof(struct abbrev_entry_s));
287 if (!entryarray) {
288 printf( "%s ERROR: Malloc of %u abbrev_entry_s"
289 " structs failed. Near section global offset 0x%"
290 DW_PR_DUx " .\n",
291 glflags.program_name,entryarray_size,offset);
292 entryarray_size = 0;
293 }
294 for (i = 0; i < abbrev_entry_count ; i++) {
295 int aeres = 0;
296 Dwarf_Bool dofilter = FALSE;
297 Dwarf_Unsigned form = 0;
298 struct abbrev_entry_s *aep = entryarray+i;
299 Dwarf_Unsigned attr = 0;
300 Dwarf_Signed impl_const = 0;
301 Dwarf_Off off = 0;
302
303 aeres = dwarf_get_abbrev_entry_b(ab, i,
304 dofilter,&attr, &form,&impl_const, &off,
305 error);
306 if (aeres == DW_DLV_ERROR) {
307 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
308 free(entryarray);
309 print_error_and_continue(dbg,
310 "Error reading abbreviation entry",
311 aeres, *error);
312 return aeres;
313 }
314 aep->ae_number = i;
315 aep->ae_attr = attr;
316 aep->ae_form = form;
317 aep->ae_offset = off;
318 aep->ae_impl_const = impl_const;
319 if (glflags.gf_do_print_dwarf) {
320 char buf [80];
321 struct esb_s m;
322
323 buf[0] = 0;
324 esb_constructor_fixed(&m,buf,sizeof(buf));
325 if (form == DW_FORM_implicit_const) {
326 esb_append_printf_i(&m,
327 " <%d",impl_const);
328 esb_append_printf_u(&m,
329 " (0x%x)>",
330 impl_const);
331 }
332 if (glflags.dense) {
333 printf(" <%ld>%s<%s>%s", (unsigned long) off,
334 get_AT_name(attr,dwarf_names_print_on_error),
335 get_FORM_name((Dwarf_Half) form,
336 dwarf_names_print_on_error),
337 esb_get_string(&m));
338 } else if (!esb_string_len(&m)) {
339 printf(" <0x%08lx> %-28s%s\n",
340 (unsigned long) off,
341 get_AT_name(attr,
342 dwarf_names_print_on_error),
343 get_FORM_name((Dwarf_Half) form,
344 dwarf_names_print_on_error));
345 } else {
346 printf(" <0x%08lx>"
347 " %-28s%-20s%s\n",
348 (unsigned long) off,
349 get_AT_name(attr,
350 dwarf_names_print_on_error),
351 get_FORM_name((Dwarf_Half) form,
352 dwarf_names_print_on_error),
353 esb_get_string(&m));
354 }
355 esb_destructor(&m);
356 }
357 }
358 if (glflags.gf_check_abbreviations &&
359 entryarray_size > 0) {
360 unsigned l = 0;
361 struct abbrev_entry_s *lastaep = 0;
362
363 DWARF_CHECK_COUNT(abbreviations_result,1);
364 qsort((void *)entryarray,entryarray_size,
365 sizeof(struct abbrev_entry_s),ab_compare);
366
367 for (l = 0; l < entryarray_size ; ++l) {
368 struct abbrev_entry_s *aep = entryarray+l;
369
370 if (attr_unknown(aep->ae_attr) ) {
371 struct esb_s msg;
372
373 esb_constructor(&msg);
374 esb_append_printf_u(&msg,
375 "Attribute "
376 "0x%" DW_PR_XZEROS DW_PR_DUx ,
377 aep->ae_attr);
378 esb_append_printf_u(&msg,
379 " near offset "
380 "0x%" DW_PR_XZEROS DW_PR_DUx "." ,
381 aep->ae_offset);
382 DWARF_CHECK_ERROR2(abbreviations_result,
383 "Attr number unknown",
384 esb_get_string(&msg));
385 esb_destructor(&msg);
386 }
387 if (!is_valid_form_we_know(aep->ae_form)){
388 struct esb_s msg;
389
390 esb_constructor(&msg);
391 esb_append_printf_u(&msg,
392 "Form "
393 "0x%" DW_PR_XZEROS DW_PR_DUx,
394 aep->ae_form);
395 esb_append_printf_u(&msg,
396 " near offset "
397 "0x%" DW_PR_XZEROS DW_PR_DUx ".",
398 aep->ae_offset);
399 DWARF_CHECK_ERROR2(abbreviations_result,
400 "Form number unknown",
401 esb_get_string(&msg));
402 esb_destructor(&msg);
403 }
404 if (l == 0) {
405 lastaep = aep;
406 } else if (lastaep->ae_attr == aep->ae_attr) {
407 lastaep->ae_dupcount++;
408 } else {
409 if (lastaep->ae_dupcount) {
410 printdupab(lastaep);
411 }
412 lastaep = aep;
413 }
414 }
415 if (lastaep->ae_dupcount) {
416 printdupab(lastaep);
417 }
418 }
419 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
420 free(entryarray);
421 entryarray = 0;
422 entryarray_size = 0;
423 *length_out = length;
424 *abbrev_num_out = abbrev_num;
425 if (glflags.gf_do_print_dwarf && glflags.dense) {
426 printf("\n");
427 }
428 return DW_DLV_OK;
429 }
430
431 int
432 print_all_abbrevs_for_cu(Dwarf_Debug dbg,
433 Dwarf_Unsigned offset,
434 Dwarf_Unsigned abbrev_num_in,
435 Dwarf_Unsigned *length_out,
436 Dwarf_Unsigned *abbrev_num_out,
437 Dwarf_Error *error)
438 {
439 Dwarf_Unsigned total_len = 0;
440 int pres = 0;
441 Dwarf_Unsigned loopcount = 0;
442 /* We have always printed the abbrev_num starting with 1.
443 Unclear why. */
444 Dwarf_Unsigned abbrev_num = abbrev_num_in;
445 Dwarf_Unsigned abbrev_num_ret = abbrev_num_in;
446
447 for ( ; ;++loopcount ) {
448 Dwarf_Unsigned local_len = 0;
449
450 abbrev_num = abbrev_num_ret;
451 pres = print_one_abbrev_for_cu(dbg,offset,
452 abbrev_num,
453 &local_len,&abbrev_num_ret,error);
454 if (pres == DW_DLV_ERROR) {
455 return pres;
456 }
457 if (pres == DW_DLV_NO_ENTRY) {
458 if (loopcount) {
459 /* This is an incomplete final entry,
460 the trailing NUL byte for a CU
461 abbrev set is missing
462 as of end of section. */
463 printf("ERROR: The final .debug_abbrev "
464 "abbreviation ends without its required "
465 "final NUL byte. A harmless error at "
466 "section offset 0x%"
467 DW_PR_XZEROS DW_PR_DUx
468 ".",offset);
469 glflags.gf_count_major_errors++;
470 return pres;
471 }
472 return pres;
473 }
474 total_len += local_len;
475 if (local_len == 1) {
476 /* last of a CU data printed */
477 *abbrev_num_out = abbrev_num_ret;
478 *length_out = total_len;
479 return DW_DLV_OK;
480 }
481 offset += local_len;
482 }
483 *abbrev_num_out = abbrev_num_ret;
484 *length_out = total_len;
485 return DW_DLV_OK;
486 }
487
488 int
159489 print_abbrevs(Dwarf_Debug dbg,Dwarf_Error* paerr)
160490 {
161 Dwarf_Abbrev ab;
491 Dwarf_Abbrev ab = 0;
162492 Dwarf_Unsigned offset = 0;
163 Dwarf_Off off = 0;
164 Dwarf_Unsigned i = 0;
493 int abres = 0;
494 int tres = 0;
495 unsigned loopct = 0;
496 Dwarf_Unsigned length = 0;
497 Dwarf_Unsigned unused_entry_count = 0;
165498 Dwarf_Unsigned abbrev_num = 1;
166 Dwarf_Signed child_flag = 0;
167 int abres = 0;
168 int tres = 0;
169 int acres = 0;
170 unsigned loopct = 0;
171 char const_integer_string[60];
499 Dwarf_Unsigned abbrev_num_ret = 1;
172500
173501 glflags.current_section_id = DEBUG_ABBREV;
502 /* Doing this just to print the section name */
503 abres = dwarf_get_abbrev(dbg, offset, &ab,
504 &length, &unused_entry_count, paerr);
505 {
506 /* Do this after a dwarf_get_abbrev()
507 so the section is loaded and uncompressed
508 if necessary. We get information printed
509 about the compression (if any) this way. */
510 print_secname(dbg,".debug_abbrev");
511 }
512 if (abres == DW_DLV_OK) {
513 /* discard what we got. */
514 dwarf_dealloc(dbg,ab, DW_DLA_ABBREV);
515 ab = 0;
516 } else if (abres == DW_DLV_ERROR) {
517 dwarf_dealloc_error(dbg,*paerr);
518 *paerr = 0;
519 }
520
174521
175522 for (loopct = 0; ; ++loopct) {
176 const char *tagname = "";
177 struct abbrev_entry_s *entryarray =0;
178 unsigned entryarray_size = 0;
179 Dwarf_Unsigned abbrev_entry_count = 0;
180 Dwarf_Unsigned abbrev_code = 0;
181 Dwarf_Half tag = 0;
182 Dwarf_Unsigned length = 0;
183
184 abres = dwarf_get_abbrev(dbg, offset, &ab,
185 &length, &abbrev_entry_count, paerr);
186 if (!loopct) {
187 /* Do this here (not before the loop)
188 so the section is loaded and uncompressed
189 if necessary. We get information printed
190 about the compression (if any) this way. */
191 print_secname(dbg,".debug_abbrev");
192 }
193 if (abres == DW_DLV_ERROR) {
194 return abres;
195 }
196 if (abres == DW_DLV_NO_ENTRY) {
197 return abres;
198 }
199 /* Here offset is the global offset in .debug_abbrev.
200 The abbrev_num is a relatively worthless counter
201 of all abbreviations. */
202 tres = dwarf_get_abbrev_tag(ab, &tag, paerr);
523 tres = print_all_abbrevs_for_cu(dbg,offset,
524 abbrev_num,&length,&abbrev_num_ret,paerr);
525 if (tres == DW_DLV_NO_ENTRY) {
526 if (loopct > 0) {
527 return DW_DLV_OK;
528 }
529 return DW_DLV_NO_ENTRY;
530 }
203531 if (tres == DW_DLV_ERROR) {
204 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
205 print_error_and_continue(dbg,
206 "Error reading abbreviation Tag", tres, *paerr);
207532 return tres;
208533 }
209 tres = dwarf_get_abbrev_code(ab, &abbrev_code, paerr);
210 if (tres != DW_DLV_OK) {
211 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
212 print_error_and_continue(dbg,
213 "Error reading abbreviation code",
214 tres, *paerr);
215 paerr = 0;
216 abbrev_code = 0;
217 return tres;
218 }
219 if (!tag) {
220 tagname = "Abbrev 0: null abbrev entry";
221 } else {
222 tagname = get_TAG_name(tag,dwarf_names_print_on_error);
223 }
224 if ( glflags.gf_do_print_dwarf) {
225 if (glflags.dense) {
226 printf("<%" DW_PR_DUu "><0x%" DW_PR_XZEROS DW_PR_DUx
227 "><code: %" DW_PR_DUu ">",
228 abbrev_num, offset,abbrev_code);
229 if (glflags.verbose) {
230 printf("<length: 0x%" DW_PR_XZEROS DW_PR_DUx ">",
231 length);
232 }
233 printf(" %s", tagname);
234 }
235 else {
236 printf("<%5" DW_PR_DUu "><0x%" DW_PR_XZEROS DW_PR_DUx
237 "><code: %3" DW_PR_DUu ">",
238 abbrev_num, offset, abbrev_code);
239 if (glflags.verbose) {
240 printf("<length: 0x%" DW_PR_XZEROS DW_PR_DUx ">",
241 length);
242 }
243 printf(" %-27s", tagname);
244 }
245 }
246 /* Process specific TAGs specially. */
247 tag_specific_checks_setup(dbg,tag,0);
248 ++abbrev_num;
249 acres = dwarf_get_abbrev_children_flag(ab, &child_flag,
250 paerr);
251 if (acres == DW_DLV_ERROR) {
252 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
253 print_error_and_continue(dbg,
254 "Error reading abbreviation children flag",
255 acres, *paerr);
256 return acres;
257 }
258 if (acres == DW_DLV_NO_ENTRY) {
259 child_flag = 0;
260 }
261 /* If tag is zero, it is a null byte, not a real abbreviation,
262 so there is no 'children' flag to print. */
263 if (tag && glflags.gf_do_print_dwarf) {
264 const char * child_name = 0;
265
266 child_name = get_children_name(child_flag,
267 dwarf_names_print_on_error);
268 printf(" %s", child_name);
269 }
270 if(!glflags.dense) {
271 if ( glflags.gf_do_print_dwarf) {
272 printf("\n");
273 }
274 }
275 if (abbrev_entry_count < 1) {
276 if(tag) {
277 printf(" This abbreviation code has no entries\n");
278 }
279 if (length == 0 || length == 1 ) {
280 if ( glflags.gf_do_print_dwarf && glflags.dense ) {
281 printf("\n");
282 }
283 if (!length) {
284 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
285 break;
286 }
287 }
288 /* printed null abrev name above */
289 offset += length;
290 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
291 continue;
292 }
293 /* Abbrev contains the format of a die,
294 which debug_info then points to with the
295 real data. So here we just print the
296 given format. */
297 entryarray_size = abbrev_entry_count;
298 entryarray = calloc(entryarray_size,
299 sizeof(struct abbrev_entry_s));
300 if (!entryarray) {
301 printf( "%s ERROR: Malloc of %u abbrev_entry_s"
302 " structs failed. Near section global offset 0x%"
303 DW_PR_DUx " .\n",
304 glflags.program_name,entryarray_size,offset);
305 entryarray_size = 0;
306 }
307 for (i = 0; i < abbrev_entry_count ; i++) {
308 int aeres = 0;
309 Dwarf_Bool dofilter = FALSE;
310 Dwarf_Unsigned form = 0;
311 struct abbrev_entry_s *aep = entryarray+i;
312 Dwarf_Unsigned attr = 0;
313 Dwarf_Signed impl_const = 0;
314
315 aeres = dwarf_get_abbrev_entry_b(ab, i,
316 dofilter,&attr, &form,&impl_const, &off,
317 paerr);
318 if (aeres == DW_DLV_ERROR) {
319 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
320 free(entryarray);
321 print_error_and_continue(dbg,
322 "Error reading abbreviation entry",
323 aeres, *paerr);
324 return aeres;
325 }
326 aep->ae_number = i;
327 aep->ae_attr = attr;
328 aep->ae_form = form;
329 aep->ae_offset = off;
330 aep->ae_impl_const = impl_const;
331 if (glflags.gf_do_print_dwarf) {
332 const_integer_string[0] = 0;
333 if (form == DW_FORM_implicit_const) {
334 sprintf(const_integer_string,
335 " <%" DW_PR_DSd
336 " (0x%" DW_PR_DUx
337 ")>",impl_const,impl_const);
338 }
339 if (glflags.dense) {
340 printf(" <%ld>%s<%s>%s", (unsigned long) off,
341 get_AT_name(attr,dwarf_names_print_on_error),
342 get_FORM_name((Dwarf_Half) form,
343 dwarf_names_print_on_error),
344 const_integer_string);
345 } else if (!const_integer_string[0]) {
346 printf(" <0x%08lx> %-28s%s\n",
347 (unsigned long) off,
348 get_AT_name(attr,
349 dwarf_names_print_on_error),
350 get_FORM_name((Dwarf_Half) form,
351 dwarf_names_print_on_error));
352 } else {
353 printf(" <0x%08lx> %-28s%-20s%s\n",
354 (unsigned long) off,
355 get_AT_name(attr,
356 dwarf_names_print_on_error),
357 get_FORM_name((Dwarf_Half) form,
358 dwarf_names_print_on_error),
359 const_integer_string);
360 }
361 }
362 }
363 if (glflags.gf_check_abbreviations &&
364 entryarray_size > 0) {
365 unsigned l = 0;
366 struct abbrev_entry_s *lastaep = 0;
367
368 DWARF_CHECK_COUNT(abbreviations_result,1);
369 qsort((void *)entryarray,entryarray_size,
370 sizeof(struct abbrev_entry_s),ab_compare);
371
372 for(l = 0; l < entryarray_size ; ++l) {
373 struct abbrev_entry_s *aep = entryarray+l;
374
375 if (attr_unknown(aep->ae_attr) ) {
376 struct esb_s msg;
377
378 esb_constructor(&msg);
379 esb_append_printf_u(&msg,
380 "Attribute "
381 "0x%" DW_PR_XZEROS DW_PR_DUx ,
382 aep->ae_attr);
383 esb_append_printf_u(&msg,
384 " near offset "
385 "0x%" DW_PR_XZEROS DW_PR_DUx "." ,
386 aep->ae_offset);
387 DWARF_CHECK_ERROR2(abbreviations_result,
388 "Attr number unknown",
389 esb_get_string(&msg));
390 esb_destructor(&msg);
391 }
392 if (!is_valid_form_we_know(aep->ae_form)){
393 struct esb_s msg;
394
395 esb_constructor(&msg);
396 esb_append_printf_u(&msg,
397 "Form "
398 "0x%" DW_PR_XZEROS DW_PR_DUx,
399 aep->ae_form);
400 esb_append_printf_u(&msg,
401 " near offset "
402 "0x%" DW_PR_XZEROS DW_PR_DUx ".",
403 aep->ae_offset);
404 DWARF_CHECK_ERROR2(abbreviations_result,
405 "Form number unknown",
406 esb_get_string(&msg));
407 esb_destructor(&msg);
408 }
409 if (l == 0) {
410 lastaep = aep;
411 } else if (lastaep->ae_attr == aep->ae_attr) {
412 lastaep->ae_dupcount++;
413 } else {
414 if (lastaep->ae_dupcount) {
415 printdupab(lastaep);
416 }
417 lastaep = aep;
418 }
419 }
420 if (lastaep->ae_dupcount) {
421 printdupab(lastaep);
422 }
423 }
424 dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
425 free(entryarray);
426 entryarray = 0;
427 entryarray_size = 0;
428 offset += length;
429 if (glflags.gf_do_print_dwarf && glflags.dense) {
430 printf("\n");
431 }
432 }
433 return DW_DLV_OK;
434 }
534 offset = offset+length;
535 abbrev_num = abbrev_num_ret;
536 }
537 }
538
435539
436540 /* Abbreviations array info for checking abbrev tags.
437541 The [zero] entry is not used.
471575 check_abbrev_num_sequence(Dwarf_Unsigned abbrev_code,
472576 Dwarf_Unsigned last_abbrev_code,
473577 UNUSEDARG Dwarf_Unsigned l_abbrev_array_size,
474 UNUSEDARG Dwarf_Unsigned abbrev_entry_count,
578 UNUSEDARG Dwarf_Unsigned ev_entry_count,
475579 UNUSEDARG Dwarf_Unsigned total_abbrevs_counted)
476580 {
477581 char buf[128];
491595 last_abbrev_code);
492596 DWARF_CHECK_ERROR2(abbreviations_result,
493597 esb_get_string(&ar),
494 "Questionable abbreviation code! Not checking reuse.");
598 "Questionable abbreviation code! "
599 "Not checking reuse.");
495600 esb_destructor(&ar);
496601 return 0;
497602 } else if ((abbrev_code-last_abbrev_code) > 1 ) {
679784 abbrev_array_size *= 2;
680785 abbrev_array = (Dwarf_Unsigned *)
681786 realloc(abbrev_array,
682 abbrev_array_size * sizeof(Dwarf_Unsigned));
787 abbrev_array_size *
788 sizeof(Dwarf_Unsigned));
683789 /* Zero out the new bytes. */
684790 memset(abbrev_array + old_size,0,
685791 addl_size_bytes);
114114 glflags.gf_count_major_errors++;
115115 printf("\n");
116116 }
117 #if 0
118 If it has a dwo, this needs to look up in the dwo object.
119 {
120 Dwarf_Die die = 0;
121 Dwarf_Bool is_info = TRUE;
122 res = dwarf_offdie_b(dbg,offset_in_debug_info,
123 is_info, &die,error);
124 if (res != DW_DLV_OK) {
125 printf(" ERROR: Block %" DW_PR_DUu
126 " entry %" DW_PR_DUu " offset 0x%"
127 DW_PR_DUx
128 " is not a valid DIE offset in .debug_info",
129 blocknum,i, offset_in_debug_info);
117 }
118 return DW_DLV_OK;
119 }
120
121 int attrlist[] = {
122 DW_AT_GNU_dwo_name,
123 DW_AT_dwo_name,
124 DW_AT_comp_dir,
125 DW_AT_GNU_dwo_id,
126 0 };
127
128 static void
129 error_report(int errcode,
130 const char *text,
131 Dwarf_Error *error) {
132 if (errcode == DW_DLV_ERROR) {
133 printf(" ERROR: %s"
134 ", ignoring other attributes here: %s\n",
135 text,
136 dwarf_errmsg(*error));
137 glflags.gf_count_major_errors++;
138 return;
139 } else {
140 printf(" ERROR impossible DW_DLV_NO_ENTRY: %s"
141 ", ignoringother attributes here. \n",
142 text);
143 }
144 return;
145 }
146 static void
147 print_selected_attributes(Dwarf_Debug dbg,
148 Dwarf_Die die,
149 Dwarf_Half version,
150 Dwarf_Half offset_size,
151 Dwarf_Error *error)
152 {
153 int res = 0;
154 int i = 0;
155
156 for ( ; attrlist[i]; ++i) {
157 Dwarf_Attribute attr = 0;
158 int attrid = 0;
159 const char * atname = 0;
160 Dwarf_Half form = 0;
161 enum Dwarf_Form_Class fclass = 0;
162 char *formstring = 0;
163 int print_str = FALSE;
164 struct esb_s m;
165 Dwarf_Sig8 sig;
166
167 attrid = attrlist[i];
168 res = dwarf_attr(die,attrid,&attr,error);
169 if (res == DW_DLV_ERROR) {
170 error_report(res,"dwarf_attr() returned error",error);
171 dwarf_dealloc_error(dbg,*error);
172 *error = 0;
173 return;
174 }
175 if (res == DW_DLV_NO_ENTRY) {
176 continue;
177 }
178 /* ok, this attribute is present */
179 atname = get_AT_name(attrid,FALSE);
180 res = dwarf_whatform(attr,&form,error);
181 if (res != DW_DLV_OK) {
182 error_report(res,"dwarf_whatform() problem: ",error);
183 dwarf_dealloc_error(dbg,*error);
184 dwarf_dealloc_attribute(attr);
185 *error = 0;
186 return;
187 }
188 if (res == DW_DLV_NO_ENTRY) {
189 /* impossible, cannot get here */
190 dwarf_dealloc_attribute(attr);
191 continue;
192 }
193 esb_constructor(&m);
194 fclass = dwarf_get_form_class(version,attrid,
195 offset_size,form);
196 if (fclass == DW_FORM_CLASS_STRING) {
197 res = dwarf_formstring(attr,&formstring,error);
198 if (res == DW_DLV_OK) {
199 print_str = TRUE;
200 esb_append(&m,formstring);
201 } else {
202 error_report(res,"dwarf_formstring() returned error",
203 error);
130204 if (res == DW_DLV_ERROR) {
131205 dwarf_dealloc_error(dbg,*error);
132206 *error = 0;
207 }
208 dwarf_dealloc_attribute(attr);
209 esb_destructor(&m);
210 break;
211 }
212 } else if (fclass == DW_FORM_CLASS_CONSTANT) {
213 if (form == DW_FORM_data8) {
214 res = dwarf_formsig8_const(attr,&sig,error);
215 if (res == DW_DLV_OK) {
216 print_str = TRUE;
217 format_sig8_string(&sig,&m);
133218 } else {
219 error_report(res,"dwarf_formsig8_const() "
220 "returned error",error);
221 if (res == DW_DLV_ERROR) {
222 dwarf_dealloc_error(dbg,*error);
223 *error = 0;
224 }
225 esb_destructor(&m);
226 dwarf_dealloc_attribute(attr);
227 break;
134228 }
135 glflags.gf_count_major_errors++;
136 printf("\n");
137 }else {
138 /* Look into DIE? */
139 dwarf_dealloc_die(die);
140229 }
141 }
142 #endif
143 }
230 } else if (fclass == DW_FORM_CLASS_REFERENCE) {
231 /* includes DW_FORM_ref_sig8, DW_FORM_ref* */
232 if (form == DW_FORM_ref_sig8) {
233 res = dwarf_formsig8(attr,&sig,error);
234 if (res == DW_DLV_OK) {
235 print_str = TRUE;
236 esb_constructor(&m);
237 format_sig8_string(&sig,&m);
238 } else {
239 error_report(res,"dwarf_formsig8() "
240 "problem error",error);
241 if (res == DW_DLV_ERROR) {
242 dwarf_dealloc_error(dbg,*error);
243 *error = 0;
244 }
245 esb_destructor(&m);
246 dwarf_dealloc_attribute(attr);
247 break;
248 }
249 }
250 }
251 if (print_str) {
252 printf(" %-18s : %s\n",
253 atname,esb_get_string(&m));
254 }
255 dwarf_dealloc_attribute(attr);
256 esb_destructor(&m);
257 }
258 }
259
260
261 static int
262 print_die_basics(Dwarf_Debug dbg,
263 Dwarf_Die die,
264 UNUSEDARG Dwarf_Unsigned cudie_goff,
265 Dwarf_Error *error)
266 {
267 int res = 0;
268 Dwarf_Half tag = 0;
269 Dwarf_Half version = 0;
270 Dwarf_Bool is_info = 0;
271 Dwarf_Bool is_dwo = 0;
272 Dwarf_Half offset_size = 0;
273 Dwarf_Half address_size = 0;
274 Dwarf_Half extension_size = 0;
275 Dwarf_Sig8 *signature = 0;
276 Dwarf_Off offset_of_length = 0;
277 Dwarf_Unsigned total_byte_length = 0;
278
279 res = dwarf_cu_header_basics(die, &version,
280 &is_info,&is_dwo,
281 &offset_size,&address_size,&extension_size,
282 &signature,&offset_of_length,&total_byte_length,error);
283 if (res != DW_DLV_OK) {
284 if (res == DW_DLV_ERROR) {
285 printf("ERROR: Cannot access compilation unit data: %s",
286 dwarf_errmsg(*error));
287 dwarf_dealloc_error(dbg,*error);
288 *error = 0;
289 } else {
290 printf("ERROR: Cannot access compilation unit data"
291 "No such found");
292 }
293 glflags.gf_count_major_errors++;
294 return DW_DLV_OK;
295 }
296 printf(" Compilation unit data follows\n");
297 printf(" CU version : %d\n",version);
298 if (!is_info) {
299 printf(" CU section is .debug_types");
300 }
301 printf(" CU section is dwo? : %s\n",
302 is_dwo?"yes":"no");
303 printf(" CU offset size : %u\n",
304 offset_size);
305 printf(" CU extension size : %u\n",
306 extension_size);
307 printf(" CU address size : %u\n",
308 address_size);
309 printf(" CU beginning offset : 0x%"
310 DW_PR_XZEROS DW_PR_DUx "\n",
311 offset_of_length);
312 printf(" CU total length : 0x%"
313 DW_PR_XZEROS DW_PR_DUx "\n",
314 total_byte_length);
315
316 if (signature) {
317 struct esb_s m;
318 char buf[24];
319
320 esb_constructor_fixed(&m,buf,sizeof(buf));
321 printf(" CU signature : ");
322 format_sig8_string(signature,&m);
323 printf("%s\n", esb_get_string(&m));
324 esb_destructor(&m);
325 }
326 res = dwarf_tag(die,&tag,error);
327 if (res != DW_DLV_OK) {
328 if (res == DW_DLV_ERROR) {
329 printf("ERROR: Cannot access DIE tag ERROR: %s\n",
330 dwarf_errmsg(*error));
331 dwarf_dealloc_error(dbg,*error);
332 *error = 0;
333 } else {
334 printf("ERROR: Cannot access DIE tag "
335 "No such found\n");
336 }
337 printf("\n");
338 glflags.gf_count_major_errors++;
339 } else {
340 const char *actual_tag_name = 0;
341
342 actual_tag_name = get_TAG_name(tag,FALSE);
343 printf(" CU die TAG : "
344 "%s\n", actual_tag_name);
345 }
346 print_selected_attributes(dbg,die,version,offset_size,error);
144347 return DW_DLV_OK;
145348 }
146349
191394 "%" DW_PR_DUu "\n",size_of_debug_info_area);
192395 printf(" Number of entries in block : "
193396 "%" DW_PR_DUu "\n",entrycount);
194 res = print_block_entries(dbg,for_pubnames,
195 secname,head,i,entrycount,error);
196 if (res == DW_DLV_ERROR) {
197 return res;
198 }
199 #if 0
200 {
201 Dwarf_Unsigned cu_die_offset = 0;
202
203 /* If has dwo, look there */
397
398 /* The CU offsets appear to be those in
399 the executable here. Not in
400 any dwo object. The offsets within
401 the entries in a block are a different
402 story and some of that seems odd,
403 the content names many things in libraries,
404 not just the executable or its dwo. ?
405 */
204406 res = dwarf_get_cu_die_offset_given_cu_header_offset_b(
205407 dbg,offset_into_debug_info,/*is_info = */ TRUE,
206 &cu_die_offset,error);
408 &offset_into_debug_info,error);
207409 if (res != DW_DLV_OK) {
208410 printf(" ERROR: Block %" DW_PR_DUu
209411 " has an invalid .debug_info offset of "
215417 *error = 0;
216418 }
217419 glflags.gf_count_major_errors++;
218 return res;
219420 } else {
220421 Dwarf_Die die = 0;
221422 Dwarf_Bool is_info = TRUE;
222 res = dwarf_offdie_b(dbg,cu_die_offset,
423 res = dwarf_offdie_b(dbg,offset_into_debug_info,
223424 is_info, &die,error);
224425 if (res != DW_DLV_OK) {
225426 printf(" ERROR: Block %" DW_PR_DUu
226427 " cu DIE offset 0x%" DW_PR_DUx
227428 " is not a valid DIE offset in .debug_info\n",
228 i, cu_die_offset);
429 i, offset_into_debug_info);
229430 if (res == DW_DLV_ERROR) {
230431 dwarf_dealloc_error(dbg,*error);
231432 *error = 0;
232433 }
233434 glflags.gf_count_major_errors++;
234435 } else {
235 /* look into die */
436 /* Always returns DW_DLV_OK */
437 print_die_basics(dbg, die,
438 offset_into_debug_info, error);
439 printf("\n");
236440 dwarf_dealloc_die(die);
237441 }
238
239 }
240 }
241 #endif
242
442 }
443 res = print_block_entries(dbg,for_pubnames,
444 secname,head,i,entrycount,error);
445 if (res == DW_DLV_ERROR) {
446 return res;
447 }
243448 }
244449 return DW_DLV_OK;
245450 }
246451
247
248
452 /* November 25,2020: gdb 10.2 binutils source
453 can print these sections
454 but gdb does not, AFAICT, use this at all.
455 (binutils can print it, as can we).
456 The Block offset is part of the skeleton, and refers
457 to the skeleton CU DIEs (when
458 that is involved) but the individual item offsets
459 are referring to I-do-not-know-what.
460 Block zero refers to the single CU_DIE in
461 the .dwo file. The others....?
462 Nothing suggests how things actually connect up. */
249463 int
250 print_debug_gnu(UNUSEDARG Dwarf_Debug dbg,
251 UNUSEDARG Dwarf_Error *error)
464 print_debug_gnu(Dwarf_Debug dbg,
465 Dwarf_Error *error)
252466 {
253467 int res = 0;
254468 Dwarf_Gnu_Index_Head head = 0;
262476 for(i = 0; i < 2; i++) {
263477 esb_constructor_fixed(&truename,buf,
264478 DWARF_SECNAME_BUFFER_SIZE);
265 if(!i) {
479 if (!i) {
266480 glflags.current_section_id = DEBUG_GNU_PUBNAMES;
267481 for_pubnames = TRUE;
268482 stdname = ".debug_gnu_pubnames";
9797 boolean checking,
9898 int die_indent_level,
9999 int showhextoo,
100 struct esb_s *esbp,Dwarf_Error *err);
100 struct esb_s *esbp,
101 struct esb_s *exprops,
102 Dwarf_Error *err);
101103 static int print_attribute(Dwarf_Debug dbg, Dwarf_Die die,
102104 Dwarf_Off dieprint_cu_goffset,
103105 Dwarf_Half attr,
115117 Dwarf_Die die,
116118 Dwarf_Attribute attr,
117119 boolean checking,
120 int die_indent_level,
118121 int no_ending_newline,
119122 struct esb_s *details,Dwarf_Error *);
120123
165168 printf("\n");
166169 }
167170 #endif /* 0 */
171 /* 20 characters */
172 static char * indentspace =
173 " "
174 " ";
175 static int indentspacelen = 20;
176 static void
177 appendn( struct esb_s *m, int len)
178 {
179 int remaining = len;
180 while (remaining > indentspacelen) {
181 esb_append(m,indentspace);
182 remaining -= indentspacelen;
183 }
184 esb_appendn(m,indentspace,remaining);
185 }
186 static void
187 append_indent_prefix(struct esb_s *m,int prespaces,int indent,int postspaces)
188 {
189 if (indent < glflags.gf_max_space_indent) {
190 appendn(m,2*indent + prespaces+postspaces);
191 return;
192 }
193 appendn(m,prespaces);
194 esb_append_printf_i(m,"...%d...",indent);
195 appendn(m,postspaces);
196 }
197
198 static int
199 standard_indent(void)
200 {
201 /* Attribute indent. The global offset printed length
202 is actually 32. With GOFF the length is
203 actually 16. Usually. */
204 int nColumn = glflags.gf_show_global_offsets ? 34 : 18;
205 if (!glflags.gf_display_offsets) {
206 nColumn = 2;
207 }
208 return nColumn;
209 }
210
211 static void
212 print_indent_prefix(int prespaces,int indent,int postspaces)
213 {
214 if (indent < glflags.gf_max_space_indent) {
215 int len = prespaces+postspaces+ 2*indent;
216 printf("%*s",len," ");
217 return;
218 }
219 if (prespaces) {
220 printf("%*s",prespaces," ");
221 }
222 printf("...%d...",indent);
223 if (postspaces) {
224 printf("%*s",postspaces," ");
225 }
226 }
227
228
229 struct die_stack_data_s {
230 Dwarf_Die die_;
231 /* sibling_die_globaloffset_ is set while processing the DIE.
232 We do not know the sibling global offset
233 when we create the stack entry.
234 If the sibling attribute absent we never know. */
235 Dwarf_Off sibling_die_globaloffset_;
236 /* We may need is_info here too. */
237 Dwarf_Off cu_die_offset_; /* global offset. */
238 boolean already_printed_;
239 };
240 static struct die_stack_data_s empty_stack_entry;
241 #define DIE_STACK_SIZE 800
242 static struct die_stack_data_s die_stack[DIE_STACK_SIZE];
243 #define SET_DIE_STACK_ENTRY(i,x,o) { die_stack[i].die_ = x; \
244 die_stack[i].cu_die_offset_ = o; \
245 die_stack[i].sibling_die_globaloffset_ = 0; \
246 die_stack[i].already_printed_ = FALSE; }
247 #define EMPTY_DIE_STACK_ENTRY(i) { die_stack[i] = empty_stack_entry; }
248 #define SET_DIE_STACK_SIBLING(x) { \
249 die_stack[die_stack_indent_level].sibling_die_globaloffset_ = x; }
250
251
252 static void
253 report_die_stack_error(Dwarf_Debug dbg, Dwarf_Error *err)
254 {
255 struct esb_s m;
256
257 esb_constructor(&m);
258 esb_append_printf_i(&m,
259 "ERROR: compiled in DIE_STACK_SIZE "
260 "(the depth of the DIE tree in this CU)"
261 " of %d exceeded!"
262 " Likely a circular DIE reference."
263 ,DIE_STACK_SIZE);
264 dwarf_error_creation(dbg,err,
265 esb_get_string(&m));
266 print_error_and_continue(dbg,
267 esb_get_string(&m),
268 DW_DLV_OK,*err);
269 esb_destructor(&m);
270 }
271
272 /* Just access the die and print selected fields into
273 the string.
274 In case of error print an error message
275 and return DW_DLV_NO_ENTRY.
276 Initially we just verify the offset is ok. */
277 #define NO_SPECIFIC_TAG 0
278 /* The following two must differ, but value unimportant.
279 We choose each to be a small prime number. */
280 #define NON_ZERO_OFFSET_REQUIRED 3
281 #define ZERO_OFFSET_GENERIC_TYPE 19
282 #define WITHIN_CU TRUE
283 static void
284 check_die_expr_op_basic_data(Dwarf_Debug dbg,Dwarf_Die die,
285 const char * op_name,
286 int indentprespaces,
287 int die_indent_level,
288 int indentpostspaces,
289 int required_tag,
290 int required_offset,
291 int within_cu,
292 Dwarf_Unsigned offset,
293 struct esb_s *string_out)
294 {
295 Dwarf_Error err = 0;
296 Dwarf_Off globaloff = 0;
297 Dwarf_Bool is_info =0;
298 Dwarf_Die other_die = 0;
299 int res = 0;
300 Dwarf_Half tag = 0;
301 const char * required_tag_name = 0;
302 const char * actual_tag_name = 0;
303
304 if (! glflags.gf_do_print_dwarf) {
305 /* We are checking so any errors detected
306 will not print, so do not check.
307 Even though this all seems self-contradictory! */
308 return;
309 }
310 if (within_cu && !offset &&
311 required_offset == ZERO_OFFSET_GENERIC_TYPE ) {
312 /* Means the offset zero represents generic type,
313 not a DIE DW_OP_convert DW_OP_reinterpret */
314 return;
315 }
316 if (!die) {
317 esb_append(string_out," <No DIE, cannot verify die offset>");
318 return;
319 }
320 is_info = dwarf_get_die_infotypes_flag(die);
321 if (within_cu) {
322 /* Our target DIE is in same CU as die argument */
323 /* DW_OP_const_type */
324 Dwarf_Unsigned length = 0;
325
326 res = dwarf_die_CU_offset_range(die,&globaloff,
327 &length,&err);
328 if (res != DW_DLV_OK) {
329 esb_append_printf_s(string_out,
330 " ERROR: %s Cannot access CU DIE global offset ",
331 (char *)op_name);
332 if (res == DW_DLV_ERROR) {
333 esb_append(string_out, dwarf_errmsg(err));
334 dwarf_dealloc_error(dbg,err);
335 err = 0;
336 } else {
337 esb_append(string_out, "DW_DLV_NO_ENTRY ");
338 }
339 glflags.gf_count_major_errors++;
340 return;
341 }
342 /* Offset passed in is off of CU header, not
343 CU DIE. */
344 globaloff += offset;
345 } else {
346 /* DW_OP_implicit_ptr */
347 globaloff = offset;
348 }
349 if ((required_offset == NON_ZERO_OFFSET_REQUIRED)
350 && !globaloff) {
351 esb_append_printf_s(string_out,
352 "ERROR: %s DIE global offset 0, but 0 not allowed ",
353 op_name);
354 glflags.gf_count_major_errors++;
355 return;
356 }
357 if (!globaloff) {
358 return;
359 }
360 res = dwarf_offdie_b(dbg,globaloff,is_info,
361 &other_die,&err);
362 if (res != DW_DLV_OK) {
363 esb_append_printf_s(string_out,
364 "ERROR: %s Cannot access DIE via global offset ",
365 op_name);
366 esb_append_printf_u(string_out,
367 "0x%x ",globaloff);
368 if (res == DW_DLV_ERROR) {
369 esb_append(string_out, dwarf_errmsg(err));
370 esb_append(string_out, " ");
371 dwarf_dealloc_error(dbg,err);
372 err = 0;
373 } else {
374 esb_append(string_out, "DW_DLV_NO_ENTRY ");
375 }
376 if (!within_cu) {
377 esb_append(string_out,"DW_OP_implicit_ptr offset "
378 "might apply to another object file ");
379 }
380 glflags.gf_count_major_errors++;
381 return;
382 }
383 res = dwarf_tag(other_die,&tag,&err);
384 if (res != DW_DLV_OK) {
385 esb_append_printf_s(string_out,
386 "ERROR: %s Cannot access DIE tag ",
387 op_name);
388 esb_append_printf_u(string_out,
389 "0x%x ",globaloff);
390 if (res == DW_DLV_ERROR) {
391 esb_append(string_out, dwarf_errmsg(err));
392 esb_append(string_out, " ");
393 dwarf_dealloc_error(dbg,err);
394 err = 0;
395 } else {
396 esb_append(string_out, "DW_DLV_NO_ENTRY ");
397 }
398 glflags.gf_count_major_errors++;
399 dwarf_dealloc_die(other_die);
400 return;
401 }
402 if (required_tag) {
403 required_tag_name = get_TAG_name(required_tag,FALSE);
404 }
405 actual_tag_name = get_TAG_name(tag,FALSE);
406 if (required_tag && tag != required_tag) {
407 esb_append_printf_s(string_out,
408 "ERROR: %s incorrect target die tag ",
409 op_name);
410 esb_append_printf_s(string_out,
411 " Tag required: %s",required_tag_name);
412 esb_append_printf_s(string_out,
413 " Tag found: %s",actual_tag_name);
414 glflags.gf_count_major_errors++;
415 }
416 if (!glflags.dense && !glflags.gf_expr_ops_joined) {
417 char *diename = 0;
418
419 /* <0x000854ff GOFF=0x00546047> */
420 esb_append(string_out,"\n");
421 append_indent_prefix(string_out,indentprespaces,
422 die_indent_level,indentpostspaces+2);
423 esb_append(string_out," Target Die: ");
424 if (within_cu) {
425 esb_append_printf_u(string_out,
426 "<0x%" DW_PR_XZEROS DW_PR_DUx ,offset);
427 if (glflags.gf_show_global_offsets) {
428 esb_append_printf_u(string_out,
429 " GOFF=0x%" DW_PR_XZEROS DW_PR_DUx,
430 globaloff);
431 }
432 esb_append(string_out,"> ");
433 } else {
434 esb_append_printf_u(string_out,
435 "<GOFF=0x%" DW_PR_XZEROS DW_PR_DUx
436 "> ",globaloff);
437 }
438 esb_append(string_out,actual_tag_name);
439 res = dwarf_diename(other_die,&diename,&err);
440 if ( res == DW_DLV_OK) {
441 esb_append_printf_s(string_out,
442 " name: %s",diename);
443 } else if (res == DW_DLV_ERROR) {
444 esb_append_printf_s(string_out,
445 "ERROR: gets error reading "
446 "DW_AT_diename: %s ",
447 dwarf_errmsg(err));
448 dwarf_dealloc_error(dbg,err);
449 err = 0;
450 } /* Else no entry */
451 }
452 dwarf_dealloc_die(other_die);
453 }
168454
169455 struct operation_descr_s {
170456 int op_code;
175461 };
176462 struct operation_descr_s opdesc[]= {
177463 {DW_OP_addr,1,"addr" },
464
178465 {DW_OP_deref,0,"" },
179466 {DW_OP_const1u,1,"1u" },
180467 {DW_OP_const1s,1,"1s" },
192479 {DW_OP_pick,1,"1u"},
193480 {DW_OP_swap,0,""},
194481 {DW_OP_rot,0,""},
195 {DW_OP_xderef,0,""},
482 {DW_OP_xderef,0,""}, /* DWARF5 */
196483 {DW_OP_abs,0,""},
197484 {DW_OP_and,0,""},
198485 {DW_OP_div,0,""},
262549
263550 {DW_OP_GNU_parameter_ref,1,"u" },
264551
265 /* https://gcc.gnu.org/legacy-ml/gcc-patches/2017-02/msg01499.html*/
552 /* https://gcc.gnu.org/legacy-ml/gcc-patches/
553 2017-02/msg01499.html */
266554 /* The value is a die offset, size offset_size */
267555 {DW_OP_GNU_variable_value,1,"val" },
268556
269 {DW_OP_xderef,0,"" }, /* DWARF5 */
270557 {DW_OP_xderef_type,2,"1u" }, /* DWARF5 */
271558 /* terminator */
272559 {0,0,""}
273560 };
274
275 struct die_stack_data_s {
276 Dwarf_Die die_;
277 /* sibling_die_globaloffset_ is set while processing the DIE.
278 We do not know the sibling global offset
279 when we create the stack entry.
280 If the sibling attribute absent we never know. */
281 Dwarf_Off sibling_die_globaloffset_;
282 /* We may need is_info here too. */
283 Dwarf_Off cu_die_offset_; /* global offset. */
284 boolean already_printed_;
285 };
286
287 static struct die_stack_data_s empty_stack_entry;
288
289 #define DIE_STACK_SIZE 800
290 static struct die_stack_data_s die_stack[DIE_STACK_SIZE];
291
292 #define SET_DIE_STACK_ENTRY(i,x,o) { die_stack[i].die_ = x; \
293 die_stack[i].cu_die_offset_ = o; \
294 die_stack[i].sibling_die_globaloffset_ = 0; \
295 die_stack[i].already_printed_ = FALSE; }
296 #define EMPTY_DIE_STACK_ENTRY(i) { die_stack[i] = empty_stack_entry; }
297 #define SET_DIE_STACK_SIBLING(x) { \
298 die_stack[die_stack_indent_level].sibling_die_globaloffset_ = x; }
299
300561
301562 /* The first non-zero sibling offset we can find
302563 is what we want to return. The lowest sibling
306567 get_die_stack_sibling()
307568 {
308569 int i = die_stack_indent_level;
309 for( ; i >=0 ; --i)
570 for ( ; i >=0 ; --i)
310571 {
311572 Dwarf_Off v = die_stack[i].sibling_die_globaloffset_;
312573 if (v) {
336597 {
337598 Dwarf_Signed i = 0;
338599
339 if(!srcfiles) {
600 if (!srcfiles) {
340601 return;
341602 }
342603 for ( ; i < cnt; ++i) {
357618 {
358619 int i = die_stack_indent_level;
359620 Dwarf_Off innersiboffset = 0;
360 for( ; i >=0 ; --i)
621 for ( ; i >=0 ; --i)
361622 {
362623 Dwarf_Off v = die_stack[i].sibling_die_globaloffset_;
363624 if (v) {
365626 break;
366627 }
367628 }
368 if(!innersiboffset) {
629 if (!innersiboffset) {
369630 /* no sibling values to check. */
370631 return;
371632 }
372 for(--i ; i >= 0 ; --i)
633 for (--i ; i >= 0 ; --i)
373634 {
374635 /* outersiboffset is an outer sibling offset. */
375636 Dwarf_Off outersiboffset = die_stack[i].sibling_die_globaloffset_;
391652 "0x%" DW_PR_XZEROS DW_PR_DUx
392653 ", the DIE tree is erroneous.",
393654 innersiboffset);
655 esb_append_printf_i(&pm,
656 "Die indent level; %d",i);
394657 print_error_and_continue(dbg,
395658 esb_get_string(&pm),
396659 DW_DLV_OK,ouerr);
488751 /* 0 is always unused. Skip it. */
489752 esb_destructor(&hash_str);
490753 printf(" %-19s = %s\n","Fission entries","offset size DW_SECTn");
491 for( i = 1; i < DW_FISSION_SECT_COUNT; ++i) {
754 for ( i = 1; i < DW_FISSION_SECT_COUNT; ++i) {
492755 const char *nstring = 0;
493756 Dwarf_Unsigned off = 0;
494757 Dwarf_Unsigned size = fsd->pcu_size[i];
573836 printf(" %s<%s>", "fissionhash",
574837 esb_get_string(&hash_str));
575838 esb_destructor(&hash_str);
576 for( i = 1; i < DW_FISSION_SECT_COUNT; ++i) {
839 for ( i = 1; i < DW_FISSION_SECT_COUNT; ++i) {
577840 const char *nstring = 0;
578841 Dwarf_Unsigned off = 0;
579842 Dwarf_Unsigned size = fsd->pcu_size[i];
709972
710973
711974 static int
712 macro_check_cu(Dwarf_Debug dbg,
975 print_macinfo_for_cu(
976 Dwarf_Debug dbg,
713977 Dwarf_Die cu_die2,
714978 Dwarf_Error *err)
715979 {
730994 return mres;
731995 } else {
732996 mres = print_macinfo_by_offset(dbg,
997 cu_die2,
733998 offset,err);
734999 if (mres==DW_DLV_ERROR) {
7351000 struct esb_s m;
7661031 return res;
7671032 }
7681033
1034 static int
1035 print_cu_hdr_abbrev_data(Dwarf_Debug dbg,
1036 Dwarf_Off aboffset,
1037 Dwarf_Error *error)
1038 {
1039 Dwarf_Unsigned initial_abbnum = 1;
1040 Dwarf_Unsigned final_abbnum = 0;
1041 Dwarf_Unsigned length = 0;
1042 int ores = 0;
1043
1044 if (glflags.gf_do_print_dwarf) {
1045 printf("\nAbbreviation table this CU, offset "
1046 "0x%" DW_PR_XZEROS DW_PR_DUx ":\n",
1047 aboffset);
1048 }
1049 ores = print_all_abbrevs_for_cu(dbg,
1050 aboffset,
1051 initial_abbnum,
1052 &length,&final_abbnum,error);
1053 return ores;
1054
1055 }
7691056
7701057 /* */
7711058 static int
7951082 res = dwarf_get_die_section_name(dbg,is_info,
7961083 &test_section_name,pod_err);
7971084 if (res == DW_DLV_NO_ENTRY) {
798 if(!is_info) {
1085 if (!is_info) {
7991086 /* No .debug_types. Do not print
8001087 .debug_types name */
8011088 return DW_DLV_NO_ENTRY;
8561143 sres = dwarf_siblingof_b(dbg, NULL,is_info, &cu_die, pod_err);
8571144 if (sres != DW_DLV_OK) {
8581145 /* There is no CU die, which should be impossible. */
859 if(sres == DW_DLV_ERROR) {
1146 if (sres == DW_DLV_ERROR) {
8601147 print_error_and_continue(dbg,
8611148 "ERROR: dwarf_siblingof_b failed, no CU die",
8621149 sres, *pod_err);
8961183 struct esb_s producername;
8971184
8981185 esb_constructor(&producername);
899 /* Fills in some producername no matter what status returned. */
1186 /* Fills in some producername no matter
1187 what status returned. */
9001188 cures = get_producer_name(dbg,cu_die,
9011189 dieprint_cu_goffset,&producername,pod_err);
9021190 DROP_ERROR_INSTANCE(dbg,cures,*pod_err);
9421230 fission_data_result, *pod_err);
9431231 return fission_data_result;
9441232 }
945 if(fission_data_result == DW_DLV_OK) {
1233 if (fission_data_result == DW_DLV_OK) {
9461234 /* In a .dwp file some checks get all sorts
9471235 of spurious errors. */
9481236 glflags.gf_suppress_checking_on_dwp = TRUE;
10001288 }
10011289 }
10021290 }
1291 if (glflags.gf_check_abbreviations ||
1292 (glflags.verbose > 3 &&
1293 (glflags.gf_info_flag || glflags.gf_types_flag) &&
1294 glflags.gf_do_print_dwarf)) {
1295 int hares = 0;
1296 hares = print_cu_hdr_abbrev_data(dbg,
1297 abbrev_offset,
1298 pod_err);
1299 if (hares == DW_DLV_ERROR) {
1300 /* Will be reported later, no doubt. */
1301 DROP_ERROR_INSTANCE(dbg,hares,*pod_err);
1302 *pod_err = 0;
1303 }
1304 }
10031305
10041306 /* Get abbreviation info for this CU */
10051307 get_abbrev_array_info(dbg,abbrev_offset);
10111313 &cu_die2, pod_err);
10121314 if (sres == DW_DLV_OK) {
10131315 int pres = 0;
1014
1316 Dwarf_Signed cnt = 0;
1317 char **srcfiles = 0;
1318 int srcf = 0;
1319 Dwarf_Error srcerr = 0;
1320
1321 srcf = dwarf_srcfiles(cu_die2,
1322 &srcfiles, &cnt, &srcerr);
1323 if (srcf == DW_DLV_ERROR) {
1324 print_error_and_continue(dbg,
1325 "ERROR: dwarf_srcfiles problem ",
1326 srcf,srcerr);
1327 DROP_ERROR_INSTANCE(dbg,srcf,srcerr);
1328 srcfiles = 0;
1329 cnt = 0;
1330 } else if (srcf == DW_DLV_NO_ENTRY) {
1331 /*DW_DLV_NO_ENTRY generally means there
1332 there is no dW_AT_stmt_list attribute.
1333 and we do not want to print anything
1334 about statements in that case */
1335 }
10151336 if (print_as_info_or_by_cuname() ||
10161337 glflags.gf_search_is_on) {
1017 Dwarf_Signed cnt = 0;
1018 char **srcfiles = 0;
1019 Dwarf_Error srcerr = 0;
1020 int srcf = 0;
1021
1022 srcf = dwarf_srcfiles(cu_die2,
1023 &srcfiles, &cnt, &srcerr);
1024 if (srcf == DW_DLV_ERROR) {
1025 print_error_and_continue(dbg,
1026 "ERROR: dwarf_srcfiles problem ",
1027 srcf,srcerr);
1028 DROP_ERROR_INSTANCE(dbg,srcf,srcerr);
1029 srcfiles = 0;
1030 cnt = 0;
1031 } else if (srcf == DW_DLV_NO_ENTRY) {
1032 /*DW_DLV_NO_ENTRY generally means there
1033 there is no dW_AT_stmt_list attribute.
1034 and we do not want to print anything
1035 about statements in that case */
1036 }
1037 {
1038 /* Do regardless if dwarf_srcfiles
1039 was successful to print die
1040 and children as best we can
1041 even with errors . */
1042 int podres2 = 0;
1043 Dwarf_Error lperr = 0;
1044
1045 /* Get the CU offset for easy error reporting */
1046 podres2 = dwarf_die_offsets(cu_die2,
1047 &glflags.DIE_overall_offset,
1048 &glflags.DIE_offset,&lperr);
1049 DROP_ERROR_INSTANCE(dbg,podres2,lperr);
1050 glflags.DIE_CU_overall_offset =
1051 glflags.DIE_overall_offset;
1052 glflags.DIE_CU_offset = glflags.DIE_offset;
1053 dieprint_cu_goffset = glflags.DIE_overall_offset;
1054 pres = print_die_and_children(dbg, cu_die2,
1055 dieprint_cu_goffset,is_info,
1338 /* Do regardless if dwarf_srcfiles
1339 was successful to print die
1340 and children as best we can
1341 even with errors . */
1342 int podres2 = 0;
1343 Dwarf_Error lperr = 0;
1344
1345 /* Get the CU offset for easy error reporting */
1346 podres2 = dwarf_die_offsets(cu_die2,
1347 &glflags.DIE_overall_offset,
1348 &glflags.DIE_offset,&lperr);
1349 DROP_ERROR_INSTANCE(dbg,podres2,lperr);
1350 glflags.DIE_CU_overall_offset =
1351 glflags.DIE_overall_offset;
1352 glflags.DIE_CU_offset = glflags.DIE_offset;
1353 dieprint_cu_goffset = glflags.DIE_overall_offset;
1354 pres = print_die_and_children(dbg, cu_die2,
1355 dieprint_cu_goffset,is_info,
10561356 srcfiles, cnt,pod_err);
1357 if (pres == DW_DLV_ERROR) {
10571358 if (srcfiles) {
10581359 dealloc_all_srcfiles(dbg,srcfiles,cnt);
10591360 srcfiles = 0;
10601361 cnt = 0;
10611362 }
1062 if (pres == DW_DLV_ERROR) {
1063 dwarf_dealloc_die(cu_die2);
1064 return pres;
1065 }
1363 dwarf_dealloc_die(cu_die2);
1364 return pres;
10661365 }
10671366 }
10681367 /* Dump Ranges Information */
10931392
10941393 int oldsection = glflags.current_section_id;
10951394 plnres = print_line_numbers_this_cu(dbg,
1096 cu_die2,pod_err);
1395 cu_die2,
1396 srcfiles,cnt,pod_err);
10971397 if (plnres == DW_DLV_ERROR) {
10981398 print_error_and_continue(dbg,
10991399 "ERROR: Printing line numbers for "
11101410 Dwarf_Bool in_import_list = FALSE;
11111411 Dwarf_Unsigned import_offset = 0;
11121412 int oldsection = glflags.current_section_id;
1413 /* DWARF5 .debug_macro (version 5
1414 in the macro header) or GNU extesion
1415 of DWARF4 .debug_macro, with version 4
1416 in the macro header. */
11131417
11141418 mres = print_macros_5style_this_cu(dbg, cu_die2,
1419 srcfiles,cnt,
11151420 in_import_list,import_offset,pod_err);
11161421 if (mres == DW_DLV_ERROR) {
11171422 print_error_and_continue(dbg,
11241429 }
11251430 in_import_list = TRUE;
11261431 if (mres == DW_DLV_OK) {
1127 for(;;) {
1432 for (;;) {
11281433 /* Never returns DW_DLV_ERROR */
11291434 mres = get_next_unprinted_macro_offset(
11301435 &macro_check_tree, &import_offset);
11331438 }
11341439 mres = print_macros_5style_this_cu(dbg,
11351440 cu_die2,
1441 srcfiles,cnt,
11361442 in_import_list,import_offset,
11371443 pod_err);
11381444 if (mres == DW_DLV_ERROR) {
11551461 }
11561462 glflags.current_section_id = oldsection;
11571463 }
1158 if (glflags.gf_macinfo_flag ||
1464 if ( glflags.gf_macinfo_flag ||
11591465 glflags.gf_check_macros) {
11601466 int mres = 0;
1161
1162 mres = macro_check_cu(dbg,cu_die2,
1467 /* Macros have no version number befoer
1468 DWARF 5. */
1469
1470 mres = print_macinfo_for_cu(dbg,cu_die2,
11631471 pod_err);
11641472 if (mres == DW_DLV_ERROR) {
11651473 if (cu_die2) {
11661474 dwarf_dealloc_die(cu_die2);
11671475 }
1476 if (srcfiles) {
1477 dealloc_all_srcfiles(dbg,srcfiles,cnt);
1478 srcfiles = 0;
1479 cnt = 0;
1480 }
11681481 return mres;
11691482 }
11701483 }
11721485 dwarf_dealloc_die(cu_die2);
11731486 }
11741487 cu_die2 = 0;
1488 if (srcfiles) {
1489 dealloc_all_srcfiles(dbg,srcfiles,cnt);
1490 srcfiles = 0;
1491 cnt = 0;
1492 }
11751493 } else if (sres == DW_DLV_NO_ENTRY) {
11761494 /* Do nothing I guess. */
11771495 } else {
15431861 }
15441862 return cores;
15451863 }
1546
1864 if ((1+die_stack_indent_level) >= DIE_STACK_SIZE ) {
1865 report_die_stack_error(dbg,err);
1866 if (in_die != in_die_in) {
1867 dwarf_dealloc_die(in_die);
1868 }
1869 dwarf_dealloc_die(child);
1870 return DW_DLV_ERROR;
1871 }
15471872 die_stack_indent_level++;
15481873 SET_DIE_STACK_ENTRY(die_stack_indent_level,0,
15491874 dieprint_cu_goffset);
1550 if (die_stack_indent_level >= DIE_STACK_SIZE ) {
1551 struct esb_s m;
1552
1553 esb_constructor(&m);
1554 esb_append_printf_i(&m,
1555 "ERROR: compiled in DIE_STACK_SIZE "
1556 "(the depth of the DIE tree in this CU)"
1557 " of %d exceeded!"
1558 ,DIE_STACK_SIZE);
1559 dwarf_error_creation(dbg,err,
1560 esb_get_string(&m));
1561 print_error_and_continue(dbg,
1562 esb_get_string(&m),
1563 DW_DLV_OK,*err);
1564 esb_destructor(&m);
1565 if (in_die != in_die_in) {
1566 dwarf_dealloc_die(in_die);
1567 }
1568 dwarf_dealloc_die(child);
1569 return DW_DLV_ERROR;
1570
1571 }
15721875 pdacres = print_die_and_children_internal(dbg, child,
15731876 dieprint_cu_goffset,
15741877 is_info, srcfiles, cnt,err);
16931996 #define PRINTING_DIES (glflags.gf_do_print_dwarf || \
16941997 (glflags.gf_record_dwarf_error && glflags.gf_check_verbose_mode))
16951998
1999 static void
2000 print_srcfiles( char **srcfiles,Dwarf_Signed srcfcnt)
2001 {
2002 Dwarf_Signed i = 0;
2003 const char * cntstr = " [%" DW_PR_DSd "]";
2004
2005 printf(" dwarf_srcfiles() returned strings. Count = %"
2006 DW_PR_DSd ".\n",srcfcnt);
2007 if (srcfcnt < 0) {
2008 glflags.gf_count_major_errors++;
2009 printf("ERROR: dwarf_srcfiles count less than zero "
2010 "which should be impossible. Ignoring srcfiles.");
2011 return;
2012 }
2013 if (srcfcnt > 9) {
2014 if (srcfcnt > 99) {
2015 cntstr = " [%3" DW_PR_DSd "]";
2016 } else {
2017 cntstr = " [%2" DW_PR_DSd "]";
2018 }
2019 }
2020 for ( ; i < srcfcnt; ++i) {
2021 printf(cntstr,i);
2022 printf(" %s\n",sanitized(srcfiles[i]));
2023 }
2024 }
16962025 /* If print_else_name_match is FALSE,
16972026 check for attribute matches with -S
16982027 inr print_attribute, and if found,
17342063 Dwarf_Addr lowAddr = 0;
17352064 Dwarf_Bool bSawHigh = FALSE;
17362065 Dwarf_Addr highAddr = 0;
1737
1738 /* Print using indentation
2066 int indentprespaces = 0;
2067
2068 /* Print using indentation see standard_indent() above.
17392069 < 1><0x000854ff GOFF=0x00546047> DW_TAG_pointer_type -> 34
17402070 < 1><0x000854ff> DW_TAG_pointer_type -> 18
17412071 DW_TAG_pointer_type -> 2
17422072 */
1743 /* Attribute indent. */
1744 int nColumn = glflags.gf_show_global_offsets ? 34 : 18;
1745
17462073 if (glflags.gf_check_abbreviations &&
17472074 checking_this_compiler()) {
17482075 validate_abbrev_code(dbg,abbrev_code);
17492076 }
1750
17512077 if (!ignore_die_stack &&
17522078 die_stack[die_indent_level].already_printed_) {
17532079 /* FALSE seems safe . */
17542080 *an_attr_matched_io = FALSE;
17552081 return DW_DLV_OK;
17562082 }
1757
1758 /* Reset indentation column if no offsets */
1759 if (!glflags.gf_display_offsets) {
1760 nColumn = 2;
1761 }
1762
2083 indentprespaces = standard_indent();
17632084 tres = dwarf_tag(die, &tag, err);
17642085 if (tres != DW_DLV_OK) {
17652086 print_error_and_continue(dbg,
17952116 " GOFF=0x%" DW_PR_XZEROS DW_PR_DUx "> ",
17962117 die_indent_level, (Dwarf_Unsigned)offset,
17972118 (Dwarf_Unsigned)overall_offset);
1798 printf("%*s%s\n",die_indent_level * 2 + 2," ",tagname);
1799 }
1800
2119 print_indent_prefix(0,die_indent_level,2);
2120 printf("%s\n",tagname);
2121 }
18012122 /* Print the die */
18022123 if (PRINTING_DIES && print_else_name_match) {
18032124 if (!ignore_die_stack) {
18152136 /* Print just the Tags and Attributes */
18162137 if (!glflags.gf_display_offsets) {
18172138 /* Print using indentation */
1818 printf("%*s%s\n",die_stack_indent_level * 2 + 2," ",tagname);
2139 print_indent_prefix(0,die_indent_level,2);
2140 printf("%s\n",tagname);
18192141 } else {
18202142 if (glflags.dense) {
18212143 if (glflags.gf_show_global_offsets) {
18222144 if (die_indent_level == 0) {
1823 printf("<%d><0x%" DW_PR_DUx "+0x%" DW_PR_DUx " GOFF=0x%"
2145 printf("<%d><0x%" DW_PR_DUx
2146 "+0x%" DW_PR_DUx
2147 " GOFF=0x%"
18242148 DW_PR_DUx ">", die_indent_level,
1825 (Dwarf_Unsigned)(overall_offset - offset),
2149 (Dwarf_Unsigned)
2150 (overall_offset - offset),
18262151 (Dwarf_Unsigned)offset,
1827 (Dwarf_Unsigned)overall_offset);
1828 } else {
1829 printf("<%d><0x%" DW_PR_DUx " GOFF=0x%" DW_PR_DUx ">",
2152 (Dwarf_Unsigned)overall_offset);
2153 } else {
2154 printf("<%d><0x%" DW_PR_DUx
2155 " GOFF=0x%" DW_PR_DUx ">",
18302156 die_indent_level,
18312157 (Dwarf_Unsigned)offset,
18322158 (Dwarf_Unsigned)overall_offset);
18332159 }
18342160 } else {
18352161 if (die_indent_level == 0) {
1836 printf("<%d><0x%" DW_PR_DUx "+0x%" DW_PR_DUx ">",
2162 printf("<%d><0x%" DW_PR_DUx "+0x%"
2163 DW_PR_DUx ">",
18372164 die_indent_level,
1838 (Dwarf_Unsigned)(overall_offset - offset),
2165 (Dwarf_Unsigned)
2166 (overall_offset - offset),
18392167 (Dwarf_Unsigned)offset);
18402168 } else {
1841 printf("<%d><0x%" DW_PR_DUx ">", die_indent_level,
2169 printf("<%d><0x%" DW_PR_DUx ">",
2170 die_indent_level,
18422171 (Dwarf_Unsigned)offset);
18432172 }
18442173 }
18502179 if (glflags.gf_show_global_offsets) {
18512180 int agres = 0;
18522181
1853 agres = dwarf_die_abbrev_global_offset(die,
1854 &agoff, &acount,err);
1855 if(agres == DW_DLV_ERROR) {
2182 agres =
2183 dwarf_die_abbrev_global_offset(
2184 die, &agoff, &acount,err);
2185 if (agres == DW_DLV_ERROR) {
18562186 print_error_and_continue(dbg,
1857 "dwarf_die_abbrev_global_offset call "
2187 "dwarf_die_abbrev_global_offset call"
18582188 " failed",
18592189 agres, *err);
18602190 return agres;
18612191 } else if (agres == DW_DLV_NO_ENTRY) {
18622192 print_error_and_continue(dbg,
1863 "dwarf_die_abbrev_global_offset "
1864 "no entry?",
2193 "dwarf_die_abbrev_global_offset"
2194 " no entry?",
18652195 agres, *err);
18662196 return agres;
18672197 } else {
18682198 printf(" ABGOFF = 0x%"
18692199 DW_PR_XZEROS DW_PR_DUx
1870 " count = 0x%" DW_PR_XZEROS DW_PR_DUx,
2200 " count = 0x%"
2201 DW_PR_XZEROS DW_PR_DUx,
18712202 agoff, acount);
18722203 }
18732204 }
18862217 }
18872218
18882219 /* Print using indentation */
1889 printf("%*s%s",die_indent_level * 2 + 2," ",tagname);
2220 print_indent_prefix(0,die_indent_level, 2);
2221 printf("%s",tagname);
18902222 if (glflags.verbose) {
18912223 Dwarf_Off agoff = 0;
18922224 Dwarf_Unsigned acount = 0;
18962228
18972229 agres = dwarf_die_abbrev_global_offset(die,
18982230 &agoff, &acount,err);
1899 if(agres == DW_DLV_ERROR) {
2231 if (agres == DW_DLV_ERROR) {
19002232 print_error_and_continue(dbg,
19012233 "Call to "
19022234 "dwarf_die_abbrev_global_offset"
19222254 fputs("\n",stdout);
19232255 }
19242256 }
2257 }
2258 if ((glflags.verbose > 2) && (die_indent_level == 0) &&
2259 srcfcnt && PRINTING_DIES) {
2260 print_srcfiles(srcfiles,srcfcnt);
19252261 }
19262262
19272263 atres = dwarf_attrlist(die, &atlist, &atcnt, err);
19912327 /* Print using indentation */
19922328 if (!glflags.dense && PRINTING_DIES &&
19932329 print_else_name_match) {
1994
1995 printf("%*s",die_indent_level * 2 + 2 + nColumn,
1996 " ");
2330 print_indent_prefix(indentprespaces,die_indent_level,2);
19972331 }
19982332 {
19992333 boolean attr_match_localb = FALSE;
22182552 unsigned i = 0;
22192553 /* Print a full line */
22202554 esb_append(esbp,"\n ");
2221 for(i = 0 ; i < 2 && next < array_len; ++i,++next) {
2555 for (i = 0 ; i < 2 && next < array_len; ++i,++next) {
22222556 Dwarf_Signed vs = array[next];
22232557 Dwarf_Unsigned vu = (Dwarf_Unsigned)vs;
22242558
23452679 " CU-GOFF=0x%" DW_PR_XZEROS DW_PR_DUx
23462680 "> ",
23472681 level, loff, goff,cu_die_goff);
2348 printf("%*s%s -> %s\n",level * 2 + 2,
2349 " ",atname,valname);
2682 print_indent_prefix(0,level,2);
2683 printf("%s -> %s\n",atname,valname);
23502684 }
23512685
23522686 /* DW_FORM_data16 should not apply here. */
24722806 }
24732807 esb_constructor_fixed(&specificationstr,buf,sizeof(buf));
24742808 ++die_indent_level;
2475 res = get_attr_value(dbg, tag, die, dieprint_cu_goffset,
2809 if (die_indent_level >= DIE_STACK_SIZE ) {
2810 esb_destructor(&valname);
2811 report_die_stack_error(dbg,err);
2812 return DW_DLV_ERROR;
2813 }
2814 res = get_attr_value(dbg, tag, die,
2815 die_indent_level,
2816 dieprint_cu_goffset,
24762817 attrib, srcfiles, srcfcnt,
24772818 &specificationstr,glflags.show_form_used,glflags.verbose,
24782819 err);
25472888 atname,esb_get_string(&valname));
25482889 }
25492890 ++die_indent_level;
2891 if (die_indent_level >= DIE_STACK_SIZE ) {
2892 report_die_stack_error(dbg,err);
2893 esb_destructor(&valname);
2894 return DW_DLV_ERROR;
2895 }
25502896 res =dwarf_CU_dieoffset_given_die(ref_die,
25512897 &target_die_cu_goff, err);
25522898 if (res != DW_DLV_OK) {
26422988
26432989 esb_constructor(&bucketgroupstr);
26442990 res = get_attr_value(dbg, tag, die,
2991 die_indent_level,
26452992 dieprint_cu_goffset,
26462993 attrib, srcfiles,
26472994 cnt, &bucketgroupstr,
30753422 esb_append_printf_u(strout,
30763423 "\n discr list array len: "
30773424 "%" DW_PR_DUu "\n",arraycount);
3078 for(u = 0; u < arraycount; u++) {
3425 for (u = 0; u < arraycount; u++) {
30793426 int u2res = 0;
30803427 Dwarf_Half dtype = 0;
30813428 Dwarf_Signed slow = 0;
31453492 print_location_description(Dwarf_Debug dbg,
31463493 Dwarf_Attribute attrib,
31473494 Dwarf_Die die,
3148 UNUSEDARG int checking,
3495 int checking,
31493496 Dwarf_Half attr,
3150 UNUSEDARG int die_indent_level,
3497 int die_indent_level,
31513498 struct esb_s *base,
31523499 struct esb_s *details,
31533500 Dwarf_Error *err)
31693516 if (is_simple_location_expr(theform)) {
31703517 res = print_location_list(dbg, die, attrib,
31713518 checking,
3519 die_indent_level,
31723520 TRUE,base,err);
31733521 if (res == DW_DLV_ERROR) {
31743522 return res;
31783526 } else if (is_location_form(theform)) {
31793527 res = print_location_list(dbg, die, attrib,
31803528 checking,
3529 die_indent_level,
31813530 FALSE,
31823531 details,err);
31833532 if (res == DW_DLV_ERROR) {
36624011 Dwarf_Half directform = 0;
36634012 boolean showform = glflags.show_form_used;
36644013
3665 append_extra_string = TRUE;
36664014 res = get_form_values(dbg,attrib,&theform,&directform,
36674015 err);
36684016 if (res == DW_DLV_ERROR) {
36804028 showform = FALSE;
36814029 }
36824030 res = get_attr_value(dbg, tag, die,
4031 die_indent_level,
36834032 dieprint_cu_goffset,
36844033 attrib, srcfiles, cnt, &valname,
36854034 showform,
36904039 esb_destructor(&esb_extra);
36914040 return res;
36924041 }
4042 append_extra_string = TRUE;
36934043 res = print_location_description(dbg,attrib,die,
36944044 checking,
36954045 attr,die_indent_level,
38144164 rv, *err);
38154165 return rv;
38164166 }
4167 append_extra_string = TRUE;
38174168 rv = print_location_list(dbg, die, attrib,
38184169 checking,
4170 die_indent_level,
38194171 TRUE,
38204172 &esb_extra,err);
38214173 if (rv == DW_DLV_ERROR) {
38234175 esb_destructor(&esb_extra);
38244176 return rv;
38254177 }
3826 append_extra_string = TRUE;
38274178 show_form_itself(glflags.show_form_used,
38284179 glflags.verbose,
38294180 btheform,
38324183 break;
38334184 default:
38344185 rv = get_attr_value(dbg, tag, die,
4186 die_indent_level,
38354187 dieprint_cu_goffset,
38364188 attrib, srcfiles, cnt, &upperboundstr,
38374189 glflags.show_form_used,glflags.verbose,
38564208 case DW_AT_high_pc:
38574209 {
38584210 int rv = 0;
3859 rv = print_hipc_lopc_attribute(dbg, tag,
3860 die, dieprint_cu_goffset,
4211 rv = print_hipc_lopc_attribute(dbg, tag, die,
4212 die_indent_level,
4213 dieprint_cu_goffset,
38614214 srcfiles, cnt,
38624215 attrib,
38634216 attr,
38934246 break;
38944247 }
38954248 rv = get_attr_value(dbg, tag,die,
4249 die_indent_level,
38964250 dieprint_cu_goffset,attrib, srcfiles, cnt,
38974251 &valname,
38984252 glflags.show_form_used,glflags.verbose,err);
39314285 esb_constructor_fixed(&linkagenamestr,linknamebuf,
39324286 sizeof(linknamebuf));
39334287 ml = get_attr_value(dbg, tag, die,
4288 die_indent_level,
39344289 dieprint_cu_goffset, attrib, srcfiles,
39354290 cnt, &linkagenamestr, glflags.show_form_used,
39364291 glflags.verbose,err);
39564311
39574312 esb_constructor(&lesb);
39584313 get_attr_value(dbg, tag, die,
4314 die_indent_level,
39594315 dieprint_cu_goffset,attrib, srcfiles, cnt,
39604316 &lesb, local_show_form,local_verbose,err);
39614317
39784334 esb_constructor_fixed(&templatenamestr,atnamebuf,
39794335 sizeof(atnamebuf));
39804336 tres = get_attr_value(dbg, tag, die,
4337 die_indent_level,
39814338 dieprint_cu_goffset,attrib, srcfiles, cnt,
39824339 &templatenamestr, glflags.show_form_used,
39834340 glflags.verbose,err);
40024359
40034360 esb_constructor(&lesb);
40044361 tres = get_attr_value(dbg, tag, die,
4362 die_indent_level,
40054363 dieprint_cu_goffset,attrib, srcfiles, cnt,
40064364 &lesb, local_show_form,local_verbose,err);
40074365 /* Look for specific name forms, attempting to
40474405
40484406 esb_constructor(&lesb);
40494407 vres = get_attr_value(dbg, tag, die,
4408 die_indent_level,
40504409 dieprint_cu_goffset,attrib, srcfiles, cnt,
40514410 &lesb, local_show_form,local_verbose,err);
40524411 if (vres == DW_DLV_ERROR) {
40754434
40764435 esb_constructor(&lesb);
40774436 sres = get_attr_value(dbg, tag, die,
4437 die_indent_level,
40784438 dieprint_cu_goffset,attrib, srcfiles, cnt,
40794439 &lesb, local_show_form_used,local_verbose,
40804440 err);
41034463
41044464 esb_constructor(&lesb);
41054465 pres = get_attr_value(dbg, tag, die,
4466 die_indent_level,
41064467 dieprint_cu_goffset,attrib, srcfiles, cnt,
41074468 &lesb, glflags.show_form_used,glflags.verbose,
41084469 err);
41314492
41324493 esb_constructor(&local_e);
41334494 pres = get_attr_value(dbg, tag, die,
4495 die_indent_level,
41344496 dieprint_cu_goffset,attrib, srcfiles, cnt,
41354497 &local_e, show_form_local,local_verbose,err);
41364498 if (pres == DW_DLV_ERROR) {
41704532 esb_constructor_fixed(&lesb,typebuf,
41714533 sizeof(typebuf));
41724534 tres = get_attr_value(dbg, tag, die,
4535 die_indent_level,
41734536 dieprint_cu_goffset,attrib, srcfiles, cnt, &lesb,
41744537 glflags.show_form_used,glflags.verbose,err);
41754538 if (tres == DW_DLV_ERROR) {
44864849
44874850 esb_constructor_fixed(&lesb,ebuf,sizeof(ebuf));
44884851 dres = get_attr_value(dbg, tag,die,
4852 die_indent_level,
44894853 dieprint_cu_goffset,attrib, srcfiles, cnt, &lesb,
44904854 glflags.show_form_used,glflags.verbose,err);
44914855 if (dres == DW_DLV_ERROR) {
45644928 printf("%-28s\n",atname);
45654929 } else {
45664930 if (glflags.dense) {
4567 printf(" %s<%s>", atname, esb_get_string(&valname));
4931 char *v = 0;
4932 v = esb_get_string(&valname);
4933 printf(" %s<%s>", atname, sanitized(v));
45684934 if (append_extra_string) {
4569 char *v = esb_get_string(&esb_extra);
4570 printf("%s", v);
4935 v = esb_get_string(&esb_extra);
4936 printf("%s", sanitized(v));
45714937 }
45724938 } else {
4939 char *v = 0;
45734940 printf("%-28s", atname);
45744941 if (strlen(atname) >= 28) {
45754942 printf(" ");
45764943 }
4577 printf("%s\n", sanitized(esb_get_string(&valname)));
4944 v = esb_get_string(&valname);
4945 printf("%s\n", sanitized(v));
45784946 if (append_extra_string) {
4579 char *v = esb_get_string(&esb_extra);
4947 v = esb_get_string(&esb_extra);
45804948 printf("%s", sanitized(v));
45814949 }
45824950 }
45904958
45914959 int
45924960 dwarfdump_print_location_operations(Dwarf_Debug dbg,
4961 Dwarf_Die die,
4962 int die_indent_level,
45934963 Dwarf_Locdesc * llbuf, /* Non-zero for old interface. */
45944964 Dwarf_Locdesc_c locdesc, /* Non-zero for 2015 interface. */
45954965 UNUSEDARG Dwarf_Unsigned llent, /* Which desc we have . */
46044974 unsigned i = 0;
46054975 Dwarf_Bool report_raw = TRUE;
46064976
4607 if(llbuf) {
4977 if (llbuf) {
46084978 Dwarf_Locdesc *locd = 0;
46094979 locd = llbuf;
46104980 no_of_ops = llbuf->ld_cents;
46124982 for (i = 0; i < no_of_ops; i++) {
46134983 Dwarf_Loc * op = &locd->ld_s[i];
46144984
4615 int res = _dwarf_print_one_expr_op(dbg,op,NULL,i,
4985 int res = _dwarf_print_one_expr_op(dbg,die,
4986 die_indent_level,op,NULL,i,
46164987 report_raw,
46174988 baseaddr,string_out,err);
46184989 if (res == DW_DLV_ERROR) {
46264997 possibly_increase_esb_alloc(string_out,no_of_ops,100);
46274998 for (i = 0; i < no_of_ops; i++) {
46284999 int res = 0;
4629 res = _dwarf_print_one_expr_op(dbg,NULL,locdesc,i,
5000 res = _dwarf_print_one_expr_op(dbg,die,
5001 die_indent_level,NULL,locdesc,i,
46305002 report_raw,
46315003 baseaddr,string_out,err);
46325004 if (res == DW_DLV_ERROR) {
46655037 {
46665038 unsigned int i = 0;
46675039
4668 if(!length) {
5040 if (!length) {
46695041 return;
46705042 }
46715043 esb_append(string_out," contents 0x");
46795051
46805052 int
46815053 _dwarf_print_one_expr_op(Dwarf_Debug dbg,
5054 Dwarf_Die die,
5055 int die_indent_level,
46825056 Dwarf_Loc* expr,
46835057 Dwarf_Locdesc_c exprc,
46845058 int index,
46965070 Dwarf_Unsigned raw3 = 0;
46975071 Dwarf_Unsigned offsetforbranch = 0;
46985072 const char * op_name = 0;
4699
4700 if (index > 0) {
5073 int indentprespaces = 0;
5074 int indentpostspaces = 0;
5075
5076 if (!glflags.dense && !glflags.gf_expr_ops_joined) {
5077 indentprespaces = standard_indent();
5078 indentpostspaces = 6;
5079 esb_append(string_out,"\n");
5080 append_indent_prefix(string_out,indentprespaces,
5081 die_indent_level,indentpostspaces);
5082 } else if (index > 0) {
47015083 esb_append(string_out, " ");
47025084 }
47035085 if (expr) {
47735155 esb_append(string_out,"+");
47745156 formx_signed(opd2,string_out);
47755157 break;
4776 case DW_OP_call2:
5158 case DW_OP_call2: {
47775159 bracket_hex(" ",opd1,"",string_out);
5160 check_die_expr_op_basic_data(dbg,die,op_name,
5161 indentprespaces,die_indent_level,indentpostspaces,
5162 NO_SPECIFIC_TAG,NON_ZERO_OFFSET_REQUIRED,
5163 WITHIN_CU,opd1,string_out);
5164 }
47785165 break;
4779 case DW_OP_call4:
5166 case DW_OP_call4: {
47805167 bracket_hex(" ",opd1,"",string_out);
5168 check_die_expr_op_basic_data(dbg,die,op_name,
5169 indentprespaces,die_indent_level,indentpostspaces,
5170 NO_SPECIFIC_TAG,NON_ZERO_OFFSET_REQUIRED,
5171 WITHIN_CU,opd1,string_out);
5172 }
47815173 break;
4782 case DW_OP_call_ref:
5174 case DW_OP_call_ref: {
47835175 bracket_hex(" ",opd1,"",string_out);
5176 check_die_expr_op_basic_data(dbg,die,op_name,
5177 indentprespaces,die_indent_level,indentpostspaces,
5178 NO_SPECIFIC_TAG,NON_ZERO_OFFSET_REQUIRED,
5179 WITHIN_CU,opd1,string_out);
5180 }
47845181 break;
47855182 case DW_OP_bit_piece:
47865183 bracket_hex(" ",opd1,"",string_out);
48275224 case DW_OP_GNU_encoded_addr:
48285225 bracket_hex(" ",opd1,"",string_out);
48295226 break;
4830 case DW_OP_GNU_variable_value:
5227 case DW_OP_GNU_variable_value: {
48315228 bracket_hex(" ",opd1,"",string_out);
5229 check_die_expr_op_basic_data(dbg,die,op_name,
5230 indentprespaces,die_indent_level,indentpostspaces,
5231 NO_SPECIFIC_TAG,NON_ZERO_OFFSET_REQUIRED,
5232 WITHIN_CU,opd1,string_out);
5233 }
48325234 break;
48335235 case DW_OP_implicit_pointer: /* DWARF5 */
4834 case DW_OP_GNU_implicit_pointer:
5236 case DW_OP_GNU_implicit_pointer: {
5237 /* opd1 is a section offset, not a CU offset.
5238 We don't know if DW_OP_GNU_implicit_pointer
5239 allows a zero offset meaning 'generic type'
5240 but GNU C++ 4.9.x-google 20150123 (prerelease)
5241 generates zero in DWARF4.
5242 DWARF5 does not allow zero. */
48355243 bracket_hex(" ",opd1,"",string_out);
48365244 esb_append(string_out, " ");
48375245 formx_signed(opd2,string_out);
5246 check_die_expr_op_basic_data(dbg,die,op_name,
5247 indentprespaces,die_indent_level,indentpostspaces,
5248 NO_SPECIFIC_TAG,
5249 op= DW_OP_implicit_pointer?
5250 ZERO_OFFSET_GENERIC_TYPE:
5251 NON_ZERO_OFFSET_REQUIRED,
5252 !WITHIN_CU,opd1,string_out);
5253 }
48385254 break;
48395255 case DW_OP_entry_value: /* DWARF5 */
48405256 case DW_OP_GNU_entry_value: {
48465262 bp = (Dwarf_Small *)(uintptr_t) opd2;
48475263 if (!bp) {
48485264 esb_append(string_out,
4849 "ERROR: Null databyte pointer DW_OP_entry_value ");
5265 "ERROR: Null databyte pointer "
5266 "DW_OP_entry_value ");
48505267 } else {
48515268 show_contents(string_out,length,bp);
48525269 }
48575274 {
48585275 const unsigned char *bp = 0;
48595276 unsigned int length = 0;
4860
5277 /* opd1 is cu-relative offset of type DIE.
5278 we have a die in the relevant CU in the arg
5279 list */
48615280 bracket_hex(" ",opd1,"",string_out);
48625281 length = opd2;
48635282 esb_append(string_out," const length: ");
48715290 } else {
48725291 show_contents(string_out,length,bp);
48735292 }
5293 check_die_expr_op_basic_data(dbg,die,op_name,
5294 indentprespaces,die_indent_level,indentpostspaces,
5295 DW_TAG_base_type, NON_ZERO_OFFSET_REQUIRED,
5296 WITHIN_CU,opd1,string_out);
48745297 }
48755298 break;
48765299 case DW_OP_regval_type: /* DWARF5 */
48785301 esb_append_printf_u(string_out,
48795302 " 0x%" DW_PR_DUx , opd1);
48805303 bracket_hex(" ",opd2,"",string_out);
5304 check_die_expr_op_basic_data(dbg,die,op_name,
5305 indentprespaces,die_indent_level,indentpostspaces,
5306 DW_TAG_base_type,NON_ZERO_OFFSET_REQUIRED,
5307 WITHIN_CU,opd2,string_out);
48815308 }
48825309 break;
5310 case DW_OP_xderef_type: /* DWARF5 */
48835311 case DW_OP_deref_type: /* DWARF5 */
48845312 case DW_OP_GNU_deref_type: {
48855313 esb_append_printf_u(string_out,
48865314 " 0x%02" DW_PR_DUx , opd1);
48875315 bracket_hex(" ",opd2,"",string_out);
5316 check_die_expr_op_basic_data(dbg,die,op_name,
5317 indentprespaces,die_indent_level,indentpostspaces,
5318 DW_TAG_base_type,NON_ZERO_OFFSET_REQUIRED,
5319 WITHIN_CU,opd2,string_out);
48885320 }
48895321 break;
48905322 case DW_OP_convert: /* DWARF5 */
48915323 case DW_OP_GNU_convert:
48925324 case DW_OP_reinterpret: /* DWARF5 */
48935325 case DW_OP_GNU_reinterpret:
4894 case DW_OP_GNU_parameter_ref:
5326 /* For following case, unsure if non-zero opd2
5327 is required or not. Assume not */
5328 case DW_OP_GNU_parameter_ref: {
48955329 esb_append_printf_u(string_out,
48965330 " 0x%02" DW_PR_DUx , opd1);
5331 check_die_expr_op_basic_data(dbg,die,op_name,
5332 indentprespaces,die_indent_level,indentpostspaces,
5333 DW_TAG_base_type,ZERO_OFFSET_GENERIC_TYPE,
5334 WITHIN_CU,opd2,string_out);
5335 }
48975336 break;
48985337 default:
48995338 {
49005339 esb_append_printf_u(string_out,
4901 " dwarf_op unknown 0x%x", (unsigned)op);
5340 " DWARF DW_OP_ unknown 0x%x", (unsigned)op);
49025341 }
49035342 break;
49045343 }
50105449 "segment selector size : %3u",
50115450 segment_selector_size);
50125451 }
5013 if(lkind == DW_LKIND_loclists) {
5452 if (lkind == DW_LKIND_loclists) {
50145453 append_local_prefix(esbp);
50155454 esb_append_printf_u(esbp,
50165455 "offset of context : 0x%"
50795518 Dwarf_Die die,
50805519 Dwarf_Attribute attr,
50815520 boolean checking,
5521 int die_indent_level,
50825522 int no_end_newline,
50835523 struct esb_s *details,
50845524 Dwarf_Error* llerr)
51285568 Dwarf_Unsigned offset_table_offset = 0;
51295569 Dwarf_Unsigned offset_table_entrycount = 0;
51305570 struct esb_s section_truename;
5131
51325571
51335572 lres = dwarf_get_version_of_die(die,&version,
51345573 &offset_size);
53605799 /* We use DW_LLE names for DW_LKIND_loclist and
53615800 DW_LKIND_loclists. We use LLEX names for
53625801 DW_LKIND_GNU_exp_list */
5363 if(loclist_source) {
5802 if (loclist_source) {
53645803 Dwarf_Half tag = 0;
53655804 Dwarf_Half attrnum = 0;
53665805 const char *tagname = 0;
54225861 &bError);
54235862 }
54245863 }
5425 {
5426 lres = dwarfdump_print_location_operations(dbg,
5427 /* Either llbuf or locentry non-zero.
5428 Not both. */
5429 llbuf,
5430 locentry,
5431 llent, /* Which loc desc this is */
5432 ulocentry_count, /* How many ops in this loc desc */
5433 loclist_source,
5434 no_ending_newline,
5435 base_address,
5436 details,llerr);
5437 }
5864 lres = dwarfdump_print_location_operations(dbg,
5865 die,
5866 die_indent_level,
5867 /* Either llbuf or locentry non-zero.
5868 Not both. */
5869 llbuf,
5870 locentry,
5871 llent, /* Which loc desc this is */
5872 ulocentry_count, /* How many ops in this loc desc */
5873 loclist_source,
5874 no_ending_newline,
5875 base_address,
5876 details,llerr);
54385877 if (lres == DW_DLV_ERROR) {
54395878 return lres;
54405879 }
54695908 {
54705909 unsigned i = 0;
54715910
5472 for( ; i < sizeof(Dwarf_Form_Data16); ++i){
5911 for ( ; i < sizeof(Dwarf_Form_Data16); ++i){
54735912 esb_append(esbp, "0x");
54745913 if (hex_format) {
54755914 esb_append_printf_u(esbp,
55035942 const char *leader,Dwarf_Bool hex_format,struct esb_s*esbp)
55045943 {
55055944 formx_unsigned(tempud,esbp,hex_format);
5506 if(tempd < 0) {
5945 if (tempd < 0) {
55075946 esb_append(esbp,leader);
55085947 formx_signed(tempd,esbp);
55095948 esb_append(esbp,")");
55335972 int show_form_here = FALSE;
55345973 int retval = 0;
55355974
5536 if(!die) {
5975 if (!die) {
55375976 return 0;
55385977 }
55395978 is_info = dwarf_get_die_infotypes_flag(die);
5540 if(is_info) {
5979 if (is_info) {
55415980 helperbase = &helpertree_offsets_base_info;
55425981 } else {
55435982 helperbase = &helpertree_offsets_base_types;
55545993 /* This might be wrong. See the typedieoffset check below,
55555994 which is correct... */
55565995 e = helpertree_find(diegoffset,helperbase);
5557 if(e) {
5996 if (e) {
55585997 /*bracket_hex("<helper FOUND offset ",diegoffset,">",esbp);
55595998 bracket_hex("<helper FOUND val ",e->hm_val,">",esbp); */
55605999 return e->hm_val;
55906029 dwarf_dealloc_attribute(attr);
55916030 attr = 0;
55926031 e = helpertree_find(typedieoffset,helperbase);
5593 if(e) {
6032 if (e) {
55946033 /*bracket_hex("<helper FOUND typedieoffset ",typedieoffset,">",esbp);
55956034 bracket_hex("<helper FOUND val ",e->hm_val,">",esbp); */
55966035 return e->hm_val;
57756214 print_exprloc_content(Dwarf_Debug dbg,Dwarf_Die die,
57766215 Dwarf_Attribute attrib,
57776216 boolean checking,
5778 UNUSEDARG int die_indent_level,
6217 int die_indent_level,
57796218 UNUSEDARG int showhextoo,
5780 struct esb_s *esbp,Dwarf_Error* err)
6219 struct esb_s *esbp,
6220 struct esb_s *exprops,
6221 Dwarf_Error* err)
57816222 {
57826223 Dwarf_Ptr x = 0;
57836224 Dwarf_Unsigned exprlength = 0;
58456286 if (!checking) {
58466287 int sres = 0;
58476288
5848 sres = print_location_operations(dbg,x,
6289 sres = print_location_operations(dbg,die,
6290 die_indent_level,x,
58496291 exprlength,address_size,
5850 offset_size,version, esbp,err);
6292 offset_size,version, exprops,err);
58516293 if (sres == DW_DLV_ERROR) {
58526294 glflags.gf_count_major_errors++;
58536295 printf("\nERROR: Unable to create "
61226564 " "
61236565 "secoff");
61246566 }
6125 for( ; i < count; ++i) {
6567 for ( ; i < count; ++i) {
61266568 unsigned entrylen = 0;
61276569 unsigned rle_code = 0;
61286570 Dwarf_Unsigned raw1 = 0;
63566798 int
63576799 get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
63586800 Dwarf_Die die,
6801 int die_indent_level,
63596802 Dwarf_Off dieprint_cu_goffset,
63606803 Dwarf_Attribute attrib,
63616804 char **srcfiles, Dwarf_Signed cnt, struct esb_s *esbp,
63796822 Dwarf_Half direct_form = 0;
63806823 Dwarf_Bool is_info = TRUE;
63816824 boolean checking = !PRINTING_DIES;
6825 struct esb_s esb_expr;
6826 int esb_expr_alive = FALSE;
63826827
63836828 is_info = dwarf_get_die_infotypes_flag(die);
63846829 /* Dwarf_whatform gets the real form, DW_FORM_indir is
64146859 Dwarf_Unsigned index = 0;
64156860 int res = dwarf_get_debug_addr_index
64166861 (attrib,&index,err);
6417 if(res != DW_DLV_OK) {
6862 if (res != DW_DLV_OK) {
64186863 struct esb_s lstr;
64196864 esb_constructor(&lstr);
64206865 esb_append(&lstr,"ERROR: getting debug addr"
64406885 glflags.gf_debug_addr_missing_search_by_address = 1;
64416886 res = dwarf_get_debug_addr_index(attrib,&index,
64426887 err);
6443 if(res != DW_DLV_OK) {
6888 if (res != DW_DLV_OK) {
64446889 struct esb_s lstr;
64456890 esb_constructor(&lstr);
64466891 esb_append(&lstr,get_FORM_name(theform,FALSE));
64676912 esb_get_string(&lstr),
64686913 bres, *err);
64696914 esb_destructor(&lstr);
6470 if(!glflags.gf_error_code_in_name_search_by_address) {
6915 if (!glflags.gf_error_code_in_name_search_by_address)
6916 {
64716917 glflags.gf_error_code_in_name_search_by_address =
64726918 dwarf_errno(*err);
64736919 }
65116957 wres, *err);
65126958 return wres;
65136959 }
6514 {
6515 if (attr == DW_AT_sibling) {
6516 /* The value had better be inside the current CU
6517 else there is a nasty error here, as a sibling
6518 has to be in the same CU, it seems. */
6519 /* The target offset (off) had better be
6520 following the die's global offset else
6521 we have a serious botch. this FORM
6522 defines the value as a .debug_info
6523 global offset. */
6524 Dwarf_Off cuoff = 0;
6525 Dwarf_Off culen = 0;
6526 Dwarf_Off die_overall_offset = 0;
6527 int res = 0;
6528 int ores = dwarf_dieoffset(die, &die_overall_offset,
6529 err);
6530 if (ores != DW_DLV_OK) {
6531 print_error_and_continue(dbg,
6532 "dwarf_dieoffsetnot available for"
6533 "DW_AT_sibling. Something is corrupted.",
6534 ores, *err);
6535 return ores;
6536 }
6537 SET_DIE_STACK_SIBLING(off);
6538 if (die_overall_offset >= off) {
6539 struct esb_s msg;
6540
6541 esb_constructor(&msg);
6542 esb_append_printf_u(&msg,
6543 "ERROR: Sibling DW_FORM_ref_offset 0x%"
6544 DW_PR_XZEROS DW_PR_DUx ,
6545 off);
6546 esb_append_printf_s(&msg,
6547 " points %s die Global offset ",
6548 (die_overall_offset == off)?"at":"before");
6549 esb_append_printf_u(&msg,
6550 "0x%" DW_PR_XZEROS DW_PR_DUx,
6551 die_overall_offset);
6552 simple_err_only_return_action(DW_DLV_ERROR,
6553 esb_get_string(&msg));
6554 esb_destructor(&msg);
6555 }
6556
6557 DWARF_CHECK_COUNT(tag_tree_result,1);
6558 res = dwarf_die_CU_offset_range(die,&cuoff,
6559 &culen,err);
6560 if (res != DW_DLV_OK) {
6960 if (attr == DW_AT_sibling) {
6961 /* The value had better be inside the current CU
6962 else there is a nasty error here, as a sibling
6963 has to be in the same CU, it seems. */
6964 /* The target offset (off) had better be
6965 following the die's global offset else
6966 we have a serious botch. this FORM
6967 defines the value as a .debug_info
6968 global offset. */
6969 Dwarf_Off cuoff = 0;
6970 Dwarf_Off culen = 0;
6971 Dwarf_Off die_overall_offset = 0;
6972 int res = 0;
6973 int ores = dwarf_dieoffset(die, &die_overall_offset,
6974 err);
6975 if (ores != DW_DLV_OK) {
6976 print_error_and_continue(dbg,
6977 "dwarf_dieoffsetnot available for"
6978 "DW_AT_sibling. Something is corrupted.",
6979 ores, *err);
6980 return ores;
6981 }
6982 if (die_stack_indent_level >= DIE_STACK_SIZE ) {
6983 report_die_stack_error(dbg,err);
6984 return DW_DLV_ERROR;
6985 }
6986 SET_DIE_STACK_SIBLING(off);
6987 if (die_overall_offset >= off) {
6988 struct esb_s msg;
6989
6990 esb_constructor(&msg);
6991 esb_append_printf_u(&msg,
6992 "ERROR: Sibling DW_FORM_ref_offset 0x%"
6993 DW_PR_XZEROS DW_PR_DUx ,
6994 off);
6995 esb_append_printf_s(&msg,
6996 " points %s die Global offset ",
6997 (die_overall_offset == off)?"at":"before");
6998 esb_append_printf_u(&msg,
6999 "0x%" DW_PR_XZEROS DW_PR_DUx,
7000 die_overall_offset);
7001 simple_err_only_return_action(DW_DLV_ERROR,
7002 esb_get_string(&msg));
7003 esb_destructor(&msg);
7004 }
7005
7006 DWARF_CHECK_COUNT(tag_tree_result,1);
7007 res = dwarf_die_CU_offset_range(die,&cuoff,
7008 &culen,err);
7009 if (res != DW_DLV_OK) {
7010 DWARF_CHECK_ERROR(tag_tree_result,
7011 "DW_AT_sibling DW_FORM_ref_addr "
7012 "offset range of the CU "
7013 "is not available");
7014 DROP_ERROR_INSTANCE(dbg,res,*err);
7015 } else {
7016 Dwarf_Off cuend = cuoff+culen;
7017 if (off < cuoff || off >= cuend) {
65617018 DWARF_CHECK_ERROR(tag_tree_result,
65627019 "DW_AT_sibling DW_FORM_ref_addr "
6563 "offset range of the CU "
6564 "is not available");
6565 DROP_ERROR_INSTANCE(dbg,res,*err);
6566 } else {
6567 Dwarf_Off cuend = cuoff+culen;
6568 if (off < cuoff || off >= cuend) {
6569 DWARF_CHECK_ERROR(tag_tree_result,
6570 "DW_AT_sibling DW_FORM_ref_addr "
6571 "offset points "
6572 "outside of current CU");
6573 }
7020 "offset points "
7021 "outside of current CU");
65747022 }
65757023 }
65767024 }
69047352 vres = dwarf_get_version_of_die(die,
69057353 &dwversion,&offset_size);
69067354 if (srcfiles && vres == DW_DLV_OK) {
6907 /* srcfiles is indexed starting at 0, but
6908 DW_AT_decl_file defines that 0 means no
6909 file, so tempud 1 means the 0th entry in
6910 srcfiles, thus tempud-1 is the correct */
6911 if (!tempud) {
6912 /* Just print the number,
6913 there is noname. */
6914 } else if (tempud > 0 &&
6915 tempud <= (Dwarf_Unsigned)cnt) {
6916 fname = srcfiles[tempud - 1];
6917 esb_append(&declmsg,fname);
7355 Dwarf_Unsigned localud = tempud;
7356 Dwarf_Bool done = FALSE;
7357
7358 if (dwversion == DWVERSION5) {
7359 if ( localud < (Dwarf_Unsigned)cnt) {
7360 fname = srcfiles[localud];
7361 esb_append(&declmsg,fname);
7362 done = TRUE;
7363 }
69187364 } else {
7365 if (!localud) {
7366 /* Just print the number,
7367 there is no name. */
7368 done=TRUE;
7369 } else if (localud > 0 &&
7370 localud <= (Dwarf_Unsigned)cnt) {
7371 fname = srcfiles[localud - 1];
7372 esb_append(&declmsg,fname);
7373 done = TRUE;
7374 }
7375 }
7376 if (!done) {
69197377 esb_append(&declmsg,
69207378 " <DW_AT_decl_file index ");
69217379 esb_append_printf_u(&declmsg,
71427600 sizeof(saverbuf));
71437601 sres = dwarf_get_debug_str_index(attrib,&index,err);
71447602 esb_append(&saver,temps);
7145 if(sres == DW_DLV_OK) {
7603 if (sres == DW_DLV_OK) {
71467604 bracket_hex("(indexed string: ",index,")",esbp);
71477605 } else {
71487606 DROP_ERROR_INSTANCE(dbg,sres,*err);
72297687 case DW_FORM_exprloc: { /* DWARF4 */
72307688 int showhextoo = 1;
72317689
7690 esb_expr_alive = TRUE;
7691 esb_constructor(&esb_expr);
72327692 wres = print_exprloc_content(dbg,die,attrib,
72337693 checking,
7234 0, /* die_indent_level pointless here */
7694 die_indent_level,
72357695 showhextoo,
7236 esbp, err);
7696 esbp, &esb_expr,
7697 err);
72377698 if (wres == DW_DLV_ERROR) {
72387699 print_error_and_continue(dbg,
72397700 "ERROR: cannot print DW_FORM_exprloc content.",
72407701 wres,*err);
7702 esb_destructor(&esb_expr);
72417703 return wres;
72427704 }
72437705 }
72927754 }
72937755 }
72947756 break;
7295 case DW_FORM_implicit_const: { /* DWARF5, attr val is signed uleb */
7757 /* DWARF5, attr val is signed uleb */
7758 case DW_FORM_implicit_const: {
72967759 wres = dwarf_formsdata(attrib, &tempsd, err);
72977760 if (wres == DW_DLV_OK) {
72987761 Dwarf_Bool hxform=TRUE;
73947857 } /* end switch on theform */
73957858 show_form_itself(show_form,local_verbose,theform,
73967859 direct_form,esbp);
7860 if (esb_expr_alive) {
7861 /* So the expr ops follow the FORM of the attribute
7862 if indeed FORMs shown. */
7863 esb_append(esbp,esb_get_string(&esb_expr));
7864 esb_destructor(&esb_expr);
7865 }
73977866 return DW_DLV_OK;
73987867 }
73997868
6666
6767 static void
6868 print_one_frame_reg_col(Dwarf_Debug dbg,
69 Dwarf_Die die,
6970 Dwarf_Unsigned rule_id,
7071 Dwarf_Small value_type,
7172 Dwarf_Unsigned reg_used,
7879
7980 static void
8081 print_frame_inst_bytes(Dwarf_Debug dbg,
82 Dwarf_Die die,
8183 Dwarf_Ptr cie_init_inst, Dwarf_Signed len,
8284 Dwarf_Signed data_alignment_factor,
8385 int code_alignment_factor, Dwarf_Half addr_size,
130132 Dwarf_Error loadcuerr = 0;
131133 Dwarf_Off cu_die_goff = 0;
132134
133 if(!cu_die) {
135 if (!cu_die) {
134136 return;
135137 }
136138 atres = dwarf_attrlist(cu_die, &atlist, &atcnt, &loadcuerr);
203205
204206 esb_constructor(&namestr);
205207 ares = get_attr_value(dbg, tag, cu_die,
208 /* die_indent_level */ 0,
206209 cu_die_goff,attrib, srcfiles, srccnt,
207210 &namestr, local_show_form_used,local_verbose,
208211 &loadcuerr);
209212 DROP_ERROR_INSTANCE(dbg,ares,loadcuerr);
210213 if (esb_string_len(&namestr)) {
211214 name = esb_get_string(&namestr);
212 if(attr == DW_AT_name) {
215 if (attr == DW_AT_name) {
213216 safe_strcpy(glflags.CU_name,sizeof(
214217 glflags.CU_name),name,
215218 strlen(name));
542545 printf("\nERROR: dwarf_formaddr() failed"
543546 " in get_proc_name. %s\n",
544547 dwarf_errmsg(aterr));
545 if(!glflags.gf_error_code_in_name_search_by_address) {
548 if (!glflags.gf_error_code_in_name_search_by_address) {
546549 glflags.gf_error_code_in_name_search_by_address
547550 = dwarf_errno(aterr);
548551 }
11741177 } else if (ares == DW_DLV_OK) {
11751178 if (glflags.gf_do_print_dwarf) {
11761179 printf("\n <eh aug data len 0x%" DW_PR_DUx, len);
1177 if(len) {
1178 if(!valid_fde_content(fde_bytes,fde_bytes_length,
1180 if (len) {
1181 if (!valid_fde_content(fde_bytes,fde_bytes_length,
11791182 data,len) ) {
11801183 glflags.gf_count_major_errors++;
11811184 printf("ERROR:The .eh_frame augmentation data "
12321235 if (fires == DW_DLV_ERROR) {
12331236 glflags.gf_count_major_errors++;
12341237 printf("\nERROR: on getting fde details for "
1235 "fde row for address 0x%" DW_PR_XZEROS DW_PR_DUx "\n",
1238 "fde row for address 0x%"
1239 DW_PR_XZEROS DW_PR_DUx "\n",
12361240 j);
12371241 return fires;
12381242 }
12551259 ": ", (Dwarf_Unsigned)cur_pc_in_table);
12561260 printed_intro_addr = 1;
12571261 }
1258 print_one_frame_reg_col(dbg, config_data->cf_cfa_reg,
1262 print_one_frame_reg_col(dbg,
1263 *cu_die_for_print_frames,
1264 config_data->cf_cfa_reg,
12591265 value_type,
12601266 reg,
12611267 address_size,
13241330 (Dwarf_Unsigned)j);
13251331 printed_intro_addr = 1;
13261332 }
1327 print_one_frame_reg_col(dbg,k,
1333 print_one_frame_reg_col(dbg,
1334 *cu_die_for_print_frames,
1335 k,
13281336 value_type,
13291337 reg,
13301338 address_size,
14011409 return DW_DLV_NO_ENTRY;
14021410 }
14031411 cires = dwarf_get_offset_size(dbg,&cie_offset_size,err);
1404 if( cires != DW_DLV_OK) {
1412 if ( cires != DW_DLV_OK) {
14051413 return res;
14061414 }
14071415 cires = dwarf_get_cie_info_b(cie_data[cie_index],
14271435 } else {
14281436 /* Do not print if in check mode */
14291437 if (glflags.gf_do_print_dwarf) {
1430 print_frame_inst_bytes(dbg, instrs,
1438 print_frame_inst_bytes(dbg,
1439 *cu_die_for_print_frames,
1440 instrs,
14311441 (Dwarf_Signed) ilen,
14321442 data_alignment_factor,
14331443 (int) code_alignment_factor,
14531463 is clearer.
14541464 */
14551465 int
1456 print_one_cie(Dwarf_Debug dbg, Dwarf_Cie cie,
1466 print_one_cie(Dwarf_Debug dbg,
1467 Dwarf_Die die,
1468 Dwarf_Cie cie,
14571469 Dwarf_Unsigned cie_index,
14581470 Dwarf_Half address_size,
14591471 struct dwconf_s *config_data,
14721484 Dwarf_Half offset_size = 0;
14731485
14741486 cires = dwarf_get_offset_size(dbg,&offset_size,err);
1475 if( cires == DW_DLV_ERROR) {
1487 if ( cires == DW_DLV_ERROR) {
14761488 glflags.gf_count_major_errors++;
14771489 printf("ERROR: calling dwarf_get_offset_size() fails\n");
14781490 return cires;
15671579 "\n", cie_length);
15681580 /* For better layout */
15691581 printf(" initial instructions\n");
1570 print_frame_inst_bytes(dbg, initial_instructions,
1582 print_frame_inst_bytes(dbg,
1583 die,
1584 initial_instructions,
15711585 (Dwarf_Signed) initial_instructions_length,
15721586 data_alignment_factor,
15731587 (int) code_alignment_factor,
15801594
15811595 int
15821596 print_location_operations(Dwarf_Debug dbg,
1597 Dwarf_Die die,
1598 int die_indent_level,
15831599 Dwarf_Ptr bytes_in,
15841600 Dwarf_Unsigned block_len,
15851601 Dwarf_Half addr_size,
15951611 Dwarf_Addr baseaddr = 0; /* Really unknown */
15961612 /* See PRINTING_DIES macro in print_die.c */
15971613
1598 if(!glflags.gf_use_old_dwarf_loclist) {
1614 if (!glflags.gf_use_old_dwarf_loclist) {
15991615 Dwarf_Loc_Head_c head = 0;
16001616 Dwarf_Locdesc_c locentry = 0;
16011617 int lres = 0;
16151631 &head,
16161632 &ulistlen,
16171633 err);
1618 if(res2 == DW_DLV_NO_ENTRY) {
1634 if (res2 == DW_DLV_NO_ENTRY) {
16191635 return res2;
16201636 }
1621 if(res2 == DW_DLV_ERROR) {
1637 if (res2 == DW_DLV_ERROR) {
16221638 glflags.gf_count_major_errors++;
16231639 printf("\nERROR: calling dwarf_loclist_from_expr_c()");
16241640 return res2;
16461662 /* ASSERT: loclist_source == DW_LKIND_expression */
16471663 /* ASSERT: lle_value == DW_LLE_start_end */
16481664 lres = dwarfdump_print_location_operations(dbg,
1665 die,
1666 die_indent_level,
16491667 NULL,
16501668 locentry,
16511669 0, /* index 0: locdesc 0 */
16751693 /* listlen is always 1 */
16761694 ulistlen = listlen;
16771695
1678
16791696 res2 = dwarfdump_print_location_operations(dbg,
1697 die,
1698 die_indent_level,
16801699 locdescarray,
16811700 NULL,
16821701 0,
17621781 */
17631782 /*ARGSUSED*/ static void
17641783 print_frame_inst_bytes(Dwarf_Debug dbg,
1784 Dwarf_Die die,
17651785 Dwarf_Ptr cie_init_inst,
17661786 Dwarf_Signed len_in,
17671787 Dwarf_Signed data_alignment_factor,
21952215 esb_constructor_fixed(&exprstring,exprstr_buf,
21962216 sizeof(exprstr_buf));
21972217 gres = print_location_operations(dbg,
2218 die,
2219 /* indent */ 1,
21982220 instp+1,block_len,addr_size,
21992221 offset_size,version,
22002222 &exprstring,&cerr);
22812303 exprstr_buf,
22822304 sizeof(exprstr_buf));
22832305 gres = print_location_operations(dbg,
2306 die,
2307 /* indent */ 1,
22842308 instp+1,block_len,addr_size,
22852309 offset_size,version,
22862310 &exprstring,&cerr);
25472571 exprstr_buf,
25482572 sizeof(exprstr_buf));
25492573 pres = print_location_operations(dbg,
2574 die,
2575 /* indent */ 1,
25502576 instp+1,block_len,addr_size,
25512577 offset_size,version,
25522578 &exprstring,&cerr);
26782704 This may print something or may print nothing! */
26792705 static void
26802706 print_one_frame_reg_col(Dwarf_Debug dbg,
2707 Dwarf_Die die,
26812708 Dwarf_Unsigned rule_id,
26822709 Dwarf_Small value_type,
26832710 Dwarf_Unsigned reg_used,
26922719 char *type_title = "";
26932720 int print_type_title = 1;
26942721
2722 if (!glflags.gf_do_print_dwarf) {
2723 return;
2724 }
26952725 if (reg_used == config_data->cf_initial_rule_value &&
26962726 (value_type == DW_EXPR_OFFSET ||
26972727 value_type == DW_EXPR_VAL_OFFSET) ) {
26982728 /* This is really an empty column. Nothing to do.
26992729 Would be great if we could tell the caller
27002730 the *next* column used here or something. */
2701 return;
2702 }
2703 if (!glflags.gf_do_print_dwarf) {
27042731 return;
27052732 }
27062733 if (config_data->cf_interface_number == 2) {
27652792 sizeof(local_buf));
27662793 /* Here 'offset' is actually block length. */
27672794 gres = print_location_operations(dbg,
2795 die,
2796 /* indent */ 1,
27682797 block_ptr,offset,addr_size,
27692798 offset_size,version,
27702799 &exprstring,&cerr);
27712800 if ( gres == DW_DLV_OK) {
2772 printf("<expr:%s>",sanitized(esb_get_string(&exprstring)));
2801 printf("<expr:%s>",sanitized(
2802 esb_get_string(&exprstring)));
27732803 } else if (gres == DW_DLV_NO_ENTRY) {
27742804 glflags.gf_count_major_errors++;
27752805 printf("\nERROR: Unable to get string from"
27942824 return;
27952825 }
27962826
2827 /* We do NOT want to free cie/fde data as we will
2828 use that in print_all_cies() */
2829 static int
2830 print_all_fdes(Dwarf_Debug dbg,
2831 const char *frame_section_name,
2832 Dwarf_Fde *fde_data,
2833 Dwarf_Signed fde_element_count,
2834 Dwarf_Cie *cie_data,
2835 Dwarf_Signed cie_element_count,
2836 Dwarf_Half address_size,
2837 Dwarf_Half offset_size,
2838 Dwarf_Half version,
2839 int is_eh,
2840 struct dwconf_s *config_data,
2841 void **map_lowpc_to_name,
2842 void **lowpcSet,
2843 Dwarf_Die *cu_die_for_print_frames,
2844 Dwarf_Error*err)
2845 {
2846 Dwarf_Signed i = 0;
2847 int frame_count = 0;
2848
2849 /* Do not print if in check mode */
2850 if (glflags.gf_do_print_dwarf) {
2851 struct esb_s truename;
2852 char buf[DWARF_SECNAME_BUFFER_SIZE];
2853 const char *stdsecname = 0;
2854
2855 if (!is_eh) {
2856 stdsecname=".debug_frame";
2857 } else {
2858 stdsecname=".eh_frame";
2859 }
2860 esb_constructor_fixed(&truename,buf,sizeof(buf));
2861 get_true_section_name(dbg,stdsecname,
2862 &truename,true);
2863 printf("\n%s\n",sanitized(esb_get_string(&truename)));
2864 esb_destructor(&truename);
2865 printf("\nfde:\n");
2866 }
2867
2868 for (i = 0; i < fde_element_count; i++) {
2869 int fdres = 0;
2870
2871 fdres = print_one_fde(dbg,
2872 frame_section_name, fde_data[i],
2873 i, cie_data, cie_element_count,
2874 address_size, offset_size, version,
2875 is_eh, config_data,
2876 map_lowpc_to_name,
2877 lowpcSet,
2878 cu_die_for_print_frames,
2879 err);
2880 if (fdres == DW_DLV_ERROR) {
2881 glflags.gf_count_major_errors++;
2882 printf("ERROR: Printing fde %" DW_PR_DSd
2883 " fails. Error %s\n",
2884 i,dwarf_errmsg(*err));
2885 return fdres;
2886 }
2887 if (fdres == DW_DLV_NO_ENTRY) {
2888 glflags.gf_count_major_errors++;
2889 printf("ERROR: Printing fde %" DW_PR_DSd
2890 " fails saying 'no entry'. Impossible.\n",
2891 i);
2892 return fdres;
2893 }
2894 ++frame_count;
2895 if (frame_count >= glflags.break_after_n_units) {
2896 break;
2897 }
2898 }
2899 return DW_DLV_OK;
2900 }
2901
2902 static int
2903 print_all_cies(Dwarf_Debug dbg,
2904 Dwarf_Cie *cie_data,
2905 Dwarf_Signed cie_element_count,
2906 Dwarf_Half address_size,
2907 struct dwconf_s *config_data,
2908 Dwarf_Die *cu_die_for_print_frames,
2909 Dwarf_Error*err)
2910 {
2911 /* Print the cie set. */
2912 /* Do not print if in check mode */
2913 Dwarf_Signed i = 0;
2914 Dwarf_Signed cie_count = 0;
2915
2916 if (glflags.gf_do_print_dwarf) {
2917 printf("\ncie:\n");
2918 }
2919 for (i = 0; i < cie_element_count; i++) {
2920 int cres = 0;
2921
2922 cres = print_one_cie(dbg,
2923 *cu_die_for_print_frames,
2924 cie_data[i], i, address_size,
2925 config_data,
2926 err);
2927 if (cres == DW_DLV_ERROR) {
2928 glflags.gf_count_major_errors++;
2929 printf("\nERROR: Printing cie %" DW_PR_DSd
2930 " fails. Error %s\n",
2931 i,dwarf_errmsg(*err));
2932 return cres;
2933 } else if (cres == DW_DLV_NO_ENTRY) {
2934 glflags.gf_count_major_errors++;
2935 printf("\nERROR: Printing cie %" DW_PR_DSd
2936 " fails. saying NO_ENTRY!\n",
2937 i);
2938 return cres;
2939 } else {
2940 ++cie_count;
2941 if (cie_count >= glflags.break_after_n_units) {
2942 break;
2943 }
2944 }
2945 }
2946 return DW_DLV_OK;
2947 }
27972948 /* get all the data in .debug_frame (or .eh_frame).
27982949 The '3' versions mean print using the dwarf3 new interfaces.
27992950 The non-3 mean use the old interfaces.
28022953 print_frames(Dwarf_Debug dbg,
28032954 int want_eh,
28042955 struct dwconf_s *config_data,
2805 /* pass these next 3 so preserved from .eh_frame to .debug_frame */
2956 /* Pass these next 3 so preserved from .eh_frame
2957 to .debug_frame */
28062958 Dwarf_Die * cu_die_for_print_frames,
28072959 void ** map_lowpc_to_name,
28082960 void ** lowpcSet,
28092961 Dwarf_Error *err)
28102962 {
2811 Dwarf_Signed i;
28122963 int fres = 0;
28132964 Dwarf_Half address_size = 0;
28142965 Dwarf_Half offset_size = 0;
28172968 /* We only get here if a flag says we want to
28182969 process the section (want_eh is either 0 or 1). */
28192970 glflags.current_section_id = DEBUG_FRAME;
2820 /* The address size here will not be right for all frames.
2821 Only in DWARF4 is there a real address size known
2822 in the frame data itself. If any DIE
2971 /* Only in DWARF4 or later is there a real address
2972 size known in the frame data itself. If any DIE
28232973 is known then a real address size can be gotten from
28242974 dwarf_get_die_address_size(). */
28252975 fres = dwarf_get_address_size(dbg, &address_size, err);
28342984 Dwarf_Signed cie_element_count = 0;
28352985 Dwarf_Fde *fde_data = NULL;
28362986 Dwarf_Signed fde_element_count = 0;
2837 int frame_count = 0;
2838 int cie_count = 0;
28392987 const char *frame_section_name = 0;
28402988 int silent_if_missing = 0;
28412989 int is_eh = 0;
29113059 loc = "dwarf_get_fde_list_eh";
29123060 }
29133061 glflags.gf_count_major_errors++;
2914 printf("\nERROR: %s not loadable. %s\n",
2915 sanitized(frame_section_name),loc);
3062 printf("\nERROR: %s not loadable. %s %s\n",
3063 sanitized(frame_section_name),loc,
3064 dwarf_errmsg(*err));
29163065 return fres;
29173066 }
29183067
29343083 /* no frame information */
29353084 return fres;
29363085 } else { /* DW_DLV_OK */
2937 /* Do not print if in check mode */
2938 if (glflags.gf_do_print_dwarf) {
2939 struct esb_s truename;
2940 char buf[DWARF_SECNAME_BUFFER_SIZE];
2941 const char *stdsecname = 0;
2942
2943 if (!is_eh) {
2944 stdsecname=".debug_frame";
2945 } else {
2946 stdsecname=".eh_frame";
2947 }
2948 esb_constructor_fixed(&truename,buf,sizeof(buf));
2949 get_true_section_name(dbg,stdsecname,
2950 &truename,true);
2951 printf("\n%s\n",sanitized(esb_get_string(&truename)));
2952 esb_destructor(&truename);
2953 printf("\nfde:\n");
2954 }
2955
2956 for (i = 0; i < fde_element_count; i++) {
2957 int fdres = 0;
2958
2959 fdres = print_one_fde(dbg, frame_section_name, fde_data[i],
2960 i, cie_data, cie_element_count,
2961 address_size, offset_size, version,
2962 is_eh, config_data,
2963 map_lowpc_to_name,
2964 lowpcSet,
2965 cu_die_for_print_frames,
2966 err);
2967 if (fdres == DW_DLV_ERROR) {
2968 glflags.gf_count_major_errors++;
2969 printf("ERROR: Printing fde %" DW_PR_DSd
2970 " fails. Error %s\n",
2971 i,dwarf_errmsg(*err));
2972 dwarf_fde_cie_list_dealloc(dbg, cie_data,
2973 cie_element_count,
2974 fde_data, fde_element_count);
2975 return fdres;
2976 }
2977 if (fdres == DW_DLV_NO_ENTRY) {
2978 glflags.gf_count_major_errors++;
2979 printf("ERROR: Printing fde %" DW_PR_DSd
2980 " fails saying 'no entry'. Impossible.\n",
2981 i);
2982 dwarf_fde_cie_list_dealloc(dbg, cie_data,
2983 cie_element_count,
2984 fde_data, fde_element_count);
2985 return fdres;
2986 }
2987 ++frame_count;
2988 if (frame_count >= glflags.break_after_n_units) {
2989 break;
2990 }
2991 }
2992 /* Print the cie set. */
2993 /* Do not print if in check mode */
2994 if (glflags.gf_do_print_dwarf) {
2995 printf("\ncie:\n");
2996 }
2997 for (i = 0; i < cie_element_count; i++) {
2998 int cres = 0;
2999
3000 cres = print_one_cie(dbg, cie_data[i], i, address_size,
3001 config_data,
3002 err);
3003 if (cres == DW_DLV_ERROR) {
3004 glflags.gf_count_major_errors++;
3005 printf("\nERROR: Printing cie %" DW_PR_DSd
3006 " fails. Error %s\n",
3007 i,dwarf_errmsg(*err));
3008 dwarf_fde_cie_list_dealloc(dbg, cie_data,
3009 cie_element_count,
3010 fde_data, fde_element_count);
3011 return cres;
3012 } else if (cres == DW_DLV_NO_ENTRY) {
3013 glflags.gf_count_major_errors++;
3014 printf("\nERROR: Printing cie %" DW_PR_DSd
3015 " fails. saying NO_ENTRY!\n",
3016 i);
3017 dwarf_fde_cie_list_dealloc(dbg, cie_data,
3018 cie_element_count,
3019 fde_data, fde_element_count);
3020 return cres;
3021 } else {
3022 ++cie_count;
3023 if (cie_count >= glflags.break_after_n_units) {
3024 break;
3025 }
3026 }
3027 }
3086 int res = 0;
3087
3088 res = print_all_fdes(dbg,frame_section_name,fde_data,
3089 fde_element_count,
3090 cie_data, cie_element_count,
3091 address_size,offset_size,version,is_eh,
3092 config_data,map_lowpc_to_name,
3093 lowpcSet,
3094 cu_die_for_print_frames,
3095 err);
3096 if (res == DW_DLV_ERROR) {
3097 glflags.gf_count_major_errors++;
3098 printf("ERROR: printing fdes fails. %s "
3099 " Attempting to continue. \n",
3100 dwarf_errmsg(*err));
3101 dwarf_dealloc_error(dbg,*err);
3102 *err = 0;
3103 }
3104
3105 res = print_all_cies(dbg,
3106 /* frame_section_name, */
3107 cie_data, cie_element_count,
3108 address_size,
3109 /* offset_size,version,is_eh, */
3110 config_data,
3111 /* map_lowpc_to_name, lowpcSet, */
3112 cu_die_for_print_frames,
3113 err);
3114 if (res == DW_DLV_ERROR) {
3115 glflags.gf_count_major_errors++;
3116 printf("ERROR: printing cies fails. %s "
3117 " Attempting to continue. \n",
3118 dwarf_errmsg(*err));
3119 dwarf_dealloc_error(dbg,*err);
3120 *err = 0;
3121 }
3122 /* Here we do the free. Not earlier. */
30283123 dwarf_fde_cie_list_dealloc(dbg, cie_data,
30293124 cie_element_count,
30303125 fde_data, fde_element_count);
3031 }
3032 }
3126 } /* End innner scope, not a loop */
3127 } /* End innner scope, not a loop */
30333128 return DW_DLV_OK;
30343129 }
11 Copyright (C) 2006 Silicon Graphics, Inc. All Rights Reserved.
22 Portions Copyright (C) 2009-2011 David Anderson. All Rights Reserved.
33
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of version 2 of the GNU General Public License as
6 published by the Free Software Foundation.
4 This program is free software; you can redistribute it
5 and/or modify it under the terms of version 2 of the GNU
6 General Public License as published by the Free Software
7 Foundation.
78
8 This program is distributed in the hope that it would be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 This program is distributed in the hope that it would
10 be useful, but WITHOUT ANY WARRANTY; without even the
11 implied warranty of MERCHANTABILITY or FITNESS FOR A
12 PARTICULAR PURPOSE.
1113
12 Further, this software is distributed without any warranty that it is
13 free of the rightful claim of any third person regarding infringement
14 or the like. Any license provided herein, whether implied or
15 otherwise, applies only to this software file. Patent licenses, if
16 any, provided herein do not apply to combinations of this program with
14 Further, this software is distributed without any warranty
15 that it is free of the rightful claim of any third person
16 regarding infringement or the like. Any license provided
17 herein, whether implied or otherwise, applies only to
18 this software file. Patent licenses, if any, provided
19 herein do not apply to combinations of this program with
1720 other software, or any other product whatsoever.
1821
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write the Free Software Foundation, Inc., 51
21 Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
22 You should have received a copy of the GNU General Public
23 License along with this program; if not, write the Free
24 Software Foundation, Inc., 51 Franklin Street - Fifth
25 Floor, Boston MA 02110-1301, USA.
2226 */
2327
2428 #ifndef PRINT_FRAMES_H
2832 extern "C" {
2933 #endif /* __cplusplus */
3034
31 int print_one_cie(Dwarf_Debug dbg, Dwarf_Cie cie,
35 int print_one_cie(Dwarf_Debug dbg,
36 Dwarf_Die die,
37 Dwarf_Cie cie,
3238 Dwarf_Unsigned cie_index,
3339 Dwarf_Half address_size,
3440 struct dwconf_s *config_data,
3541 Dwarf_Error *err);
3642 int print_location_operations(Dwarf_Debug dbg,
43 Dwarf_Die die,
44 int die_indent_level,
3745 Dwarf_Ptr bytes_in,
3846 Dwarf_Unsigned block_len,
3947 Dwarf_Half addr_size,
148148 print_hipc_lopc_attribute(Dwarf_Debug dbg,
149149 Dwarf_Half tag,
150150 Dwarf_Die die,
151 int die_indent_level,
151152 Dwarf_Unsigned dieprint_cu_goffset,
152153 char ** srcfiles,
153154 Dwarf_Signed cnt,
228229 }
229230 }
230231 rv = get_attr_value(dbg, tag, die,
232 die_indent_level,
231233 dieprint_cu_goffset,
232234 attrib, srcfiles, cnt,
233235 &highpcstr,glflags.show_form_used,
7272 DROP_ERROR_INSTANCE(dbg,lres,src_err);
7373 } else {
7474 DROP_ERROR_INSTANCE(dbg,ores,src_err);
75 printf("Source lines (for the CU-DIE at unknown location):\n");
75 printf("Source lines (for the CU-DIE at unknown"
76 " location):\n");
7677 }
7778 }
7879
183184 if (glflags.gf_check_decl_file && checking_this_compiler()) {
184185 /* A line record with addr=0 was detected */
185186 if (SkipRecord) {
186 /* Skip records that do not have ís_addr_set' */
187 /* Skip records that do not have is_addr_set */
187188 ares = dwarf_line_is_addr_set(line,
188189 &has_is_addr_set, lt_err);
189190 if (ares == DW_DLV_OK && has_is_addr_set) {
291292 is we have consumed the deug_info section
292293 and we are dealing just with the records
293294 from the .debug_line, so no PU_name is
294 available and no high_pc. Traverse the linkonce
295 table if try to match the pc value with
296 one of those ranges.
295 available and no high_pc.
296 Traverse the linkonce table if try to
297 match the pc value with one of those ranges.
297298 */
298299 if (glflags.gf_check_lines &&
299300 checking_this_compiler()) {
300301 DWARF_CHECK_COUNT(lines_result,1);
301302 }
302 if (FindAddressInBucketGroup(glflags.pLinkonceInfo,pc)){
303 if (FindAddressInBucketGroup(
304 glflags.pLinkonceInfo,pc)){
303305 /* Valid values; do nothing */
304306 } else {
305307 /* The SN Systems Linker generates
353355 checking_this_compiler()) {
354356 DWARF_CHECK_COUNT(lines_result,1);
355357 if ((pc != glflags.PU_high_address) &&
356 (glflags.PU_base_address != elf_max_address)) {
358 (glflags.PU_base_address !=
359 elf_max_address)) {
357360 char addr_tmp[140];
358361 struct esb_s cm;
359362
363366 "%s: Address",sanitized(sec_name));
364367 esb_append_printf_u(&cm,
365368 " 0x%" DW_PR_XZEROS DW_PR_DUx
366 " DW_LNE_end_sequence address does not"
367 " exactly match",pc);
369 " DW_LNE_end_sequence address"
370 " does not exactly match",pc);
368371 esb_append_printf_u(&cm,
369372 " high function addr: "
370373 " 0x%" DW_PR_XZEROS DW_PR_DUx,
381384 /* Display the error information */
382385 if (found_line_error || glflags.gf_record_dwarf_error) {
383386 if (glflags.gf_check_verbose_mode && PRINTING_UNIQUE) {
384 /* Print the record number for better error description */
387 /* Print the record number for better
388 error description */
385389 printf("Record = %" DW_PR_DUu
386390 " Addr = 0x%" DW_PR_XZEROS DW_PR_DUx
387391 " [%4" DW_PR_DUu ",%2" DW_PR_DUu "] '%s'\n",
411415 if (is_actuals_table) {
412416 printf("[%7" DW_PR_DUu "]", logicalno);
413417 } else {
414 printf("[%4" DW_PR_DUu ",%2" DW_PR_DUu "]", lineno, column);
418 printf("[%4" DW_PR_DUu ",%2" DW_PR_DUu "]",
419 lineno, column);
415420 }
416421 }
417422
579584 }
580585
581586 if (!is_actuals_table) {
582 if (i > 0 && glflags.verbose < 3 &&
587 if (i == 0 || glflags.verbose > 2 ||
583588 strcmp(lsrc_filename?lsrc_filename:"",
584 esb_get_string(&lastsrc)) == 0) {
585 /* Do not print name. */
586 } else {
589 esb_get_string(&lastsrc))) {
587590 struct esb_s urs;
588591 char atmp2[ESB_FIXED_ALLOC_SIZE];
589592
600603 esb_empty_string(&lastsrc);
601604 esb_append(&lastsrc,
602605 lsrc_filename?lsrc_filename:"");
606 } else {
607 /* Do not print name, it is the same
608 as the last name printed. */
603609 }
604610 }
605611 if (glflags.gf_do_print_dwarf) {
668674 if (name) {
669675 printf(" Compilation directory: %s\n",name);
670676 } else {
671 printf(" Compilation directory: <unknown no DW_AT_comp_dir>\n");
677 printf(" Compilation directory: <unknown"
678 " no DW_AT_comp_dir>\n");
672679 }
673680
674681 vres = dwarf_srclines_include_dir_count(line_context,
689696 include_dir_base = 1;
690697 include_dir_limit = dir_count+1;
691698 }
692 for(i = include_dir_base; i < include_dir_limit; ++i) {
699 for (i = include_dir_base; i < include_dir_limit; ++i) {
693700 vres = dwarf_srclines_include_dir_data(line_context,i,
694701 &name,err);
695702 if (vres != DW_DLV_OK) {
721728 file_count,file_count);
722729 /* Set up so just one loop control needed
723730 for all versions of line tables. */
724 for(i = baseindex; i < endindex; ++i) {
731 for (i = baseindex; i < endindex; ++i) {
725732 Dwarf_Unsigned dirindex = 0;
726733 Dwarf_Unsigned modtime = 0;
727734 Dwarf_Unsigned flength = 0;
797804 printf(" subprograms count (experimental) 0x%"
798805 DW_PR_DUx " %" DW_PR_DUu "\n",
799806 subprog_count,subprog_count);
800 for(i = 1; i <= subprog_count; ++i) {
807 for (i = 1; i <= subprog_count; ++i) {
801808 Dwarf_Unsigned decl_file = 0;
802809 Dwarf_Unsigned decl_line = 0;
803810 vres = dwarf_srclines_subprog_data(line_context,i,
828835
829836 int
830837 print_line_numbers_this_cu(Dwarf_Debug dbg, Dwarf_Die cu_die,
838 char **srcfiles,
839 Dwarf_Signed srcf_count,
831840 Dwarf_Error *err)
832841 {
833842 Dwarf_Unsigned lineversion = 0;
904913 dieprint_cu_goffset,
905914 /* print_information= */ 1,
906915 /* indent level */0,
907 /* srcfiles= */ 0, /* cnt= */ 0,
916 srcfiles,srcf_count,
908917 &attr_dup,
909918 /* ignore_die_stack= */TRUE,
910919 err);
958967 lres = dwarf_srclines_b(cu_die,&lineversion,
959968 &table_count,&line_context,
960969 err);
961 if(lres == DW_DLV_OK) {
970 if (lres == DW_DLV_OK) {
962971 lres = dwarf_srclines_from_linecontext(line_context,
963972 &linebuf, &linecount,err);
964973 }
967976 /* Useless for experimental line tables */
968977 lres = dwarf_srclines(cu_die,
969978 &linebuf, &linecount, err);
970 if(lres == DW_DLV_OK && linecount ){
979 if (lres == DW_DLV_OK && linecount ){
971980 table_count++;
972981 }
973982 } else if (glflags.gf_line_flag_selection == orig2l) {
976985 &linebuf, &linecount,
977986 &linebuf_actuals, &linecount_actuals,
978987 err);
979 if(lres == DW_DLV_OK && linecount){
988 if (lres == DW_DLV_OK && linecount){
980989 table_count++;
981990 }
982 if(lres == DW_DLV_OK && linecount_actuals){
991 if (lres == DW_DLV_OK && linecount_actuals){
983992 table_count++;
984993 }
985994 } else if (glflags.gf_line_flag_selection == s2l) {
986995 lres = dwarf_srclines_b(cu_die,&lineversion,
987996 &table_count,&line_context,
988997 err);
989 if(lres == DW_DLV_OK) {
998 if (lres == DW_DLV_OK) {
990999 lres = dwarf_srclines_two_level_from_linecontext(
9911000 line_context,
9921001 &linebuf, &linecount,
10131022 } else if (table_count > 0) {
10141023 /* lres DW_DLV_OK */
10151024 if (glflags.gf_do_print_dwarf) {
1016 if(line_context && glflags.verbose) {
1025 if (line_context && glflags.verbose) {
10171026 lres = print_line_context_record(dbg,
10181027 line_context,err);
10191028 if (lres != DW_DLV_OK){
10361045
10371046 &attr_dup,
10381047 /* ignore_die_stack= */TRUE,err);
1039 if(dres == DW_DLV_ERROR) {
1048 if (dres == DW_DLV_ERROR) {
10401049 dwarf_srclines_dealloc_b(line_context);
10411050 return dres;
10421051 }
10431052 }
10441053 }
1045 if(glflags.gf_line_flag_selection == singledw5 ||
1054 if (glflags.gf_line_flag_selection == singledw5 ||
10461055 glflags.gf_line_flag_selection == s2l) {
10471056 int ltres = 0;
10481057
11511160 &attr_dup,
11521161 /* ignore_die_stack= */TRUE,
11531162 err);
1154 if(dpres == DW_DLV_ERROR) {
1163 if (dpres == DW_DLV_ERROR) {
11551164 dwarf_srclines_dealloc(dbg,linebuf,linecount);
11561165 return dpres;
11571166 }
11581167 }
1159 if(line_context) {
1168 if (line_context) {
11601169 if (glflags.verbose > 2) {
11611170 ores = print_line_context_record(dbg,
11621171 line_context,err);
11871196 ") but no lines present\n", off);
11881197 }
11891198 } else {
1190 printf(" Line table is present but no lines present\n");
1191 }
1192 }
1193 if(glflags.gf_line_flag_selection == singledw5 ||
1199 printf(" Line table is present but"
1200 " no lines present\n");
1201 }
1202 }
1203 if (glflags.gf_line_flag_selection == singledw5 ||
11941204 glflags.gf_line_flag_selection == s2l) {
11951205 /* also deletes the linebuf... */
11961206 dwarf_srclines_dealloc_b(line_context);
114114 break;
115115 }
116116
117 fres = print_location_operations(dbg,data,
117 fres = print_location_operations(dbg,
118 0, /* passing null, no die known. */
119 /* indent level*/ 4,
120 data,
118121 entry_len,address_size,
119122 offset_size,
120123 version,
0 /*
1 Copyright (C) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
2 Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
3 Portions Copyright 2009-2018 SN Systems Ltd. All rights reserved.
4 Portions Copyright 2008-2020 David Anderson. All rights reserved.
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of version 2 of the GNU General
8 Public License as published by the Free Software Foundation.
9
10 This program is distributed in the hope that it would be
11 useful, but WITHOUT ANY WARRANTY; without even the implied
12 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE.
14
15 Further, this software is distributed without any warranty
16 that it is free of the rightful claim of any third person
17 regarding infringement or the like. Any license provided
18 herein, whether implied or otherwise, applies only to this
19 software file. Patent licenses, if any, provided herein
20 do not apply to combinations of this program with other
21 software, or any other product whatsoever.
22
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write the Free
25 Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
26 Boston MA 02110-1301, USA.
27
28 */
29
30 #include "globals.h"
31 #include "naming.h"
32 #include "macrocheck.h"
33 #include "esb.h"
34 #include "esb_using_functions.h"
35 #include "sanitized.h"
36
37 #include "print_sections.h"
38 #include "print_frames.h"
39
40 #define TRUE 1
41 #define FALSE 0
42
43 struct macro_counts_s {
44 long mc_start_file;
45 long mc_end_file;
46 long mc_define;
47 long mc_undef;
48 long mc_extension;
49 long mc_code_zero;
50 long mc_unknown;
51 };
52
53 static int
54 print_one_macro_entry_detail(long i,
55 char *type,
56 struct Dwarf_Macro_Details_s *mdp,
57 UNUSEDARG Dwarf_Error *err)
58 {
59 /* "DW_MACINFO_*: section-offset file-index [line] string\n" */
60 if (glflags.gf_do_print_dwarf) {
61 if (mdp->dmd_macro) {
62 printf("%3ld %s: %6" DW_PR_DUu " %4" DW_PR_DSd " [%4"
63 DW_PR_DSd "] \"%s\" \n",
64 i,
65 type,
66 (Dwarf_Unsigned)mdp->dmd_offset,
67 mdp->dmd_fileindex, mdp->dmd_lineno,
68 sanitized(mdp->dmd_macro));
69 } else {
70 printf("%3ld %s: %6" DW_PR_DUu " %4" DW_PR_DSd " [%4"
71 DW_PR_DSd "] 0\n",
72 i,
73 type,
74 (Dwarf_Unsigned)mdp->dmd_offset,
75 mdp->dmd_fileindex, mdp->dmd_lineno);
76 }
77 }
78 return DW_DLV_OK;
79 }
80
81 /* Nothing in here can actually fail.
82 Returns DW_DLV_OK */
83 static int
84 print_one_macro_entry(long i,
85 struct Dwarf_Macro_Details_s *mdp,
86 struct macro_counts_s *counts,
87 char ** srcfiles,
88 Dwarf_Signed srcf_count,
89 UNUSEDARG Dwarf_Error *error)
90 {
91 int res = 0;
92
93 switch (mdp->dmd_type) {
94 case 0:
95 counts->mc_code_zero++;
96 res = print_one_macro_entry_detail(i,
97 "DW_MACINFO_type-code-0", mdp,error);
98 break;
99
100 case DW_MACINFO_start_file: {
101 counts->mc_start_file++;
102 if (mdp->dmd_fileindex == 0) {
103 mdp->dmd_macro = "<zero index, no file specified>";
104 } else if (srcf_count > 0 &&
105 mdp->dmd_fileindex <= srcf_count) {
106 mdp->dmd_macro = srcfiles[mdp->dmd_fileindex-1];
107 } else {
108 if (srcf_count == 0) {
109 mdp->dmd_macro =
110 "<invalid index, no line table file names exist>";
111 } else {
112 mdp->dmd_macro = "<invalid index, corrupt data?>";
113 }
114 }
115 res = print_one_macro_entry_detail(i,
116 "DW_MACINFO_start_file", mdp,error);
117 break;
118 }
119
120 case DW_MACINFO_end_file:
121 counts->mc_end_file++;
122 res = print_one_macro_entry_detail(i,
123 "DW_MACINFO_end_file ", mdp,error);
124 break;
125
126 case DW_MACINFO_vendor_ext:
127 counts->mc_extension++;
128 res = print_one_macro_entry_detail(i,
129 "DW_MACINFO_vendor_ext", mdp,error);
130 break;
131
132 case DW_MACINFO_define:
133 counts->mc_define++;
134 res = print_one_macro_entry_detail(i,
135 "DW_MACINFO_define ", mdp,error);
136 break;
137
138 case DW_MACINFO_undef:
139 counts->mc_undef++;
140 res = print_one_macro_entry_detail(i,
141 "DW_MACINFO_undef ", mdp,error);
142 break;
143
144 default:
145 {
146 struct esb_s typeb;
147
148 esb_constructor(&typeb);
149 counts->mc_unknown++;
150 esb_append_printf_u(&typeb,
151 "DW_MACINFO_0x%x, of unknown type", mdp->dmd_type);
152 print_one_macro_entry_detail(i,
153 esb_get_string(&typeb), mdp,error);
154 esb_destructor(&typeb);
155 }
156 res = DW_DLV_OK;
157 break;
158 }
159 return res;
160 }
161
162 static void
163 mac_dealloc_srcfiles_data(Dwarf_Debug dbg,
164 char **srcfiles,
165 Dwarf_Signed srcf_count)
166 {
167 Dwarf_Signed i = 0;
168 if (!srcfiles) {
169 return;
170 }
171 for ( ; i < srcf_count; ++i) {
172 dwarf_dealloc(dbg,srcfiles[i],DW_DLA_STRING);
173 }
174 dwarf_dealloc(dbg, srcfiles, DW_DLA_LIST);
175 }
176
177 /* print data in .debug_macinfo */
178 /*ARGSUSED*/ int
179 print_macinfo_by_offset(Dwarf_Debug dbg,
180 Dwarf_Die cu_die,
181 Dwarf_Unsigned offset,
182 Dwarf_Error *error)
183 {
184 Dwarf_Unsigned max = 0;
185 Dwarf_Signed count = 0;
186 Dwarf_Macro_Details *maclist = NULL;
187 int lres = 0;
188 long i = 0;
189 struct macro_counts_s counts;
190 Dwarf_Unsigned totallen = 0;
191 Dwarf_Bool is_primary = TRUE;
192 char ** srcfiles = 0;
193 Dwarf_Signed srcf_count = 0;
194
195 glflags.current_section_id = DEBUG_MACINFO;
196
197 /* No real need to get the real section name, this
198 section not used much in modern compilers
199 as this definition of macro data (V2-V4)
200 is obsolete -- it takes too much space to be
201 much used. */
202
203 lres = dwarf_get_macro_details(dbg, offset,
204 max, &count, &maclist, error);
205 if (lres == DW_DLV_ERROR) {
206 struct esb_s m;
207
208 esb_constructor(&m);
209 esb_append_printf_u(&m,
210 "\nERROR: dwarf_get_macro_details() fails on"
211 " offset 0x%x from print_macinfo_by_offset().",offset);
212 simple_err_only_return_action(lres,
213 esb_get_string(&m));
214 esb_destructor(&m);
215 return lres;
216 } else if (lres == DW_DLV_NO_ENTRY) {
217 return lres;
218 }
219 lres = dwarf_srcfiles(cu_die,&srcfiles,&srcf_count,error);
220 if (lres == DW_DLV_ERROR) {
221 /* This error will get found other places. No need
222 to say anything here. */
223 dwarf_dealloc_error(dbg,*error);
224 *error = 0;
225 }
226
227 memset(&counts, 0, sizeof(counts));
228 if (glflags.gf_do_print_dwarf) {
229 struct esb_s truename;
230 char buf[DWARF_SECNAME_BUFFER_SIZE];
231
232 esb_constructor_fixed(&truename,buf,sizeof(buf));
233 get_true_section_name(dbg,".debug_macinfo",
234 &truename,TRUE);
235 printf("\n%s\n",sanitized(esb_get_string(&truename)));
236 esb_destructor(&truename);
237 printf("\n");
238 printf("compilation-unit .debug_macinfo offset "
239 "0x%" DW_PR_XZEROS DW_PR_DUx "\n",offset);
240 printf(" sec file\n");
241 printf("num name offset index [line] \"string\"\n");
242 }
243 for (i = 0; i < count; i++) {
244 struct Dwarf_Macro_Details_s *mdp = &maclist[i];
245 print_one_macro_entry(i, mdp, &counts,
246 srcfiles,srcf_count,error);
247 }
248
249 if (counts.mc_start_file == 0) {
250 printf("ERROR: DW_MACINFO file count of zero is "
251 "invalid DWARF2/3/4\n");
252 glflags.gf_count_major_errors++;
253 }
254 if (counts.mc_start_file != counts.mc_end_file) {
255 glflags.gf_count_major_errors++;
256 printf("ERROR: Counts of DW_MACINFO start_file (%ld)"
257 " end_file (%ld) "
258 "do not match!. Incorrect DWARF2,3,4.\n",
259 counts.mc_start_file, counts.mc_end_file);
260 }
261 if (counts.mc_code_zero < 1) {
262 glflags.gf_count_major_errors++;
263 printf("ERROR: Count of zeros in macro group "
264 "should be non-zero "
265 "(1 preferred), count is %ld\n",
266 counts.mc_code_zero);
267 }
268 /* next byte is maclist[count - 1].dmd_offset + 1; */
269 totallen = (maclist[count - 1].dmd_offset + 1) - offset;
270 add_macro_import(&macinfo_check_tree,is_primary, offset);
271 add_macro_area_len(&macinfo_check_tree,offset,totallen);
272 if (glflags.gf_do_print_dwarf) {
273 printf("Macro counts: start file %ld, "
274 "end file %ld, "
275 "define %ld, "
276 "undef %ld, "
277 "ext %ld, "
278 "code-zero %ld, "
279 "unknown %ld\n",
280 counts.mc_start_file,
281 counts.mc_end_file,
282 counts.mc_define,
283 counts.mc_undef,
284 counts.mc_extension,
285 counts.mc_code_zero, counts.mc_unknown);
286 }
287
288 /* int type= maclist[count - 1].dmd_type; */
289 /* ASSERT: type is zero */
290 mac_dealloc_srcfiles_data(dbg,srcfiles,srcf_count);
291 dwarf_dealloc(dbg, maclist, DW_DLA_STRING);
292 return DW_DLV_OK;
293 }
276276 k,&line_number,
277277 &index,
278278 &macro_string,err);
279 /* The above call knows how to reference
280 its one srcfiles data and has the
281 .debug_macro version. So we do not
282 need to worry about getting the file name
283 here. */
279284 if (lres != DW_DLV_OK) {
280285 derive_error_message(dbg,k,macro_operator,
281286 number_of_ops,
284289 }
285290 if (glflags.gf_do_print_dwarf) {
286291 printf(" line %" DW_PR_DUu
287 " file number %" DW_PR_DUu
288 " %s\n",
292 " file number %" DW_PR_DUu,
289293 line_number,
290 index,
294 index);
295 printf(" %s\n",
291296 macro_string?sanitized(macro_string):
292297 "<no-name-available>");
293298 }
335340 /* This is for the DWARF5 macro section. */
336341 int
337342 print_macros_5style_this_cu(Dwarf_Debug dbg, Dwarf_Die cu_die,
343 char **dwarf_srcfiles,
344 Dwarf_Signed cnt,
338345 int by_offset, Dwarf_Unsigned offset,
339346 Dwarf_Error *err)
340347 {
432439 dieprint_cu_goffset,
433440 /* print_information= */ 1,
434441 /* indent level */0,
435 /* srcfiles= */ 0, /* cnt= */ 0,
442 dwarf_srcfiles,cnt,
436443 &attr_dup,
437444 /* ignore_die_stack= */TRUE,err);
438445 if (pdres == DW_DLV_ERROR) {
566573 ", bytes length: %" DW_PR_DUu "\n",
567574 number_of_ops,ops_total_byte_len);
568575 }
569 lres = print_macro_ops(dbg,macro_context,number_of_ops,err);
576 lres = print_macro_ops(dbg,macro_context,number_of_ops,
577 err);
570578 if (lres != DW_DLV_OK) {
571579 struct esb_s m;
572580
+0
-251
dwarfdump/print_macros.c less more
0 /*
1 Copyright (C) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
2 Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
3 Portions Copyright 2009-2018 SN Systems Ltd. All rights reserved.
4 Portions Copyright 2008-2020 David Anderson. All rights reserved.
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of version 2 of the GNU General
8 Public License as published by the Free Software Foundation.
9
10 This program is distributed in the hope that it would be
11 useful, but WITHOUT ANY WARRANTY; without even the implied
12 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE.
14
15 Further, this software is distributed without any warranty
16 that it is free of the rightful claim of any third person
17 regarding infringement or the like. Any license provided
18 herein, whether implied or otherwise, applies only to this
19 software file. Patent licenses, if any, provided herein
20 do not apply to combinations of this program with other
21 software, or any other product whatsoever.
22
23 You should have received a copy of the GNU General Public
24 License along with this program; if not, write the Free
25 Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
26 Boston MA 02110-1301, USA.
27
28 */
29
30 #include "globals.h"
31 #include "naming.h"
32 #include "macrocheck.h"
33 #include "esb.h"
34 #include "esb_using_functions.h"
35 #include "sanitized.h"
36
37 #include "print_sections.h"
38 #include "print_frames.h"
39
40 #define TRUE 1
41 #define FALSE 0
42
43 struct macro_counts_s {
44 long mc_start_file;
45 long mc_end_file;
46 long mc_define;
47 long mc_undef;
48 long mc_extension;
49 long mc_code_zero;
50 long mc_unknown;
51 };
52
53 static int
54 print_one_macro_entry_detail(long i,
55 char *type,
56 struct Dwarf_Macro_Details_s *mdp,
57 UNUSEDARG Dwarf_Error *err)
58 {
59 /* "DW_MACINFO_*: section-offset file-index [line] string\n" */
60 if (glflags.gf_do_print_dwarf) {
61 if (mdp->dmd_macro) {
62 printf("%3ld %s: %6" DW_PR_DUu " %4" DW_PR_DSd " [%4"
63 DW_PR_DSd "] \"%s\" \n",
64 i,
65 type,
66 (Dwarf_Unsigned)mdp->dmd_offset,
67 mdp->dmd_fileindex, mdp->dmd_lineno,
68 sanitized(mdp->dmd_macro));
69 } else {
70 printf("%3ld %s: %6" DW_PR_DUu " %4" DW_PR_DSd " [%4"
71 DW_PR_DSd "] 0\n",
72 i,
73 type,
74 (Dwarf_Unsigned)mdp->dmd_offset,
75 mdp->dmd_fileindex, mdp->dmd_lineno);
76 }
77 }
78 return DW_DLV_OK;
79 }
80
81 /* Nothing in here can actually fail.
82 Returns DW_DLV_OK */
83 static int
84 print_one_macro_entry(long i,
85 struct Dwarf_Macro_Details_s *mdp,
86 struct macro_counts_s *counts,
87 UNUSEDARG Dwarf_Error *error)
88 {
89 int res = 0;
90
91 switch (mdp->dmd_type) {
92 case 0:
93 counts->mc_code_zero++;
94 res = print_one_macro_entry_detail(i,
95 "DW_MACINFO_type-code-0", mdp,error);
96 break;
97
98 case DW_MACINFO_start_file:
99 counts->mc_start_file++;
100 res = print_one_macro_entry_detail(i,
101 "DW_MACINFO_start_file", mdp,error);
102 break;
103
104 case DW_MACINFO_end_file:
105 counts->mc_end_file++;
106 res = print_one_macro_entry_detail(i,
107 "DW_MACINFO_end_file ", mdp,error);
108 break;
109
110 case DW_MACINFO_vendor_ext:
111 counts->mc_extension++;
112 res = print_one_macro_entry_detail(i,
113 "DW_MACINFO_vendor_ext", mdp,error);
114 break;
115
116 case DW_MACINFO_define:
117 counts->mc_define++;
118 res = print_one_macro_entry_detail(i,
119 "DW_MACINFO_define ", mdp,error);
120 break;
121
122 case DW_MACINFO_undef:
123 counts->mc_undef++;
124 res = print_one_macro_entry_detail(i,
125 "DW_MACINFO_undef ", mdp,error);
126 break;
127
128 default:
129 {
130 struct esb_s typeb;
131
132 esb_constructor(&typeb);
133 counts->mc_unknown++;
134 esb_append_printf_u(&typeb,
135 "DW_MACINFO_0x%x, of unknown type", mdp->dmd_type);
136 print_one_macro_entry_detail(i,
137 esb_get_string(&typeb), mdp,error);
138 esb_destructor(&typeb);
139 }
140 res = DW_DLV_OK;
141 break;
142 }
143 return res;
144 }
145
146 /* print data in .debug_macinfo */
147 /*ARGSUSED*/ int
148 print_macinfo_by_offset(Dwarf_Debug dbg,Dwarf_Unsigned offset,
149 Dwarf_Error *error)
150 {
151 Dwarf_Unsigned max = 0;
152 Dwarf_Signed count = 0;
153 Dwarf_Macro_Details *maclist = NULL;
154 int lres = 0;
155 long i = 0;
156 struct macro_counts_s counts;
157 Dwarf_Unsigned totallen = 0;
158 Dwarf_Bool is_primary = TRUE;
159
160 glflags.current_section_id = DEBUG_MACINFO;
161
162 /* No real need to get the real section name, this
163 section not used much in modern compilers
164 as this definition of macro data (V2-V4)
165 is obsolete -- it takes too much space to be
166 much used. */
167
168 lres = dwarf_get_macro_details(dbg, offset,
169 max, &count, &maclist, error);
170 if (lres == DW_DLV_ERROR) {
171 struct esb_s m;
172
173 esb_constructor(&m);
174 esb_append_printf_u(&m,
175 "\nERROR: dwarf_get_macro_details() fails on"
176 " offset 0x%x from print_macinfo_by_offset().",offset);
177 simple_err_only_return_action(lres,
178 esb_get_string(&m));
179 esb_destructor(&m);
180 return lres;
181 } else if (lres == DW_DLV_NO_ENTRY) {
182 return lres;
183 }
184
185 memset(&counts, 0, sizeof(counts));
186 if (glflags.gf_do_print_dwarf) {
187 struct esb_s truename;
188 char buf[DWARF_SECNAME_BUFFER_SIZE];
189
190 esb_constructor_fixed(&truename,buf,sizeof(buf));
191 get_true_section_name(dbg,".debug_macinfo",
192 &truename,TRUE);
193 printf("\n%s\n",sanitized(esb_get_string(&truename)));
194 esb_destructor(&truename);
195 printf("\n");
196 printf("compilation-unit .debug_macinfo offset "
197 "0x%" DW_PR_XZEROS DW_PR_DUx "\n",offset);
198 printf(" sec file\n");
199 printf("num name offset index [line] \"string\"\n");
200 }
201 for (i = 0; i < count; i++) {
202 struct Dwarf_Macro_Details_s *mdp = &maclist[i];
203 print_one_macro_entry(i, mdp, &counts,error);
204 }
205
206 if (counts.mc_start_file == 0) {
207 printf("ERROR: DW_MACINFO file count of zero is "
208 "invalid DWARF2/3/4\n");
209 glflags.gf_count_major_errors++;
210 }
211 if (counts.mc_start_file != counts.mc_end_file) {
212 glflags.gf_count_major_errors++;
213 printf("ERROR: Counts of DW_MACINFO start_file (%ld)"
214 " end_file (%ld) "
215 "do not match!. Incorrect DWARF2,3,4.\n",
216 counts.mc_start_file, counts.mc_end_file);
217 }
218 if (counts.mc_code_zero < 1) {
219 glflags.gf_count_major_errors++;
220 printf("ERROR: Count of zeros in macro group "
221 "should be non-zero "
222 "(1 preferred), count is %ld\n",
223 counts.mc_code_zero);
224 }
225 /* next byte is maclist[count - 1].dmd_offset + 1; */
226 totallen = (maclist[count - 1].dmd_offset + 1) - offset;
227 add_macro_import(&macinfo_check_tree,is_primary, offset);
228 add_macro_area_len(&macinfo_check_tree,offset,totallen);
229 if (glflags.gf_do_print_dwarf) {
230 printf("Macro counts: start file %ld, "
231 "end file %ld, "
232 "define %ld, "
233 "undef %ld, "
234 "ext %ld, "
235 "code-zero %ld, "
236 "unknown %ld\n",
237 counts.mc_start_file,
238 counts.mc_end_file,
239 counts.mc_define,
240 counts.mc_undef,
241 counts.mc_extension,
242 counts.mc_code_zero, counts.mc_unknown);
243 }
244
245 /* int type= maclist[count - 1].dmd_type; */
246 /* ASSERT: type is zero */
247
248 dwarf_dealloc(dbg, maclist, DW_DLA_STRING);
249 return DW_DLV_OK;
250 }
6565
6666 #define TRUE 1
6767 #define FALSE 0
68
68 #if 0
6969 static struct glfsetting_s {
7070 const char *secname;
7171 boolean *flag;
9595 {".debug_weaknames", &glflags.gf_weakname_flag,FALSE,FALSE}, /* SGI only */
9696 {0,0,0,0}
9797 };
98
98 #endif /* 0 */
9999
100100 /* If a section is not in group N but is in group 1
101101 then turn off its flag. Since sections are never
108108 FIXME: It would be good if, for a wholly missing
109109 section related to a flag, that the flag got turned
110110 off. */
111 #if 0
111112 static void
112113 turn_off_subsidiary_flags(UNUSEDARG Dwarf_Debug dbg)
113114 {
131132 }
132133 }
133134
135 #endif
134136 /* Restoring original condition in the glftab array
135137 and in the global flags it points to.
136138 So that when processing an archive one can restore
141143 void
142144 groups_restore_subsidiary_flags(void)
143145 {
146 #if 0
144147 unsigned k = 0;
148 #endif
145149
146150 /* Duplicative but harmless free. */
147151 freeall_groups_tables();
148
152 #if 0
149153 for( ; glftab[k].secname; ++k ) {
150154 if(glftab[k].origset) {
151155 *(glftab[k].flag) = glftab[k].origflag;
153157 glftab[k].origflag = FALSE;
154158 }
155159 }
160 #endif
156161 }
157162
158163
168173 changed.
169174 */
170175 void
171 update_section_flags_per_groups(Dwarf_Debug dbg)
176 update_section_flags_per_groups(
177 UNUSEDARG Dwarf_Debug dbg)
172178 {
173179 if (!sec_names) {
174180 /* The tables are absent. Internal logic
184190 freeall_groups_tables();
185191 return;
186192 }
193 #if 0
187194 turn_off_subsidiary_flags(dbg);
195 #endif
188196 freeall_groups_tables();
189197 }
190198
166166 # So let dwarfdump emit more then trim.
167167 if [ x$win = "xy" ]
168168 then
169 textlim=502
170 else
171 textlim=500
172 fi
173 ./dwarfdump $f | head -n $textlim > $t
169 textlim=702
170 else
171 textlim=700
172 fi
173 echo "./dwarfdump -a -vvv $f | head -n $textlim > $t "
174 ./dwarfdump -a -vvv $f | head -n $textlim > $t
174175 chkres $? "Running dwarfdump $f output to $t base $b"
175176 if [ x$win = "xy" ]
176177 then
177178 echo "drop two lines"
178179 droptwoifwin $t
180 echo did drop two
181 wc $t
179182 fi
180183 which dos2unix
181184 if [ $? -eq 0 ]
194197 b=$srcdir/testuriLE64ELf.base
195198 t=junk.testuriLE64ELf.base
196199 echo "start dwarfdump sanity check on $f"
197 ./dwarfdump $f | head -n $textlim > $t
200 ./dwarfdump -vvv -a $f | head -n $textlim > $t
198201 chkres $? "running ./dwarfdump $f otuput to $t base $b "
199202 if [ x$win = "xy" ]
200203 then
2626
2727 */
2828
29 #include <dwarf.h>
3029 #include <stdio.h>
3130 #include <stdarg.h> /* For va_start va_arg va_list */
3231 #include <errno.h> /* For errno declaration. */
33 #include "globals.h"
3432 #ifdef HAVE_UNISTD_H
3533 #include <unistd.h>
36 #endif
34 #endif /* HAVE_UNISTD_ */
35 #ifdef HAVE_STDLIB_H
3736 #include <stdlib.h> /* For exit() declaration etc. */
37 #endif /* HAVE_STDLIB_H */
38 #include "globals.h"
39 #include <dwarf.h>
3840 #include "libdwarf.h"
3941 #include "common.h"
4042 #include "esb.h"
4143 #include "tag_common.h"
4244 #include "dwgetopt.h"
43 #include "libdwarf_version.h" /* for DW_VERSION_DATE_STR,RELEASE DATE*/
45 #include "libdwarf_version.h"
4446
4547 boolean ellipsis = FALSE; /* So we can use dwarf_names.c */
4648
6567 For standard tags the generated table is indexed by
6668 tag number. All the columns are bit flags.
6769
68 For extended tags the generated table is indexed (call it j) by 0 - N-1
69 and [j][0] is the tag number and the rest of the columns (1 - N-1) are
70 For extended tags the generated table is indexed
71 (call it j) by 0 - N-1
72 and [j][0] is the tag number and the rest of
73 the columns (1 - N-1) are
7074 allowed attribute numbers.
7175
7276 */
7377
74 unsigned int tag_attr_combination_table[ATTR_TABLE_ROW_MAXIMUM][ATTR_TABLE_COLUMN_MAXIMUM];
78 unsigned int tag_attr_combination_table[ATTR_TABLE_ROW_MAXIMUM]
79 [ATTR_TABLE_COLUMN_MAXIMUM];
7580
7681 #ifdef HAVE_USAGE_TAG_ATTR
77 /* Working array for a specific tag and will contain its valid attributes */
82 /* Working array for a specific tag and will
83 contain its valid attributes */
7884 static Dwarf_Half tag_attr_vector[DW_AT_last] = {0};
7985 static Dwarf_Half tag_parents[DW_TAG_last] = {0};
8086 static Dwarf_Half tag_children[DW_TAG_last] = {0};
260266 }
261267 fileInp = fopen(input_name,"r");
262268 if (!fileInp) {
263 fprintf(stderr,"Invalid input filename, could not open '%s'\n",
269 fprintf(stderr,"Invalid input filename,"
270 " could not open '%s'\n",
264271 input_name);
265272 print_usage_message(argv[0],usage);
266273 exit(FAILED);
273280 }
274281 fileOut = fopen(output_name,"w");
275282 if (!fileOut) {
276 fprintf(stderr,"Invalid output filename, could not open: '%s'\n",
283 fprintf(stderr,"Invalid output filename,"
284 " could not open: '%s'\n",
277285 output_name);
278286 print_usage_message(argv[0],usage);
279287 exit(FAILED);
304312
305313 /* Generate main header, regardless of contents */
306314 fprintf(fileOut,"/* Generated code, do not edit. */\n");
307 fprintf(fileOut,"/* Generated sourcedate %s */\n",DW_VERSION_DATE_STR);
315 fprintf(fileOut,"/* Generated sourcedate %s */\n",
316 DW_VERSION_DATE_STR);
308317 fprintf(fileOut,"\n/* BEGIN FILE */\n\n");
309318
310319 #ifdef HAVE_USAGE_TAG_ATTR
311 /* Generate the data type to record the usage of the pairs tag-attr */
320 /* Generate the data type to record the usage
321 of the pairs tag-attr */
312322 if (standard_flag) {
313323 fprintf(fileOut,"#ifndef HAVE_USAGE_TAG_ATTR\n");
314324 fprintf(fileOut,"#define HAVE_USAGE_TAG_ATTR 1\n");
317327 fprintf(fileOut,"#include \"dwarf.h\"\n");
318328 fprintf(fileOut,"#include \"libdwarf.h\"\n\n");
319329 fprintf(fileOut,"typedef struct {\n");
320 fprintf(fileOut," unsigned int count; /* Attribute count */\n");
321 fprintf(fileOut," Dwarf_Half attr; /* Attribute value */\n");
330 fprintf(fileOut," unsigned int count;"
331 " /* Attribute count */\n");
332 fprintf(fileOut," Dwarf_Half attr;"
333 " /* Attribute value */\n");
322334 fprintf(fileOut,"} Usage_Tag_Attr;\n\n");
323335 }
324336 #endif /* HAVE_USAGE_TAG_ATTR */
344356 /* In extended case, the row indexed by 0-N
345357 and column zero has the tag number. */
346358 if (current_row >= table_rows) {
347 bad_line_input("too many extended table rows. Have %u max %u",
359 bad_line_input(
360 "too many extended table rows. Have %u max %u",
348361 current_row,table_rows);
349362 }
350363 validate_row_col("Reading tag",current_row,0,
363376 /* Check if we have duplicated tags */
364377 if (standard_flag) {
365378 if (tag_parents[tag]) {
366 bad_line_input("tag 0x%02x value already defined",tag);
379 bad_line_input("tag 0x%02x value already defined",
380 tag);
367381 }
368382 tag_parents[tag] = tag;
369383
370384 /* Clear out the working attribute vector */
371 memset(tag_attr_vector,0,DW_AT_last * sizeof(Dwarf_Half));
385 memset(tag_attr_vector,0,DW_AT_last*sizeof(Dwarf_Half));
372386 }
373387 #endif /* HAVE_USAGE_TAG_ATTR */
374388
390404 }
391405 validate_row_col("Setting attr bit",tag,idx,
392406 table_rows,table_columns);
393 tag_attr_combination_table[tag][idx] |= (((unsigned)1) << bit);
407 tag_attr_combination_table[tag][idx] |=
408 (((unsigned)1) << bit);
394409 } else {
395410 if (curcol >= table_columns) {
396411 esb_append_printf_i(&msg_buf,
400415 "cols %d.",table_columns);
401416 bad_line_input(esb_get_string(&msg_buf));
402417 }
403 validate_row_col("Setting attr col",current_row,curcol,
418 validate_row_col("Setting attr col",
419 current_row,curcol,
404420 table_rows,table_columns);
405 tag_attr_combination_table[current_row][curcol] = num;
421 tag_attr_combination_table[current_row][curcol] =
422 num;
406423 curcol++;
407424
408425 }
422439 }
423440 /* Check for duplicated entries */
424441 if (tag_attr_vector[cur_attr]) {
425 bad_line_input("duplicated attributes: table incomplete.");
442 bad_line_input(
443 "duplicated attributes: table incomplete.");
426444 }
427445 tag_attr_vector[cur_attr] = num;
428446 cur_attr++;
440458 /* Generate the tag-attributes vector for current tag */
441459 if (standard_flag) {
442460 if (tag >= DW_TAG_last) {
443 bad_line_input("tag 0x%02x exceeds standard table size",tag);
461 bad_line_input(
462 "tag 0x%02x exceeds standard table size",tag);
444463 }
445464 if (tag_children[tag]) {
446465 bad_line_input("tag 0x%02x already defined",tag);
455474 for (index = 1; index < cur_attr; ++index) {
456475 attr = tag_attr_vector[index];
457476 ta_get_AT_name(attr,&aname);
458 fprintf(fileOut," {/* 0x%02x */ 0, %s},\n",attr,aname);
477 fprintf(fileOut," {/* 0x%02x */ 0, %s},\n",
478 attr,aname);
459479 }
460480 fprintf(fileOut," {/* %4s */ 0, 0}\n};\n\n"," ");
461481 /* Record allowed number of attributes */
481501 aname = 0;
482502 ta_get_TAG_name(tag,&aname);
483503 fprintf(fileOut,
484 " tag_attr_%02x, /* 0x%02x - %s */\n",tag,tag,aname);
504 " tag_attr_%02x, /* 0x%02x - %s */\n",
505 tag,tag,aname);
485506 } else {
486507 fprintf(fileOut," 0,\n");
487508 }
490511
491512 /* Generate table with allowed number of attributes */
492513 fprintf(fileOut,"typedef struct {\n");
493 fprintf(fileOut," Dwarf_Small legal; /* Legal attributes */\n");
494 fprintf(fileOut," Dwarf_Small found; /* Found attributes */\n");
514 fprintf(fileOut," Dwarf_Small legal;"
515 " /* Legal attributes */\n");
516 fprintf(fileOut," Dwarf_Small found;"
517 " /* Found attributes */\n");
495518 fprintf(fileOut,"} Rate_Tag_Attr;\n\n");
496519 fprintf(fileOut,
497520 "static Rate_Tag_Attr rate_tag_attr[] = {\n");
501524 aname = 0;
502525 ta_get_TAG_name(tag,&aname);
503526 fprintf(fileOut,
504 " {%2d, 0, /* 0x%02x - %s */},\n",legal,tag,aname);
527 " {%2d, 0, /* 0x%02x - %s */},\n",
528 legal,tag,aname);
505529 } else {
506530 fprintf(fileOut," {0, 0},\n");
507531 }
512536 #endif /* HAVE_USAGE_TAG_ATTR */
513537
514538 if (standard_flag) {
515 fprintf(fileOut,"#define ATTR_TREE_ROW_COUNT %d\n\n",table_rows);
516 fprintf(fileOut,"#define ATTR_TREE_COLUMN_COUNT %d\n\n",table_columns);
539 fprintf(fileOut,"#define ATTR_TREE_ROW_COUNT %d\n\n",
540 table_rows);
541 fprintf(fileOut,"#define ATTR_TREE_COLUMN_COUNT %d\n\n",
542 table_columns);
517543 fprintf(fileOut,
518544 "static unsigned int tag_attr_combination_table"
519545 "[ATTR_TREE_ROW_COUNT][ATTR_TREE_COLUMN_COUNT] = {\n");
520546 }
521547 else {
522548 fprintf(fileOut,"/* Common extensions */\n");
523 fprintf(fileOut,"#define ATTR_TREE_EXT_ROW_COUNT %d\n\n",table_rows);
549 fprintf(fileOut,"#define ATTR_TREE_EXT_ROW_COUNT %d\n\n",
550 table_rows);
524551 fprintf(fileOut,"#define ATTR_TREE_EXT_COLUMN_COUNT %d\n\n",
525552 table_columns);
526553 fprintf(fileOut,
527554 "static unsigned int tag_attr_combination_ext_table"
528 "[ATTR_TREE_EXT_ROW_COUNT][ATTR_TREE_EXT_COLUMN_COUNT] = {\n");
555 "[ATTR_TREE_EXT_ROW_COUNT][ATTR_TREE_EXT_COLUMN_COUNT]"
556 " = {\n");
529557 }
530558
531559 for (u = 0; u < table_rows; u++) {
541569 }
542570 fprintf(fileOut," { ");
543571 for (j = 0; j < table_columns; ++j ) {
544 fprintf(fileOut,"0x%08x,",tag_attr_combination_table[u][j]);
572 fprintf(fileOut,"0x%08x,",
573 tag_attr_combination_table[u][j]);
545574 }
546575 fprintf(fileOut,"},\n");
547576 }
3636 #include "dwgetopt.h"
3737 #include "libdwarf_version.h" /* for DW_VERSION_DATE_STR */
3838
39 unsigned int tag_tree_combination_table[TAG_TABLE_ROW_MAXIMUM][TAG_TABLE_COLUMN_MAXIMUM];
39 unsigned int tag_tree_combination_table[TAG_TABLE_ROW_MAXIMUM]
40 [TAG_TABLE_COLUMN_MAXIMUM];
4041
4142 #ifdef HAVE_USAGE_TAG_ATTR
4243 /* Working array for a specific tag and its valid tags */
233234 }
234235 fileInp = fopen(input_name,"r");
235236 if (!fileInp) {
236 fprintf(stderr,"Invalid input filename, could not open '%s'\n",
237 fprintf(stderr,"Invalid input filename,"
238 " could not open '%s'\n",
237239 input_name);
238240 print_usage_message(argv[0],usage);
239241 exit(FAILED);
246248 }
247249 fileOut = fopen(output_name,"w");
248250 if (!fileOut) {
249 fprintf(stderr,"Invalid output filename, could not open: '%s'\n",
251 fprintf(stderr,"Invalid output filename,"
252 " could not open: '%s'\n",
250253 output_name);
251254 print_usage_message(argv[0],usage);
252255 exit(FAILED);
253256 }
254 if ((standard_flag && extended_flag) || (!standard_flag && !extended_flag)) {
257 if ((standard_flag && extended_flag) ||
258 (!standard_flag && !extended_flag)) {
255259 fprintf(stderr,"Invalid table type\n");
256260 fprintf(stderr,"Choose -e or -s .\n");
257261 print_usage_message(argv[0],usage);
275279
276280 /* Generate main header, regardless of contents */
277281 fprintf(fileOut,"/* Generated code, do not edit. */\n");
278 fprintf(fileOut,"/* Generated sourcedate %s */\n",DW_VERSION_DATE_STR );
282 fprintf(fileOut,"/* Generated sourcedate %s */\n",
283 DW_VERSION_DATE_STR );
279284 fprintf(fileOut,"\n/* BEGIN FILE */\n\n");
280285
281286 #ifdef HAVE_USAGE_TAG_ATTR
282 /* Generate the data type to record the usage of the pairs tag-tag */
287 /* Generate the data type to record the usage of
288 the pairs tag-tag */
283289 if (standard_flag) {
284290 fprintf(fileOut,"#ifndef HAVE_USAGE_TAG_ATTR\n");
285291 fprintf(fileOut,"#define HAVE_USAGE_TAG_ATTR 1\n");
307313 }
308314 if (standard_flag) {
309315 if (current_row >= table_rows ) {
310 bad_line_input("tag value exceeds standard table size");
316 bad_line_input(
317 "tag value exceeds standard table size");
311318 }
312319 } else {
313320 if (current_row >= table_rows) {
333340 tag_parents[tag] = tag;
334341
335342 /* Clear out the working attribute vector */
336 memset(tag_tree_vector,0,DW_TAG_last * sizeof(Dwarf_Half));
343 memset(tag_tree_vector,0,DW_TAG_last *
344 sizeof(Dwarf_Half));
337345 }
338346 #endif /* HAVE_USAGE_TAG_ATTR */
339347
345353 if (idx >= table_columns) {
346354 fprintf(stderr,"Want column %d, have only %d\n",
347355 idx,table_columns);
348 bad_line_input("too many TAGs: table incomplete.");
356 bad_line_input(
357 "too many TAGs: table incomplete.");
349358 }
350359 validate_row_col("Update columns bit",tag,idx,
351360 table_rows,table_columns);
352 tag_tree_combination_table[tag][idx] |= (((unsigned)1) << bit);
361 tag_tree_combination_table[tag][idx] |=
362 (((unsigned)1) << bit);
353363 } else {
354364 if (nTagLoc >= table_columns) {
355365 printf("Attempting to use column %d, max is %d\n",
356366 nTagLoc,table_columns);
357 bad_line_input("too many subTAGs, table incomplete.");
367 bad_line_input(
368 "too many subTAGs, table incomplete.");
358369 }
359370 validate_row_col("Update tagloc",current_row,nTagLoc,
360371 table_rows,table_columns);
361 tag_tree_combination_table[current_row][nTagLoc] = num;
372 tag_tree_combination_table[current_row][nTagLoc] =
373 num;
362374 nTagLoc++;
363375 }
364376
367379 if (standard_flag) {
368380 /* Add child tag to current tag */
369381 if (cur_tag >= DW_TAG_last) {
370 bad_line_input("too many TAGs: table incomplete.");
382 bad_line_input(
383 "too many TAGs: table incomplete.");
371384 }
372385 /* Check for duplicated entries */
373386 if (tag_tree_vector[cur_tag]) {
374 bad_line_input("duplicated tag: table incomplete.");
387 bad_line_input(
388 "duplicated tag: table incomplete.");
375389 }
376390 tag_tree_vector[cur_tag] = num;
377391 cur_tag++;
388402 /* Generate the tag-tree vector for current tag */
389403 if (standard_flag) {
390404 if (tag >= DW_TAG_last) {
391 bad_line_input("tag value exceeds standard table size");
405 bad_line_input(
406 "tag value exceeds standard table size");
392407 }
393408 if (tag_children[tag]) {
394409 bad_line_input("subtag 0x%02x already defined",tag);
403418 for (index = 1; index < cur_tag; ++index) {
404419 child_tag = tag_tree_vector[index];
405420 ta_get_TAG_name(child_tag,&aname);
406 fprintf(fileOut," {/* 0x%02x */ 0, %s},\n",child_tag,aname);
421 fprintf(fileOut," {/* 0x%02x */ 0, %s},\n",
422 child_tag,aname);
407423 }
408424 fprintf(fileOut," {/* %4s */ 0, 0}\n};\n\n"," ");
409425 /* Record allowed number of attributes */
428444 aname = 0;
429445 ta_get_TAG_name(tag,&aname);
430446 fprintf(fileOut,
431 " tag_tree_%02x, /* 0x%02x - %s */\n",tag,tag,aname);
447 " tag_tree_%02x, /* 0x%02x - %s */\n",
448 tag,tag,aname);
432449 } else {
433450 fprintf(fileOut," 0,\n");
434451 }
448465 aname = 0;
449466 ta_get_TAG_name(tag,&aname);
450467 fprintf(fileOut,
451 " {%2d, 0 /* 0x%02x - %s */},\n",legal,tag,aname);
468 " {%2d, 0 /* 0x%02x - %s */},\n",
469 legal,tag,aname);
452470 } else {
453471 fprintf(fileOut," {0, 0},\n");
454472 }
460478
461479 check_unused_combo(table_rows, table_columns);
462480 if (standard_flag) {
463 fprintf(fileOut,"#define TAG_TREE_COLUMN_COUNT %d\n\n",table_columns);
464 fprintf(fileOut,"#define TAG_TREE_ROW_COUNT %d\n\n",table_rows);
481 fprintf(fileOut,"#define TAG_TREE_COLUMN_COUNT %d\n\n",
482 table_columns);
483 fprintf(fileOut,"#define TAG_TREE_ROW_COUNT %d\n\n",
484 table_rows);
465485 fprintf(fileOut,
466486 "static unsigned int tag_tree_combination_table"
467487 "[TAG_TREE_ROW_COUNT][TAG_TREE_COLUMN_COUNT] = {\n");
468488 } else {
469489 fprintf(fileOut,"#define TAG_TREE_EXT_COLUMN_COUNT %d\n\n",
470490 table_columns);
471 fprintf(fileOut,"#define TAG_TREE_EXT_ROW_COUNT %d\n\n",table_rows);
491 fprintf(fileOut,"#define TAG_TREE_EXT_ROW_COUNT %d\n\n",
492 table_rows);
472493 fprintf(fileOut,"/* Common extensions */\n");
473494 fprintf(fileOut,
474495 "static unsigned int tag_tree_combination_ext_table"
475 "[TAG_TREE_EXT_ROW_COUNT][TAG_TREE_EXT_COLUMN_COUNT] = {\n");
496 "[TAG_TREE_EXT_ROW_COUNT][TAG_TREE_EXT_COLUMN_COUNT]"
497 " = {\n");
476498 }
477499
478500 for (u = 0; u < table_rows; u++) {
488510 }
489511 fprintf(fileOut," { ");
490512 for (j = 0; j < table_columns; ++j ) {
491 fprintf(fileOut,"0x%08x,",tag_tree_combination_table[u][j]);
513 fprintf(fileOut,"0x%08x,",
514 tag_tree_combination_table[u][j]);
492515 }
493516 fprintf(fileOut,"},\n");
494517
1717 DW_AT_external yes(1)
1818 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
1919 DW_AT_decl_line 0x00000084
20 DW_AT_location 0x037cbc0500 DW_OP_addr 0x0005bc7c
20 DW_AT_location 0x037cbc0500
21 DW_OP_addr 0x0005bc7c
2122 < 1><0x00000038> DW_TAG_pointer_type
2223 DW_AT_type <0x0000003d>
2324 < 1><0x0000003d> DW_TAG_typedef
3536 DW_AT_type <0x00000169>
3637 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
3738 DW_AT_decl_line 0x0000007b
38 DW_AT_data_member_location DW_OP_plus_uconst 0
39 DW_AT_data_member_location
40 DW_OP_plus_uconst 0
3941 < 2><0x0000005e> DW_TAG_member
4042 DW_AT_name _r
4143 DW_AT_type <0x00000175>
4244 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
4345 DW_AT_decl_line 0x0000007c
44 DW_AT_data_member_location DW_OP_plus_uconst 4
46 DW_AT_data_member_location
47 DW_OP_plus_uconst 4
4548 < 2><0x0000006c> DW_TAG_member
4649 DW_AT_name _w
4750 DW_AT_type <0x00000175>
4851 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
4952 DW_AT_decl_line 0x0000007d
50 DW_AT_data_member_location DW_OP_plus_uconst 8
53 DW_AT_data_member_location
54 DW_OP_plus_uconst 8
5155 < 2><0x0000007a> DW_TAG_member
5256 DW_AT_name _flags
5357 DW_AT_type <0x0000017c>
5458 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
5559 DW_AT_decl_line 0x0000007e
56 DW_AT_data_member_location DW_OP_plus_uconst 12
60 DW_AT_data_member_location
61 DW_OP_plus_uconst 12
5762 < 2><0x00000088> DW_TAG_member
5863 DW_AT_name _file
5964 DW_AT_type <0x0000017c>
6065 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
6166 DW_AT_decl_line 0x0000007f
62 DW_AT_data_member_location DW_OP_plus_uconst 14
67 DW_AT_data_member_location
68 DW_OP_plus_uconst 14
6369 < 2><0x00000096> DW_TAG_member
6470 DW_AT_name _bf
6571 DW_AT_type <0x00000183>
6672 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
6773 DW_AT_decl_line 0x00000080
68 DW_AT_data_member_location DW_OP_plus_uconst 16
74 DW_AT_data_member_location
75 DW_OP_plus_uconst 16
6976 < 2><0x000000a4> DW_TAG_member
7077 DW_AT_name _lbfsize
7178 DW_AT_type <0x00000175>
7279 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
7380 DW_AT_decl_line 0x00000081
74 DW_AT_data_member_location DW_OP_plus_uconst 24
81 DW_AT_data_member_location
82 DW_OP_plus_uconst 24
7583 < 2><0x000000b2> DW_TAG_member
7684 DW_AT_name _cookie
7785 DW_AT_type <0x000001a8>
7886 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
7987 DW_AT_decl_line 0x00000084
80 DW_AT_data_member_location DW_OP_plus_uconst 28
88 DW_AT_data_member_location
89 DW_OP_plus_uconst 28
8190 < 2><0x000000c0> DW_TAG_member
8291 DW_AT_name _close
8392 DW_AT_type <0x000001a9>
8493 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
8594 DW_AT_decl_line 0x00000085
86 DW_AT_data_member_location DW_OP_plus_uconst 32
95 DW_AT_data_member_location
96 DW_OP_plus_uconst 32
8797 < 2><0x000000ce> DW_TAG_member
8898 DW_AT_name _read
8999 DW_AT_type <0x000001ba>
90100 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
91101 DW_AT_decl_line 0x00000086
92 DW_AT_data_member_location DW_OP_plus_uconst 36
102 DW_AT_data_member_location
103 DW_OP_plus_uconst 36
93104 < 2><0x000000dc> DW_TAG_member
94105 DW_AT_name _seek
95106 DW_AT_type <0x000001e1>
96107 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
97108 DW_AT_decl_line 0x00000087
98 DW_AT_data_member_location DW_OP_plus_uconst 40
109 DW_AT_data_member_location
110 DW_OP_plus_uconst 40
99111 < 2><0x000000ea> DW_TAG_member
100112 DW_AT_name _write
101113 DW_AT_type <0x00000224>
102114 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
103115 DW_AT_decl_line 0x00000088
104 DW_AT_data_member_location DW_OP_plus_uconst 44
116 DW_AT_data_member_location
117 DW_OP_plus_uconst 44
105118 < 2><0x000000f8> DW_TAG_member
106119 DW_AT_name _ub
107120 DW_AT_type <0x00000183>
108121 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
109122 DW_AT_decl_line 0x0000008b
110 DW_AT_data_member_location DW_OP_plus_uconst 48
123 DW_AT_data_member_location
124 DW_OP_plus_uconst 48
111125 < 2><0x00000106> DW_TAG_member
112126 DW_AT_name _extra
113127 DW_AT_type <0x00000249>
114128 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
115129 DW_AT_decl_line 0x0000008c
116 DW_AT_data_member_location DW_OP_plus_uconst 56
130 DW_AT_data_member_location
131 DW_OP_plus_uconst 56
117132 < 2><0x00000114> DW_TAG_member
118133 DW_AT_name _ur
119134 DW_AT_type <0x00000175>
120135 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
121136 DW_AT_decl_line 0x0000008d
122 DW_AT_data_member_location DW_OP_plus_uconst 60
137 DW_AT_data_member_location
138 DW_OP_plus_uconst 60
123139 < 2><0x00000122> DW_TAG_member
124140 DW_AT_name _ubuf
125141 DW_AT_type <0x00000254>
126142 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
127143 DW_AT_decl_line 0x00000090
128 DW_AT_data_member_location DW_OP_plus_uconst 64
144 DW_AT_data_member_location
145 DW_OP_plus_uconst 64
129146 < 2><0x00000130> DW_TAG_member
130147 DW_AT_name _nbuf
131148 DW_AT_type <0x00000267>
132149 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
133150 DW_AT_decl_line 0x00000091
134 DW_AT_data_member_location DW_OP_plus_uconst 67
151 DW_AT_data_member_location
152 DW_OP_plus_uconst 67
135153 < 2><0x0000013e> DW_TAG_member
136154 DW_AT_name _lb
137155 DW_AT_type <0x00000183>
138156 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
139157 DW_AT_decl_line 0x00000094
140 DW_AT_data_member_location DW_OP_plus_uconst 68
158 DW_AT_data_member_location
159 DW_OP_plus_uconst 68
141160 < 2><0x0000014c> DW_TAG_member
142161 DW_AT_name _blksize
143162 DW_AT_type <0x00000175>
144163 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
145164 DW_AT_decl_line 0x00000097
146 DW_AT_data_member_location DW_OP_plus_uconst 76
165 DW_AT_data_member_location
166 DW_OP_plus_uconst 76
147167 < 2><0x0000015a> DW_TAG_member
148168 DW_AT_name _offset
149169 DW_AT_type <0x000001fc>
150170 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
151171 DW_AT_decl_line 0x00000098
152 DW_AT_data_member_location DW_OP_plus_uconst 80
172 DW_AT_data_member_location
173 DW_OP_plus_uconst 80
153174 < 1><0x00000169> DW_TAG_pointer_type
154175 DW_AT_type <0x0000016e>
155176 < 1><0x0000016e> DW_TAG_base_type
174195 DW_AT_type <0x00000169>
175196 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
176197 DW_AT_decl_line 0x00000059
177 DW_AT_data_member_location DW_OP_plus_uconst 0
198 DW_AT_data_member_location
199 DW_OP_plus_uconst 0
178200 < 2><0x00000199> DW_TAG_member
179201 DW_AT_name _size
180202 DW_AT_type <0x00000175>
181203 DW_AT_decl_file 0x00000001 /usr/include/stdio.h
182204 DW_AT_decl_line 0x0000005a
183 DW_AT_data_member_location DW_OP_plus_uconst 4
205 DW_AT_data_member_location
206 DW_OP_plus_uconst 4
184207 < 1><0x000001a8> DW_TAG_pointer_type
185208 < 1><0x000001a9> DW_TAG_pointer_type
186209 DW_AT_type <0x000001ae>
276299 DW_AT_external yes(1)
277300 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
278301 DW_AT_decl_line 0x00000091
279 DW_AT_location 0x0380bc0500 DW_OP_addr 0x0005bc80
302 DW_AT_location 0x0380bc0500
303 DW_OP_addr 0x0005bc80
280304 < 1><0x00000285> DW_TAG_variable
281305 DW_AT_name cu_offset_size
282306 DW_AT_type <0x00000175>
283307 DW_AT_external yes(1)
284308 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
285309 DW_AT_decl_line 0x00000092
286 DW_AT_location 0x0384bc0500 DW_OP_addr 0x0005bc84
310 DW_AT_location 0x0384bc0500
311 DW_OP_addr 0x0005bc84
287312 < 1><0x00000297> DW_TAG_variable
288313 DW_AT_name namesoptionon
289314 DW_AT_type <0x00000175>
290315 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
291316 DW_AT_decl_line 0x00000081
292 DW_AT_location 0x0398bc0500 DW_OP_addr 0x0005bc98
317 DW_AT_location 0x0398bc0500
318 DW_OP_addr 0x0005bc98
293319 < 1><0x000002a8> DW_TAG_variable
294320 DW_AT_name dupstrused
295321 DW_AT_type <0x000002b9>
296322 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
297323 DW_AT_decl_line 0x000000a5
298 DW_AT_location 0x03bcbc0500 DW_OP_addr 0x0005bcbc
324 DW_AT_location 0x03bcbc0500
325 DW_OP_addr 0x0005bcbc
299326 < 1><0x000002b9> DW_TAG_base_type
300327 DW_AT_name unsigned int
301328 DW_AT_encoding DW_ATE_unsigned
305332 DW_AT_type <0x000002d1>
306333 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
307334 DW_AT_decl_line 0x000000a4
308 DW_AT_location 0x03c0bc0500 DW_OP_addr 0x0005bcc0
335 DW_AT_location 0x03c0bc0500
336 DW_OP_addr 0x0005bcc0
309337 < 1><0x000002d1> DW_TAG_array_type
310338 DW_AT_type <0x0000023f>
311339 < 2><0x000002d6> DW_TAG_subrange_type
316344 DW_AT_type <0x0000023f>
317345 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
318346 DW_AT_decl_line 0x00000085
319 DW_AT_location 0x039cbc0500 DW_OP_addr 0x0005bc9c
347 DW_AT_location 0x039cbc0500
348 DW_OP_addr 0x0005bc9c
320349 < 1><0x000002ee> DW_TAG_variable
321350 DW_AT_name dumpallnames
322351 DW_AT_type <0x00000175>
323352 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
324353 DW_AT_decl_line 0x00000083
325 DW_AT_location 0x03a0bc0500 DW_OP_addr 0x0005bca0
354 DW_AT_location 0x03a0bc0500
355 DW_OP_addr 0x0005bca0
326356 < 1><0x000002ff> DW_TAG_variable
327357 DW_AT_name checkoptionon
328358 DW_AT_type <0x00000175>
329359 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
330360 DW_AT_decl_line 0x00000082
331 DW_AT_location 0x03a4bc0500 DW_OP_addr 0x0005bca4
361 DW_AT_location 0x03a4bc0500
362 DW_OP_addr 0x0005bca4
332363 < 1><0x00000310> DW_TAG_variable
333364 DW_AT_name tuhash
334365 DW_AT_type <0x0000023f>
335366 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
336367 DW_AT_decl_line 0x0000009c
337 DW_AT_location 0x03a8bc0500 DW_OP_addr 0x0005bca8
368 DW_AT_location 0x03a8bc0500
369 DW_OP_addr 0x0005bca8
338370 < 1><0x00000321> DW_TAG_variable
339371 DW_AT_name cuhash
340372 DW_AT_type <0x0000023f>
341373 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
342374 DW_AT_decl_line 0x0000009b
343 DW_AT_location 0x03acbc0500 DW_OP_addr 0x0005bcac
375 DW_AT_location 0x03acbc0500
376 DW_OP_addr 0x0005bcac
344377 < 1><0x00000332> DW_TAG_variable
345378 DW_AT_name tufissionhash
346379 DW_AT_type <0x0000023f>
347380 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
348381 DW_AT_decl_line 0x0000009e
349 DW_AT_location 0x03b0bc0500 DW_OP_addr 0x0005bcb0
382 DW_AT_location 0x03b0bc0500
383 DW_OP_addr 0x0005bcb0
350384 < 1><0x00000343> DW_TAG_variable
351385 DW_AT_name cufissionhash
352386 DW_AT_type <0x0000023f>
353387 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
354388 DW_AT_decl_line 0x0000009d
355 DW_AT_location 0x03b4bc0500 DW_OP_addr 0x0005bcb4
389 DW_AT_location 0x03b4bc0500
390 DW_OP_addr 0x0005bcb4
356391 < 1><0x00000354> DW_TAG_variable
357392 DW_AT_name passnullerror
358393 DW_AT_type <0x00000175>
359394 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
360395 DW_AT_decl_line 0x00000098
361 DW_AT_location 0x03b8bc0500 DW_OP_addr 0x0005bcb8
396 DW_AT_location 0x03b8bc0500
397 DW_OP_addr 0x0005bcb8
362398 < 1><0x00000365> DW_TAG_variable
363399 DW_AT_name g_is_info
364400 DW_AT_type <0x00000376>
365401 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
366402 DW_AT_decl_line 0x0000008f
367 DW_AT_location 0x0358b40500 DW_OP_addr 0x0005b458
403 DW_AT_location 0x0358b40500
404 DW_OP_addr 0x0005b458
368405 < 1><0x00000376> DW_TAG_typedef
369406 DW_AT_type <0x00000175>
370407 DW_AT_name Dwarf_Bool
375412 DW_AT_type <0x00000175>
376413 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
377414 DW_AT_decl_line 0x0000008e
378 DW_AT_location 0x035cb40500 DW_OP_addr 0x0005b45c
415 DW_AT_location 0x035cb40500
416 DW_OP_addr 0x0005b45c
379417 < 1><0x00000392> DW_TAG_variable
380418 DW_AT_name fissionfordie
381419 DW_AT_type <0x00000175>
382420 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
383421 DW_AT_decl_line 0x00000097
384 DW_AT_location 0x0360b40500 DW_OP_addr 0x0005b460
422 DW_AT_location 0x0360b40500
423 DW_OP_addr 0x0005b460
385424 < 1><0x000003a3> DW_TAG_variable
386425 DW_AT_name stdrun
387426 DW_AT_type <0x00000175>
388427 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
389428 DW_AT_decl_line 0x0000008c
390 DW_AT_location 0x0364b40500 DW_OP_addr 0x0005b464
429 DW_AT_location 0x0364b40500
430 DW_OP_addr 0x0005b464
391431 < 1><0x000003b4> DW_TAG_variable
392432 DW_AT_name dienumber
393433 DW_AT_type <0x00000175>
394434 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
395435 DW_AT_decl_line 0x00000096
396 DW_AT_location 0x0350be0500 DW_OP_addr 0x0005be50
436 DW_AT_location 0x0350be0500
437 DW_OP_addr 0x0005be50
397438 < 1><0x000003c5> DW_TAG_enumeration_type
398439 DW_AT_name Dwarf_Form_Class
399440 DW_AT_byte_size 0x00000004
476517 < 1><0x00000464> DW_TAG_subprogram
477518 DW_AT_low_pc 0x000025c0
478519 DW_AT_high_pc 0x000034d6
479 DW_AT_frame_base 0x55 DW_OP_reg5
520 DW_AT_frame_base 0x55
521 DW_OP_reg5
480522 DW_AT_name main
481523 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
482524 DW_AT_decl_line 0x00000164
484526 DW_AT_type <0x00000175>
485527 DW_AT_external yes(1)
486528 < 2><0x0000047c> DW_TAG_formal_parameter
487 DW_AT_location 0x91907c DW_OP_fbreg -496
529 DW_AT_location 0x91907c
530 DW_OP_fbreg -496
488531 DW_AT_name argc
489532 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
490533 DW_AT_decl_line 0x00000164
491534 DW_AT_type <0x00000175>
492535 < 2><0x0000048c> DW_TAG_formal_parameter
493 DW_AT_location 0x918c7c DW_OP_fbreg -500
536 DW_AT_location 0x918c7c
537 DW_OP_fbreg -500
494538 DW_AT_name argv
495539 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
496540 DW_AT_decl_line 0x00000164
497541 DW_AT_type <0x000012c8>
498542 < 2><0x0000049c> DW_TAG_variable
499 DW_AT_location 0x91887c DW_OP_fbreg -504
543 DW_AT_location 0x91887c
544 DW_OP_fbreg -504
545 DW_AT_name dbg
546 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
547 DW_AT_decl_line 0x00000166
548 DW_AT_type <0x000012cd>
549 < 2><0x000004ac> DW_TAG_variable
550 DW_AT_location 0x91847c
551 DW_OP_fbreg -508
552 DW_AT_name fd
553 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
554 DW_AT_decl_line 0x00000167
555 DW_AT_type <0x00000175>
556 < 2><0x000004bc> DW_TAG_variable
557 DW_AT_location 0x91807c
558 DW_OP_fbreg -512
559 DW_AT_name filepath
560 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
561 DW_AT_decl_line 0x00000168
562 DW_AT_type <0x0000023f>
563 < 2><0x000004cc> DW_TAG_variable
564 DW_AT_location 0x91fc7b
565 DW_OP_fbreg -516
566 DW_AT_name res
567 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
568 DW_AT_decl_line 0x00000169
569 DW_AT_type <0x00000175>
570 < 2><0x000004dc> DW_TAG_variable
571 DW_AT_location 0x91f87b
572 DW_OP_fbreg -520
573 DW_AT_name error
574 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
575 DW_AT_decl_line 0x0000016a
576 DW_AT_type <0x000012e4>
577 < 2><0x000004ec> DW_TAG_variable
578 DW_AT_location 0x91f47b
579 DW_OP_fbreg -524
580 DW_AT_name errhand
581 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
582 DW_AT_decl_line 0x0000016b
583 DW_AT_type <0x000012fb>
584 < 2><0x000004fc> DW_TAG_variable
585 DW_AT_location 0x91f07b
586 DW_OP_fbreg -528
587 DW_AT_name errarg
588 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
589 DW_AT_decl_line 0x0000016c
590 DW_AT_type <0x00000447>
591 < 2><0x0000050c> DW_TAG_variable
592 DW_AT_location 0x9168
593 DW_OP_fbreg -24
594 DW_AT_name hash8
595 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
596 DW_AT_decl_line 0x0000016d
597 DW_AT_type <0x00001319>
598 < 2><0x0000051b> DW_TAG_variable
599 DW_AT_location 0x91ec7b
600 DW_OP_fbreg -532
601 DW_AT_name errp
602 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
603 DW_AT_decl_line 0x0000016e
604 DW_AT_type <0x00001347>
605 < 2><0x0000052b> DW_TAG_variable
606 DW_AT_location 0x91e87b
607 DW_OP_fbreg -536
608 DW_AT_name simpleerrhand
609 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
610 DW_AT_decl_line 0x0000016f
611 DW_AT_type <0x00000175>
612 < 2><0x0000053b> DW_TAG_lexical_block
613 DW_AT_low_pc 0x0000266d
614 DW_AT_high_pc 0x00002b51
615 < 3><0x00000544> DW_TAG_variable
616 DW_AT_location 0x91e47b
617 DW_OP_fbreg -540
618 DW_AT_name i
619 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
620 DW_AT_decl_line 0x00000174
621 DW_AT_type <0x00000175>
622 < 2><0x00000555> DW_TAG_lexical_block
623 DW_AT_low_pc 0x00002c81
624 DW_AT_high_pc 0x00002e70
625 < 3><0x0000055e> DW_TAG_variable
626 DW_AT_location 0x91e07b
627 DW_OP_fbreg -544
628 DW_AT_name die
629 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
630 DW_AT_decl_line 0x000001c4
631 DW_AT_type <0x0000134c>
632 < 3><0x0000056e> DW_TAG_lexical_block
633 DW_AT_low_pc 0x00002d35
634 DW_AT_high_pc 0x00002dd9
635 < 4><0x00000577> DW_TAG_variable
636 DW_AT_location 0x91d07b
637 DW_OP_fbreg -560
638 DW_AT_name sf
639 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
640 DW_AT_decl_line 0x000001cd
641 DW_AT_type <0x00001363>
642 < 2><0x00000589> DW_TAG_lexical_block
643 DW_AT_low_pc 0x00002e86
644 DW_AT_high_pc 0x00003075
645 < 3><0x00000592> DW_TAG_variable
646 DW_AT_location 0x91cc7b
647 DW_OP_fbreg -564
648 DW_AT_name die
649 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
650 DW_AT_decl_line 0x000001dc
651 DW_AT_type <0x0000134c>
652 < 3><0x000005a2> DW_TAG_lexical_block
653 DW_AT_low_pc 0x00002f3a
654 DW_AT_high_pc 0x00002fde
655 < 4><0x000005ab> DW_TAG_variable
656 DW_AT_location 0x91b87b
657 DW_OP_fbreg -584
658 DW_AT_name sf
659 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
660 DW_AT_decl_line 0x000001e5
661 DW_AT_type <0x00001363>
662 < 2><0x000005bd> DW_TAG_lexical_block
663 DW_AT_low_pc 0x00003098
664 DW_AT_high_pc 0x0000323e
665 < 3><0x000005c6> DW_TAG_variable
666 DW_AT_location 0x91807e
667 DW_OP_fbreg -256
668 DW_AT_name fisdata
669 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
670 DW_AT_decl_line 0x000001f5
671 DW_AT_type <0x000013a1>
672 < 2><0x000005d7> DW_TAG_lexical_block
673 DW_AT_low_pc 0x00003261
674 DW_AT_high_pc 0x00003407
675 < 3><0x000005e0> DW_TAG_variable
676 DW_AT_location 0x91987c
677 DW_OP_fbreg -488
678 DW_AT_name fisdata
679 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
680 DW_AT_decl_line 0x00000209
681 DW_AT_type <0x000013a1>
682 < 1><0x000005f2> DW_TAG_subprogram
683 DW_AT_low_pc 0x000034e0
684 DW_AT_high_pc 0x000035c8
685 DW_AT_frame_base 0x55
686 DW_OP_reg5
687 DW_AT_name startswithextractstring
688 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
689 DW_AT_decl_line 0x00000103
690 DW_AT_prototyped yes(1)
691 DW_AT_type <0x00000175>
692 < 2><0x00000609> DW_TAG_formal_parameter
693 DW_AT_location 0x9174
694 DW_OP_fbreg -12
695 DW_AT_name arg
696 DW_AT_decl_file 0x00000004 /tmp/c/tmp/dwarf-20170709/libdwarf/../dwarfexample/simplereader.c
697 DW_AT_decl_line 0x00000103
698 DW_AT_type <0x0000023f>
699 < 2><0x00000618> DW_TAG_formal_parameter
00
11 .debug_info
22
3 CU_HEADER:
4 cu_header_length = 0x00000223 547
5 version_stamp = 0x0004 4
6 abbrev_offset = 0x00000000 0
7 address_size = 0x04 4
8 offset_size = 0x04 4
9 cu_type = 0x01 DW_UT_compile
10
311 COMPILE_UNIT<header overall offset = 0x00000000>:
4 < 0><0x0000000b> DW_TAG_compile_unit
12 < 0><0x0000000b> DW_TAG_compile_unit <abbrev 1>
13 dwarf_srcfiles() returned strings. Count = 9.
14 [0] c:/Users/dandelot/test.c
15 [1] c:/mingw/include/stdio.h
16 [2] c:/mingw/include/_mingw.h
17 [3] c:/mingw/include/msvcrtver.h
18 [4] c:/mingw/include/w32api.h
19 [5] c:/mingw/include/sdkddkver.h
20 [6] c:/mingw/lib/gcc/mingw32/6.3.0/include/stddef.h
21 [7] c:/mingw/include/sys/types.h
22 [8] c:/mingw/lib/gcc/mingw32/6.3.0/include/stdarg.h
523 DW_AT_producer GNU C11 6.3.0 -mtune=generic -march=i586 -g3 -ggdb3
624 DW_AT_language DW_LANG_C99
725 DW_AT_name c:/Users/dandelot/test.c
1129 DW_AT_GNU_macros 0x00000000
1230
1331 LOCAL_SYMBOLS:
14 < 1><0x0000006a> DW_TAG_base_type
32 < 1><0x0000006a> DW_TAG_base_type <abbrev 2>
1533 DW_AT_byte_size 0x00000004
1634 DW_AT_encoding DW_ATE_unsigned
1735 DW_AT_name unsigned int
18 < 1><0x0000007a> DW_TAG_base_type
36 < 1><0x0000007a> DW_TAG_base_type <abbrev 2>
1937 DW_AT_byte_size 0x00000002
2038 DW_AT_encoding DW_ATE_unsigned
2139 DW_AT_name short unsigned int
22 < 1><0x00000090> DW_TAG_base_type
40 < 1><0x00000090> DW_TAG_base_type <abbrev 2>
2341 DW_AT_byte_size 0x00000004
2442 DW_AT_encoding DW_ATE_signed
2543 DW_AT_name long int
26 < 1><0x0000009c> DW_TAG_base_type
44 < 1><0x0000009c> DW_TAG_base_type <abbrev 2>
2745 DW_AT_byte_size 0x00000008
2846 DW_AT_encoding DW_ATE_signed
2947 DW_AT_name long long int
30 < 1><0x000000ad> DW_TAG_base_type
48 < 1><0x000000ad> DW_TAG_base_type <abbrev 2>
3149 DW_AT_byte_size 0x00000004
3250 DW_AT_encoding DW_ATE_signed
3351 DW_AT_name int
34 < 1><0x000000b4> DW_TAG_base_type
52 < 1><0x000000b4> DW_TAG_base_type <abbrev 2>
3553 DW_AT_byte_size 0x00000001
3654 DW_AT_encoding DW_ATE_signed_char
3755 DW_AT_name char
38 < 1><0x000000bc> DW_TAG_structure_type
56 < 1><0x000000bc> DW_TAG_structure_type <abbrev 3>
3957 DW_AT_name _iobuf
4058 DW_AT_byte_size 0x00000020
4159 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
4260 DW_AT_decl_line 0x000000d2
4361 DW_AT_sibling <0x00000143>
44 < 2><0x000000cb> DW_TAG_member
62 < 2><0x000000cb> DW_TAG_member <abbrev 4>
4563 DW_AT_name _ptr
4664 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
4765 DW_AT_decl_line 0x000000d4
4866 DW_AT_type <0x00000143>
4967 DW_AT_data_member_location 0
50 < 2><0x000000d8> DW_TAG_member
68 < 2><0x000000d8> DW_TAG_member <abbrev 4>
5169 DW_AT_name _cnt
5270 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
5371 DW_AT_decl_line 0x000000d5
5472 DW_AT_type <0x000000ad>
5573 DW_AT_data_member_location 4
56 < 2><0x000000e5> DW_TAG_member
74 < 2><0x000000e5> DW_TAG_member <abbrev 4>
5775 DW_AT_name _base
5876 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
5977 DW_AT_decl_line 0x000000d6
6078 DW_AT_type <0x00000143>
6179 DW_AT_data_member_location 8
62 < 2><0x000000f3> DW_TAG_member
80 < 2><0x000000f3> DW_TAG_member <abbrev 4>
6381 DW_AT_name _flag
6482 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
6583 DW_AT_decl_line 0x000000d7
6684 DW_AT_type <0x000000ad>
6785 DW_AT_data_member_location 12
68 < 2><0x00000101> DW_TAG_member
86 < 2><0x00000101> DW_TAG_member <abbrev 4>
6987 DW_AT_name _file
7088 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
7189 DW_AT_decl_line 0x000000d8
7290 DW_AT_type <0x000000ad>
7391 DW_AT_data_member_location 16
74 < 2><0x0000010f> DW_TAG_member
92 < 2><0x0000010f> DW_TAG_member <abbrev 4>
7593 DW_AT_name _charbuf
7694 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
7795 DW_AT_decl_line 0x000000d9
7896 DW_AT_type <0x000000ad>
7997 DW_AT_data_member_location 20
80 < 2><0x00000120> DW_TAG_member
98 < 2><0x00000120> DW_TAG_member <abbrev 4>
8199 DW_AT_name _bufsiz
82100 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
83101 DW_AT_decl_line 0x000000da
84102 DW_AT_type <0x000000ad>
85103 DW_AT_data_member_location 24
86 < 2><0x00000130> DW_TAG_member
104 < 2><0x00000130> DW_TAG_member <abbrev 4>
87105 DW_AT_name _tmpfname
88106 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
89107 DW_AT_decl_line 0x000000db
90108 DW_AT_type <0x00000143>
91109 DW_AT_data_member_location 28
92 < 1><0x00000143> DW_TAG_pointer_type
110 < 1><0x00000143> DW_TAG_pointer_type <abbrev 5>
93111 DW_AT_byte_size 0x00000004
94112 DW_AT_type <0x000000b4>
95 < 1><0x00000149> DW_TAG_typedef
113 < 1><0x00000149> DW_TAG_typedef <abbrev 6>
96114 DW_AT_name FILE
97115 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
98116 DW_AT_decl_line 0x000000dc
99117 DW_AT_type <0x000000bc>
100 < 1><0x00000155> DW_TAG_array_type
118 < 1><0x00000155> DW_TAG_array_type <abbrev 7>
101119 DW_AT_type <0x00000149>
102120 DW_AT_sibling <0x00000160>
103 < 2><0x0000015e> DW_TAG_subrange_type
104 < 1><0x00000160> DW_TAG_variable
121 < 2><0x0000015e> DW_TAG_subrange_type <abbrev 8>
122 < 1><0x00000160> DW_TAG_variable <abbrev 9>
105123 DW_AT_name _iob
106124 DW_AT_decl_file 0x00000002 c:/mingw/include/stdio.h
107125 DW_AT_decl_line 0x000000ef
108126 DW_AT_type <0x00000155>
109127 DW_AT_external yes(1)
110128 DW_AT_declaration yes(1)
111 < 1><0x0000016c> DW_TAG_structure_type
129 < 1><0x0000016c> DW_TAG_structure_type <abbrev 3>
112130 DW_AT_name something
113131 DW_AT_byte_size 0x00000008
114132 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
115133 DW_AT_decl_line 0x00000004
116134 DW_AT_sibling <0x00000193>
117 < 2><0x0000017e> DW_TAG_member
135 < 2><0x0000017e> DW_TAG_member <abbrev 4>
118136 DW_AT_name a
119137 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
120138 DW_AT_decl_line 0x00000005
121139 DW_AT_type <0x000000ad>
122140 DW_AT_data_member_location 0
123 < 2><0x00000188> DW_TAG_member
141 < 2><0x00000188> DW_TAG_member <abbrev 4>
124142 DW_AT_name b
125143 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
126144 DW_AT_decl_line 0x00000006
127145 DW_AT_type <0x0000006a>
128146 DW_AT_data_member_location 4
129 < 1><0x00000193> DW_TAG_subprogram
147 < 1><0x00000193> DW_TAG_subprogram <abbrev 10>
130148 DW_AT_external yes(1)
131149 DW_AT_name main
132150 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
135153 DW_AT_type <0x000000ad>
136154 DW_AT_low_pc 0x0040146d
137155 DW_AT_high_pc <offset-from-lowpc>74
138 DW_AT_frame_base len 0x0001: 0x9c: DW_OP_call_frame_cfa
156 DW_AT_frame_base len 0x0001: 0x9c:
157 DW_OP_call_frame_cfa
139158 DW_AT_GNU_all_tail_call_sites yes(1)
140159 DW_AT_sibling <0x000001f1>
141 < 2><0x000001ad> DW_TAG_formal_parameter
160 < 2><0x000001ad> DW_TAG_formal_parameter <abbrev 11>
142161 DW_AT_name argc
143162 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
144163 DW_AT_decl_line 0x00000010
145164 DW_AT_type <0x000000ad>
146 DW_AT_location len 0x0002: 0x9100: DW_OP_fbreg 0
147 < 2><0x000001bc> DW_TAG_formal_parameter
165 DW_AT_location len 0x0002: 0x9100:
166 DW_OP_fbreg 0
167 < 2><0x000001bc> DW_TAG_formal_parameter <abbrev 11>
148168 DW_AT_name argv
149169 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
150170 DW_AT_decl_line 0x00000010
151171 DW_AT_type <0x000001f1>
152 DW_AT_location len 0x0002: 0x9104: DW_OP_fbreg 4
153 < 2><0x000001cb> DW_TAG_variable
172 DW_AT_location len 0x0002: 0x9104:
173 DW_OP_fbreg 4
174 < 2><0x000001cb> DW_TAG_variable <abbrev 12>
154175 DW_AT_name x
155176 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
156177 DW_AT_decl_line 0x00000013
157178 DW_AT_type <0x000000ad>
158 DW_AT_location len 0x0002: 0x741c: DW_OP_breg4+28
159 < 2><0x000001d7> DW_TAG_variable
179 DW_AT_location len 0x0002: 0x741c:
180 DW_OP_breg4+28
181 < 2><0x000001d7> DW_TAG_variable <abbrev 12>
160182 DW_AT_name y
161183 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
162184 DW_AT_decl_line 0x00000014
163185 DW_AT_type <0x000000ad>
164 DW_AT_location len 0x0002: 0x7418: DW_OP_breg4+24
165 < 2><0x000001e3> DW_TAG_variable
186 DW_AT_location len 0x0002: 0x7418:
187 DW_OP_breg4+24
188 < 2><0x000001e3> DW_TAG_variable <abbrev 12>
166189 DW_AT_name so
167190 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
168191 DW_AT_decl_line 0x00000015
169192 DW_AT_type <0x0000016c>
170 DW_AT_location len 0x0002: 0x7410: DW_OP_breg4+16
171 < 1><0x000001f1> DW_TAG_pointer_type
193 DW_AT_location len 0x0002: 0x7410:
194 DW_OP_breg4+16
195 < 1><0x000001f1> DW_TAG_pointer_type <abbrev 5>
172196 DW_AT_byte_size 0x00000004
173197 DW_AT_type <0x00000143>
174 < 1><0x000001f7> DW_TAG_subprogram
198 < 1><0x000001f7> DW_TAG_subprogram <abbrev 13>
175199 DW_AT_external yes(1)
176200 DW_AT_name buffle
177201 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
180204 DW_AT_type <0x000000ad>
181205 DW_AT_low_pc 0x00401460
182206 DW_AT_high_pc <offset-from-lowpc>13
183 DW_AT_frame_base len 0x0001: 0x9c: DW_OP_call_frame_cfa
207 DW_AT_frame_base len 0x0001: 0x9c:
208 DW_OP_call_frame_cfa
184209 DW_AT_GNU_all_call_sites yes(1)
185210 DW_AT_sibling <0x00000220>
186 < 2><0x00000213> DW_TAG_formal_parameter
211 < 2><0x00000213> DW_TAG_formal_parameter <abbrev 11>
187212 DW_AT_name v
188213 DW_AT_decl_file 0x00000001 c:/Users/dandelot/test.c
189214 DW_AT_decl_line 0x0000000a
190215 DW_AT_type <0x00000220>
191 DW_AT_location len 0x0002: 0x9100: DW_OP_fbreg 0
192 < 1><0x00000220> DW_TAG_pointer_type
216 DW_AT_location len 0x0002: 0x9100:
217 DW_OP_fbreg 0
218 < 1><0x00000220> DW_TAG_pointer_type <abbrev 5>
193219 DW_AT_byte_size 0x00000004
194220 DW_AT_type <0x0000016c>
195221
196222 .debug_line: line number info for a single cu
197223 Source lines (from CU-DIE at .debug_info offset 0x0000000b):
198224
199 NS new statement, BB new basic block, ET end of text sequence
200 PE prologue end, EB epilogue begin
201 IS=val ISA number, DI=val discriminator value
202 <pc> [lno,col] NS BB ET PE EB IS= DI= uri: "filepath"
203 0x00401460 [ 11, 0] NS uri: "c:/Users/dandelot/test.c"
204 0x00401463 [ 12, 0] NS
205 0x0040146b [ 14, 0] NS
206 0x0040146d [ 17, 0] NS
207 0x00401476 [ 17, 0] NS
208 0x0040147b [ 19, 0] NS
209 0x00401483 [ 20, 0] NS
210 0x0040148b [ 23, 0] NS
211 0x00401493 [ 24, 0] NS
212 0x004014a3 [ 25, 0] NS
213 0x004014b5 [ 26, 0] NS
214 0x004014b7 [ 26, 0] NS ET
225 COMPILE_UNIT<header overall offset = 0x00000000>:
226 < 0><0x0000000b> DW_TAG_compile_unit <abbrev 1>
227 dwarf_srcfiles() returned strings. Count = 9.
228 [0] c:/Users/dandelot/test.c
229 [1] c:/mingw/include/stdio.h
230 [2] c:/mingw/include/_mingw.h
231 [3] c:/mingw/include/msvcrtver.h
232 [4] c:/mingw/include/w32api.h
233 [5] c:/mingw/include/sdkddkver.h
234 [6] c:/mingw/lib/gcc/mingw32/6.3.0/include/stddef.h
235 [7] c:/mingw/include/sys/types.h
236 [8] c:/mingw/lib/gcc/mingw32/6.3.0/include/stdarg.h
237 DW_AT_producer GNU C11 6.3.0 -mtune=generic -march=i586 -g3 -ggdb3
238 DW_AT_language DW_LANG_C99
239 DW_AT_name c:/Users/dandelot/test.c
240 DW_AT_low_pc 0x00401460
241 DW_AT_high_pc <offset-from-lowpc>87
242 DW_AT_stmt_list 0x00000000
243 DW_AT_GNU_macros 0x00000000
244
245 *** DWARF CHECK: .debug_line: standard DWARF3 operands matched, but is DWARF2 linetable: count 12 at offset 0x00000000 ( 0 ) ***
246 total line info length 256 bytes, line offset 0x00000000 0
247 line table version 2
248 line table length field length 4
249 prologue length 224
250 compilation_directory
251 min instruction length 1
252 default is stmt 1
253 line base -5
254 line_range 14
255 opcode base 13
256 standard opcode count 12
257 opcode[ 1] length 0
258 opcode[ 2] length 1
259 opcode[ 3] length 1
260 opcode[ 4] length 1
261 opcode[ 5] length 1
262 opcode[ 6] length 0
263 opcode[ 7] length 0
264 opcode[ 8] length 0
265 opcode[ 9] length 1
266 opcode[10] length 0
267 opcode[11] length 0
268 opcode[12] length 1
269 include directories count 4 (index starts at 1)
270 include dir[1] c:/Users/dandelot
271 include dir[2] c:/mingw/include
272 include dir[3] c:/mingw/lib/gcc/mingw32/6.3.0/include
273 include dir[4] c:/mingw/include/sys
274 file names count 9
275 file[0] test.c (file-number: 1)
276 dir index 1
277 last time 0x0 Wed Dec 31 16:00:00 1969
278 file length 0 0x0
279 file[1] stdio.h (file-number: 2)
280 dir index 2
281 last time 0x0 Wed Dec 31 16:00:00 1969
282 file length 0 0x0
283 file[2] _mingw.h (file-number: 3)
284 dir index 2
285 last time 0x0 Wed Dec 31 16:00:00 1969
286 file length 0 0x0
287 file[3] msvcrtver.h (file-number: 4)
288 dir index 2
289 last time 0x0 Wed Dec 31 16:00:00 1969
290 file length 0 0x0
291 file[4] w32api.h (file-number: 5)
292 dir index 2
293 last time 0x0 Wed Dec 31 16:00:00 1969
294 file length 0 0x0
295 file[5] sdkddkver.h (file-number: 6)
296 dir index 2
297 last time 0x0 Wed Dec 31 16:00:00 1969
298 file length 0 0x0
299 file[6] stddef.h (file-number: 7)
300 dir index 3
301 last time 0x0 Wed Dec 31 16:00:00 1969
302 file length 0 0x0
303 file[7] types.h (file-number: 8)
304 dir index 4
305 last time 0x0 Wed Dec 31 16:00:00 1969
306 file length 0 0x0
307 file[8] stdarg.h (file-number: 9)
308 dir index 3
309 last time 0x0 Wed Dec 31 16:00:00 1969
310 file length 0 0x0
311 statement prog offset in section: 0x000000ea (234)
312 s b e p e i d
313 t l s r p s i
314 m c e o i a s
315 section op col t k q l l c
316 offset code address file line umn ? ? ? ? ?
317 [0x0000ea] DW_LNE_set_address address 0x00401460
318 [0x0000f1] DW_LNS_advance_line val 10 0x0000000a
319 [0x0000f3] DW_LNS_copy 1 0x00401460 1 11 0 1 0 0
320 [0x0000f4] Specialop 61 48 0x00401463 1 12 0 1 0 0
321 [0x0000f5] Specialop 132 119 0x0040146b 1 14 0 1 0 0
322 [0x0000f6] Specialop 49 36 0x0040146d 1 17 0 1 0 0
323 [0x0000f7] Specialop 144 131 0x00401476 1 17 0 1 0 0
324 [0x0000f8] Specialop 90 77 0x0040147b 1 19 0 1 0 0
325 [0x0000f9] Specialop 131 118 0x00401483 1 20 0 1 0 0
326 [0x0000fa] Specialop 133 120 0x0040148b 1 23 0 1 0 0
327 [0x0000fb] Specialop 131 118 0x00401493 1 24 0 1 0 0
328 [0x0000fc] Specialop 243 230 0x004014a3 1 25 0 1 0 0
329 [0x0000fd] DW_LNS_const_add_pc new address 0x004014b4
330 [0x0000fe] Specialop 33 20 0x004014b5 1 26 0 1 0 0
331 [0x0000ff] DW_LNS_advance_pc val 2 0x00000002
332 [0x000101] DW_LNE_end_sequence extended 1 0x004014b7 1 26 0 1 0 1
215333
216334 .debug_macro: Macro info for a single cu
217335 Macro data from CU-DIE at .debug_info offset 0x0000000b:
336
337 COMPILE_UNIT<header overall offset = 0x00000000>:
338 < 0><0x0000000b> DW_TAG_compile_unit <abbrev 1>
339 dwarf_srcfiles() returned strings. Count = 9.
340 [0] c:/Users/dandelot/test.c
341 [1] c:/mingw/include/stdio.h
342 [2] c:/mingw/include/_mingw.h
343 [3] c:/mingw/include/msvcrtver.h
344 [4] c:/mingw/include/w32api.h
345 [5] c:/mingw/include/sdkddkver.h
346 [6] c:/mingw/lib/gcc/mingw32/6.3.0/include/stddef.h
347 [7] c:/mingw/include/sys/types.h
348 [8] c:/mingw/lib/gcc/mingw32/6.3.0/include/stdarg.h
349 DW_AT_producer GNU C11 6.3.0 -mtune=generic -march=i586 -g3 -ggdb3
350 DW_AT_language DW_LANG_C99
351 DW_AT_name c:/Users/dandelot/test.c
352 DW_AT_low_pc 0x00401460
353 DW_AT_high_pc <offset-from-lowpc>87
354 DW_AT_stmt_list 0x00000000
355 DW_AT_GNU_macros 0x00000000
218356 Macro version: 4
357 macro section offset 0x00000000
358 flags: 0x2, line offset? 1 offsetsize 0, operands_table? 0
359 offset size 0x4
360 header length: 0x00000007 total length: 0x00003f19
361 debug_line_offset: 0x00000000
219362 MacroInformationEntries count: 565, bytes length: 16146
220363 [ 0] 0x01 DW_MACRO_define line 0 __STDC__ 1
221364 [ 1] 0x01 DW_MACRO_define line 0 __STDC_VERSION__ 201112L
497640 [277] 0x01 DW_MACRO_define line 53 __W32API_MINOR_VERSION 0
498641 [278] 0x01 DW_MACRO_define line 54 __W32API_PATCHLEVEL 1
499642 [279] 0x03 DW_MACRO_start_file line 59 file number 6 c:/mingw/include/sdkddkver.h
643 [280] 0x01 DW_MACRO_define line 34 _SDKDDKVER_H
644 [281] 0x01 DW_MACRO_define line 41 OSVERSION_MASK 0xFFFF0000
645 [282] 0x01 DW_MACRO_define line 42 SPVERSION_MASK 0x0000FF00
646 [283] 0x01 DW_MACRO_define line 43 SUBVERSION_MASK 0x000000FF
647 [284] 0x01 DW_MACRO_define line 48 OSVER(ver) ((ver) & OSVERSION_MASK)
648 [285] 0x01 DW_MACRO_define line 49 SPVER(ver) (((ver) & SPVERSION_MASK) >> 8)
649 [286] 0x01 DW_MACRO_define line 50 SUBVER(ver) ((ver) & SUBVERSION_MASK)
650 [287] 0x01 DW_MACRO_define line 51 WINNTVER(ver) ((ver) >> 16)
651 [288] 0x01 DW_MACRO_define line 55 NTDDI_VERSION_FROM_WIN32_WINNT(ver) _NTDDI_VERSION_FROM_WIN32_WINNT(ver)
652 [289] 0x01 DW_MACRO_define line 56 _NTDDI_VERSION_FROM_WIN32_WINNT(ver) ver ##0000
653 [290] 0x01 DW_MACRO_define line 62 _WIN32_WINNT_NT4 0x0400
654 [291] 0x01 DW_MACRO_define line 63 _WIN32_WINNT_NT4E 0x0401
655 [292] 0x01 DW_MACRO_define line 64 _WIN32_WINNT_NT4SP3 0x0403
656 [293] 0x01 DW_MACRO_define line 65 _WIN32_WINDOWS_95 0x0400
657 [294] 0x01 DW_MACRO_define line 66 _WIN32_WINDOWS_98 0x0410
658 [295] 0x01 DW_MACRO_define line 67 _WIN32_WINDOWS_ME 0x0490
659 [296] 0x01 DW_MACRO_define line 68 _WIN32_WINNT_WIN2K 0x0500
660 [297] 0x01 DW_MACRO_define line 69 _WIN32_WINNT_WINXP 0x0501
661 [298] 0x01 DW_MACRO_define line 70 _WIN32_WINNT_WS03 0x0502
662 [299] 0x01 DW_MACRO_define line 71 _WIN32_WINNT_WIN6 0x0600
663 [300] 0x01 DW_MACRO_define line 72 _WIN32_WINNT_VISTA 0x0600
664 [301] 0x01 DW_MACRO_define line 73 _WIN32_WINNT_WS08 0x0600
665 [302] 0x01 DW_MACRO_define line 74 _WIN32_WINNT_LONGHORN 0x0600
666 [303] 0x01 DW_MACRO_define line 75 _WIN32_WINNT_WIN7 0x0601
667 [304] 0x01 DW_MACRO_define line 76 _WIN32_WINNT_WIN8 0x0602
668 [305] 0x01 DW_MACRO_define line 77 _WIN32_WINNT_WINBLUE 0x0603
669 [306] 0x01 DW_MACRO_define line 82 _WIN32_IE_IE50 0x0500
670 [307] 0x01 DW_MACRO_define line 83 _WIN32_IE_IE501 0x0501
671 [308] 0x01 DW_MACRO_define line 84 _WIN32_IE_IE55 0x0550
672 [309] 0x01 DW_MACRO_define line 85 _WIN32_IE_IE56 0x0560
673 [310] 0x01 DW_MACRO_define line 86 _WIN32_IE_IE60 0x0600
674 [311] 0x01 DW_MACRO_define line 87 _WIN32_IE_IE60SP1 0x0601
675 [312] 0x01 DW_MACRO_define line 88 _WIN32_IE_IE60SP2 0x0603
676 [313] 0x01 DW_MACRO_define line 89 _WIN32_IE_IE70 0x0700
677 [314] 0x01 DW_MACRO_define line 90 _WIN32_IE_IE80 0x0800
678 [315] 0x01 DW_MACRO_define line 92 _WIN32_IE_IE30 0x0300
679 [316] 0x01 DW_MACRO_define line 93 _WIN32_IE_IE301 0x0301
680 [317] 0x01 DW_MACRO_define line 94 _WIN32_IE_IE302 0x0302
681 [318] 0x01 DW_MACRO_define line 95 _WIN32_IE_IE40 0x0400
682 [319] 0x01 DW_MACRO_define line 96 _WIN32_IE_IE401 0x0401
683 [320] 0x01 DW_MACRO_define line 101 __NTDDI_WIN5 0x05000000
684 [321] 0x01 DW_MACRO_define line 102 __NTDDI_WIN51 0x05010000
685 [322] 0x01 DW_MACRO_define line 103 __NTDDI_WIN52 0x05020000
686 [323] 0x01 DW_MACRO_define line 104 __NTDDI_WIN6 0x06000000
687 [324] 0x01 DW_MACRO_define line 105 __NTDDI_WIN61 0x06010000
688 [325] 0x01 DW_MACRO_define line 106 __NTDDI_WIN62 0x06020000
689 [326] 0x01 DW_MACRO_define line 107 __NTDDI_WIN63 0x06030000
690 [327] 0x01 DW_MACRO_define line 108 __NTDDI_SP0 0x00000000
691 [328] 0x01 DW_MACRO_define line 109 __NTDDI_SP1 0x00000100
692 [329] 0x01 DW_MACRO_define line 110 __NTDDI_SP2 0x00000200
693 [330] 0x01 DW_MACRO_define line 111 __NTDDI_SP3 0x00000300
694 [331] 0x01 DW_MACRO_define line 112 __NTDDI_SP4 0x00000400
695 [332] 0x01 DW_MACRO_define line 114 NTDDI_WIN2K __NTDDI_WIN5 + __NTDDI_SP0
696 [333] 0x01 DW_MACRO_define line 115 NTDDI_WIN2KSP1 __NTDDI_WIN5 + __NTDDI_SP1
697 [334] 0x01 DW_MACRO_define line 116 NTDDI_WIN2KSP2 __NTDDI_WIN5 + __NTDDI_SP2
698 [335] 0x01 DW_MACRO_define line 117 NTDDI_WIN2KSP3 __NTDDI_WIN5 + __NTDDI_SP3
699 [336] 0x01 DW_MACRO_define line 118 NTDDI_WIN2KSP4 __NTDDI_WIN5 + __NTDDI_SP4
00
11 .debug_info
22
3 CU_HEADER:
4 cu_header_length = 0x0000133e 4926
5 version_stamp = 0x0004 4
6 abbrev_offset = 0x00000000 0
7 address_size = 0x08 8
8 offset_size = 0x04 4
9 cu_type = 0x01 DW_UT_compile
10
311 COMPILE_UNIT<header overall offset = 0x00000000>:
4 < 0><0x0000000b> DW_TAG_compile_unit
12 < 0><0x0000000b> DW_TAG_compile_unit <abbrev 1>
13 dwarf_srcfiles() returned strings. Count = 16.
14 [ 0] /home/davea/dwarf/code/dwarfdump/uri.c
15 [ 1] /usr/include/x86_64-linux-gnu/bits/stdio2.h
16 [ 2] /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
17 [ 3] /usr/include/x86_64-linux-gnu/bits/types.h
18 [ 4] /usr/include/x86_64-linux-gnu/bits/libio.h
19 [ 5] /usr/include/x86_64-linux-gnu/bits/types/FILE.h
20 [ 6] /usr/include/stdio.h
21 [ 7] /usr/include/x86_64-linux-gnu/bits/sys_errlist.h
22 [ 8] /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
23 [ 9] /usr/include/regex.h
24 [10] /home/davea/dwarf/code/dwarfdump/checkutil.h
25 [11] /home/davea/dwarf/code/dwarfdump/defined_types.h
26 [12] /home/davea/dwarf/code/dwarfdump/glflags.h
27 [13] /home/davea/dwarf/code/dwarfdump/esb.h
28 [14] /home/davea/dwarf/code/dwarfdump/globals.h
29 [15] /tmp/dwbld/dwarfdump/<built-in>
530 DW_AT_producer GNU C11 7.4.0 -mtune=generic -march=x86-64 -g -O2 -fstack-protector-strong
631 DW_AT_language DW_LANG_C99
732 DW_AT_name /home/davea/dwarf/code/dwarfdump/uri.c
1136 DW_AT_stmt_list 0x00000000
1237
1338 LOCAL_SYMBOLS:
14 < 1><0x0000002d> DW_TAG_typedef
39 < 1><0x0000002d> DW_TAG_typedef <abbrev 2>
1540 DW_AT_name size_t
1641 DW_AT_decl_file 0x00000003 /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
1742 DW_AT_decl_line 0x000000d8
1843 DW_AT_type <0x00000038>
19 < 1><0x00000038> DW_TAG_base_type
44 < 1><0x00000038> DW_TAG_base_type <abbrev 3>
2045 DW_AT_byte_size 0x00000008
2146 DW_AT_encoding DW_ATE_unsigned
2247 DW_AT_name long unsigned int
23 < 1><0x0000003f> DW_TAG_base_type
48 < 1><0x0000003f> DW_TAG_base_type <abbrev 3>
2449 DW_AT_byte_size 0x00000001
2550 DW_AT_encoding DW_ATE_unsigned_char
2651 DW_AT_name unsigned char
27 < 1><0x00000046> DW_TAG_base_type
52 < 1><0x00000046> DW_TAG_base_type <abbrev 3>
2853 DW_AT_byte_size 0x00000002
2954 DW_AT_encoding DW_ATE_unsigned
3055 DW_AT_name short unsigned int
31 < 1><0x0000004d> DW_TAG_base_type
56 < 1><0x0000004d> DW_TAG_base_type <abbrev 3>
3257 DW_AT_byte_size 0x00000004
3358 DW_AT_encoding DW_ATE_unsigned
3459 DW_AT_name unsigned int
35 < 1><0x00000054> DW_TAG_base_type
60 < 1><0x00000054> DW_TAG_base_type <abbrev 3>
3661 DW_AT_byte_size 0x00000001
3762 DW_AT_encoding DW_ATE_signed_char
3863 DW_AT_name signed char
39 < 1><0x0000005b> DW_TAG_base_type
64 < 1><0x0000005b> DW_TAG_base_type <abbrev 3>
4065 DW_AT_byte_size 0x00000002
4166 DW_AT_encoding DW_ATE_signed
4267 DW_AT_name short int
43 < 1><0x00000062> DW_TAG_base_type
68 < 1><0x00000062> DW_TAG_base_type <abbrev 4>
4469 DW_AT_byte_size 0x00000004
4570 DW_AT_encoding DW_ATE_signed
4671 DW_AT_name int
47 < 1><0x00000069> DW_TAG_base_type
72 < 1><0x00000069> DW_TAG_base_type <abbrev 3>
4873 DW_AT_byte_size 0x00000008
4974 DW_AT_encoding DW_ATE_signed
5075 DW_AT_name long int
51 < 1><0x00000070> DW_TAG_typedef
76 < 1><0x00000070> DW_TAG_typedef <abbrev 2>
5277 DW_AT_name __off_t
5378 DW_AT_decl_file 0x00000004 /usr/include/x86_64-linux-gnu/bits/types.h
5479 DW_AT_decl_line 0x0000008c
5580 DW_AT_type <0x00000069>
56 < 1><0x0000007b> DW_TAG_typedef
81 < 1><0x0000007b> DW_TAG_typedef <abbrev 2>
5782 DW_AT_name __off64_t
5883 DW_AT_decl_file 0x00000004 /usr/include/x86_64-linux-gnu/bits/types.h
5984 DW_AT_decl_line 0x0000008d
6085 DW_AT_type <0x00000069>
61 < 1><0x00000086> DW_TAG_pointer_type
62 DW_AT_byte_size 0x00000008
63 < 1><0x00000088> DW_TAG_pointer_type
86 < 1><0x00000086> DW_TAG_pointer_type <abbrev 5>
87 DW_AT_byte_size 0x00000008
88 < 1><0x00000088> DW_TAG_pointer_type <abbrev 6>
6489 DW_AT_byte_size 0x00000008
6590 DW_AT_type <0x0000008e>
66 < 1><0x0000008e> DW_TAG_base_type
91 < 1><0x0000008e> DW_TAG_base_type <abbrev 3>
6792 DW_AT_byte_size 0x00000001
6893 DW_AT_encoding DW_ATE_signed_char
6994 DW_AT_name char
70 < 1><0x00000095> DW_TAG_const_type
95 < 1><0x00000095> DW_TAG_const_type <abbrev 7>
7196 DW_AT_type <0x0000008e>
72 < 1><0x0000009a> DW_TAG_structure_type
97 < 1><0x0000009a> DW_TAG_structure_type <abbrev 8>
7398 DW_AT_name _IO_FILE
7499 DW_AT_byte_size 0x000000d8
75100 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
76101 DW_AT_decl_line 0x000000f5
77102 DW_AT_sibling <0x0000021a>
78 < 2><0x000000a6> DW_TAG_member
103 < 2><0x000000a6> DW_TAG_member <abbrev 9>
79104 DW_AT_name _flags
80105 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
81106 DW_AT_decl_line 0x000000f6
82107 DW_AT_type <0x00000062>
83108 DW_AT_data_member_location 0
84 < 2><0x000000b2> DW_TAG_member
109 < 2><0x000000b2> DW_TAG_member <abbrev 9>
85110 DW_AT_name _IO_read_ptr
86111 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
87112 DW_AT_decl_line 0x000000fb
88113 DW_AT_type <0x00000088>
89114 DW_AT_data_member_location 8
90 < 2><0x000000be> DW_TAG_member
115 < 2><0x000000be> DW_TAG_member <abbrev 9>
91116 DW_AT_name _IO_read_end
92117 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
93118 DW_AT_decl_line 0x000000fc
94119 DW_AT_type <0x00000088>
95120 DW_AT_data_member_location 16
96 < 2><0x000000ca> DW_TAG_member
121 < 2><0x000000ca> DW_TAG_member <abbrev 9>
97122 DW_AT_name _IO_read_base
98123 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
99124 DW_AT_decl_line 0x000000fd
100125 DW_AT_type <0x00000088>
101126 DW_AT_data_member_location 24
102 < 2><0x000000d6> DW_TAG_member
127 < 2><0x000000d6> DW_TAG_member <abbrev 9>
103128 DW_AT_name _IO_write_base
104129 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
105130 DW_AT_decl_line 0x000000fe
106131 DW_AT_type <0x00000088>
107132 DW_AT_data_member_location 32
108 < 2><0x000000e2> DW_TAG_member
133 < 2><0x000000e2> DW_TAG_member <abbrev 9>
109134 DW_AT_name _IO_write_ptr
110135 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
111136 DW_AT_decl_line 0x000000ff
112137 DW_AT_type <0x00000088>
113138 DW_AT_data_member_location 40
114 < 2><0x000000ee> DW_TAG_member
139 < 2><0x000000ee> DW_TAG_member <abbrev 10>
115140 DW_AT_name _IO_write_end
116141 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
117142 DW_AT_decl_line 0x00000100
118143 DW_AT_type <0x00000088>
119144 DW_AT_data_member_location 48
120 < 2><0x000000fb> DW_TAG_member
145 < 2><0x000000fb> DW_TAG_member <abbrev 10>
121146 DW_AT_name _IO_buf_base
122147 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
123148 DW_AT_decl_line 0x00000101
124149 DW_AT_type <0x00000088>
125150 DW_AT_data_member_location 56
126 < 2><0x00000108> DW_TAG_member
151 < 2><0x00000108> DW_TAG_member <abbrev 10>
127152 DW_AT_name _IO_buf_end
128153 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
129154 DW_AT_decl_line 0x00000102
130155 DW_AT_type <0x00000088>
131156 DW_AT_data_member_location 64
132 < 2><0x00000115> DW_TAG_member
157 < 2><0x00000115> DW_TAG_member <abbrev 10>
133158 DW_AT_name _IO_save_base
134159 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
135160 DW_AT_decl_line 0x00000104
136161 DW_AT_type <0x00000088>
137162 DW_AT_data_member_location 72
138 < 2><0x00000122> DW_TAG_member
163 < 2><0x00000122> DW_TAG_member <abbrev 10>
139164 DW_AT_name _IO_backup_base
140165 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
141166 DW_AT_decl_line 0x00000105
142167 DW_AT_type <0x00000088>
143168 DW_AT_data_member_location 80
144 < 2><0x0000012f> DW_TAG_member
169 < 2><0x0000012f> DW_TAG_member <abbrev 10>
145170 DW_AT_name _IO_save_end
146171 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
147172 DW_AT_decl_line 0x00000106
148173 DW_AT_type <0x00000088>
149174 DW_AT_data_member_location 88
150 < 2><0x0000013c> DW_TAG_member
175 < 2><0x0000013c> DW_TAG_member <abbrev 10>
151176 DW_AT_name _markers
152177 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
153178 DW_AT_decl_line 0x00000108
154179 DW_AT_type <0x0000025d>
155180 DW_AT_data_member_location 96
156 < 2><0x00000149> DW_TAG_member
181 < 2><0x00000149> DW_TAG_member <abbrev 10>
157182 DW_AT_name _chain
158183 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
159184 DW_AT_decl_line 0x0000010a
160185 DW_AT_type <0x00000263>
161186 DW_AT_data_member_location 104
162 < 2><0x00000156> DW_TAG_member
187 < 2><0x00000156> DW_TAG_member <abbrev 10>
163188 DW_AT_name _fileno
164189 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
165190 DW_AT_decl_line 0x0000010c
166191 DW_AT_type <0x00000062>
167192 DW_AT_data_member_location 112
168 < 2><0x00000163> DW_TAG_member
193 < 2><0x00000163> DW_TAG_member <abbrev 10>
169194 DW_AT_name _flags2
170195 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
171196 DW_AT_decl_line 0x00000110
172197 DW_AT_type <0x00000062>
173198 DW_AT_data_member_location 116
174 < 2><0x00000170> DW_TAG_member
199 < 2><0x00000170> DW_TAG_member <abbrev 10>
175200 DW_AT_name _old_offset
176201 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
177202 DW_AT_decl_line 0x00000112
178203 DW_AT_type <0x00000070>
179204 DW_AT_data_member_location 120
180 < 2><0x0000017d> DW_TAG_member
205 < 2><0x0000017d> DW_TAG_member <abbrev 10>
181206 DW_AT_name _cur_column
182207 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
183208 DW_AT_decl_line 0x00000116
184209 DW_AT_type <0x00000046>
185210 DW_AT_data_member_location 128 (-128)
186 < 2><0x0000018a> DW_TAG_member
211 < 2><0x0000018a> DW_TAG_member <abbrev 10>
187212 DW_AT_name _vtable_offset
188213 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
189214 DW_AT_decl_line 0x00000117
190215 DW_AT_type <0x00000054>
191216 DW_AT_data_member_location 130 (-126)
192 < 2><0x00000197> DW_TAG_member
217 < 2><0x00000197> DW_TAG_member <abbrev 10>
193218 DW_AT_name _shortbuf
194219 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
195220 DW_AT_decl_line 0x00000118
196221 DW_AT_type <0x00000269>
197222 DW_AT_data_member_location 131 (-125)
198 < 2><0x000001a4> DW_TAG_member
223 < 2><0x000001a4> DW_TAG_member <abbrev 10>
199224 DW_AT_name _lock
200225 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
201226 DW_AT_decl_line 0x0000011c
202227 DW_AT_type <0x00000279>
203228 DW_AT_data_member_location 136 (-120)
204 < 2><0x000001b1> DW_TAG_member
229 < 2><0x000001b1> DW_TAG_member <abbrev 10>
205230 DW_AT_name _offset
206231 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
207232 DW_AT_decl_line 0x00000125
208233 DW_AT_type <0x0000007b>
209234 DW_AT_data_member_location 144 (-112)
210 < 2><0x000001be> DW_TAG_member
235 < 2><0x000001be> DW_TAG_member <abbrev 10>
211236 DW_AT_name __pad1
212237 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
213238 DW_AT_decl_line 0x0000012d
214239 DW_AT_type <0x00000086>
215240 DW_AT_data_member_location 152 (-104)
216 < 2><0x000001cb> DW_TAG_member
241 < 2><0x000001cb> DW_TAG_member <abbrev 10>
217242 DW_AT_name __pad2
218243 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
219244 DW_AT_decl_line 0x0000012e
220245 DW_AT_type <0x00000086>
221246 DW_AT_data_member_location 160 (-96)
222 < 2><0x000001d8> DW_TAG_member
247 < 2><0x000001d8> DW_TAG_member <abbrev 10>
223248 DW_AT_name __pad3
224249 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
225250 DW_AT_decl_line 0x0000012f
226251 DW_AT_type <0x00000086>
227252 DW_AT_data_member_location 168 (-88)
228 < 2><0x000001e5> DW_TAG_member
253 < 2><0x000001e5> DW_TAG_member <abbrev 10>
229254 DW_AT_name __pad4
230255 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
231256 DW_AT_decl_line 0x00000130
232257 DW_AT_type <0x00000086>
233258 DW_AT_data_member_location 176 (-80)
234 < 2><0x000001f2> DW_TAG_member
259 < 2><0x000001f2> DW_TAG_member <abbrev 10>
235260 DW_AT_name __pad5
236261 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
237262 DW_AT_decl_line 0x00000132
238263 DW_AT_type <0x0000002d>
239264 DW_AT_data_member_location 184 (-72)
240 < 2><0x000001ff> DW_TAG_member
265 < 2><0x000001ff> DW_TAG_member <abbrev 10>
241266 DW_AT_name _mode
242267 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
243268 DW_AT_decl_line 0x00000133
244269 DW_AT_type <0x00000062>
245270 DW_AT_data_member_location 192 (-64)
246 < 2><0x0000020c> DW_TAG_member
271 < 2><0x0000020c> DW_TAG_member <abbrev 10>
247272 DW_AT_name _unused2
248273 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
249274 DW_AT_decl_line 0x00000135
250275 DW_AT_type <0x0000027f>
251276 DW_AT_data_member_location 196 (-60)
252 < 1><0x0000021a> DW_TAG_typedef
277 < 1><0x0000021a> DW_TAG_typedef <abbrev 2>
253278 DW_AT_name FILE
254279 DW_AT_decl_file 0x00000006 /usr/include/x86_64-linux-gnu/bits/types/FILE.h
255280 DW_AT_decl_line 0x00000007
256281 DW_AT_type <0x0000009a>
257 < 1><0x00000225> DW_TAG_typedef
282 < 1><0x00000225> DW_TAG_typedef <abbrev 11>
258283 DW_AT_name _IO_lock_t
259284 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
260285 DW_AT_decl_line 0x0000009a
261 < 1><0x0000022c> DW_TAG_structure_type
286 < 1><0x0000022c> DW_TAG_structure_type <abbrev 8>
262287 DW_AT_name _IO_marker
263288 DW_AT_byte_size 0x00000018
264289 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
265290 DW_AT_decl_line 0x000000a0
266291 DW_AT_sibling <0x0000025d>
267 < 2><0x00000238> DW_TAG_member
292 < 2><0x00000238> DW_TAG_member <abbrev 9>
268293 DW_AT_name _next
269294 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
270295 DW_AT_decl_line 0x000000a1
271296 DW_AT_type <0x0000025d>
272297 DW_AT_data_member_location 0
273 < 2><0x00000244> DW_TAG_member
298 < 2><0x00000244> DW_TAG_member <abbrev 9>
274299 DW_AT_name _sbuf
275300 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
276301 DW_AT_decl_line 0x000000a2
277302 DW_AT_type <0x00000263>
278303 DW_AT_data_member_location 8
279 < 2><0x00000250> DW_TAG_member
304 < 2><0x00000250> DW_TAG_member <abbrev 9>
280305 DW_AT_name _pos
281306 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
282307 DW_AT_decl_line 0x000000a6
283308 DW_AT_type <0x00000062>
284309 DW_AT_data_member_location 16
285 < 1><0x0000025d> DW_TAG_pointer_type
310 < 1><0x0000025d> DW_TAG_pointer_type <abbrev 6>
286311 DW_AT_byte_size 0x00000008
287312 DW_AT_type <0x0000022c>
288 < 1><0x00000263> DW_TAG_pointer_type
313 < 1><0x00000263> DW_TAG_pointer_type <abbrev 6>
289314 DW_AT_byte_size 0x00000008
290315 DW_AT_type <0x0000009a>
291 < 1><0x00000269> DW_TAG_array_type
316 < 1><0x00000269> DW_TAG_array_type <abbrev 12>
292317 DW_AT_type <0x0000008e>
293318 DW_AT_sibling <0x00000279>
294 < 2><0x00000272> DW_TAG_subrange_type
319 < 2><0x00000272> DW_TAG_subrange_type <abbrev 13>
295320 DW_AT_type <0x00000038>
296321 DW_AT_upper_bound 0
297 < 1><0x00000279> DW_TAG_pointer_type
322 < 1><0x00000279> DW_TAG_pointer_type <abbrev 6>
298323 DW_AT_byte_size 0x00000008
299324 DW_AT_type <0x00000225>
300 < 1><0x0000027f> DW_TAG_array_type
325 < 1><0x0000027f> DW_TAG_array_type <abbrev 12>
301326 DW_AT_type <0x0000008e>
302327 DW_AT_sibling <0x0000028f>
303 < 2><0x00000288> DW_TAG_subrange_type
328 < 2><0x00000288> DW_TAG_subrange_type <abbrev 13>
304329 DW_AT_type <0x00000038>
305330 DW_AT_upper_bound 19
306 < 1><0x0000028f> DW_TAG_structure_type
331 < 1><0x0000028f> DW_TAG_structure_type <abbrev 14>
307332 DW_AT_name _IO_FILE_plus
308333 DW_AT_declaration yes(1)
309 < 1><0x00000294> DW_TAG_variable
334 < 1><0x00000294> DW_TAG_variable <abbrev 15>
310335 DW_AT_name _IO_2_1_stdin_
311336 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
312337 DW_AT_decl_line 0x0000013f
313338 DW_AT_type <0x0000028f>
314339 DW_AT_external yes(1)
315340 DW_AT_declaration yes(1)
316 < 1><0x000002a0> DW_TAG_variable
341 < 1><0x000002a0> DW_TAG_variable <abbrev 15>
317342 DW_AT_name _IO_2_1_stdout_
318343 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
319344 DW_AT_decl_line 0x00000140
320345 DW_AT_type <0x0000028f>
321346 DW_AT_external yes(1)
322347 DW_AT_declaration yes(1)
323 < 1><0x000002ac> DW_TAG_variable
348 < 1><0x000002ac> DW_TAG_variable <abbrev 15>
324349 DW_AT_name _IO_2_1_stderr_
325350 DW_AT_decl_file 0x00000005 /usr/include/x86_64-linux-gnu/bits/libio.h
326351 DW_AT_decl_line 0x00000141
327352 DW_AT_type <0x0000028f>
328353 DW_AT_external yes(1)
329354 DW_AT_declaration yes(1)
330 < 1><0x000002b8> DW_TAG_pointer_type
355 < 1><0x000002b8> DW_TAG_pointer_type <abbrev 6>
331356 DW_AT_byte_size 0x00000008
332357 DW_AT_type <0x00000095>
333 < 1><0x000002be> DW_TAG_const_type
358 < 1><0x000002be> DW_TAG_const_type <abbrev 7>
334359 DW_AT_type <0x000002b8>
335 < 1><0x000002c3> DW_TAG_restrict_type
360 < 1><0x000002c3> DW_TAG_restrict_type <abbrev 16>
336361 DW_AT_type <0x000002b8>
337 < 1><0x000002c8> DW_TAG_variable
362 < 1><0x000002c8> DW_TAG_variable <abbrev 17>
338363 DW_AT_name stdin
339364 DW_AT_decl_file 0x00000007 /usr/include/stdio.h
340365 DW_AT_decl_line 0x00000087
341366 DW_AT_type <0x00000263>
342367 DW_AT_external yes(1)
343368 DW_AT_declaration yes(1)
344 < 1><0x000002d3> DW_TAG_variable
369 < 1><0x000002d3> DW_TAG_variable <abbrev 17>
345370 DW_AT_name stdout
346371 DW_AT_decl_file 0x00000007 /usr/include/stdio.h
347372 DW_AT_decl_line 0x00000088
348373 DW_AT_type <0x00000263>
349374 DW_AT_external yes(1)
350375 DW_AT_declaration yes(1)
351 < 1><0x000002de> DW_TAG_variable
376 < 1><0x000002de> DW_TAG_variable <abbrev 17>
352377 DW_AT_name stderr
353378 DW_AT_decl_file 0x00000007 /usr/include/stdio.h
354379 DW_AT_decl_line 0x00000089
355380 DW_AT_type <0x00000263>
356381 DW_AT_external yes(1)
357382 DW_AT_declaration yes(1)
358 < 1><0x000002e9> DW_TAG_variable
383 < 1><0x000002e9> DW_TAG_variable <abbrev 17>
359384 DW_AT_name sys_nerr
360385 DW_AT_decl_file 0x00000008 /usr/include/x86_64-linux-gnu/bits/sys_errlist.h
361386 DW_AT_decl_line 0x0000001a
362387 DW_AT_type <0x00000062>
363388 DW_AT_external yes(1)
364389 DW_AT_declaration yes(1)
365 < 1><0x000002f4> DW_TAG_array_type
390 < 1><0x000002f4> DW_TAG_array_type <abbrev 12>
366391 DW_AT_type <0x000002be>
367392 DW_AT_sibling <0x000002ff>
368 < 2><0x000002fd> DW_TAG_subrange_type
369 < 1><0x000002ff> DW_TAG_const_type
393 < 2><0x000002fd> DW_TAG_subrange_type <abbrev 18>
394 < 1><0x000002ff> DW_TAG_const_type <abbrev 7>
370395 DW_AT_type <0x000002f4>
371 < 1><0x00000304> DW_TAG_variable
396 < 1><0x00000304> DW_TAG_variable <abbrev 17>
372397 DW_AT_name sys_errlist
373398 DW_AT_decl_file 0x00000008 /usr/include/x86_64-linux-gnu/bits/sys_errlist.h
374399 DW_AT_decl_line 0x0000001b
375400 DW_AT_type <0x000002ff>
376401 DW_AT_external yes(1)
377402 DW_AT_declaration yes(1)
378 < 1><0x0000030f> DW_TAG_base_type
403 < 1><0x0000030f> DW_TAG_base_type <abbrev 3>
379404 DW_AT_byte_size 0x00000008
380405 DW_AT_encoding DW_ATE_signed
381406 DW_AT_name long long int
382 < 1><0x00000316> DW_TAG_base_type
407 < 1><0x00000316> DW_TAG_base_type <abbrev 3>
383408 DW_AT_byte_size 0x00000008
384409 DW_AT_encoding DW_ATE_unsigned
385410 DW_AT_name long long unsigned int
386 < 1><0x0000031d> DW_TAG_typedef
411 < 1><0x0000031d> DW_TAG_typedef <abbrev 2>
387412 DW_AT_name Dwarf_Unsigned
388413 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
389414 DW_AT_decl_line 0x0000004a
390415 DW_AT_type <0x00000316>
391 < 1><0x00000328> DW_TAG_typedef
416 < 1><0x00000328> DW_TAG_typedef <abbrev 2>
392417 DW_AT_name Dwarf_Off
393418 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
394419 DW_AT_decl_line 0x0000004c
395420 DW_AT_type <0x00000316>
396 < 1><0x00000333> DW_TAG_typedef
421 < 1><0x00000333> DW_TAG_typedef <abbrev 2>
397422 DW_AT_name Dwarf_Addr
398423 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
399424 DW_AT_decl_line 0x0000004d
400425 DW_AT_type <0x00000316>
401 < 1><0x0000033e> DW_TAG_typedef
426 < 1><0x0000033e> DW_TAG_typedef <abbrev 2>
402427 DW_AT_name Dwarf_Bool
403428 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
404429 DW_AT_decl_line 0x0000004e
405430 DW_AT_type <0x00000062>
406 < 1><0x00000349> DW_TAG_typedef
431 < 1><0x00000349> DW_TAG_typedef <abbrev 19>
407432 DW_AT_name Dwarf_Die
408433 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
409434 DW_AT_decl_line 0x00000218
410435 DW_AT_type <0x00000355>
411 < 1><0x00000355> DW_TAG_pointer_type
436 < 1><0x00000355> DW_TAG_pointer_type <abbrev 6>
412437 DW_AT_byte_size 0x00000008
413438 DW_AT_type <0x0000035b>
414 < 1><0x0000035b> DW_TAG_structure_type
439 < 1><0x0000035b> DW_TAG_structure_type <abbrev 14>
415440 DW_AT_name Dwarf_Die_s
416441 DW_AT_declaration yes(1)
417 < 1><0x00000360> DW_TAG_structure_type
442 < 1><0x00000360> DW_TAG_structure_type <abbrev 20>
418443 DW_AT_byte_size 0x00000004
419444 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
420445 DW_AT_decl_line 0x00001391
421446 DW_AT_sibling <0x00000377>
422 < 2><0x00000369> DW_TAG_member
447 < 2><0x00000369> DW_TAG_member <abbrev 10>
423448 DW_AT_name check_verbose_mode
424449 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
425450 DW_AT_decl_line 0x00001392
426451 DW_AT_type <0x0000033e>
427452 DW_AT_data_member_location 0
428 < 1><0x00000377> DW_TAG_typedef
453 < 1><0x00000377> DW_TAG_typedef <abbrev 19>
429454 DW_AT_name Dwarf_Cmdline_Options
430455 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
431456 DW_AT_decl_line 0x00001393
432457 DW_AT_type <0x00000360>
433 < 1><0x00000383> DW_TAG_variable
458 < 1><0x00000383> DW_TAG_variable <abbrev 15>
434459 DW_AT_name dwarf_cmdline_options
435460 DW_AT_decl_file 0x00000009 /tmp/dwbld/dwarfdump/../libdwarf/libdwarf.h
436461 DW_AT_decl_line 0x00001394
437462 DW_AT_type <0x00000377>
438463 DW_AT_external yes(1)
439464 DW_AT_declaration yes(1)
440 < 1><0x0000038f> DW_TAG_typedef
465 < 1><0x0000038f> DW_TAG_typedef <abbrev 2>
441466 DW_AT_name reg_syntax_t
442467 DW_AT_decl_file 0x0000000a /usr/include/regex.h
443468 DW_AT_decl_line 0x0000002a
444469 DW_AT_type <0x00000038>
445 < 1><0x0000039a> DW_TAG_variable
470 < 1><0x0000039a> DW_TAG_variable <abbrev 17>
446471 DW_AT_name re_syntax_options
447472 DW_AT_decl_file 0x0000000a /usr/include/regex.h
448473 DW_AT_decl_line 0x000000b5
449474 DW_AT_type <0x0000038f>
450475 DW_AT_external yes(1)
451476 DW_AT_declaration yes(1)
452 < 1><0x000003a5> DW_TAG_structure_type
477 < 1><0x000003a5> DW_TAG_structure_type <abbrev 21>
453478 DW_AT_name re_pattern_buffer
454479 DW_AT_byte_size 0x00000040
455480 DW_AT_decl_file 0x0000000a /usr/include/regex.h
456481 DW_AT_decl_line 0x00000165
457482 DW_AT_sibling <0x0000047e>
458 < 2><0x000003b2> DW_TAG_member
483 < 2><0x000003b2> DW_TAG_member <abbrev 10>
459484 DW_AT_name __buffer
460485 DW_AT_decl_file 0x0000000a /usr/include/regex.h
461486 DW_AT_decl_line 0x0000016a
462487 DW_AT_type <0x0000047e>
463488 DW_AT_data_member_location 0
464 < 2><0x000003bf> DW_TAG_member
489 < 2><0x000003bf> DW_TAG_member <abbrev 10>
465490 DW_AT_name __allocated
466491 DW_AT_decl_file 0x0000000a /usr/include/regex.h
467492 DW_AT_decl_line 0x0000016d
468493 DW_AT_type <0x00000038>
469494 DW_AT_data_member_location 8
470 < 2><0x000003cc> DW_TAG_member
495 < 2><0x000003cc> DW_TAG_member <abbrev 10>
471496 DW_AT_name __used
472497 DW_AT_decl_file 0x0000000a /usr/include/regex.h
473498 DW_AT_decl_line 0x00000170
474499 DW_AT_type <0x00000038>
475500 DW_AT_data_member_location 16
476 < 2><0x000003d9> DW_TAG_member
501 < 2><0x000003d9> DW_TAG_member <abbrev 10>
477502 DW_AT_name __syntax
478503 DW_AT_decl_file 0x0000000a /usr/include/regex.h
479504 DW_AT_decl_line 0x00000173
480505 DW_AT_type <0x0000038f>
481506 DW_AT_data_member_location 24
482 < 2><0x000003e6> DW_TAG_member
507 < 2><0x000003e6> DW_TAG_member <abbrev 10>
483508 DW_AT_name __fastmap
484509 DW_AT_decl_file 0x0000000a /usr/include/regex.h
485510 DW_AT_decl_line 0x00000178
486511 DW_AT_type <0x00000088>
487512 DW_AT_data_member_location 32
488 < 2><0x000003f3> DW_TAG_member
513 < 2><0x000003f3> DW_TAG_member <abbrev 10>
489514 DW_AT_name __translate
490515 DW_AT_decl_file 0x0000000a /usr/include/regex.h
491516 DW_AT_decl_line 0x0000017e
492517 DW_AT_type <0x0000047e>
493518 DW_AT_data_member_location 40
494 < 2><0x00000400> DW_TAG_member
519 < 2><0x00000400> DW_TAG_member <abbrev 10>
495520 DW_AT_name re_nsub
496521 DW_AT_decl_file 0x0000000a /usr/include/regex.h
497522 DW_AT_decl_line 0x00000181
498523 DW_AT_type <0x0000002d>
499524 DW_AT_data_member_location 48
525 < 2><0x0000040d> DW_TAG_member <abbrev 22>
526 DW_AT_name __can_be_null
527 DW_AT_decl_file 0x0000000a /usr/include/regex.h
528 DW_AT_decl_line 0x00000187
529 DW_AT_type <0x0000004d>
530 DW_AT_byte_size 0x00000004
531 DW_AT_bit_size 0x00000001
532 DW_AT_bit_offset 0x0000001f
533 DW_AT_data_member_location 56
534 < 2><0x0000041d> DW_TAG_member <abbrev 22>
535 DW_AT_name __regs_allocated
536 DW_AT_decl_file 0x0000000a /usr/include/regex.h
537 DW_AT_decl_line 0x00000192
538 DW_AT_type <0x0000004d>
539 DW_AT_byte_size 0x00000004
540 DW_AT_bit_size 0x00000002
541 DW_AT_bit_offset 0x0000001d
542 DW_AT_data_member_location 56
543 < 2><0x0000042d> DW_TAG_member <abbrev 22>
544 DW_AT_name __fastmap_accurate
545 DW_AT_decl_file 0x0000000a /usr/include/regex.h
546 DW_AT_decl_line 0x00000196
547 DW_AT_type <0x0000004d>
548 DW_AT_byte_size 0x00000004
549 DW_AT_bit_size 0x00000001
550 DW_AT_bit_offset 0x0000001c
551 DW_AT_data_member_location 56
552 < 2><0x0000043d> DW_TAG_member <abbrev 22>
553 DW_AT_name __no_sub
554 DW_AT_decl_file 0x0000000a /usr/include/regex.h
555 DW_AT_decl_line 0x0000019a
556 DW_AT_type <0x0000004d>
557 DW_AT_byte_size 0x00000004
558 DW_AT_bit_size 0x00000001
559 DW_AT_bit_offset 0x0000001b
560 DW_AT_data_member_location 56
561 < 2><0x0000044d> DW_TAG_member <abbrev 22>
562 DW_AT_name __not_bol
563 DW_AT_decl_file 0x0000000a /usr/include/regex.h
564 DW_AT_decl_line 0x0000019e
565 DW_AT_type <0x0000004d>
566 DW_AT_byte_size 0x00000004
567 DW_AT_bit_size 0x00000001
568 DW_AT_bit_offset 0x0000001a
569 DW_AT_data_member_location 56
570 < 2><0x0000045d> DW_TAG_member <abbrev 22>
571 DW_AT_name __not_eol
572 DW_AT_decl_file 0x0000000a /usr/include/regex.h
573 DW_AT_decl_line 0x000001a1
574 DW_AT_type <0x0000004d>
575 DW_AT_byte_size 0x00000004
576 DW_AT_bit_size 0x00000001
577 DW_AT_bit_offset 0x00000019
578 DW_AT_data_member_location 56
579 < 2><0x0000046d> DW_TAG_member <abbrev 22>
580 DW_AT_name __newline_anchor
581 DW_AT_decl_file 0x0000000a /usr/include/regex.h
582 DW_AT_decl_line 0x000001a4
583 DW_AT_type <0x0000004d>
584 DW_AT_byte_size 0x00000004
585 DW_AT_bit_size 0x00000001
586 DW_AT_bit_offset 0x00000018
587 DW_AT_data_member_location 56
588 < 1><0x0000047e> DW_TAG_pointer_type <abbrev 6>
589 DW_AT_byte_size 0x00000008
590 DW_AT_type <0x0000003f>
591 < 1><0x00000484> DW_TAG_typedef <abbrev 19>
592 DW_AT_name regex_t
593 DW_AT_decl_file 0x0000000a /usr/include/regex.h
594 DW_AT_decl_line 0x000001a7
595 DW_AT_type <0x000003a5>
596 < 1><0x00000490> DW_TAG_structure_type <abbrev 23>
597 DW_AT_byte_size 0x00000030
598 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
599 DW_AT_decl_line 0x00000026
600 DW_AT_sibling <0x000004e1>
601 < 2><0x00000498> DW_TAG_member <abbrev 9>
602 DW_AT_name bFlag
603 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
604 DW_AT_decl_line 0x00000027
605 DW_AT_type <0x0000033e>
606 DW_AT_data_member_location 0
607 < 2><0x000004a4> DW_TAG_member <abbrev 9>
608 DW_AT_name name
609 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
610 DW_AT_decl_line 0x00000028
611 DW_AT_type <0x000002b8>
612 DW_AT_data_member_location 8
613 < 2><0x000004b0> DW_TAG_member <abbrev 24>
614 DW_AT_name key
615 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
616 DW_AT_decl_line 0x00000029
617 DW_AT_type <0x00000333>
618 DW_AT_data_member_location 16
619 < 2><0x000004bc> DW_TAG_member <abbrev 9>
620 DW_AT_name base
621 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
622 DW_AT_decl_line 0x0000002c
623 DW_AT_type <0x00000333>
624 DW_AT_data_member_location 24
625 < 2><0x000004c8> DW_TAG_member <abbrev 24>
626 DW_AT_name low
627 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
628 DW_AT_decl_line 0x0000002d
629 DW_AT_type <0x00000333>
630 DW_AT_data_member_location 32
631 < 2><0x000004d4> DW_TAG_member <abbrev 9>
632 DW_AT_name high
633 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
634 DW_AT_decl_line 0x0000002e
635 DW_AT_type <0x00000333>
636 DW_AT_data_member_location 40
637 < 1><0x000004e1> DW_TAG_typedef <abbrev 2>
638 DW_AT_name Bucket_Data
639 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
640 DW_AT_decl_line 0x0000002f
641 DW_AT_type <0x00000490>
642 < 1><0x000004ec> DW_TAG_structure_type <abbrev 25>
643 DW_AT_name bucket
644 DW_AT_byte_size 0x00017e90
645 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
646 DW_AT_decl_line 0x0000003a
647 DW_AT_sibling <0x00000523>
648 < 2><0x000004fb> DW_TAG_member <abbrev 9>
649 DW_AT_name nEntries
650 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
651 DW_AT_decl_line 0x0000003b
652 DW_AT_type <0x00000062>
653 DW_AT_data_member_location 0
654 < 2><0x00000507> DW_TAG_member <abbrev 9>
655 DW_AT_name Entries
656 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
657 DW_AT_decl_line 0x0000003c
658 DW_AT_type <0x00000523>
659 DW_AT_data_member_location 8
660 < 2><0x00000513> DW_TAG_member <abbrev 26>
661 DW_AT_name pNext
662 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
663 DW_AT_decl_line 0x0000003d
664 DW_AT_type <0x00000534>
665 DW_AT_data_member_location 97928
666 < 1><0x00000523> DW_TAG_array_type <abbrev 12>
667 DW_AT_type <0x000004e1>
668 DW_AT_sibling <0x00000534>
669 < 2><0x0000052c> DW_TAG_subrange_type <abbrev 27>
670 DW_AT_type <0x00000038>
671 DW_AT_upper_bound 2039
672 < 1><0x00000534> DW_TAG_pointer_type <abbrev 6>
673 DW_AT_byte_size 0x00000008
674 DW_AT_type <0x000004ec>
675 < 1><0x0000053a> DW_TAG_typedef <abbrev 2>
676 DW_AT_name Bucket
677 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
678 DW_AT_decl_line 0x0000003e
679 DW_AT_type <0x000004ec>
680 < 1><0x00000545> DW_TAG_structure_type <abbrev 23>
681 DW_AT_byte_size 0x00000038
682 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
683 DW_AT_decl_line 0x00000042
684 DW_AT_sibling <0x000005a2>
685 < 2><0x0000054d> DW_TAG_member <abbrev 9>
686 DW_AT_name kind
687 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
688 DW_AT_decl_line 0x00000043
689 DW_AT_type <0x00000062>
690 DW_AT_data_member_location 0
691 < 2><0x00000559> DW_TAG_member <abbrev 9>
692 DW_AT_name lower
693 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
694 DW_AT_decl_line 0x00000044
695 DW_AT_type <0x00000333>
696 DW_AT_data_member_location 8
697 < 2><0x00000565> DW_TAG_member <abbrev 9>
698 DW_AT_name upper
699 DW_AT_decl_file 0x0000000b /home/davea/dwarf/code/dwarfdump/checkutil.h
434434 esb_constructor(&out);
435435 translate_to_uri(in, &out);
436436 if (strcmp(expected, esb_get_string(&out))) {
437 printf(" Fail test %d expected %s got %s\n",testnum,expected,esb_get_string(&out));
437 printf(" Fail test %d expected %s got %s\n",
438 testnum,expected,esb_get_string(&out));
438439 ++errcnt;
439440 }
440441 esb_destructor(&out);
0 2020-11-25: David Anderson
1 * Makefile.am: Now creates DWARF_BIGENDIAN env var for the tests
2 * Makefile.in: Regenerated.
3 * runtests.sh: Now skips the test (of crc32) that will always fail
4 on a bigendian build.
5 2020-10-27: David Anderson
6 * simplereader.c: changed a few lines
7 to have shorter line lengths. No logic change.
8 2020-10-21: David Anderson
9 * dwdebuglink.c,findfuncbypc.c,frame1.c: Cleaning
10 up line formatting a little.
011 2020-10-19: David Anderson
112 * Makefile.am: adding dummyexecutable.debug
213 and debuglink2.base so 'make check' can work.
55 AUTOMAKE_OPTIONS = subdir-objects
66
77 bin_PROGRAMS = simplereader frame1 findfuncbypc dwdebuglink
8 dwarfbigend=@DWARF_BIGENDIAN@
89
910 simplereader_SOURCES = simplereader.c
1011 simplereader_CPPFLAGS = -I$(top_srcdir)/libdwarf \
3536 $(DWARF_LIBS)
3637
3738 TESTS = runtests.sh
38 AM_TESTS_ENVIRONMENT = DWTOPSRCDIR='$(top_srcdir)'; export DWTOPSRCDIR ; DWCOMPILERFLAGS='$(DWARF_CFLAGS_WARN)'; export DWCOMPILERFLAGS ;
39 AM_TESTS_ENVIRONMENT = DWARF_BIGENDIAN='$(dwarfbigend)'; export DWARF_BIGENDIAN ; DWTOPSRCDIR='$(top_srcdir)'; export DWTOPSRCDIR ; DWCOMPILERFLAGS='$(DWARF_CFLAGS_WARN)'; export DWCOMPILERFLAGS ;
3940
4041 EXTRA_DIST = \
4142 ChangeLog \
438438 DLLTOOL = @DLLTOOL@
439439 DSYMUTIL = @DSYMUTIL@
440440 DUMPBIN = @DUMPBIN@
441 DWARF_BIGENDIAN = @DWARF_BIGENDIAN@
441442 DWARF_CFLAGS_WARN = @DWARF_CFLAGS_WARN@
442443 DWARF_CXXFLAGS_WARN = @DWARF_CXXFLAGS_WARN@
443444 DWARF_LIBS = @DWARF_LIBS@
545546 version_info = @version_info@
546547 MAINTAINERCLEANFILES = Makefile.in
547548 AUTOMAKE_OPTIONS = subdir-objects
549 dwarfbigend = @DWARF_BIGENDIAN@
548550 simplereader_SOURCES = simplereader.c
549551 simplereader_CPPFLAGS = -I$(top_srcdir)/libdwarf \
550552 -I$(top_builddir)/libdwarf
578580 $(DWARF_LIBS)
579581
580582 TESTS = runtests.sh
581 AM_TESTS_ENVIRONMENT = DWTOPSRCDIR='$(top_srcdir)'; export DWTOPSRCDIR ; DWCOMPILERFLAGS='$(DWARF_CFLAGS_WARN)'; export DWCOMPILERFLAGS ;
583 AM_TESTS_ENVIRONMENT = DWARF_BIGENDIAN='$(dwarfbigend)'; export DWARF_BIGENDIAN ; DWTOPSRCDIR='$(top_srcdir)'; export DWTOPSRCDIR ; DWCOMPILERFLAGS='$(DWARF_CFLAGS_WARN)'; export DWCOMPILERFLAGS ;
582584 EXTRA_DIST = \
583585 ChangeLog \
584586 ChangeLog2009 \
6666
6767 #define Dwarf_Small unsigned char
6868 static void
69 dump_bytes(const char *prefix,char * msg,unsigned char * start, long len)
69 dump_bytes(const char *prefix,
70 char *msg,
71 unsigned char *start,
72 long len)
7073 {
7174 Dwarf_Small *end = start + len;
7275 Dwarf_Small *cur = start;
341344 }
342345 /* If debug_path_in then this list does not
343346 mean anything. */
344
347
345348 for (i =0; is_outer && i < paths_count; ++i) {
346349 char *pa = paths[i];
347350 unsigned int ftype = 0;
158158 static void target_data_destructor( struct target_data_s *td);
159159
160160 static int
161 startswithextractnum(const char *arg,const char *lookfor, Dwarf_Unsigned *numout)
161 startswithextractnum(const char *arg,
162 const char *lookfor,
163 Dwarf_Unsigned *numout)
162164 {
163165 const char *s = 0;
164166 unsigned prefixlen = strlen(lookfor);
983985 int finalres = 0;
984986 int have_pc_range = FALSE;
985987
986 res = getlowhighpc(dbg,td,die,level,&have_pc_range,&lowpc,&highpc,errp);
988 res = getlowhighpc(dbg,td,die,level,
989 &have_pc_range,&lowpc,&highpc,errp);
987990 if (res == DW_DLV_OK) {
988991 if (have_pc_range) {
989992 int res2 = DW_DLV_OK;
154154 res = dwarf_init_b(fd,DW_DLC_READ,DW_GROUPNUMBER_ANY,
155155 errhand,errarg, &dbg,&error);
156156 if(res != DW_DLV_OK) {
157 printf("Giving up, dwarf_init failed, cannot do DWARF processing\n");
157 printf("Giving up, dwarf_init failed, "
158 "cannot do DWARF processing\n");
158159 if (res == DW_DLV_ERROR) {
159160 printf("Error code %s\n",dwarf_errmsg(error));
160161 }
466467 &fde_offset, &oneferr);
467468
468469 if (fres == DW_DLV_ERROR) {
469 printf("FAIL: dwarf_get_fde_range err %" DW_PR_DUu " line %d\n",
470 printf("FAIL: dwarf_get_fde_range err %" DW_PR_DUu
471 " line %d\n",
470472 dwarf_errno(oneferr),__LINE__);
471473 exit(1);
472474 }
646648 printf("type: %d %s ",
647649 entry->dw_value_type,
648650 (entry->dw_value_type == DW_EXPR_OFFSET)? "DW_EXPR_OFFSET":
649 (entry->dw_value_type == DW_EXPR_VAL_OFFSET)? "DW_EXPR_VAL_OFFSET":
650 (entry->dw_value_type == DW_EXPR_EXPRESSION)? "DW_EXPR_EXPRESSION":
651 (entry->dw_value_type == DW_EXPR_VAL_OFFSET)?
652 "DW_EXPR_VAL_OFFSET":
653 (entry->dw_value_type == DW_EXPR_EXPRESSION)?
654 "DW_EXPR_EXPRESSION":
651655 (entry->dw_value_type == DW_EXPR_VAL_EXPRESSION)?
652656 "DW_EXPR_VAL_EXPRESSION":
653657 "Unknown");
00 #!/bin/sh
11 #
22 # Intended to be run only on local machine.
3 # Run in the dwarfdump directory
43 # Run only after config.h created in a configure
54 # in the source directory
65 # Assumes env vars DWTOPSRCDIR set to the path to source.
1514 else
1615 top_srcdir=$DWTOPSRCDIR
1716 fi
17 # So we know the build. Because of debuglink.
18 echo "DWARF_BIGENDIAN=$DWARF_BIGENDIAN"
1819 srcdir=$top_srcdir/dwarfexample
1920 if [ x"$DWCOMPILERFLAGS" = 'x' ]
2021 then
5657 fi
5758 fi
5859
59 echo "dwdebuglink test1"
60 o=junk.debuglink1
61 p="--add-debuglink-path=/exam/ple"
62 p2="--add-debuglink-path=/tmp/phony"
63 $blddir/dwdebuglink $p $p2 $srcdir/dummyexecutable > $blddir/$o
64 chkres $? "running dwdebuglink"
65 # we strip out the actual srcdir and blddir for the obvious
66 # reason: We want the baseline data to be meaningful no matter
67 # where one's source/build directories are.
68 sed "s:$srcdir:..src..:" <$blddir/$o >$blddir/${o}a
69 sed "s:$blddir:..bld..:" <$blddir/${o}a >$blddir/${o}b
70 diff $srcdir/debuglink.base $blddir/${o}b
71 r=$?
72 if [ $r -ne 0 ]
60 if [ $DWARF_BIGENDIAN = "yes" ]
7361 then
74 echo "To update dwdebuglink baseline: mv $blddir/${o}b $srcdir/debuglink.base"
62 echo "SKIP dwdebuglink test1, cannot work on bigendian build"
63 else
64 echo "dwdebuglink test1"
65 o=junk.debuglink1
66 p="--add-debuglink-path=/exam/ple"
67 p2="--add-debuglink-path=/tmp/phony"
68 $blddir/dwdebuglink $p $p2 $srcdir/dummyexecutable > $blddir/$o
69 chkres $? "running dwdebuglink test1"
70 # we strip out the actual srcdir and blddir for the obvious
71 # reason: We want the baseline data to be meaningful no matter
72 # where one's source/build directories are.
73 sed "s:$srcdir:..src..:" <$blddir/$o >$blddir/${o}a
74 sed "s:$blddir:..bld..:" <$blddir/${o}a >$blddir/${o}b
75 diff $srcdir/debuglink.base $blddir/${o}b
76 r=$?
77 if [ $r -ne 0 ]
78 then
79 echo "To update dwdebuglink baseline:"
80 echo "mv $blddir/${o}b $srcdir/debuglink.base"
81 fi
82 chkres $r "running dwdebuglink test1 diff against baseline"
7583 fi
76 chkres $r "running dwdebuglink test1 diff against baseline"
7784
7885 echo "dwdebuglink test2"
7986 o=junk.debuglink2
8087 p=" --no-follow-debuglink --add-debuglink-path=/exam/ple"
8188 p2="--add-debuglink-path=/tmp/phony"
8289 $blddir/dwdebuglink $p $p2 $srcdir/dummyexecutable > $blddir/$o
83 chkres $? "running dwdebuglink"
90 chkres $? "running dwdebuglink test2"
8491 # we strip out the actual srcdir and blddir for the obvious
8592 # reason: We want the baseline data to be meaningful no matter
8693 # where one's source/build directories are.
9097 r=$?
9198 if [ $r -ne 0 ]
9299 then
93 echo "To update dwdebuglink baseline: mv $blddir/${o}b $srcdir/debuglink2.base"
100 echo "To update dwdebuglink test2 baseline: mv $blddir/${o}b $srcdir/debuglink2.base"
94101 fi
95102 chkres $r "running dwdebuglink test2 diff against baseline"
96
97
98
99103
100104 if [ $failcount -gt 0 ]
101105 then
00 /*
1 Copyright (c) 2009-2019 David Anderson. All rights reserved.
1 Copyright (c) 2009-2020 David Anderson. All rights reserved.
22
33 Redistribution and use in source and binary forms, with
44 or without modification, are permitted provided that the
238238
239239 memset(localhash,0,fixed_size);
240240 if (hashin_len > fixed_size) {
241 printf("FAIL: argument hash too long, len %u val:\"%s\"\n",hashin_len,
242 cuhash_in);
241 printf("FAIL: argument hash too long, len %u val:\"%s\"\n",
242 hashin_len, cuhash_in);
243243 exit(1);
244244 }
245245 if (hashin_len < fixed_size) {
303303 dupstrarray[dupstrused] = *ptrout;
304304 dupstrused++;
305305 if (dupstrused >= DUPSTRARRAYSIZE) {
306 printf("FAIL: increase the value DUPSTRARRAYSIZE for test purposes\n");
306 printf("FAIL: increase the value DUPSTRARRAYSIZE"
307 " for test purposes\n");
307308 exit(1);
308309 }
309310 return TRUE;
444445 exit(1);
445446 }
446447 }
448 if (i >= argc) {
449 printf("simplereader not given file to open\n");
450 printf("simplereader exits\n");
451 exit(1);
452 }
447453 filepath = argv[i];
448454 if (dumpallnames) {
449455 if (!strcmp(dumpallnamespath,filepath)) {
0 2020-11-25 David Anderson
1 * Makefile.in: Regenerated from configure.ac.
2 To support data needed for dwarfexample make check.
03 2020-10-03 David Anderson
14 * Makefile.in: autoreconf with newly installed ubuntu
25 20.04 created small changes.
36 * COPYING: Corrected the references to the BSD copyright
47 to use "two-clause BSD license".
5
68 2020-07-13 David Anderson
79 * dwarfgen.cc: Add create_debug_sup_content() so we
810 could create a .debug_sup print testcase.
233233 DLLTOOL = @DLLTOOL@
234234 DSYMUTIL = @DSYMUTIL@
235235 DUMPBIN = @DUMPBIN@
236 DWARF_BIGENDIAN = @DWARF_BIGENDIAN@
236237 DWARF_CFLAGS_WARN = @DWARF_CFLAGS_WARN@
237238 DWARF_CXXFLAGS_WARN = @DWARF_CXXFLAGS_WARN@
238239 DWARF_LIBS = @DWARF_LIBS@
8484
8585 list(LENGTH DWARF_TARGETS targetCount)
8686 math(EXPR targetCount "${targetCount} - 1")
87 list(APPEND DWARF_LIBS ${LIBELF_LIBRARIES})
88 if(UNIX)
89 list(APPEND DWARF_LIBS z)
90 endif()
8791 foreach(i RANGE ${targetCount})
8892 list(GET DWARF_TARGETS ${i} target)
8993 list(GET DWARF_TYPES ${i} type)
110114 ARCHIVE DESTINATION ${LIBDIR})
111115 endforeach()
112116
113 if(UNIX AND BUILD_SHARED)
114 target_link_libraries(dwarf-shared PUBLIC z)
115 endif()
117 #if(UNIX AND BUILD_SHARED)
118 # target_link_libraries(dwarf-shared PUBLIC z)
119 #endif()
116120
117121 if (DO_TESTING)
118122 set_source_group(TESTLEB "Source Files" dwarf_leb_test.c
0 2020-11-30 David Anderson
1 * libdwarf_version.h: updated version string
2 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
3 dwarf_names_new.h: regenerated with new version string.
4 2020-11-29 David Anderson
5 * dwarf_form.c: Correct comments on dwarf_formsig8_const()
6 * dwarf_query.c: Fix if( to if ( in some places.
7 Shorten some too-long lines. Implement the new function
8 dwarf_cu_header_basics().
9 * dwarf_opaque.h: Corrected a comment on one field.
10 * libdwarf.h.in: Prototype for dwarf_cu_header_basics()
11 added.
12 * generated_libdwarf.h.in: regenerated.
13 * libdwarf2.1.mm. Version 3.18. Added to the description
14 of dwarf_attr(), which was incomplete.
15 Documented dwarf_cu_header_basics().
16 * libdwarf.2.1.pdf: Regenerated 3.18
17 2020-11-25 David Anderson
18 * Makefile.in: Regenerated from configure.ac.
19 To support data needed for dwarfexample make check.
20 2020-11-25: David Anderson
21 * libdwarf_version.h: updated version string
22 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
23 dwarf_names_new.h: regenerated with new version string.
24 2020-11-23: David Anderson
25 * libdwarf_version.h: updated version string
26 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
27 dwarf_names_new.h: regenerated with new version string.
28 2020-11-21: David Anderson
29 * dwarf_frame.c: Improve a couple error messages with
30 additional detail.
31 Remove old #if0/endif around macros no longer used.
32 * dwarf_frame2.c: Improve some error messages with
33 additional detail.
34 2020-11-15: David Anderson
35 * dwarf_locationop_read.c: Comments corrected.
36 2020-11-15: David Anderson
37 * libdwarf.h.in: Cooment for dwarf_get_die_infotypes_flag()
38 corrected.
39 * generated_libdwarf.h.in: Regenerated
40 2020-11-12: David Anderson
41 * libdwarf.h.in: Altering too-long lines
42 and poor indenting.
43 * generated_libdwarf.h.in: Regenerated.
44 2020-11-12: David Anderson
45 * CMakeLists.txt, Makefile.am: new file to
46 and code to put into releases to help
47 some cmake users.
48 2020-11-10: David Anderson
49 * Correctly dealing with SHF_COMPRESSED when
50 we are reading the object using libelf.
51 Was a surprise to learn libelf translates
52 the endianness of the little header in
53 SHF_COMPRESSED.
54 * dwarf_original_elf_init.c: Set de_using_libelf = TRUE.
55 * dwarfstring.c: Fix some if( to match libdwarf
56 coding standard.
57 2020-11-10: David Anderson
58 * dwarf_opaque.h: Fixing indents, trailing
59 whitespace, and too-long lines.
60 Adding field de_using_libelf (helpful
61 when using libelf and there is SHF_COMPRESSED elf)
62 2020-11-10: David Anderson
63 * dwarf_vars.c: Shortening too-long line.
64 2020-11-09: David Anderson
65 * dwarf_harmless.c,dwarf_machoread.c: Modified slightly
66 to match libdwarf coding style.
67 2020-11-09: David Anderson
68 * libdwarf_version.h: updated version string
69 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
70 dwarf_names_new.h: regenerated with new version string.
71 2020-11-08: David Anderson
72 * dwarf_abbrev.c: Shorten a pointlessly long line.
73 * libdwarf2.1.mm: Rev 3.17. Remove many accidental
74 tab characters and fix indents of the function
75 prototypes. Broke up some pointlessly
76 long lines.
77 * libdwarf2.1.pdf: Regenerated as 3.17
78 2020-11-04: David Anderson
79 * dwarf_crc32.c,dwarf_debuglink.c,dwarf_elf_access.c,
80 dwarf_elf_load_headers.c,dwarf_elfread.c,dwarf_error.c,
81 dwarf_frame2.c,dwarf_generic_init.c,dwarf_init_finish.c,
82 dwarf_loclists.c,dwarf_machoread.c,dwarf_object_detector.c,
83 dwarf_object_read_common.c,dwarf_original_elf_init.c,
84 dwarf_peread.c,dwarf_print_lines.c,dwarf_ranges.c,
85 dwarf_rnglists.c,dwarf_util.c,dwarfstring.c,dwgetopt.c,
86 gennames.c,pro_arange.c,pro_debug_sup.c,pro_die.c,
87 pro_dnames.c,pro_encode_nm.c,pro_error.c,pro_forms.c,
88 pro_frame.c,pro_funcs.c,pro_init.c,pro_line.c: These
89 had instances of includes not protected by, for
90 example, #ifdef HAVE_STRING_H. All fixed to be
91 consistent with all the HAVE*H config.h has.
92 2020-11-04: David Anderson
93 * dwarf_frame2.c: Remove useless/misleading comments.
94 Quite a few lines were longer than the libdwarf
95 standard line length. Many of them comments.
96 All now (aside from two copyright lines) have proper
97 length.
98 2020-11-03: David Anderson
99 * libdwarf_version.h: updated version string
100 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
101 dwarf_names_new.h: regenerated with new version string.
102 2020-11-03: David Anderson
103 * dwarf_macro.c: shortened a pointlessly long line.
104 2020-11-03: David Anderson
105 * dwarf_macro5.c: Fixed a test which was a dreadful
106 assignment instead of being the correct test.
107 Otherwise just changing a comment and arranging
108 if (... instead of if(, similarly for for(.
109 2020-11-01: David Anderson
110 * dwarf_line.c: Corrected the comments for dwarf_srcfiles().
111 * dwarf_print_lines.c: When turning a DW_LNS file to
112 a name, do it correctly.
113 * libdwarf2.1.mm: Rev 3.16. Document dwarf_srclines()
114 more fully and correctly. Refer to dwarfstd.org
115 for more information on DWARF file numbers.
116 dwarf_srcfileno() is also more fully
117 and more correctly described. DWARF5 differs.
118 * libdwarf2.1.pdf: Rev 3.16. Regenerated.
119 2020-10-31: David Anderson
120 * dwarf_line.h: Removed a FIXME comment that no longer applies.
121 * dwarf_die_deliv.c: Now compares and reports
122 signature variance when
123 the DWARF4 GNU extension DW_AT_[GNU_]dwo_id used
124 with DWARF4 extension split dwarf.
125 * dwarf_errmsg_list.h: Adds DW_DLE_SIGNATURE_MISMATCH.
126 * dwarf_line.h: Deleted three obsolete comment lines.
127 * libdwarf.h.in: Added DW_DLE_SIGNATURE_MISMATCH.
128 * generated_libdwarf.h.in: Regenerated.
129 2020-10-29: David Anderson
130 * dwarf_generic_init.c: Remove trailing whitepace.
131 * dwarf_crc32.c: Added initializer to conform
132 to libdwarf practices.
133 2020-10-29: David Anderson
134 * dwarfstring.c: Dealing with impossible things by
135 reporting ERROR plus descriptive information in the string.
136 * test_dwarfstring.c: Now tests all the various
137 impossible things for correct ERROR message content.
138 2020-10-29: David Anderson
139 * libdwarf_version.h: updated version string
140 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
141 dwarf_names_new.h: regenerated with new version string.
142 2020-10-29: David Anderson
143 * dwarf_print_lines.c: Fixed an old mistake passing
144 %d into dwarfstrling_append_printf_u (the value
145 in question is unsigned).
146 * dwarfstring.c: If a caller passes in something bogus
147 dwarfstring now adds specifics with "ERROR:"
148 to the output dwarfstring as well as returning FALSE.
149 2020-10-28: David Anderson
150 * dwarf_print_lines.c: In case of corrupted
151 DWARF5 line header the fi_file_name field
152 for a file entry can be null. Now
153 we print a <no file name> string in that case
154 to avoid passing a null to dwarfstring_append.
155 Dwarfbug DW202010-003.
156 Also some lines longer than libdwarf standard
157 were shortened, but a few long lines really
158 must remain.
159 2020-10-28: David Anderson
160 * dwarf_ranges.c: Altered lines longer than libdwarf
161 standard.
162 2020-10-27: David Anderson
163 * dwarf_generic_init.c: Now checks for a null PATH
164 passed to dwarf_init_path() or dwarf_init_path_dl()
165 and returns error.
0166 2020-10-20: David Anderson
1167 * libdwarf_version.h: updated version string
2168 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
8174 a short comment.
9175 2020-10-19: David Anderson
10176 * crc32.c,dwarf_debuglink.c,dwarf_die_deliv.c,dwarf_line.c,
11 dwarf_line.h,dwarf_line_table_reader_common.h,dwarf_query.c,
12 dwarf_str_offsets.c: Fixed indents and removed
177 dwarf_line.h,dwarf_line_table_reader_common.h,dwarf_query.c,
178 dwarf_str_offsets.c: Fixed indents and removed
13179 trailing whitespace.
14180 2020-10-19: David Anderson
15181 * crc32.c: Revised line lengths to under
16182 20 characters for a better appearance.
17183 No change in wording.
18 * pro_frame.c,pro_funcs.c: Removed a blank line
184 * pro_frame.c,pro_funcs.c: Removed a blank line
19185 before the copyright text for a better appearance.
20186 2020-10-19: David Anderson
21187 * dwarf_arange.h,dwarf_base_types.h,dwarf_die_deliv.h,
22 dwarf_dsc.h,dwarf_elf_access.h,dwarf_errmsg_list.h,
23 dwarf_error.h,dwarf_frame.h,dwarf_funcs.h,dwarf_gdbindex.h,
24 dwarf_global.h,dwarf_harmless.h,dwarf_line.h,dwarf_macro.h,
25 dwarf_macro5.h,dwarf_reloc_386.h,dwarf_reloc_arm.h,
26 dwarf_reloc_mips.h,dwarf_reloc_ppc.h,dwarf_reloc_ppc64.h,
27 dwarf_reloc_x86_64.h,dwarf_tied_decls.h,dwarf_types.h,
28 dwarf_util.h,dwarf_vars.h,dwarf_weaks.h,dwarf_xu_index.h,
29 libdwarfdefs.h,malloc_check.h,pro_alloc.h,pro_arange.h,
30 pro_die.h,pro_encode_nm.h,pro_error.h,pro_expr.h,
31 pro_frame.h,pro_incl.h,pro_macinfo.h,pro_reloc.h,
32 pro_reloc_stream.h,pro_reloc_symbolic.h,pro_section.h,
33 pro_types.h,pro_util.h: License text reformatted
188 dwarf_dsc.h,dwarf_elf_access.h,dwarf_errmsg_list.h,
189 dwarf_error.h,dwarf_frame.h,dwarf_funcs.h,dwarf_gdbindex.h,
190 dwarf_global.h,dwarf_harmless.h,dwarf_line.h,dwarf_macro.h,
191 dwarf_macro5.h,dwarf_reloc_386.h,dwarf_reloc_arm.h,
192 dwarf_reloc_mips.h,dwarf_reloc_ppc.h,dwarf_reloc_ppc64.h,
193 dwarf_reloc_x86_64.h,dwarf_tied_decls.h,dwarf_types.h,
194 dwarf_util.h,dwarf_vars.h,dwarf_weaks.h,dwarf_xu_index.h,
195 libdwarfdefs.h,malloc_check.h,pro_alloc.h,pro_arange.h,
196 pro_die.h,pro_encode_nm.h,pro_error.h,pro_expr.h,
197 pro_frame.h,pro_incl.h,pro_macinfo.h,pro_reloc.h,
198 pro_reloc_stream.h,pro_reloc_symbolic.h,pro_section.h,
199 pro_types.h,pro_util.h: License text reformatted
34200 to fit libdwarf line lengths. No change in terms.
35201 2020-10-19: David Anderson
36202 * dwarf_debuglink.c,dwarf_die_deliv.c,dwarf_query.c,
37 dwarf_str_offsets.c,dwarf_util.c: These no longer
203 dwarf_str_offsets.c,dwarf_util.c: These no longer
38204 explicitly use ptrdiff_t. Only non-negative pointer
39205 differences are converted to unsigned. The other
40206 side of a compare is given an appropriate constant unsigned
117283 * dwarf_object_detector.h: Deleted #if 0 prototype.
118284 * testdebuglink.sh: Removed a trailing blank.
119285 2020-10-11: David Anderson
120 * libdwarf_version.h: updated version string
121 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
122 dwarf_names_new.h: regenerated with new version string.
286 * libdwarf_version.h: updated version string
287 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
288 dwarf_names_new.h: regenerated with new version string.
123289 2020-10-11: David Anderson
124290 * CMakeLists.txt: Added crc32.c, a new source file.
125291 * Makefile.am: Same addition.
171337 * libdwarf2.1.pdf: Regenerated as 3.12.
172338 2020-10-02: David Anderson
173339 * dwarf_crc32.c,dwarf_fission_to_cu.c,dwarf_macro5.c,
174 dwarf_opaque.h,libdwarf.h.in,test_linkedtopath.c,
175 test_linkedtopath.c: Removed whitespace and
340 dwarf_opaque.h,libdwarf.h.in,test_linkedtopath.c,
341 test_linkedtopath.c: Removed whitespace and
176342 tabs and make indents dwarf-standard.
177343 * COPYING: Corrected the references to the BSD copyright
178344 to use "two-clause BSD license".
220386 * libdwarf2.1.pdf: Regenerated as version 3.10.
221387 2020-09-26: David Anderson
222388 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
223 dwarf_names_new.h,libdwarf_version.h: Updated version
389 dwarf_names_new.h,libdwarf_version.h: Updated version
224390 string, regenerated files that reference it.
225391 2020-09-26: David Anderson
226392 * baseline.ltp: new test baseline for debuglink.
227 * test_linkedtopath.c: Now with better coverage
393 * test_linkedtopath.c: Now with better coverage
228394 of the paths in tbe debuglink code, we
229395 add a getcwd here to return a test cwd
230396 of /exam/ple so the output of debuglink
231397 does not depend on the real build
232398 directory location.
233399 2020-09-25: David Anderson
234 * dwarf_debuglink.c: Corrected and clarified.
400 * dwarf_debuglink.c: Corrected and clarified.
235401 2020-09-22: David Anderson
236402 * CMakeLists.txt, Makefile.am: Added new file
237403 dwarf_fission_to_cu.c.
269435 * generated_libdwarf.h.in: Regenerated.
270436 2020-09-18: David Anderson
271437 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
272 dwarf_names_new.h,libdwarf_version.h: Updated version
438 dwarf_names_new.h,libdwarf_version.h: Updated version
273439 string, regenerated files that reference it.
274440 2020-09-18: David Anderson
275441 * dwarf_debug_names.c: If allocation fails in setting up
363529 * libdwarf2.1.pdf: Generated Version 3.08.
364530 2020-09-08: David Anderson
365531 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
366 dwarf_names_new.h,libdwarf_version.h: Updated version
532 dwarf_names_new.h,libdwarf_version.h: Updated version
367533 string, regenerated files that reference it.
368534 2020-09-07: David Anderson
369535 * dwarf_xu_index.c: We were not checking the
457623 for an error in DW_FORM_strp.
458624 2020-08-23: David Anderson
459625 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
460 dwarf_names_new.h,libdwarf_version.h: Updated version
626 dwarf_names_new.h,libdwarf_version.h: Updated version
461627 string, regenerated files that reference it.
462628 2020-08-23: David Anderson
463629 * dwarf_form.c,dwarf_generic_init.c,dwarf_loc.c,
477643 _dwarf_extract_address_from_debug_addr.
478644 2020-08-22: David Anderson
479645 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
480 dwarf_names_new.h,libdwarf_version.h: Updated version
646 dwarf_names_new.h,libdwarf_version.h: Updated version
481647 string, regenerated files that reference it.
482648 2020-08-21: David Anderson
483649 * dwarf_init_finish.c(insert_sht_list_in_group_map):
514680
515681 2020-08-10: David Anderson
516682 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
517 dwarf_names_new.h,libdwarf_version.h: Updated version
683 dwarf_names_new.h,libdwarf_version.h: Updated version
518684 string, regenerated files that reference it.
519685 2020-08-10: David Anderson
520686 * dwarf_elf_defines.h,dwarf_elfread.c: A linux kernel used a
553719 These caused the regeneration of dwarf_names.h.
554720 2020-07-22: David Anderson
555721 * dwarf_abbrev.c,dwarf_debug_names.c, dwarf_debuglink.c,
556 dwarf_dsc.c,dwarf_error.c,dwarf_form.c,dwarf_funcs.c,
557 dwarf_gdbindex.c,dwarf_harmless.c,dwarf_init_finish.c,
558 dwarf_leb.c,dwarf_leb_test.c,dwarf_line.c,dwarf_macro.c,
559 dwarf_macro5.c,dwarf_original_elf_init.c,dwarf_pubtypes.c,
560 dwarf_str_offsets.c,dwarf_stringsection.c,dwarf_stubs.c,
561 dwarf_test_errmsg_list.c,dwarf_types.c,dwarf_vars.c,
562 dwarf_weaks.c,dwarf_xu_index.c,gennames.c,malloc_check.c,
563 pro_arange.c,pro_encode_nm.c,pro_error.c,pro_finish.c,
564 pro_forms.c,pro_funcs.c,pro_line.c,pro_macinfo.c,
565 pro_pubnames.c,pro_reloc.c,pro_reloc_stream.c,
566 pro_reloc_symbolic.c,pro_types.c,pro_vars.c,pro_weaks.c:
722 dwarf_dsc.c,dwarf_error.c,dwarf_form.c,dwarf_funcs.c,
723 dwarf_gdbindex.c,dwarf_harmless.c,dwarf_init_finish.c,
724 dwarf_leb.c,dwarf_leb_test.c,dwarf_line.c,dwarf_macro.c,
725 dwarf_macro5.c,dwarf_original_elf_init.c,dwarf_pubtypes.c,
726 dwarf_str_offsets.c,dwarf_stringsection.c,dwarf_stubs.c,
727 dwarf_test_errmsg_list.c,dwarf_types.c,dwarf_vars.c,
728 dwarf_weaks.c,dwarf_xu_index.c,gennames.c,malloc_check.c,
729 pro_arange.c,pro_encode_nm.c,pro_error.c,pro_finish.c,
730 pro_forms.c,pro_funcs.c,pro_line.c,pro_macinfo.c,
731 pro_pubnames.c,pro_reloc.c,pro_reloc_stream.c,
732 pro_reloc_symbolic.c,pro_types.c,pro_vars.c,pro_weaks.c:
567733 Updated copyright date. Reformatted copyright to
568734 have slightly shorter lines, no change in content.
569735 2020-07-22: David Anderson
587753 2020-07-17: David Anderson
588754 * dwarf_frame.c: rearrange comments a little and
589755 add a web reference as documentation.
590 * pro_debug_sup.c,pro_section.c: Remove trailing
756 * pro_debug_sup.c,pro_section.c: Remove trailing
591757 whitespace. Fix indents.
592758 2020-07-15: David Anderson
593759 * dwarf_alloc.c: Improved printf if DEBUG
605771 * libdwarf2.1.pdf,libdwarf2p.1.pdf: Regenerated.
606772 2020-07-14: David Anderson
607773 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
608 dwarf_names_new.h,libdwarf_version.h: Regenerated
774 dwarf_names_new.h,libdwarf_version.h: Regenerated
609775 with new version string.
610776 2020-07-13: David Anderson
611777 * CMakeLists.txt, Makefile.am: Added dwarf_debug_sup.c
623789 * pro_opaque.h: Support for creating .debug_sup.
624790 * pro_section.c: Support for creating .debug_sup.
625791 * dwarf_debug_sup.c: New, for .debug_sup access.
626 * pro_debug_sup.c: New. for .debug_sup creation.
792 * pro_debug_sup.c: New. for .debug_sup creation.
627793 2020-07-10: David Anderson
628794 * dwarf_die_deliv.c: Handle
629795 DW_AT_GNU_ranges_base in a CU DIE.
646812 done twice (not harmful but the duplicate removed now).
647813 2020-07-08: David Anderson
648814 * dwarf_elf_load_headers.c,dwarf_gdbindex.c,dwarf_gnu_index.c,
649 dwarf_gnu_index.h,dwarf_init_finish.c,
815 dwarf_gnu_index.h,dwarf_init_finish.c,
650816 dwarf_locationop_read.c: Fixed indents and trailing
651817 whitespace.
652818 2020-07-08: David Anderson
699865 * generated_libdwarf.h.in: Regenerated.
700866 2020-07-04: David Anderson
701867 * dwarf_names.c,dwarf_names.h,dwarf_names_enum.h,
702 dwarf_names_new.h,libdwarf_version.h: new version string.
868 dwarf_names_new.h,libdwarf_version.h: new version string.
703869 2020-07-03: David Anderson
704870 * CMakeLists.txt, Makefile.am: renamed dwarf_dnames.h ->
705871 dwarf_debug_names.h and dwarf_dnames.c to
249249 dwgetopt.h \
250250 dwgetopt.c \
251251 CMakeLists.txt \
252 cmake/libdwarf-config.cmake \
252253 libdwarf.h.in \
253254 testdebuglink.sh \
254255 generated_libdwarf.h.in \
583583 DLLTOOL = @DLLTOOL@
584584 DSYMUTIL = @DSYMUTIL@
585585 DUMPBIN = @DUMPBIN@
586 DWARF_BIGENDIAN = @DWARF_BIGENDIAN@
586587 DWARF_CFLAGS_WARN = @DWARF_CFLAGS_WARN@
587588 DWARF_CXXFLAGS_WARN = @DWARF_CXXFLAGS_WARN@
588589 DWARF_LIBS = @DWARF_LIBS@
928929 dwgetopt.h \
929930 dwgetopt.c \
930931 CMakeLists.txt \
932 cmake/libdwarf-config.cmake \
931933 libdwarf.h.in \
932934 testdebuglink.sh \
933935 generated_libdwarf.h.in \
0 if (NOT TARGET libdwarf::libdwarf)
1 include(${CMAKE_CURRENT_LIST_DIR}/libdwarf-targets.cmake)
2 endif()
118118 /* The following is essentially identical
119119 to every crc32 anyone uses up to trivial
120120 differences in starting conditions.
121 The alogorithm appears on
121 The alogorithm appears on
122122 https://en.wikipedia.org/wiki/Cyclic_redundancy_check
123123 in a simple logic loop (written in no actual
124124 language but English) and the following is a translation
127127 unsigned int
128128 _dwarf_crc32 (unsigned int crc, const unsigned char *buf, size_t len)
129129 {
130 const unsigned char *end;
130 const unsigned char *end = 0;
131131
132132 crc = ~crc;
133133 for (end = buf + len; buf < end; ++buf)
154154 if (offset >= dbg->de_debug_abbrev.dss_size) {
155155 return DW_DLV_NO_ENTRY;
156156 }
157 ret_abbrev = (Dwarf_Abbrev) _dwarf_get_alloc(dbg, DW_DLA_ABBREV, 1);
157 ret_abbrev = (Dwarf_Abbrev) _dwarf_get_alloc(dbg,
158 DW_DLA_ABBREV, 1);
158159 if (ret_abbrev == NULL) {
159160 _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
160161 return DW_DLV_ERROR;
3737 #ifdef HAVE_SYS_TYPES_H
3838 #include <sys/types.h> /* off_t ssize_t */
3939 #endif /* HAVE_SYS_TYPES_H */
40 #ifdef HAVE_SYS_STAT_H
4041 #include <sys/stat.h>
42 #endif /* HAVE_SYS_STAT_H */
4143 #include <fcntl.h>
4244
4345 #ifdef HAVE_UNISTD_H
4040 #ifdef HAVE_STDLIB_H
4141 #include <stdlib.h>
4242 #endif /* HAVE_STDLIB_H */
43 #ifdef HAVE_STRING_H
4344 #include <string.h>
45 #endif /* HAVE_STRING_H */
4446 #ifdef HAVE_ELF_H
4547 #include <elf.h>
4648 #endif /* HAVE_ELF_H */
11421142 cucon->cc_signature = signature;
11431143 cucon->cc_signature_present = TRUE;
11441144 } else {
1145 /* Something wrong. Two styles ?
1146 Do what? verify the same sig?
1147 FIXME */
1145 /* Something wrong. Two styles of sig?
1146 Can happen with DWARF4
1147 debug-fission extension DWO_id.
1148 */
1149 if (memcmp(&signature,&cucon->cc_signature,
1150 sizeof(signature))) {
1151 /* The two sigs do not match! */
1152 const char *m="DW_DLE_SIGNATURE_MISMATCH"
1153 "DWARF4 extension fission signature"
1154 " and DW_AT_GNU_dwo_id do not match"
1155 " ignoring DW_AT[_GNU]_dwo_id";
1156 dwarf_insert_harmless_error(dbg,
1157 (char*)m);
1158 }
11481159 }
11491160 } else {
11501161 /* Something is badly wrong. */
3535
3636 #include "config.h"
3737 #ifdef DWARF_WITH_LIBELF
38 #include "dwarf_incl.h"
39 #include "dwarf_error.h"
40 #include "dwarf_elf_access.h"
41 #include "dwarf_elf_rel_detector.h"
42
43 /* Include the ELF definitions depending on system headers if any. */
44 #include "dwarf_elf_defines.h"
45
4638 #include <stdio.h>
39 #ifdef HAVE_SYS_STAT_H
4740 #include <sys/stat.h>
41 #endif /* HAVE_SYS_STAT_H */
4842 #ifdef HAVE_SYS_TYPES_H
4943 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
5044 #endif /* HAVE_SYS_TYPES_H */
6256
6357 #define FALSE 0
6458 #define TRUE 1
59 #include "dwarf_incl.h"
60 #include "dwarf_error.h"
61 #include "dwarf_elf_access.h"
62 #include "dwarf_elf_rel_detector.h"
63
64 /* Include the ELF definitions depending
65 on system headers if any. */
66 #include "dwarf_elf_defines.h"
67
6568
6669 #ifdef HAVE_ELF64_GETEHDR
6770 extern Elf64_Ehdr *elf64_getehdr(Elf *);
5252
5353 #include "config.h"
5454 #include <stdio.h>
55 #ifdef HAVE_STRING_H
5556 #include <string.h> /* For memcpy etc */
57 #endif /* HAVE_STRING_H */
5658 #ifdef HAVE_STDLIB_H
5759 #include <stdlib.h>
5860 #endif /* HAVE_STDLIB_H */
6466 #ifdef HAVE_SYS_TYPES_H
6567 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
6668 #endif /* HAVE_SYS_TYPES_H */
69 #ifdef HAVE_SYS_STAT_H
6770 #include <sys/stat.h> /* for open() */
71 #endif /* HAVE_SYS_STAT_H */
6872 #include <fcntl.h> /* for open() */
6973 #ifdef HAVE_UNISTD_H
7074 #include <unistd.h> /* lseek read close */
6767 #ifdef HAVE_STDLIB_H
6868 #include <stdlib.h>
6969 #endif /* HAVE_STDLIB_H */
70 #ifdef HAVE_STRING_H
7071 #include <string.h>
72 #endif /* HAVE_STRING_H */
73 #ifdef HAVE_STDLIB_H
7174 #include <stdlib.h>
75 #endif /* HAVE_STDLIB_H */
7276 #ifdef HAVE_SYS_TYPES_H
7377 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
7478 #endif /* HAVE_SYS_TYPES_H */
79 #ifdef HAVE_SYS_STAT_H
7580 #include <sys/stat.h> /* open() */
81 #endif /* HAVE_SYS_STAT_H */
7682 #include <fcntl.h> /* open() */
7783 #include <time.h>
7884 #ifdef HAVE_UNISTD_H
553553 "DW_DLE_DEBUG_SUP_ERROR(477). .debug_sup data corruption",
554554 "DW_DLE_LOCATION_ERROR(478). A location processing libdwarf error",
555555 "DW_DLE_DEBUGLINK_PATH_SHORT(479) Buffer provided for GNU debuglink is too small",
556
557
556 "DW_DLE_SIGNATURE_MISMATCH(480) DWARF4 extension dwo_id and dwarf5signature present but they do not match!",
558557 };
559558 #endif /* DWARF_ERRMSG_LIST_H */
2929
3030 #include "config.h"
3131 #include <stdio.h>
32 #ifdef HAVE_SYS_STAT_H
3233 #include <sys/stat.h>
34 #endif /* HAVE_SYS_STAT_H */
3335 #ifdef HAVE_SYS_TYPES_H
3436 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
3537 #endif /* HAVE_SYS_TYPES_H */
644644 /* dwarf_formsig8 returns in the caller-provided 8 byte area
645645 the 8 bytes of a DW_FORM_ref_sig8 (copying the bytes
646646 directly to the caller). Not a string, an 8 byte
647 MD5 hash. This function is new in DWARF4 libdwarf.
647 MD5 hash or a signature.
648 This function is new in DWARF4 libdwarf and used in
649 more places in DWARF5.
648650 */
649651 int
650652 dwarf_formsig8(Dwarf_Attribute attr,
425425 free(localregtab);
426426 return adres;
427427 }
428 #if 0
429 DECODE_LEB128_UWORD_CK(instr_ptr, factored_N_value,
430 dbg,error,final_instr_ptr);
431 #endif
432
433428 fp_register = reg_no;
434429 fp_offset = factored_N_value;
435430
474469 free(localregtab);
475470 return adres;
476471 }
477 #if 0
478 READ_UNALIGNED_CK(dbg, new_loc, Dwarf_Addr,
479 instr_ptr, address_size,
480 error,final_instr_ptr);
481 #endif
482472 instr_ptr += address_size;
483473 if (new_loc != 0 && current_loc != 0) {
484474 /* Pre-relocation or before current_loc
518508 free(localregtab);
519509 return adres;
520510 }
521 #if 0
522 READ_UNALIGNED_CK(dbg, adv_loc, Dwarf_Unsigned,
523 instr_ptr, sizeof(Dwarf_Small),
524 error,final_instr_ptr);
525 #endif
526511 instr_ptr += sizeof(Dwarf_Small);
527512 fp_offset = adv_loc;
528513
552537 free(localregtab);
553538 return adres;
554539 }
555 #if 0
556 READ_UNALIGNED_CK(dbg, adv_loc, Dwarf_Unsigned,
557 instr_ptr, DWARF_HALF_SIZE,
558 error,final_instr_ptr);
559 #endif
560540 instr_ptr += DWARF_HALF_SIZE;
561541 fp_offset = adv_loc;
562542
585565 free(localregtab);
586566 return adres;
587567 }
588 #if 0
589 READ_UNALIGNED_CK(dbg, adv_loc, Dwarf_Unsigned,
590 instr_ptr, DWARF_32BIT_SIZE,
591 error,final_instr_ptr);
592 #endif
593568 instr_ptr += DWARF_32BIT_SIZE;
594569 fp_offset = adv_loc;
595570
617592 free(localregtab);
618593 return adres;
619594 }
620 #if 0
621 READ_UNALIGNED_CK(dbg, adv_loc, Dwarf_Unsigned,
622 instr_ptr, DWARF_64BIT_SIZE,
623 error,final_instr_ptr);
624 #endif
625595 instr_ptr += DWARF_64BIT_SIZE;
626596 fp_offset = adv_loc;
627597
651621 free(localregtab);
652622 return adres;
653623 }
654 #if 0
655 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
656 dbg,error,final_instr_ptr);
657 #endif
658624 reg_no = (reg_num_type) lreg;
659625 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
660626
665631 free(localregtab);
666632 return adres;
667633 }
668 #if 0
669 DECODE_LEB128_UWORD_CK(instr_ptr, factored_N_value,
670 dbg,error,final_instr_ptr);
671 #endif
672634 if (need_augmentation) {
673635 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
674636 }
696658 free(localregtab);
697659 return adres;
698660 }
699
700 #if 0
701 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
702 dbg,error,final_instr_ptr);
703 #endif
704661 reg_no = (reg_num_type) lreg;
705
706662 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
707
708663 if (cie != NULL && cie->ci_initial_table != NULL) {
709664 localregtab[reg_no] =
710665 cie->ci_initial_table->fr_reg[reg_no];
731686 free(localregtab);
732687 return adres;
733688 }
734 #if 0
735 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
736 dbg,error,final_instr_ptr);
737 #endif
738689 reg_no = (reg_num_type) lreg;
739690 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
740691
760711 free(localregtab);
761712 return adres;
762713 }
763 #if 0
764 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
765 dbg,error,final_instr_ptr);
766 #endif
767714 reg_no = (reg_num_type) lreg;
768715 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
769716
790737 free(localregtab);
791738 return adres;
792739 }
793
794 #if 0
795 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
796 dbg,error,final_instr_ptr);
797 #endif
798740 reg_noA = (reg_num_type) lreg;
799
800741 ERROR_IF_REG_NUM_TOO_HIGH(reg_noA, reg_count);
801742 adres = _dwarf_leb128_uword_wrapper(dbg,
802743 &instr_ptr,final_instr_ptr,
805746 free(localregtab);
806747 return adres;
807748 }
808 #if 0
809 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
810 dbg,error,final_instr_ptr);
811 #endif
812749 reg_noB = (reg_num_type) lreg;
813
814750 if (reg_noB > reg_count) {
815751 SIMPLE_ERROR_RETURN(DW_DLE_DF_REG_NUM_TOO_HIGH);
816752 }
817
818
819753 localregtab[reg_noA].ru_is_off = 0;
820754 localregtab[reg_noA].ru_value_type = DW_EXPR_OFFSET;
821755 localregtab[reg_noA].ru_register = reg_noB;
822756 localregtab[reg_noA].ru_offset_or_block_len = 0;
823
824757 fp_register = reg_noA;
825758 fp_offset = reg_noB;
826759 break;
873806 free(localregtab);
874807 return adres;
875808 }
876
877 #if 0
878 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
879 dbg,error,final_instr_ptr);
880 #endif
881809 reg_no = (reg_num_type) lreg;
882
883810 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
884811 adres = _dwarf_leb128_uword_wrapper(dbg,
885812 &instr_ptr,final_instr_ptr,
888815 free(localregtab);
889816 return adres;
890817 }
891 #if 0
892 DECODE_LEB128_UWORD_CK(instr_ptr, factored_N_value,
893 dbg,error,final_instr_ptr);
894 #endif
895
896818 if (need_augmentation) {
897819 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
898820 }
918840 free(localregtab);
919841 return adres;
920842 }
921 #if 0
922 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
923 dbg,error,final_instr_ptr);
924 #endif
925843 reg_no = (reg_num_type) lreg;
926844 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
927
928845 cfa_reg.ru_register = reg_no;
929846 /* Do NOT set ru_offset_or_block_len or ru_is_off here.
930847 See dwarf2/3 spec. */
942859 free(localregtab);
943860 return adres;
944861 }
945 #if 0
946 DECODE_LEB128_UWORD_CK(instr_ptr, factored_N_value,
947 dbg,error,final_instr_ptr);
948 #endif
949
950862 if (need_augmentation) {
951863 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
952864 }
955867 cfa_reg.ru_is_off = 1;
956868 cfa_reg.ru_value_type = DW_EXPR_OFFSET;
957869 cfa_reg.ru_offset_or_block_len = factored_N_value;
958
959870 fp_offset = factored_N_value;
960871 break;
961872 }
971882 free(localregtab);
972883 return adres;
973884 }
974 #if 0
975 DECODE_LEB128_UWORD_CK(instr_ptr, factored_N_value,
976 dbg,error,final_instr_ptr);
977 #endif
978
979885 /* Not really known what the value means or is. */
980886 cfa_reg.ru_is_off = 1;
981887 cfa_reg.ru_value_type = DW_EXPR_OFFSET;
1003909 free(localregtab);
1004910 return adres;
1005911 }
1006 #if 0
1007 DECODE_LEB128_UWORD_CK(instr_ptr, block_len,
1008 dbg,error,final_instr_ptr);
1009 #endif
1010912 cfa_reg.ru_is_off = 0; /* arbitrary */
1011913 cfa_reg.ru_value_type = DW_EXPR_EXPRESSION;
1012914 cfa_reg.ru_offset_or_block_len = block_len;
1034936 free(localregtab);
1035937 return adres;
1036938 }
1037 #if 0
1038 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
1039 dbg,error,final_instr_ptr);
1040 #endif
1041939 reg_no = (reg_num_type) lreg;
1042940 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
1043941
1048946 free(localregtab);
1049947 return adres;
1050948 }
1051 #if 0
1052 DECODE_LEB128_UWORD_CK(instr_ptr, block_len,
1053 dbg,error,final_instr_ptr);
1054 #endif
1055949 localregtab[lreg].ru_is_off = 0; /* arbitrary */
1056950 localregtab[lreg].ru_value_type = DW_EXPR_EXPRESSION;
1057951 localregtab[lreg].ru_offset_or_block_len = block_len;
1077971 free(localregtab);
1078972 return adres;
1079973 }
1080 #if 0
1081 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
1082 dbg,error,final_instr_ptr);
1083 #endif
1084974 reg_no = (reg_num_type) lreg;
1085975 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
1086976 adres = _dwarf_leb128_sword_wrapper(dbg,
1090980 free(localregtab);
1091981 return adres;
1092982 }
1093 #if 0
1094 DECODE_LEB128_SWORD_CK(instr_ptr,
1095 signed_factored_N_value,
1096 dbg,error,final_instr_ptr);
1097 #endif
1098983 if (need_augmentation) {
1099984 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
1100985 }
11241009 free(localregtab);
11251010 return adres;
11261011 }
1127 #if 0
1128 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
1129 dbg,error,final_instr_ptr);
1130 #endif
11311012 reg_no = (reg_num_type) lreg;
11321013 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
11331014 adres = _dwarf_leb128_sword_wrapper(dbg,
11371018 free(localregtab);
11381019 return adres;
11391020 }
1140 #if 0
1141 DECODE_LEB128_SWORD_CK(instr_ptr,
1142 signed_factored_N_value,
1143 dbg,error,final_instr_ptr);
1144 #endif
1145
11461021 if (need_augmentation) {
11471022 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
11481023 }
11711046 free(localregtab);
11721047 return adres;
11731048 }
1174
1175 #if 0
1176 DECODE_LEB128_SWORD_CK(instr_ptr,
1177 signed_factored_N_value,
1178 dbg,error,final_instr_ptr);
1179 #endif
11801049 if (need_augmentation) {
11811050 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
11821051 }
12071076 free(localregtab);
12081077 return adres;
12091078 }
1210 #if 0
1211 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
1212 dbg,error,final_instr_ptr);
1213 #endif
12141079 reg_no = (reg_num_type) lreg;
1215
12161080 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
1217
12181081 adres = _dwarf_leb128_uword_wrapper(dbg,
12191082 &instr_ptr,final_instr_ptr,
12201083 &factored_N_value,error);
12221085 free(localregtab);
12231086 return adres;
12241087 }
1225 #if 0
1226 DECODE_LEB128_UWORD_CK(instr_ptr, factored_N_value,
1227 dbg,error,final_instr_ptr);
1228 #endif
1229
12301088 if (need_augmentation) {
12311089 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
12321090 }
12571115 free(localregtab);
12581116 return adres;
12591117 }
1260 #if 0
1261 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
1262 dbg,error,final_instr_ptr);
1263 reg_no = (reg_num_type) lreg;
1264 #endif
1265
12661118 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
12671119 adres = _dwarf_leb128_sword_wrapper(dbg,
12681120 &instr_ptr,final_instr_ptr,
12711123 free(localregtab);
12721124 return adres;
12731125 }
1274 #if 0
1275 DECODE_LEB128_SWORD_CK(instr_ptr,
1276 signed_factored_N_value,
1277 dbg,error,final_instr_ptr);
1278 #endif
12791126 if (need_augmentation) {
12801127 SIMPLE_ERROR_RETURN(DW_DLE_DF_NO_CIE_AUGMENTATION);
12811128 }
13071154 free(localregtab);
13081155 return adres;
13091156 }
1310
1311 #if 0
1312 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
1313 dbg,error,final_instr_ptr);
1314 #endif
13151157 reg_no = (reg_num_type) lreg;
13161158 ERROR_IF_REG_NUM_TOO_HIGH(reg_no, reg_count);
13171159 adres = _dwarf_leb128_uword_wrapper(dbg,
13211163 free(localregtab);
13221164 return adres;
13231165 }
1324 #if 0
1325 DECODE_LEB128_UWORD_CK(instr_ptr, block_len,
1326 dbg,error,final_instr_ptr);
1327 #endif
13281166 localregtab[lreg].ru_is_off = 0; /* arbitrary */
13291167 localregtab[lreg].ru_value_type = DW_EXPR_VAL_EXPRESSION;
13301168 localregtab[lreg].ru_offset_or_block_len = block_len;
13731211 free(localregtab);
13741212 return adres;
13751213 }
1376 #if 0
1377 DECODE_LEB128_UWORD_CK(instr_ptr, lreg,
1378 dbg,error,final_instr_ptr);
1379 #endif
13801214 /* We have nowhere to store lreg.
13811215 FIXME
13821216 This is the total size of arguments
19781812 cie->ci_extension_size -
19791813 (cie->ci_cie_instr_start -
19801814 cie->ci_cie_start);
1981
19821815 if (instrend > cie->ci_cie_end) {
19831816 _dwarf_error(dbg, error,DW_DLE_CIE_INSTR_PTR_ERROR);
19841817 return DW_DLV_ERROR;
19851818 }
1986 cie->ci_initial_table = (Dwarf_Frame)_dwarf_get_alloc(dbg, DW_DLA_FRAME, 1);
1819 cie->ci_initial_table = (Dwarf_Frame)_dwarf_get_alloc(dbg,
1820 DW_DLA_FRAME, 1);
19871821
19881822 if (cie->ci_initial_table == NULL) {
19891823 _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
4747 #include "dwarfstring.h"
4848
4949 /* For a little information about .eh_frame see
50 https://stackoverflow.com/questions/14091231/what-do-the-eh-frame-and-eh-frame-hdr-sections-store-exactly
51 http://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
50 https://stackoverflow.com/questions/14091231/
51 what-do-the-eh-frame-and-eh-frame-hdr-sections-store-exactly
52 http://refspecs.linuxfoundation.org/LSB_3.0.0/
53 LSB-Core-generic/LSB-Core-generic/ehframechpt.html
5254 The above give information about fields and sizes but
5355 very very little about content.
5456
266268 (Dwarf_Unsigned) prefix->cf_cie_id,
267269 (long) prefix->cf_cie_id_addr);
268270 printf
269 (" sec ptr 0x%lx sec index %" DW_PR_DSd " sec len 0x%" DW_PR_DUx " sec past end 0x%lx\n",
271 (" sec ptr 0x%lx sec index %" DW_PR_DSd
272 " sec len 0x%" DW_PR_DUx " sec past end 0x%lx\n",
270273 (unsigned long) prefix->cf_section_ptr,
271274 (Dwarf_Signed) prefix->cf_section_index,
272275 (Dwarf_Unsigned) prefix->cf_section_length,
303306 Dwarf_Small *cieptr = 0;
304307
305308 if (use_gnu_cie_calc) {
306 /* cie_id value is offset, in section, of the cie_id itself, to
307 use vm ptr of the value, less the value, to get to the cie
308 header. */
309 /* cie_id value is offset, in section, of the
310 cie_id itself, to
311 use vm ptr of the value,
312 less the value, to get to the cie header. */
309313 cieptr = cie_id_addr - cie_id_value;
310314 } else {
311315 /* Traditional dwarf section offset is in cie_id */
340344 cur_cie_ptr are used for chaining them up in sequence.
341345 In case cie's are reused aggressively we need tail_cie_ptr
342346 to add to the chain. If we re-use an early cie
343 later on, that does not mean we chain a new cie to the early one,
347 later on, that does not mean we chain a
348 new cie to the early one,
344349 we always chain it to the tail. */
345350 Dwarf_Cie head_cie_ptr = NULL;
346351 Dwarf_Cie cur_cie_ptr = NULL;
347352 Dwarf_Cie tail_cie_ptr = NULL;
348353 Dwarf_Unsigned cie_count = 0;
349354
350 /* Points to a list of contiguous pointers to Dwarf_Cie structures.
355 /* Points to a list of contiguous pointers to
356 Dwarf_Cie structures.
351357 */
352358 Dwarf_Cie *cie_list_ptr = 0;
353359
358364 Dwarf_Fde cur_fde_ptr = NULL;
359365 Dwarf_Unsigned fde_count = 0;
360366
361 /* Points to a list of contiguous pointers to Dwarf_Fde structures.
367 /* Points to a list of contiguous pointers to
368 Dwarf_Fde structures.
362369 */
363370 Dwarf_Fde *fde_list_ptr = NULL;
364371
369376 return DW_DLV_NO_ENTRY;
370377 }
371378
372 /* We create the fde and cie arrays. Processing each CIE as we come
373 to it or as an FDE refers to it. We cannot process 'late' CIEs
374 late as GNU .eh_frame complexities mean we need the whole CIE
379 /* We create the fde and cie arrays.
380 Processing each CIE as we come
381 to it or as an FDE refers to it.
382 We cannot process 'late' CIEs
383 late as GNU .eh_frame complexities
384 mean we need the whole CIE
375385 before we can process the FDE correctly. */
376386 while (frame_ptr < section_ptr_end) {
377387
378388 struct cie_fde_prefix_s prefix;
379389
380 /* First read in the 'common prefix' to figure out what we are
390 /* First read in the 'common prefix' to
391 figure out what we are
381392 to do with this entry. */
382393 memset(&prefix, 0, sizeof(prefix));
383394 res = dwarf_read_cie_fde_prefix(dbg,
396407 if (frame_ptr >= section_ptr_end) {
397408 dealloc_fde_cie_list_internal(head_fde_ptr, head_cie_ptr);
398409 _dwarf_error(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD);
410 _dwarf_error_string(dbg, error,
411 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
412 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: following "
413 "a the start of a cie/fde we have run off"
414 " the end of the section. Corrupt Dwarf");
415
399416 return DW_DLV_ERROR;
400417 }
401418
596613 dbg->de_cie_count = cie_count;
597614 }
598615
599 /* Sort the list by the address so that dwarf_get_fde_at_pc() can
616 /* Sort the list by the address so that
617 dwarf_get_fde_at_pc() can
600618 binary search this list. */
601619 if (fde_count > 0) {
602620 qsort((void *) fde_list_ptr, fde_count, sizeof(Dwarf_Ptr),
623641 {
624642 Dwarf_Cie new_cie = 0;
625643
626 /* egcs-1.1.2 .eh_frame uses 0 as the distinguishing id. sgi uses
644 /* egcs-1.1.2 .eh_frame uses 0 as the distinguishing
645 id. sgi uses
627646 -1 (in .debug_frame). .eh_frame not quite identical to
628647 .debug_frame */
629648 /* We here default the address size as it is not present
652671 /* This is a CIE, Common Information Entry: See the dwarf spec,
653672 section 6.4.1 */
654673 if (frame_ptr >= section_ptr_end) {
655 _dwarf_error(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD);
674 _dwarf_error_string(dbg, error,
675 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
676 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: reading a cie"
677 " version byte we have run off"
678 " the end of the section. Corrupt Dwarf");
656679 return DW_DLV_ERROR;
657680 }
658681 version = *(Dwarf_Small *) frame_ptr;
659682
660683 if ((frame_ptr+2) >= section_ptr_end) {
661 _dwarf_error(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD);
684 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
685 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: reading an augmentation"
686 " would run off"
687 " the end of the section. Corrupt Dwarf");
662688 return DW_DLV_ERROR;
663689 }
664
665 frame_ptr++;
666690 if (version != DW_CIE_VERSION && version != DW_CIE_VERSION3 &&
667691 version != DW_CIE_VERSION4 && version != DW_CIE_VERSION5) {
668 _dwarf_error(dbg, error, DW_DLE_FRAME_VERSION_BAD);
669 return (DW_DLV_ERROR);
670 }
671
692 dwarfstring m;
693 dwarfstring_constructor(&m);
694 dwarfstring_append_printf_u(&m,
695 "DW_DLE_FRAME_VERSION_BAD: cie version %u unknown",
696 version);
697 _dwarf_error_string(dbg, error,
698 DW_DLE_FRAME_VERSION_BAD,
699 dwarfstring_string(&m));
700 dwarfstring_destructor(&m);
701 return DW_DLV_ERROR;
702 }
703 frame_ptr++;
672704 augmentation = frame_ptr;
673
674705 res = _dwarf_check_string_valid(dbg,section_pointer,
675706 frame_ptr,section_ptr_end,
676707 DW_DLE_AUGMENTATION_STRING_OFF_END,error);
679710 }
680711 frame_ptr = frame_ptr + strlen((char *) frame_ptr) + 1;
681712 if (frame_ptr >= section_ptr_end) {
682 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
713 _dwarf_error_string(dbg, error,
714 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
683715 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: following any "
684 "augmentation field we have run off the end of the section "
716 "augmentation field we have run off "
717 "the end of the section "
685718 "with the CIE incomplete. Corrupt Dwarf");
686719 return DW_DLV_ERROR;
687720 }
692725 UNUSEDARG Dwarf_Unsigned exception_table_addr;
693726
694727 if ((frame_ptr+local_length_size) >= section_ptr_end) {
695 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
728 _dwarf_error_string(dbg, error,
729 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
696730 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: following "
697731 "type field we have run off the end of the section "
698732 "with the CIE incomplete. Corrupt Dwarf");
710744
711745 if (version == DW_CIE_VERSION4) {
712746 if ((frame_ptr+2) >= section_ptr_end) {
713 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
747 _dwarf_error_string(dbg, error,
748 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
714749 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: "
715750 "We would run off the end of the section "
716751 "in a DWARF4 cie header. Corrupt Dwarf");
718753 }
719754 address_size = *((unsigned char *)frame_ptr);
720755 if (address_size < 1) {
721 _dwarf_error_string(dbg, error, DW_DLE_ADDRESS_SIZE_ZERO,
722 "DW_DLE_ADDRESS_SIZE_ZERO: bad addres size "
756 _dwarf_error_string(dbg, error,
757 DW_DLE_ADDRESS_SIZE_ZERO,
758 "DW_DLE_ADDRESS_SIZE_ZERO: bad address size "
723759 "for a DWARF4 cie header");
724760 return (DW_DLV_ERROR);
725761 }
731767 return DW_DLV_ERROR;
732768 }
733769 if ((frame_ptr+2) >= section_ptr_end) {
734 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
735 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: Running off the end "
770 _dwarf_error_string(dbg, error,
771 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
772 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: "
773 "Running off the end "
736774 " of a CIE header. Corrupt DWARF4");
737775 return DW_DLV_ERROR;
738776 }
747785
748786 /* Not a great test. But the DECODE* do checking so ok. */
749787 if ((frame_ptr+2) >= section_ptr_end) {
750 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
788 _dwarf_error_string(dbg, error,
789 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
751790 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: Running off the end "
752791 " of a CIE header before the code alignment value "
753792 "read. Corrupt DWARF");
754793 return DW_DLV_ERROR;
755794 }
756 DECODE_LEB128_UWORD_CK(frame_ptr, lreg,dbg,error,section_ptr_end);
795 DECODE_LEB128_UWORD_CK(frame_ptr, lreg,dbg,error,
796 section_ptr_end);
757797 code_alignment_factor = (Dwarf_Unsigned) lreg;
758798 res = (Dwarf_Signed) _dwarf_decode_s_leb128_chk(frame_ptr,
759799 &leb128_length,&data_alignment_factor,section_ptr_end);
760 if(res != DW_DLV_OK) {
800 if (res != DW_DLV_OK) {
761801 return res;
762802 }
763803 frame_ptr = frame_ptr + leb128_length;
764 /* Not a great test. FIXME */
765804 if ((frame_ptr+1) >= section_ptr_end) {
766 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
805 _dwarf_error_string(dbg, error,
806 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
767807 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: Running off the end "
768808 "of a CIE header before the return address register "
769809 "number read. Corrupt DWARF");
771811 return DW_DLV_ERROR;
772812 }
773813 res = _dwarf_get_return_address_reg(frame_ptr, version,
774 dbg,section_ptr_end, &size,&return_address_register,error);
775 if(res != DW_DLV_OK) {
814 dbg,section_ptr_end, &size,
815 &return_address_register,error);
816 if (res != DW_DLV_OK) {
776817 return res;
777818 }
778 if (return_address_register > dbg->de_frame_reg_rules_entry_count) {
819 if (return_address_register >
820 dbg->de_frame_reg_rules_entry_count) {
779821 _dwarf_error(dbg, error, DW_DLE_CIE_RET_ADDR_REG_ERROR);
780822 return (DW_DLV_ERROR);
781823 }
782824 frame_ptr += size;
783825 if ((frame_ptr) > section_ptr_end) {
784 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
826 _dwarf_error_string(dbg, error,
827 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
785828 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: Past the end "
786 "of a CIE header before reading the augmentation string."
829 "of a CIE header before reading "
830 "the augmentation string."
787831 " Corrupt DWARF");
788832 return DW_DLV_ERROR;
789833 }
798842 Dwarf_Unsigned length_of_augmented_fields;
799843
800844 /* Decode the length of augmented fields. */
801 DECODE_LEB128_UWORD_CK(frame_ptr, lreg,dbg,error,section_ptr_end);
845 DECODE_LEB128_UWORD_CK(frame_ptr, lreg,
846 dbg,error,section_ptr_end);
802847 length_of_augmented_fields = (Dwarf_Unsigned) lreg;
803848 /* set the frame_ptr to point at the instruction start. */
804849 frame_ptr += length_of_augmented_fields;
811856
812857 if (!use_gnu_cie_calc) {
813858 /* This should be impossible. */
814 _dwarf_error(dbg, error,DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
859 _dwarf_error(dbg, error,
860 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
815861 return DW_DLV_ERROR;
816862 }
817863
820866 section_ptr_end,
821867 (char *) augmentation,error);
822868 if (err == DW_DLV_ERROR) {
823 _dwarf_error(dbg, error,DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
869 _dwarf_error(dbg, error,
870 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
824871 return DW_DLV_ERROR;
825872 }
826873 frame_ptr += increment;
832879 int resz = DW_DLV_ERROR;
833880 Dwarf_Unsigned adlen = 0;
834881
835 /* Not a great test. FIXME */
836882 if ((frame_ptr+1) > section_ptr_end) {
837 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
883 _dwarf_error_string(dbg, error,
884 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
838885 "DW_DLE_AUG_DATA_LENGTH_BAD: The "
839886 "gcc .eh_frame augmentation data "
840887 "cannot be read. Out of room in the section."
897944 previous version and I am leaving them the same way. */
898945 }
899946 if ((frame_ptr) > section_ptr_end) {
900 _dwarf_error_string(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD,
947 _dwarf_error_string(dbg, error,
948 DW_DLE_DEBUG_FRAME_LENGTH_BAD,
901949 "DW_DLE_DEBUG_FRAME_LENGTH_BAD: "
902950 "Reading an unknown type of augmentation string "
903951 "run off the end of the section. Corrupt DWARF.");
904952 return DW_DLV_ERROR;
905953 }
906954 break;
907 } /* End switch on augmentation type. */
955 } /* End switch on augmentation type. */
908956
909957 new_cie = (Dwarf_Cie) _dwarf_get_alloc(dbg, DW_DLA_CIE, 1);
910958 if (new_cie == NULL) {
10091057 }
10101058
10111059 if (augt == aug_gcc_eh_z) {
1012 /* If z augmentation this is eh_frame, and initial_location and
1060 /* If z augmentation this is eh_frame,
1061 and initial_location and
10131062 address_range in the FDE are read according to the CIE
10141063 augmentation string instructions. */
10151064
10281077 }
10291078 frame_ptr = fp_updated;
10301079 /* For the address-range it makes no sense to be
1031 pc-relative, so we turn it off with a section_pointer of
1080 pc-relative, so we turn it off
1081 with a section_pointer of
10321082 NULL. Masking off DW_EH_PE_pcrel from the
1033 ci_gnu_fde_begin_encoding in this call would also work
1083 ci_gnu_fde_begin_encoding in this
1084 call would also work
10341085 to turn off DW_EH_PE_pcrel. */
10351086 res = read_encoded_ptr(dbg, (Dwarf_Small *) NULL,
10361087 frame_ptr,
11161167
11171168 if (!use_gnu_cie_calc) {
11181169 /* This should be impossible. */
1119 _dwarf_error(dbg, error,DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
1170 _dwarf_error(dbg, error,
1171 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
11201172 return DW_DLV_ERROR;
11211173 }
11221174
12281280 Dwarf_Unsigned cie_id = 0;
12291281 Dwarf_Small *section_end = section_ptr_in + section_length_in;
12301282
1231 if(section_end < (frame_ptr +4)) {
1283 if (section_end < (frame_ptr +4)) {
12321284 dwarfstring m;
12331285 Dwarf_Unsigned u =
12341286 (Dwarf_Unsigned)(uintptr_t)(frame_ptr+4) -
12571309 data. We should be very close to end of section. */
12581310 return DW_DLV_NO_ENTRY;
12591311 }
1260 if((frame_ptr + local_length_size) >= section_end) {
1312 if ((frame_ptr + local_length_size) >= section_end) {
12611313 _dwarf_error(dbg,error,DW_DLE_DEBUG_FRAME_LENGTH_BAD);
12621314 return DW_DLV_ERROR;
12631315 }
13821434 _dwarf_error(dbg, error, DW_DLE_DEBUG_FRAME_LENGTH_BAD);
13831435 return DW_DLV_ERROR;
13841436 }
1385 /* First read in the 'common prefix' to figure out what * we are to
1386 do with this entry. If it is not a cie * we are in big trouble. */
1437 /* First read in the 'common prefix' to figure out
1438 what * we are to
1439 do with this entry. If it is not a cie *
1440 we are in big trouble. */
13871441 memset(&prefix, 0, sizeof(prefix));
13881442 res = dwarf_read_cie_fde_prefix(dbg, frame_ptr, section_ptr,
13891443 section_index, section_length,
14661520 found somehow) and figuring
14671521 out (or knowing) how the kernel and libc
14681522 pushed a structure
1469 onto the stack and loading registers from that structure.
1523 onto the stack and loading registers from
1524 that structure.
14701525 Totally different from normal stack unwinding.
14711526 This flag gives an unwinder a big leg up by
14721527 decoupling the 'hint: this is a stack frame'
14781533
14791534 case 'L':
14801535 if (cur_aug_p > end_aug_p) {
1481 _dwarf_error(dbg, error, DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
1536 _dwarf_error(dbg, error,
1537 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
14821538 return DW_DLV_ERROR;
14831539 }
14841540 *lsda_enc_out = *(unsigned char *) cur_aug_p;
14861542 break;
14871543 case 'R':
14881544 /* Followed by a one byte argument giving the
1489 pointer encoding for the address pointers in the fde. */
1545 pointer encoding for the address
1546 pointers in the fde. */
14901547 if (cur_aug_p >= end_aug_p) {
1491 _dwarf_error(dbg, error, DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
1548 _dwarf_error(dbg, error,
1549 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
14921550 return DW_DLV_ERROR;
14931551 }
14941552 *fde_begin_enc_out = *(unsigned char *) cur_aug_p;
15001558 unsigned char encoding = 0;
15011559
15021560 if (cur_aug_p >= end_aug_p) {
1503 _dwarf_error(dbg, error, DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
1561 _dwarf_error(dbg, error,
1562 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
15041563 return DW_DLV_ERROR;
15051564 }
15061565 encoding = *(unsigned char *) cur_aug_p;
15071566 *pers_hand_enc_out = encoding;
15081567 ++cur_aug_p;
15091568 if (cur_aug_p > end_aug_p) {
1510 _dwarf_error(dbg, error, DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
1569 _dwarf_error(dbg, error,
1570 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
15111571 return DW_DLV_ERROR;
15121572 }
15131573 /* DW_EH_PE_pcrel makes no sense here, so we turn it
15261586 }
15271587 cur_aug_p = updated_aug_p;
15281588 if (cur_aug_p > end_aug_p) {
1529 _dwarf_error(dbg, error, DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
1589 _dwarf_error(dbg, error,
1590 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
15301591 return DW_DLV_ERROR;
15311592 }
15321593 }
15331594 break;
15341595 default:
1535 _dwarf_error(dbg, error, DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
1596 _dwarf_error(dbg, error,
1597 DW_DLE_FRAME_AUGMENTATION_UNKNOWN);
15361598 return DW_DLV_ERROR;
15371599
15381600 }
16661728
16671729 };
16681730 /* The ELF ABI for gnu does not document the meaning of
1669 DW_EH_PE_pcrel, which is awkward. It apparently means the value
1670 we got above is pc-relative (meaning section-relative), so we
1671 adjust the value. Section_pointer may be null if it is known
1672 DW_EH_PE_pcrel cannot apply, such as for .debug_frame or for an
1731 DW_EH_PE_pcrel, which is awkward.
1732 It apparently means the value
1733 we got above is pc-relative (meaning section-relative),
1734 so we adjust the value. Section_pointer may be null
1735 if it is known DW_EH_PE_pcrel cannot apply,
1736 such as for .debug_frame or for an
16731737 address-range value. */
1674 if (section_pointer && ((gnu_encoding & 0x70) == DW_EH_PE_pcrel)) {
1738 if (section_pointer && ((gnu_encoding & 0x70) ==
1739 DW_EH_PE_pcrel)) {
16751740 /* Address (*addr) above is pc relative with respect to a
16761741 section. Add to the offset the base address (from elf) of
16771742 section and the distance of the field we are reading from
17021767 enum Dwarf_augmentation_type t = aug_unknown;
17031768 char *ag_string = (char *) augmentation_string;
17041769
1705 if (ag_string[0] == 0) {
1706 /* Empty string. We'll just guess that we know what this means:
1707 standard dwarf2/3 with no implementation-defined fields. */
1770 if (!ag_string[0]) {
1771 /* Empty string. We'll just guess that we know
1772 what this means:
1773 standard dwarf2/3 with no
1774 implementation-defined fields. */
17081775 t = aug_empty_string;
1709 } else if (strcmp(ag_string, DW_DEBUG_FRAME_AUGMENTER_STRING) == 0) {
1776 } else if (!strcmp(ag_string, DW_DEBUG_FRAME_AUGMENTER_STRING)) {
17101777 /* The string is "mti v1". Used internally at SGI, probably
17111778 never shipped. Replaced by "z". Treat like 'nothing
17121779 special'. */
17151782 /* If it's IRIX cc, z means aug_irix_exception_table. z1 z2
17161783 were designed as for IRIX CC, but never implemented */
17171784 /* If it's gcc, z may be any of several things. "z" or z
1718 followed optionally followed by one or more of L R P, each
1719 of which means a value may be present. Should be in eh_frame
1785 followed optionally followed by one or more of L R P,
1786 each of which means a value may be present.
1787 Should be in eh_frame
17201788 only, I think. */
17211789 if (is_gcc_eh_frame) {
17221790 t = aug_gcc_eh_z;
1723 } else if (ag_string[1] == 0) {
1791 } else if (!ag_string[1]) {
17241792 /* This is the normal IRIX C++ case, where there is an
17251793 offset into a table in each fde. The table being for
17261794 IRIX CC exception handling. */
17271795 /* DW_CIE_AUGMENTER_STRING_V0 "z" */
17281796 t = aug_irix_exception_table;
17291797 } /* Else unknown. */
1730 } else if (strncmp(ag_string, "eh", 2) == 0) {
1798 } else if (!strncmp(ag_string, "eh", 2)) {
17311799 /* gcc .eh_frame augmentation for egcs and gcc 2.x, at least
17321800 for x86. */
17331801 t = aug_eh;
1734 } else if (strcmp(ag_string, "armcc+") == 0) {
1802 } else if (!strcmp(ag_string, "armcc+")) {
17351803 /* Arm uses this string to mean a bug in
17361804 in Arm compilers was fixed, changing to the standard
17371805 calculation of the CFA. See
1738 http://sourceware.org/ml/gdb-patches/2006-12/msg00249.html
1806 http://sourceware.org/ml/gdb-patches/
1807 2006-12/msg00249.html
17391808 for details. */
17401809 t = aug_armcc;
1741 } else if (strcmp(ag_string, "HC") == 0) {
1810 } else if (!strcmp(ag_string, "HC")) {
17421811 t = aug_metaware;
17431812 } else {
17441813 }
17861855 apparently. */
17871856 suffix = augmentation + 2;
17881857 }
1789 /* FIXME: This could run too far. */
1790 /* for (; *suffix; ++suffix) if we think we can do something */
17911858 if (*suffix) {
17921859 /* We have no idea what this is as yet.
17931860 Some extensions beyond
7272 #ifdef HAVE_SYS_TYPES_H
7373 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
7474 #endif /* HAVE_SYS_TYPES_H */
75 #ifdef HAVE_SYS_STAT_H
7576 #include <sys/stat.h>
77 #endif /* HAVE_SYS_STAT_H */
7678 #include <fcntl.h>
79 #ifdef HAVE_STRING_H
7780 #include <string.h>
81 #endif /* HAVE_STRING_H */
7882 #ifdef HAVE_STDLIB_H
7983 #include <stdlib.h>
8084 #endif /* HAVE_STDLIB_H */
250254 if (!ret_dbg) {
251255 DWARF_DBG_ERROR(NULL,DW_DLE_DWARF_INIT_DBG_NULL,
252256 DW_DLV_ERROR);
257 }
258 if (!path) {
259 /* Oops. Null path */
260 _dwarf_error_string(NULL,
261 error,DW_DLE_STRING_PTR_NULL,
262 "DW_DLE_STRING_PTR_NULL: Passing a"
263 " null path argument to "
264 "dwarf_init_path or dwarf_init_path_dl"
265 " cannot work. Error.");
266 return DW_DLV_ERROR;
253267 }
254268 /* a special dsym call so we only check once. */
255269 if (true_path_out_buffer) {
137137 return;
138138 }
139139 msgspace = dhp->dh_errors[cur];
140 safe_strncpy(msgspace, newerror,DW_HARMLESS_ERROR_MSG_STRING_SIZE);
140 safe_strncpy(msgspace, newerror,
141 DW_HARMLESS_ERROR_MSG_STRING_SIZE);
141142 next = (cur+1) % dhp->dh_maxcount;
142143 dhp->dh_errs_count++;
143144 dhp->dh_next_to_use = next;
173174 dwarf_harmless_init(dhp,maxcount-1);
174175 if (oldarray.dh_next_to_use != oldarray.dh_first) {
175176 unsigned i = 0;
176 for (i = oldarray.dh_first; i != oldarray.dh_next_to_use;
177 for (i = oldarray.dh_first;
178 i != oldarray.dh_next_to_use;
177179 i = (i+1)%oldarray.dh_maxcount) {
178 dwarf_insert_harmless_error(dbg,oldarray.dh_errors[i]);
180 dwarf_insert_harmless_error(dbg,
181 oldarray.dh_errors[i]);
179182 }
180183 if (oldarray.dh_errs_count > dhp->dh_errs_count) {
181184 dhp->dh_errs_count = oldarray.dh_errs_count;
195198 unsigned i = 0;
196199 memset(dhp,0,sizeof(*dhp));
197200 dhp->dh_maxcount = size +1;
198 dhp->dh_errors = (char **)malloc(sizeof( char *) *dhp->dh_maxcount);
201 dhp->dh_errors = (char **)malloc(sizeof(char *)*dhp->dh_maxcount);
199202 if (!dhp->dh_errors) {
200203 dhp->dh_maxcount = 0;
201204 return;
3030
3131 #include "config.h"
3232 #include <stdio.h>
33 #ifdef HAVE_SYS_STAT_H
3334 #include <sys/stat.h>
35 #endif /* HAVE_SYS_STAT_H */
3436 #ifdef HAVE_SYS_TYPES_H
3537 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
3638 #endif /* HAVE_SYS_TYPES_H */
39 #ifdef HAVE_STRING_H
3740 #include <string.h>
41 #endif /* HAVE_STRING_H */
3842 #ifdef HAVE_STDLIB_H
3943 #include <stdlib.h>
4044 #endif /* HAVE_STDLIB_H */
5660 #else
5761 #ifdef HAVE_LIBELF_LIBELF_H
5862 #include <libelf/libelf.h>
59 #endif
60 #endif
61 #ifdef HAVE_ZLIB
63 #endif /* HAVE_LIBELF_LIBELF_H */
64 #endif /* HAVE_LIBELF_H */
65 #ifdef HAVE_ZLIB_H
6266 #include "zlib.h"
6367 #endif
6468
17761780 unsigned int type; followed by pad if following are 64bit!
17771781 size-of-target-address size
17781782 size-of-target-address
1783
1784 If we read using libelf libelf knows about
1785 SHF_COMPRESSED and if the object and the
1786 running libelf do not match endianness
1787 libelf already transformed the two fields
1788 we care about to host endianness so
1789 the READ_UNALIGNED is just wrong.
1790 Just noticed this issue November 2020.
17791791 */
17801792 Dwarf_Small *ptr = (Dwarf_Small *)src;
17811793 Dwarf_Unsigned type = 0;
17831795 /* Dwarf_Unsigned addralign = 0; */
17841796 unsigned fldsize = dbg->de_pointer_size;
17851797 unsigned structsize = 3* fldsize;
1786
1787 READ_UNALIGNED_CK(dbg,type,Dwarf_Unsigned,ptr,
1788 DWARF_32BIT_SIZE,
1789 error,endsection);
1790 ptr += fldsize;
1791 READ_UNALIGNED_CK(dbg,size,Dwarf_Unsigned,ptr,fldsize,
1792 error,endsection);
1798 if (dbg->de_using_libelf) {
1799 unsigned offset = 0;
1800 unsigned offsetb = 0;
1801 #ifdef WORDS_BIGENDIAN
1802 offset = sizeof(type) - DWARF_32BIT_SIZE;
1803 offsetb = sizeof(type) - fldsize;
1804 #else /* LITTLE_ENDIAN */
1805 offset = 0;
1806 offsetb = 0;
1807 #endif /* !BIG_ENDIAM */
1808 memcpy(((char*)&type)+offset,ptr,(size_t)
1809 DWARF_32BIT_SIZE);
1810 ptr += fldsize;
1811 memcpy(((char*)&size)+offsetb,ptr,(size_t)fldsize);
1812 } else {
1813 READ_UNALIGNED_CK(dbg,type,Dwarf_Unsigned,ptr,
1814 DWARF_32BIT_SIZE,
1815 error,endsection);
1816 ptr += fldsize;
1817 READ_UNALIGNED_CK(dbg,size,Dwarf_Unsigned,ptr,fldsize,
1818 error,endsection);
1819 }
17931820 if (type != ELFCOMPRESS_ZLIB) {
17941821 DWARF_DBG_ERROR(dbg, DW_DLE_ZDEBUG_INPUT_FORMAT_ODD,
17951822 DW_DLV_ERROR);
284284
285285 In DWARF2,3,4 the array of sourcefiles is represented
286286 differently than DWARF5.
287 DWARF 2,3,4,:
288 Take the line number from macro information or lines data
289 and subtract 1 to index into srcfiles. Any with line
290 number zero can be assumed to refer to DW_AT_name from the
291 CU DIE, but zero really means "no file".
287 DWARF 2,3,4, and experimental line table:
288 Subtract 1 from the DW_AT_decl_file etc
289 to index into the array of names.
290 zero means there is no file.
292291 DWARF 5:
293 Just like DW4, but index 1 refers to the
294 same string as DW_AT_name of the CU DIE.
292 DW_AT_decl_file etc numbers should be directly
293 used to index into the array of names.
294 Do not subtract anything.
295 For further information
296 see the discussion of dwarf_srcfiles() in
297 libdwarf2.1.pdf version 3.16 and later, Section
298 6.14 around page 117.
295299 */
296300 int
297301 dwarf_srcfiles(Dwarf_Die die,
386386 planned for in the design of .debug_line)
387387 is too tricky to recode this several times and keep
388388 it right.
389
390 As it is the code starting up line-reading is duplicated
391 and that is just wrong to do. FIXME!
392389 */
393390 #define LOP_EXTENDED 1
394391 #define LOP_DISCARD 2
632632 followed by a signed leb128 offset.
633633 For DWARF2, it is actually pointer size
634634 (address size).
635 The offset is global a section offset, not cu-relative.
636 Relocation to a different object file is up to
637 the user, per DWARF5 Page 41.
635638 http://www.dwarfstd.org/ShowIssue.php?issue=100831.1 */
636639 Dwarf_Small iplen = offset_size;
637640 if (version_stamp == DW_CU_VERSION2 /* 2 */ ) {
681684 case DW_OP_const_type: /* DWARF5 */
682685 case DW_OP_GNU_const_type: /* 0xf4 */
683686 {
684 /* die offset as uleb. */
687 /* die offset as uleb. cu-relative */
685688 DECODE_LEB128_UWORD_LEN_CK(loc_ptr, operand1,leb128_length,
686689 dbg,error,section_end);
687690 offset = offset + leb128_length;
3131
3232 #include "config.h"
3333 #include <stdio.h>
34 #include <stdlib.h>
3534 #ifdef HAVE_STDLIB_H
3635 #include <stdlib.h>
3736 #endif /* HAVE_STDLIB_H */
7171 /* Useful include for some Windows compilers. */
7272 #include <malloc.h>
7373 #endif /* HAVE_MALLOC_H */
74 #ifdef HAVE_STRING_H
7475 #include <string.h>
76 #endif /* HAVE_STRING_H */
7577 #ifdef HAVE_SYS_TYPES_H
7678 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
7779 #endif /* HAVE_SYS_TYPES_H */
80 #ifdef HAVE_SYS_STAT_H
7881 #include <sys/stat.h> /* open() */
82 #endif /* HAVE_SYS_STAT_H */
7983 #include <fcntl.h> /* open() */
8084 #include <time.h>
8185 #ifdef HAVE_UNISTD_H
223227
224228 struct generic_macho_section *sp =
225229 macho->mo_dwarf_sections + section_index;
226 if(sp->loaded_data) {
230 if (sp->loaded_data) {
227231 *return_data = sp->loaded_data;
228232 return DW_DLV_OK;
229233 }
262266 dwarf_macho_object_access_internals_t *mp = 0;
263267 Dwarf_Unsigned i = 0;
264268
265 if(!aip) {
269 if (!aip) {
266270 return;
267271 }
268272 mp = (dwarf_macho_object_access_internals_t *)aip->object;
283287 struct generic_macho_section *sp = 0;
284288
285289 sp = mp->mo_dwarf_sections;
286 for( i=0; i < mp->mo_dwarf_sectioncount; ++i,++sp) {
290 for ( i=0; i < mp->mo_dwarf_sectioncount; ++i,++sp) {
287291 if (sp->loaded_data) {
288292 free(sp->loaded_data);
289293 sp->loaded_data = 0;
299303
300304 /* load_macho_header32(dwarf_macho_object_access_internals_t *mfp)*/
301305 static int
302 load_macho_header32(dwarf_macho_object_access_internals_t *mfp, int *errcode)
306 load_macho_header32(dwarf_macho_object_access_internals_t *mfp,
307 int *errcode)
303308 {
304309 struct mach_header mh32;
305310 int res = 0;
316321 /* Do not adjust endianness of magic, leave as-is. */
317322 ASNAR(memcpy,mfp->mo_header.magic,mh32.magic);
318323 ASNAR(mfp->mo_copy_word,mfp->mo_header.cputype,mh32.cputype);
319 ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,mh32.cpusubtype);
324 ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,
325 mh32.cpusubtype);
320326 ASNAR(mfp->mo_copy_word,mfp->mo_header.filetype,mh32.filetype);
321327 ASNAR(mfp->mo_copy_word,mfp->mo_header.ncmds,mh32.ncmds);
322 ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,mh32.sizeofcmds);
328 ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,
329 mh32.sizeofcmds);
323330 ASNAR(mfp->mo_copy_word,mfp->mo_header.flags,mh32.flags);
324331 mfp->mo_header.reserved = 0;
325332 mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
347354 /* Do not adjust endianness of magic, leave as-is. */
348355 ASNAR(memcpy,mfp->mo_header.magic,mh64.magic);
349356 ASNAR(mfp->mo_copy_word,mfp->mo_header.cputype,mh64.cputype);
350 ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,mh64.cpusubtype);
357 ASNAR(mfp->mo_copy_word,mfp->mo_header.cpusubtype,
358 mh64.cpusubtype);
351359 ASNAR(mfp->mo_copy_word,mfp->mo_header.filetype,mh64.filetype);
352360 ASNAR(mfp->mo_copy_word,mfp->mo_header.ncmds,mh64.ncmds);
353 ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,mh64.sizeofcmds);
361 ASNAR(mfp->mo_copy_word,mfp->mo_header.sizeofcmds,
362 mh64.sizeofcmds);
354363 ASNAR(mfp->mo_copy_word,mfp->mo_header.flags,mh64.flags);
355364 ASNAR(mfp->mo_copy_word,mfp->mo_header.reserved,mh64.reserved);
356365 mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
396405 *errcode = DW_DLE_MACH_O_SEGOFFSET_BAD;
397406 return DW_DLV_ERROR;
398407 }
399 res = RRMOA(mfp->mo_fd, &sc, (off_t)mmp->offset_this_command, sizeof(sc),
400 (off_t)filesize, errcode);
408 res = RRMOA(mfp->mo_fd, &sc, (off_t)mmp->offset_this_command,
409 sizeof(sc), (off_t)filesize, errcode);
401410 if (res != DW_DLV_OK) {
402411 return res;
403412 }
447456 *errcode = DW_DLE_FILE_OFFSET_BAD;
448457 return DW_DLV_ERROR;
449458 }
450 res = RRMOA(mfp->mo_fd, &sc, (off_t)mmp->offset_this_command, sizeof(sc),
451 (off_t)filesize, errcode);
459 res = RRMOA(mfp->mo_fd, &sc, (off_t)mmp->offset_this_command,
460 sizeof(sc), (off_t)filesize, errcode);
452461 if (res != DW_DLV_OK) {
453462 return res;
454463 }
507516 int res = 0;
508517
509518 if (cmd == LC_SEGMENT) {
510 res = load_segment_command_content32(mfp,mmp,msp,i,errcode);
519 res = load_segment_command_content32(mfp,mmp,msp,
520 i,errcode);
511521 ++msp;
512522 } else if (cmd == LC_SEGMENT_64) {
513 res = load_segment_command_content64(mfp,mmp,msp,i,errcode);
523 res = load_segment_command_content64(mfp,mmp,msp,
524 i,errcode);
514525 ++msp;
515526 }
516527 if (res != DW_DLV_OK) {
697708 continue;
698709 }
699710 /* Found DWARF, for now assume only one such. */
700 res = dwarf_macho_load_dwarf_section_details(mfp,segp,segi,errcode);
711 res = dwarf_macho_load_dwarf_section_details(mfp,
712 segp,segi,errcode);
701713 return res;
702714 }
703715 return DW_DLV_OK;
730742
731743 mfp->mo_commands = (struct generic_macho_command *) calloc(
732744 mfp->mo_command_count,sizeof(struct generic_macho_command));
733 if( !mfp->mo_commands) {
745 if (!mfp->mo_commands) {
734746 /* out of memory */
735747 *errcode = DW_DLE_ALLOC_FAIL;
736748 return DW_DLV_ERROR;
816828 macho_get_pointer_size,
817829 macho_get_section_count,
818830 macho_load_section,
819 /* We do not do macho relocations. dsym files do not require it. */
831 /* We do not do macho relocations.
832 dsym files do not require it. */
820833 NULL
821834 };
822835
890903 return res;
891904 }
892905 sp = intfc->mo_dwarf_sections+1;
893 for(i = 1; i < intfc->mo_dwarf_sectioncount ; ++i,++sp) {
906 for (i = 1; i < intfc->mo_dwarf_sectioncount ; ++i,++sp) {
894907 int j = 1;
895908 int lim = sizeof(SectionNames)/sizeof(SectionNames[0]);
896909 sp->dwarfsectname = "";
897 for( ; j < lim; ++j) {
898 if(!strcmp(sp->sectname,SectionNames[j].ms_moname)) {
910 for ( ; j < lim; ++j) {
911 if (!strcmp(sp->sectname,SectionNames[j].ms_moname)) {
899912 sp->dwarfsectname = SectionNames[j].ms_dwname;
900913 break;
901914 }
447447 pdmd->dmd_fileindex = v1;
448448 (void) _dwarf_macro_stack_push_index(dbg, fileindex,
449449 &msdata);
450 /* We ignore the error, we just let fileindex ** be -1 when
450 /* We ignore the error, we just let
451 fileindex ** be -1 when
451452 we pop this one. */
452453 fileindex = v1;
453454 if (((Dwarf_Unsigned)(pnext - macro_base)) >=
4949
5050 #define CHECKNULLCONTEXT(m,d,e) \
5151 if (!m || m->mc_sentinel != MC_SENTINAL) { \
52 if(m) { d = (m)->mc_dbg; } \
52 if (m) { d = (m)->mc_dbg; } \
5353 _dwarf_error(d, e, \
5454 DW_DLE_BAD_MACRO_HEADER_POINTER); \
5555 return DW_DLV_ERROR; \
6060 Each macro unit ends with an entry
6161 containing an opcode of 0. */
6262
63 static const Dwarf_Small dwarf_udata_string_form[] = {DW_FORM_udata,DW_FORM_string};
64 static const Dwarf_Small dwarf_udata_udata_form[] = {DW_FORM_udata,DW_FORM_udata};
65 static const Dwarf_Small dwarf_udata_strp_form[] = {DW_FORM_udata,DW_FORM_strp};
66 static const Dwarf_Small dwarf_udata_strp_sup_form[] = {DW_FORM_udata,DW_FORM_strp_sup};
67 static const Dwarf_Small dwarf_secoffset_form[] = {DW_FORM_sec_offset};
68 static const Dwarf_Small dwarf_udata_strx_form[] = {DW_FORM_udata,DW_FORM_strx};
63 static const Dwarf_Small dwarf_udata_string_form[] =
64 {DW_FORM_udata,DW_FORM_string};
65 static const Dwarf_Small dwarf_udata_udata_form[] =
66 {DW_FORM_udata,DW_FORM_udata};
67 static const Dwarf_Small dwarf_udata_strp_form[] =
68 {DW_FORM_udata,DW_FORM_strp};
69 static const Dwarf_Small dwarf_udata_strp_sup_form[] =
70 {DW_FORM_udata,DW_FORM_strp_sup};
71 static const Dwarf_Small dwarf_secoffset_form[] =
72 {DW_FORM_sec_offset};
73 static const Dwarf_Small dwarf_udata_strx_form[] =
74 {DW_FORM_udata,DW_FORM_strx};
6975
7076 struct Dwarf_Macro_Forms_s dw5formsarray[] = {
7177 {0,0,0},
9096
9197 /* Represents DWARF 5 macro info */
9298 /* .debug_macro predefined, in order by value */
93 static const struct Dwarf_Macro_OperationsList_s dwarf_default_macro_opslist = {
99 static const struct Dwarf_Macro_OperationsList_s
100 dwarf_default_macro_opslist = {
94101 13, dw5formsarray
95102 };
96103
146153 Dwarf_Small *mdata = mdata_start;
147154 Dwarf_Unsigned leb128_length = 0;
148155
149 for( ; i < formcount; ++i) {
156 for ( ; i < formcount; ++i) {
150157 curform = forms[i];
151158 if (mdata >= section_end) {
152159 _dwarf_error(dbg, error, DW_DLE_MACRO_OFFSET_BAD);
207214 int res = _dwarf_check_string_valid(dbg,
208215 mdata,mdata, section_end,
209216 DW_DLE_MACRO_STRING_BAD,error);
210 if(res != DW_DLV_OK) {
217 if (res != DW_DLV_OK) {
211218 return res;
212219 }
213220 v = strlen((char *) mdata) + 1;
274281 Dwarf_Small *cur = start;
275282 unsigned pos = 0;
276283
277 printf("dump %ld bytes, start at 0x%lx\n",len,(unsigned long)start);
284 printf("dump %ld bytes, start at 0x%lx\n",
285 len,(unsigned long)start);
278286 printf("0x");
279287 for (; cur < end;pos++, cur++) {
280288 if (!(pos %4)) {
328336 opsarray = (struct Dwarf_Macro_Operator_s *)
329337 calloc(known_ops_count,
330338 sizeof(struct Dwarf_Macro_Operator_s));
331 if(!opsarray) {
339 if (!opsarray) {
332340 _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
333341 return DW_DLV_ERROR;
334342 }
356364 macro_context->mc_ops_data_length = opslen;
357365 macro_context->mc_total_length = opslen +
358366 macro_context->mc_macro_header_length;
359 if(build_ops_array) {
367 if (build_ops_array) {
360368 curopsentry->mo_opcode = op;
361369 curopsentry->mo_form = 0;
362370 curopsentry->mo_data = 0;
378386 if ( res != DW_DLV_OK) {
379387 return res;
380388 }
381 if(build_ops_array) {
389 if (build_ops_array) {
382390 curopsentry->mo_opcode = op;
383391 curopsentry->mo_form = ourform;
384392 curopsentry->mo_data = mdata;
423431 }
424432 curop = macro_context->mc_ops + op_number;
425433 operator = curop->mo_opcode;
426 if(!operator) {
434 if (!operator) {
427435 /* A placeholder for the null byte at the end
428436 of an operator list. */
429437 *op_start_section_offset = 0;
514522 res = _dwarf_check_string_valid(dbg,
515523 startptr,mdata, endptr,
516524 DW_DLE_MACRO_STRING_BAD,error);
517 if(res != DW_DLV_OK) {
525 if (res != DW_DLV_OK) {
518526 return res;
519527 }
520528 *line_number = linenum;
549557 *macro_string = "<Error: getting local .debug_str>";
550558 return res;
551559 } else if (res == DW_DLV_NO_ENTRY) {
552 *macro_string = "<Error: NO_ENTRY on .debug_string (strp)>";
560 *macro_string = "<Error: NO_ENTRY on "
561 ".debug_string (strp)>";
553562 } else {
554563 *macro_string = (const char *)localstr;
555564 }
567576 DECODE_LEB128_UWORD_CK(mdata,linenum, dbg, error,endptr);
568577 *line_number = linenum;
569578 mdata_copy = mdata;
570 DECODE_LEB128_UWORD_CK(mdata_copy,stringindex, dbg, error,endptr);
579 DECODE_LEB128_UWORD_CK(mdata_copy,stringindex,
580 dbg, error,endptr);
571581 /* mdata_copy is for call below */
572582
573583
591601
592602 *index = stringindex;
593603 *offset = offsettostr;
594 ress = _dwarf_extract_local_debug_str_string_given_offset(dbg,
604 ress =
605 _dwarf_extract_local_debug_str_string_given_offset(
606 dbg,
595607 form1,
596608 offsettostr,
597609 &localstr,
598610 error);
599 if(ress == DW_DLV_ERROR) {
611 if (ress == DW_DLV_ERROR) {
600612 return ress;
601613 } else if (ress == DW_DLV_NO_ENTRY){
602614 *macro_string = "<:No string available>";
633645 if (resup != DW_DLV_OK) {
634646 if (resup == DW_DLV_ERROR) {
635647 int myerrno = dwarf_errno(lerr);
636 if(myerrno == DW_DLE_NO_TIED_FILE_AVAILABLE) {
648 if (myerrno == DW_DLE_NO_TIED_FILE_AVAILABLE) {
637649 *macro_string =
638650 (char *)"<DW_FORM_str_sup-no-tied_file>";
639651 } else {
675687 /* TARG now points at terminating NUL */
676688 /* LAST points at final character in targ. */
677689 if (trimtarg ) {
678 if(last && *last == '/') {
690 if (last && *last == '/') {
679691 /* Truncate. */
680692 *last = 0;
681693 targ = last;
701713 /* Allow for NUL char and added / */
702714 truelen = strlen(dir) + strlen(name) + 1 +1;
703715 final = (char *)malloc(truelen);
704 if(!final) {
716 if (!final) {
705717 return NULL;
706718 }
707719 final[0] = 0;
718730 if (mc->mc_file_path) {
719731 return mc->mc_file_path;
720732 }
721 if(!mc->mc_at_comp_dir || !mc->mc_at_comp_dir[0]) {
733 if (!mc->mc_at_comp_dir || !mc->mc_at_comp_dir[0]) {
722734 return mc->mc_at_name;
723735 }
724736 if (!mc->mc_at_name || !mc->mc_at_name[0]) {
725737 return NULL;
726738 }
727 if(_dwarf_file_name_is_full_path((Dwarf_Small *)mc->mc_at_name)) {
739 if (_dwarf_file_name_is_full_path((Dwarf_Small *)mc->mc_at_name)) {
728740 return mc->mc_at_name;
729741 }
730742 /* Dwarf_Macro_Context destructor will free this. */
773785 DECODE_LEB128_UWORD_CK(mdata,srcindex, dbg, error,endptr);
774786 *line_number = linenum;
775787 *name_index_to_line_tab = srcindex;
776 /* For DWARF 2,3,4, decrement by 1.
777 FOR DWARF 5 do not decrement. */
778 if(macro_context->mc_version_number >= 5) {
788 /* We deal with DWARF4 GNU extension
789 with .debug_macro version number 4
790 and DWARF5 .debug_macro version number 5.
791 */
792 if (macro_context->mc_version_number == DW_MACRO_VERSION5) {
779793 trueindex = srcindex;
780794 if (trueindex < 0) {
781 *src_file_name = "<source-file-index-low-no-name-available>";
795 *src_file_name =
796 "<source-file-index-low-no-name-available>";
782797 return DW_DLV_OK;
783798 }
784799 if (trueindex < macro_context->mc_srcfiles_count) {
785 *src_file_name = macro_context->mc_srcfiles[trueindex];
800 *src_file_name =
801 macro_context->mc_srcfiles[trueindex];
786802 return DW_DLV_OK;
787803 } else {
788804 *src_file_name =
790806 return DW_DLV_OK;
791807 }
792808 } else {
809 /* All except DWARF5 */
793810 /* Unsigned to signed here. */
794811 trueindex = srcindex;
795 /* Protects against crazy big srcindex, overflow territory. */
812 /* Protects against crazy big srcindex,
813 overflow territory. */
796814 if (trueindex < 0 ) {
797815 /* Something insane here. */
798 *src_file_name = "<source-file-index-low-no-name-available>";
816 *src_file_name =
817 "<source-file-index-low-no-name-available>";
799818 return DW_DLV_OK;
800819 }
801 /* Protects against crazy big srcindex, overflow territory. */
820 /* Protects against crazy big srcindex,
821 overflow territory. */
802822 if (trueindex > (macro_context->mc_srcfiles_count+1)) {
803823 /* Something insane here. */
804824 *src_file_name =
805825 "<source-file-index-high-no-name-available>";
806826 return DW_DLV_OK;
807827 }
808 --trueindex;
828 --trueindex; /* might now be -1 */
809829 if (trueindex > macro_context->mc_srcfiles_count) {
810830 *src_file_name =
811 "<adjusted-source-file-index-high-no-name-available>";
831 "<adjusted-source-file-index-high-"
832 "no-name-available>";
812833 }
813834 if (srcindex > 0 &&
814835 trueindex < macro_context->mc_srcfiles_count) {
815 *src_file_name = macro_context->mc_srcfiles[trueindex];
836 *src_file_name =
837 macro_context->mc_srcfiles[trueindex];
816838 } else {
817 const char *mcatcomp = construct_at_path_from_parts(
818 macro_context);
819 if(mcatcomp) {
839 const char *mcatcomp =
840 construct_at_path_from_parts(macro_context);
841 if (mcatcomp) {
820842 *src_file_name = mcatcomp;
821843 } else {
822 *src_file_name = "<no-source-file-name-available>";
844 *src_file_name =
845 "<no-source-file-name-available>";
823846 }
824847 }
825848 }
919942 _dwarf_error(dbg, error, DW_DLE_MACRO_OPCODE_FORM_BAD);
920943 return (DW_DLV_ERROR);
921944 }
922 for(i = 0; i < curform->mf_formcount; ++i) {
945 for (i = 0; i < curform->mf_formcount; ++i) {
923946 if (curform->mf_formbytes[i] != stdfptr->mf_formbytes[1]) {
924947 _dwarf_error(dbg, error, DW_DLE_MACRO_OPCODE_FORM_BAD);
925948 return (DW_DLV_ERROR);
9961019 calloc(operand_table_count,
9971020 sizeof(struct Dwarf_Macro_Forms_s));
9981021 macro_context->mc_opcode_count = operand_table_count;
999 if(!macro_context->mc_opcode_forms) {
1022 if (!macro_context->mc_opcode_forms) {
10001023 _dwarf_error(dbg, error, DW_DLE_ALLOC_FAIL);
10011024 return DW_DLV_ERROR;
10021025 }
10311054 macro_data += formcount;
10321055 if (opcode_number > DW_MACRO_undef_strx ) {
10331056 Dwarf_Half k = 0;
1034 for(k = 0; k < formcount; ++k) {
1035 if (!valid_macro_form(curformentry->mf_formbytes[k])) {
1036 _dwarf_error(dbg, error, DW_DLE_MACRO_OP_UNHANDLED);
1057 for (k = 0; k < formcount; ++k) {
1058 if (!valid_macro_form(
1059 curformentry->mf_formbytes[k])) {
1060 _dwarf_error(dbg, error,
1061 DW_DLE_MACRO_OP_UNHANDLED);
10371062 return (DW_DLV_ERROR);
10381063 }
10391064 }
10401065 }
1041 res = validate_opcode(macro_context->mc_dbg,curformentry, error);
1042 if(res != DW_DLV_OK) {
1066 res = validate_opcode(macro_context->mc_dbg,
1067 curformentry, error);
1068 if (res != DW_DLV_OK) {
10431069 return res;
10441070 }
10451071 }
10781104 {
10791105 Dwarf_Signed i = 0;
10801106
1081 for(i = 0; i < srcfiles_count; ++i) {
1107 for (i = 0; i < srcfiles_count; ++i) {
10821108 char * ostr = 0;
10831109 char * newstr = 0;
10841110 size_t slen = 0;
11011127 {
11021128 Dwarf_Signed i = 0;
11031129 for (i = 0; i < srcfiles_count; ++i) {
1104 if(srcfiles[i]) {
1130 if (srcfiles[i]) {
11051131 dwarf_dealloc(dbg, srcfiles[i], DW_DLA_STRING);
11061132 }
11071133 }
11681194 }
11691195 resattr = dwarf_attr(die, DW_AT_macros, &macro_attr, error);
11701196 if (resattr == DW_DLV_NO_ENTRY) {
1171 resattr = dwarf_attr(die, DW_AT_GNU_macros, &macro_attr, error);
1197 resattr = dwarf_attr(die, DW_AT_GNU_macros,
1198 &macro_attr, error);
11721199 }
11731200 if (resattr != DW_DLV_OK) {
11741201 return resattr;
11751202 }
11761203 if (!offset_specified) {
1177 lres = dwarf_global_formref(macro_attr, &macro_offset, error);
1204 lres = dwarf_global_formref(macro_attr,
1205 &macro_offset, error);
11781206 if (lres != DW_DLV_OK) {
11791207 dwarf_dealloc(dbg,macro_attr,DW_DLA_ATTR);
11801208 return lres;
13101338 return DW_DLV_ERROR;
13111339 }
13121340
1313 if ((section_base + DWARF_HALF_SIZE + sizeof(Dwarf_Small)) > section_end ) {
1341 if ((section_base + DWARF_HALF_SIZE + sizeof(Dwarf_Small)) >
1342 section_end ) {
13141343 dealloc_macro_srcfiles(srcfiles,srcfilescount);
13151344 dwarf_dealloc_macro_context(macro_context);
13161345 _dwarf_error(dbg, error, DW_DLE_MACRO_OFFSET_BAD);
00 /* Generated routines, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
00 /* Generated routines, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
00 /* Automatically generated, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
00 /* Automatically generated, do not edit. */
1 /* Generated sourcedate 2020-10-20 18:22:29-07:00 */
1 /* Generated sourcedate 2020-11-30 11:14:43-08:00 */
22
33 /* BEGIN FILE */
44
3333 #ifdef HAVE_SYS_TYPES_H
3434 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
3535 #endif /* HAVE_SYS_TYPES_H */
36 #ifdef HAVE_SYS_STAT_H
3637 #include <sys/stat.h> /* open() */
38 #endif /* HAVE_SYS_STAT_H */
3739 #include <fcntl.h> /* O_RDONLY */
3840 #ifdef HAVE_UNISTD_H
3941 #include <unistd.h> /* lseek read close */
3535
3636 #include "config.h"
3737 #include <stdio.h>
38 #ifdef HAVE_STRING_H
3839 #include <string.h> /* memcpy */
40 #endif /* HAVE_STRING_H */
3941 #ifdef HAVE_SYS_TYPES_H
4042 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
4143 #endif /* HAVE_SYS_TYPES_H */
110110 /*
111111 This structure provides the context for a compilation unit.
112112 Thus, it contains the Dwarf_Debug, cc_dbg, that this cu
113 belongs to. It contains the information in the compilation
114 unit header, cc_length, cc_version_stamp,
115 cc_abbrev_offset,
113 belongs to. It contains the information
114 in the compilation unit header, cc_length,
115 cc_version_stamp, cc_abbrev_offset,
116116 and cc_address_size, in the .debug_info section for that cu.
117117 In addition, it contains the count, cc_count_cu, of the cu
118118 number of that cu in the list of cu's in the .debug_info.
137137 Dwarf_Debug cc_dbg;
138138 /* The sum of cc_length, cc_length_size, and cc_extension_size
139139 is the total length of the CU including its header.
140
141140 cc_length is the length of the compilation unit excluding
142141 cc_length_size and cc_extension_size. */
143142 Dwarf_Unsigned cc_length;
171170 Dwarf_Small cc_segment_selector_size;
172171
173172 /* cc_debug_offset is the global offset in the section
174 of the CU header of this CU.
175 The length of the CU is at offset
176 cc_debug_offset-cc_length_size-cc_extension_size;
177 That is, it is a section global offset.
178 May be debug_info or debug_types
179 but those are distinct.
173 of the area length field of the CU.
174 The CU header of the CU is at offset
175 cc_debug_offset+cc_length_size+cc_extension_size;
176 This is a section global offset.
177 May be debug_info or debug_types.
180178 Even in DWP this is set to true global offset
181179 right away when cu_context created.
182180 See cc_is_info flag. */
374372 Dwarf_Small dss_zdebug_requires_decompress;
375373 Dwarf_Small dss_did_decompress;
376374 Dwarf_Small dss_shf_compressed; /* section flag SHF_COMPRESS */
377 Dwarf_Small dss_ZLIB_compressed; /* Section compression starts with ZLIB chars*/
375
376 /* Section compression starts with ZLIB chars*/
377 Dwarf_Small dss_ZLIB_compressed;
378378
379379 /* For non-elf, leaving the following fields zero
380380 will mean they are ignored. */
384384 Dwarf_Unsigned dss_link;
385385 /* The following is used when reading .rela sections
386386 (such sections appear in some .o files). */
387 Dwarf_Half dss_reloc_index; /* Zero means ignore the reloc fields. */
387 Dwarf_Half dss_reloc_index; /* Zero means ignore
388 the reloc fields. */
388389 Dwarf_Small * dss_reloc_data;
389390 Dwarf_Unsigned dss_reloc_size;
390391 Dwarf_Unsigned dss_reloc_entrysize;
391392 Dwarf_Addr dss_reloc_addr;
392 /* dss_reloc_symtab is the sh_link of a .rela to its .symtab, leave
393 /* dss_reloc_symtab is the sh_link of a .rela
394 to its .symtab, leave
393395 it 0 if non-meaningful. */
394396 Dwarf_Addr dss_reloc_symtab;
395 /* dss_reloc_link should be zero unless a reloc section has a link
396 to another (sh_link). Used to access the symtab for relocations
397 a section. */
397 /* dss_reloc_link should be zero unless a reloc section
398 has a link to another (sh_link).
399 Used to access the symtab for relocating a section. */
398400 Dwarf_Unsigned dss_reloc_link;
399401 /* Pointer to the elf symtab, used for elf .rela. Leave it 0
400402 if not relevant. */
480482 struct Dwarf_Section_s *ds_secdata;
481483
482484 unsigned ds_groupnumber;
483 int ds_duperr; /* Error code for duplicated section */
484 int ds_emptyerr; /* Error code for empty section */
485 int ds_have_dwarf; /* Section contains DWARF */
486 int ds_have_zdebug; /* Section compressed: .zdebug name */
485 int ds_duperr; /* Error code for duplicated section */
486 int ds_emptyerr; /* Error code for empty section */
487 int ds_have_dwarf; /* Section contains DWARF */
488 int ds_have_zdebug; /* Section compressed: .zdebug name */
487489 };
488490
489 /* As the number of debug sections does not change very often, in the case a
491 /* As the number of debug sections does not change very often,
492 in the case a
490493 new section is added in 'enter_section_in_array()'
491494 the 'MAX_DEBUG_SECTIONS' must
492495 be updated accordingly.
569572 char de_owns_fd;
570573 /* DW_PATHSOURCE_BASIC or MACOS or DEBUGLINK */
571574 unsigned char de_path_source;
575 unsigned char de_using_libelf;
572576 /* de_path is only set automatically if dwarf_init_path()
573577 was used to initialize things.
574578 Used with the .gnu_debuglink section. */
649653 struct Dwarf_Section_s de_debug_loclists; /* New in DWARF5 */
650654 struct Dwarf_Section_s de_debug_rnglists; /* New in DWARF5 */
651655 struct Dwarf_Section_s de_debug_frame;
652 struct Dwarf_Section_s de_gnu_debuglink; /* New September 2019 */
653 struct Dwarf_Section_s de_note_gnu_buildid; /* New September 2019 */
654
656 struct Dwarf_Section_s de_gnu_debuglink; /* New Sept. 2019 */
657 struct Dwarf_Section_s de_note_gnu_buildid; /* New Sept. 2019 */
655658
656659 /* gnu: the g++ eh_frame section */
657660 struct Dwarf_Section_s de_debug_frame_eh_gnu;
658661
659 struct Dwarf_Section_s de_debug_pubtypes; /* DWARF3 .debug_pubtypes */
660
662 /* DWARF3 .debug_pubtypes */
663 struct Dwarf_Section_s de_debug_pubtypes;
661664
662665 /* Four SGI IRIX extensions essentially
663666 identical to DWARF3 .debug_pubtypes.
698701 struct Dwarf_Section_s de_debug_gnu_pubnames;
699702 struct Dwarf_Section_s de_debug_gnu_pubtypes;
700703
701 /* For non-elf, simply leave the following two structs zeroed and
702 they will be ignored. */
704 /* For non-elf, simply leave the following two structs
705 zeroed and they will be ignored. */
703706 struct Dwarf_Section_s de_elf_symtab;
704707 struct Dwarf_Section_s de_elf_strtab;
705708
742745 See dwarf_return_empty_pubnames() */
743746 unsigned char de_return_empty_pubnames;
744747
745 struct Dwarf_dbg_sect_s de_debug_sections[DWARF_MAX_DEBUG_SECTIONS];
746 unsigned de_debug_sections_total_entries; /* Number actually used. */
748 struct Dwarf_dbg_sect_s de_debug_sections[
749 DWARF_MAX_DEBUG_SECTIONS];
750
751 /* Number actually used. */
752 unsigned de_debug_sections_total_entries;
747753
748754 struct Dwarf_Harmless_s de_harmless_errors;
749755
761767 file is sometimes needed
762768 and referenced.*/
763769 struct Dwarf_Tied_Data_s de_tied_data;
764
765770 };
766771
767772 /* New style. takes advantage of dwarfstrings capability.
792797 since DWARF3. */
793798 #define DISTINGUISHED_VALUE 0xffffffff
794799 #define DISTINGUISHED_VALUE_OFFSET_SIZE 8
795 #define DISTINGUISHED_VALUE_ARRAY(x) char x[4] = { 0xff,0xff,0xff,0xff }
800 #define DISTINGUISHED_VALUE_ARRAY(x) char x[4] = \
801 { 0xff,0xff,0xff,0xff }
796802
797803
798804 int _dwarf_ignorethissection(const char *scn_name);
799805
800 /* We don't load the sections until they are needed. This function is
801 used to load the section. */
806 /* We don't load the sections until they are needed.
807 This function is used to load the section. */
802808 int _dwarf_load_section(Dwarf_Debug,
803809 struct Dwarf_Section_s *,
804810 Dwarf_Error *);
884890
885891
886892 int _dwarf_get_fission_addition_die(Dwarf_Die die, int dw_sect_index,
887 Dwarf_Unsigned* offset, Dwarf_Unsigned*size,
888 Dwarf_Error *error);
889
893 Dwarf_Unsigned* offset, Dwarf_Unsigned*size,
894 Dwarf_Error *error);
890895 int _dwarf_get_addr_index_itself(int theform,
891896 Dwarf_Small *info_ptr,
892897 Dwarf_Debug dbg,
966971 Dwarf_Unsigned * addr_base_out,
967972 Dwarf_Error * error);
968973
969 int _dwarf_get_string_from_tied(Dwarf_Debug dbg, Dwarf_Unsigned offset,
974 int _dwarf_get_string_from_tied(Dwarf_Debug dbg,
975 Dwarf_Unsigned offset,
970976 char **return_str, Dwarf_Error*error);
971977
972978 int _dwarf_valid_form_we_know(Dwarf_Unsigned at_form,
973979 Dwarf_Unsigned at_name);
974 int _dwarf_extract_local_debug_str_string_given_offset(Dwarf_Debug dbg,
980 int _dwarf_extract_local_debug_str_string_given_offset(
981 Dwarf_Debug dbg,
975982 unsigned attrform,
976983 Dwarf_Unsigned offset,
977984 char ** return_str,
989996 Dwarf_Unsigned *flags_out,
990997 Dwarf_Unsigned *addralign_out,
991998 int *error);
992 extern _dwarf_get_elf_flags_func_ptr_type _dwarf_get_elf_flags_func_ptr;
999 extern _dwarf_get_elf_flags_func_ptr_type
1000 _dwarf_get_elf_flags_func_ptr;
9931001
9941002 /* This is libelf access to Elf object. */
9951003 extern int _dwarf_elf_setup(int fd,
10171025 Dwarf_Handler errhand,
10181026 Dwarf_Ptr errarg,
10191027 Dwarf_Debug *dbg,Dwarf_Error *error);
1020 void _dwarf_destruct_elf_nlaccess(struct Dwarf_Obj_Access_Interface_s *aip);
1028 void _dwarf_destruct_elf_nlaccess(
1029 struct Dwarf_Obj_Access_Interface_s *aip);
10211030
10221031 extern int _dwarf_macho_setup(int fd,
10231032 char *true_path,
10301039 Dwarf_Handler errhand,
10311040 Dwarf_Ptr errarg,
10321041 Dwarf_Debug *dbg,Dwarf_Error *error);
1033 void _dwarf_destruct_macho_access(struct Dwarf_Obj_Access_Interface_s *aip);
1042 void _dwarf_destruct_macho_access(
1043 struct Dwarf_Obj_Access_Interface_s *aip);
10341044
10351045 extern int _dwarf_pe_setup(int fd,
10361046 char *path,
10431053 Dwarf_Handler errhand,
10441054 Dwarf_Ptr errarg,
10451055 Dwarf_Debug *dbg,Dwarf_Error *error);
1046 void _dwarf_destruct_pe_access(struct Dwarf_Obj_Access_Interface_s *aip);
1056 void _dwarf_destruct_pe_access(
1057 struct Dwarf_Obj_Access_Interface_s *aip);
10471058
10481059 void _dwarf_create_address_size_dwarf_error(Dwarf_Debug dbg,
10491060 Dwarf_Error *error,
10601071 Dwarf_Unsigned *bytes_read,
10611072 Dwarf_Error *error);
10621073
1063 Dwarf_Byte_Ptr _dwarf_calculate_info_section_start_ptr(Dwarf_CU_Context context, Dwarf_Unsigned *section_len_out);
1064
1065 Dwarf_Byte_Ptr _dwarf_calculate_info_section_end_ptr(Dwarf_CU_Context context);
1066 Dwarf_Byte_Ptr _dwarf_calculate_abbrev_section_end_ptr(Dwarf_CU_Context context);
1074 Dwarf_Byte_Ptr _dwarf_calculate_info_section_start_ptr(
1075 Dwarf_CU_Context context,
1076 Dwarf_Unsigned *section_len_out);
1077
1078 Dwarf_Byte_Ptr _dwarf_calculate_info_section_end_ptr(
1079 Dwarf_CU_Context context);
1080 Dwarf_Byte_Ptr _dwarf_calculate_abbrev_section_end_ptr(
1081 Dwarf_CU_Context context);
10671082
10681083 int _dwarf_formblock_internal(Dwarf_Debug dbg,
10691084 Dwarf_Attribute attr,
3838 #endif
3939 #endif
4040 #include <stdio.h>
41 #ifdef HAVE_SYS_STAT_H
4142 #include <sys/stat.h>
43 #endif /* HAVE_SYS_STAT_H */
4244 #ifdef HAVE_SYS_TYPES_H
4345 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
4446 #endif /* HAVE_SYS_TYPES_H */
47 #ifdef HAVE_STRING_H
4548 #include <string.h>
49 #endif /* HAVE_STRING_H */
4650 #ifdef HAVE_STDLIB_H
4751 #include <stdlib.h>
4852 #endif /* HAVE_STDLIB_H */
114118 dwarf_elf_object_access_finish(binary_interface);
115119 return res;
116120 }
121 (*ret_dbg)->de_using_libelf = TRUE;
117122 res = dwarf_add_debuglink_global_path(*ret_dbg,
118123 "/usr/lib/debug",error);
119124 if (res != DW_DLV_OK){
218223 return res;
219224 }
220225 (*dbg)->de_filesize = filesize;
226 (*dbg)->de_using_libelf = TRUE;
221227 res = dwarf_add_debuglink_global_path(*dbg,
222228 "/usr/lib/debug",error);
223229 if (res != DW_DLV_OK){
4646 #ifdef HAVE_STDLIB_H
4747 #include <stdlib.h>
4848 #endif /* HAVE_STDLIB_H */
49 #ifdef HAVE_STRING_H
4950 #include <string.h> /* memcpy */
51 #endif /* HAVE_STRING_H */
5052 #ifdef HAVE_SYS_TYPES_H
5153 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
5254 #endif /* HAVE_SYS_TYPES_H */
55 #ifdef HAVE_SYS_STAT_H
5356 #include <sys/stat.h> /* open() */
57 #endif /* HAVE_SYS_STAT_H */
5458 #include <fcntl.h> /* open() */
5559 #include <time.h>
5660 #ifdef HAVE_UNISTD_H
2929
3030 #include "config.h"
3131 #include <stdio.h>
32 #ifdef HAVE_STDLIB_H
3233 #include <stdlib.h>
34 #endif /* HAVE_STDLIB_H */
3335 #include <time.h>
3436
3537 #include "dwarf_incl.h"
5355 Dwarf_Bool is_actuals_tab)
5456 {
5557 if (!is_single_tab) {
56 /* Ugly indenting follows, it makes lines shorter to see them better.
57 Best to use a wider text window to really see how it looks.*/
58 /* Ugly indenting follows, it makes lines shorter
59 to see them better.
60 Best to use a wider text window to really
61 see how it looks.*/
5862 if (is_actuals_tab) {
5963 _dwarf_printf(dbg,"\nActuals Table\n");
6064 _dwarf_printf(dbg,
101105 if(!is_single_table && is_actuals_table) {
102106 dwarfstring_append_printf_s(&m1,"%-15s ",(char *)prefix);
103107 dwarfstring_append_printf_i(&m1,"%3d ",opcode);
104 dwarfstring_append_printf_u(&m1,"0x%" DW_PR_XZEROS DW_PR_DUx ,
108 dwarfstring_append_printf_u(&m1,"0x%" DW_PR_XZEROS DW_PR_DUx,
105109 regs->lr_address);
106110 dwarfstring_append_printf_u(&m1,"/%01u",regs->lr_op_index);
107111 dwarfstring_append_printf_u(&m1," %5lu", regs->lr_line);
108 dwarfstring_append_printf_u(&m1," %3d",regs->lr_isa);
109 dwarfstring_append_printf_i(&m1," %1d", regs->lr_basic_block);
110 dwarfstring_append_printf_i(&m1,"%1d\n", regs->lr_end_sequence);
112 dwarfstring_append_printf_u(&m1," %3u",regs->lr_isa);
113 dwarfstring_append_printf_i(&m1," %1d",
114 regs->lr_basic_block);
115 dwarfstring_append_printf_i(&m1,"%1d\n",
116 regs->lr_end_sequence);
111117 _dwarf_printf(dbg,dwarfstring_string(&m1));
112118 dwarfstring_destructor(&m1);
113119 return;
137143 " x%02" DW_PR_DUx ,
138144 regs->lr_discriminator); /* DWARF4 */
139145 dwarfstring_append_printf_u(&m1,
140 " x%02" DW_PR_DUx , regs->lr_call_context); /* EXPERIMENTAL */
146 " x%02" DW_PR_DUx,
147 regs->lr_call_context); /* EXPERIMENTAL */
141148 dwarfstring_append_printf_u(&m1,
142 " x%02" DW_PR_DUx , regs->lr_subprogram); /* EXPERIMENTAL */
149 " x%02" DW_PR_DUx ,
150 regs->lr_subprogram); /* EXPERIMENTAL */
143151 dwarfstring_append_printf_i(&m1,
144152 " %1d", regs->lr_is_stmt);
145153 dwarfstring_append_printf_i(&m1,
235243 tname = "<unknown type>";
236244 }
237245 dwarfstring_append_printf_u (&m4,
238 " type 0x%" DW_PR_XZEROS DW_PR_DUx ,valpair->up_first);
246 " type 0x%" DW_PR_XZEROS DW_PR_DUx,
247 valpair->up_first);
239248 dwarfstring_append_printf_s (&m4,
240249 " %-20s\n",(char *)tname);
241250 res = dwarf_get_FORM_name(valpair->up_second,&fname);
304313 Dwarf_File_Entry fe = line_context->lc_file_entries;
305314 Dwarf_File_Entry fe2 = fe;
306315 dwarfstring m3;
307
316 unsigned increment = 1;
317
318 if (line_context->lc_version_number == DW_LINE_VERSION5 ) {
319 increment = 0;
320 }
308321 dwarfstring_constructor_static(&m3,locallinebuf,
309322 sizeof(locallinebuf));
310323 dwarfstring_append_printf_i(&m3,
318331
319332 fe = fe2;
320333 tlm2 = fe->fi_time_last_mod;
321 filenum = fiu+1;
334 filenum = fiu+increment;
322335
323336 /* The space character at the end of line is silly,
324337 but lets leave it there for the moment to avoid
326339 if (line_context->lc_file_entry_count > 9) {
327340 dwarfstring_append_printf_u(&m3,
328341 " file[%2u] ",fiu);
329 dwarfstring_append_printf_s(&m3,
330 "%-20s ",
331 (char *) fe->fi_file_name);
332 dwarfstring_append_printf_u(&m3,
333 "(file-number: %u)\n",
334 filenum);
335342 } else {
336343 dwarfstring_append_printf_u(&m3,
337344 " file[%u] ", fiu);
338 dwarfstring_append_printf_s(&m3,
339 "%-20s ",(char *)fe->fi_file_name);
340 dwarfstring_append_printf_u(&m3,
341 "(file-number: %u)\n",filenum);
342 }
345 }
346 /* DWARF5 can have a null fi_file_name
347 if the format code in the
348 line table header is unknown, such
349 as in a corrupt object file. */
350 dwarfstring_append_printf_s(&m3,
351 "%-20s ",
352 fe->fi_file_name?
353 (char *) fe->fi_file_name:
354 "<no file name>");
355 dwarfstring_append_printf_u(&m3,
356 "(file-number: %u)\n",
357 filenum);
343358 _dwarf_printf(dbg,dwarfstring_string(&m3));
344359 dwarfstring_reset(&m3);
345360 if (fe->fi_dir_index_present) {
508523 Dwarf_Small *line_ptr = 0;
509524 Dwarf_Small *orig_line_ptr = 0;
510525
511 /* Pointer to a DW_AT_stmt_list attribute in case it exists in the
512 die. */
526 /* Pointer to a DW_AT_stmt_list attribute in case
527 it exists in the die. */
513528 Dwarf_Attribute stmt_list_attr = 0;
514529
515530 /* Pointer to DW_AT_comp_dir attribute in die. */
567582 }
568583
569584 address_size = _dwarf_get_address_size(dbg, die);
570 resattr = dwarf_attr(die, DW_AT_stmt_list, &stmt_list_attr, error);
585 resattr = dwarf_attr(die, DW_AT_stmt_list, &stmt_list_attr,
586 error);
571587 if (resattr != DW_DLV_OK) {
572588 return resattr;
573589 }
599615 section_start = dbg->de_debug_line.dss_data;
600616 {
601617 Dwarf_Unsigned fission_size = 0;
602 int resfis = _dwarf_get_fission_addition_die(die, DW_SECT_LINE,
618 int resfis = _dwarf_get_fission_addition_die(die,
619 DW_SECT_LINE,
603620 &fission_offset,&fission_size,error);
604621 if(resfis != DW_DLV_OK) {
605622 dwarf_dealloc(dbg,stmt_list_attr, DW_DLA_ATTR);
611628 line_ptr = orig_line_ptr;
612629 dwarf_dealloc(dbg, stmt_list_attr, DW_DLA_ATTR);
613630
614 /* If die has DW_AT_comp_dir attribute, get the string that names
615 the compilation directory. */
631 /* If die has DW_AT_comp_dir attribute, get the string
632 that names the compilation directory. */
616633 resattr = dwarf_attr(die, DW_AT_comp_dir, &comp_dir_attr, error);
617634 if (resattr == DW_DLV_ERROR) {
618635 return resattr;
906923 is_actuals_table = true;
907924 /* Read Actuals */
908925
909 print_line_header(dbg, is_single_table, is_actuals_table);
926 print_line_header(dbg, is_single_table,
927 is_actuals_table);
910928 res = read_line_table_program(dbg,
911929 line_ptr_actuals, line_ptr_end, orig_line_ptr,
912930 section_start,
143143 dataptr = die->di_is_info? dbg->de_debug_info.dss_data:
144144 dbg->de_debug_types.dss_data;
145145
146 *cu_off = (die->di_debug_ptr - dataptr - cu_context->cc_debug_offset);
146 *cu_off = (die->di_debug_ptr - dataptr -
147 cu_context->cc_debug_offset);
147148 return DW_DLV_OK;
148149 }
149150
559560 &sov,
560561 die_info_end,
561562 error);
562 if(vres!= DW_DLV_OK) {
563 if (vres!= DW_DLV_OK) {
563564 dwarf_dealloc(dbg,new_attr,DW_DLA_ATTR);
564565 empty_local_attrlist(dbg,head_attr);
565566 return vres;
703704 Dwarf_Signed implicit_const = 0;
704705 int res = 0;
705706
706 DECODE_LEB128_UWORD_CK(abbrev_ptr, atmp3,dbg,error,abbrev_end);
707 DECODE_LEB128_UWORD_CK(abbrev_ptr, atmp3,dbg,
708 error,abbrev_end);
707709 if (atmp3 > DW_AT_hi_user) {
708710 _dwarf_error(dbg, error,DW_DLE_ATTR_CORRUPT);
709711 return DW_DLV_ERROR;
722724 Dwarf_Unsigned utmp6;
723725
724726 /* DECODE_LEB128_UWORD updates info_ptr */
725 DECODE_LEB128_UWORD_CK(info_ptr, utmp6,dbg,error,die_info_end);
727 DECODE_LEB128_UWORD_CK(info_ptr, utmp6,dbg,
728 error,die_info_end);
726729 curr_attr_form = (Dwarf_Half) utmp6;
727730 }
728731 if (curr_attr_form == DW_FORM_implicit_const) {
732735 }
733736 if (curr_attr == attr) {
734737 *attr_form = curr_attr_form;
735 if(implicit_const_out) {
738 if (implicit_const_out) {
736739 *implicit_const_out = implicit_const;
737740 }
738741 *ptr_to_value = info_ptr;
819822
820823 res = _dwarf_get_value_ptr(die, attr, &attr_form,&info_ptr,
821824 &implicit_const,error);
822 if(res == DW_DLV_ERROR) {
825 if (res == DW_DLV_ERROR) {
823826 return res;
824827 }
825 if(res == DW_DLV_NO_ENTRY) {
828 if (res == DW_DLV_NO_ENTRY) {
826829 *return_bool = false;
827830 return DW_DLV_OK;
828831 }
847850
848851 res = _dwarf_get_value_ptr(die, attr, &attr_form,&info_ptr,
849852 &implicit_const,error);
850 if(res == DW_DLV_ERROR) {
853 if (res == DW_DLV_ERROR) {
851854 return res;
852855 }
853 if(res == DW_DLV_NO_ENTRY) {
856 if (res == DW_DLV_NO_ENTRY) {
854857 return res;
855858 }
856859
920923 which is in the CU die. */
921924
922925 sectionstart = dbg->de_debug_addr.dss_data;
923 addr_offset = address_base + (addrindex * context->cc_address_size);
926 addr_offset = address_base +
927 (addrindex * context->cc_address_size);
924928 /* The offsets table is a series of address-size entries
925929 but with a base. */
926930 sectionsize = dbg->de_debug_addr.dss_size;
10311035 dbg = context->cc_dbg;
10321036 res2 = _dwarf_get_addr_index_itself(attr_form,
10331037 info_ptr,dbg,context, &index_to_addr,error);
1034 if(res2 != DW_DLV_OK) {
1038 if (res2 != DW_DLV_OK) {
10351039 return res2;
10361040 }
10371041 /* error is returned on dbg, not tieddbg. */
10651069 offset_size = context->cc_length_size;
10661070 res = _dwarf_get_value_ptr(die, DW_AT_low_pc,
10671071 &attr_form,&info_ptr,0,error);
1068 if(res == DW_DLV_ERROR) {
1072 if (res == DW_DLV_ERROR) {
10691073 return res;
10701074 }
1071 if(res == DW_DLV_NO_ENTRY) {
1075 if (res == DW_DLV_NO_ENTRY) {
10721076 return res;
10731077 }
10741078 version = context->cc_version_stamp;
10801084 return (DW_DLV_ERROR);
10811085 }
10821086
1083 if(attr_form == DW_FORM_GNU_addr_index ||
1087 if (attr_form == DW_FORM_GNU_addr_index ||
10841088 attr_form == DW_FORM_addrx) {
10851089 /* error is returned on dbg, not tieddbg. */
10861090 res = _dwarf_look_in_local_and_tied(
11941198 context-> cc_rnglists_base=
11951199 tiedcontext->cc_rnglists_base;
11961200 }
1197 if(!context->cc_loclists_base_present) {
1201 if (!context->cc_loclists_base_present) {
11981202 context-> cc_loclists_base_present =
11991203 tiedcontext->cc_loclists_base_present;
12001204 context-> cc_loclists_base=
12011205 tiedcontext->cc_loclists_base;
12021206 }
1203 if(!context->cc_str_offsets_base_present) {
1207 if (!context->cc_str_offsets_base_present) {
12041208 context-> cc_str_offsets_base_present =
12051209 tiedcontext->cc_str_offsets_base_present;
12061210 context-> cc_str_offsets_base=
12081212 }
12091213
12101214 /* GNU DW4 extension. */
1211 if(!context-> cc_ranges_base_present) {
1215 if (!context-> cc_ranges_base_present) {
12121216 context-> cc_ranges_base_present =
12131217 tiedcontext->cc_ranges_base_present;
12141218 context-> cc_ranges_base =
12151219 tiedcontext->cc_ranges_base;
12161220 }
12171221
1218 if(tiedcontext_out) {
1222 if (tiedcontext_out) {
12191223 *tiedcontext_out = tiedcontext;
12201224 }
12211225 return DW_DLV_OK;
12281232 Dwarf_Unsigned *sbase_out,
12291233 UNUSEDARG Dwarf_Error *error)
12301234 {
1231 if(context->cc_str_offsets_base_present) {
1235 if (context->cc_str_offsets_base_present) {
12321236 *sbase_out = context->cc_str_offsets_base;
12331237 return DW_DLV_OK;
12341238 }
12421246 */
12431247
12441248
1245 /* This works for all versions of DWARF.
1249 /* This works for all versions of DWARF.
12461250 This is the preferred interface, cease using dwarf_highpc.
12471251 The consumer has to check the return_form or
12481252 return_class to decide if the value returned
12741278
12751279 res = _dwarf_get_value_ptr(die, DW_AT_high_pc,
12761280 &attr_form,&info_ptr,0,error);
1277 if(res == DW_DLV_ERROR) {
1281 if (res == DW_DLV_ERROR) {
12781282 return res;
12791283 }
1280 if(res == DW_DLV_NO_ENTRY) {
1284 if (res == DW_DLV_NO_ENTRY) {
12811285 return res;
12821286 }
12831287 die_info_end = _dwarf_calculate_info_section_end_ptr(
13011305 /* error is returned on dbg, not tied */
13021306 res2 = _dwarf_get_addr_index_itself(attr_form,
13031307 info_ptr,dbg,context,&index_to_addr,error);
1304 if(res2 != DW_DLV_OK) {
1308 if (res2 != DW_DLV_OK) {
13051309 return res2;
13061310 }
13071311 res2= _dwarf_look_in_local_and_tied_by_index(dbg,
13091313 index_to_addr,
13101314 &addr_out,
13111315 error);
1312 if(res2 != DW_DLV_OK) {
1316 if (res2 != DW_DLV_OK) {
13131317 return res2;
13141318 }
13151319 }
13221326 Dwarf_Unsigned v = 0;
13231327 res3 = _dwarf_die_attr_unsigned_constant(die,DW_AT_high_pc,
13241328 &v,error);
1325 if(res3 != DW_DLV_OK) {
1329 if (res3 != DW_DLV_OK) {
13261330 Dwarf_Byte_Ptr info_ptr2 = 0;
13271331
13281332 res3 = _dwarf_get_value_ptr(die, DW_AT_high_pc,
13291333 &attr_form,&info_ptr2,0,error);
1330 if(res3 == DW_DLV_ERROR) {
1334 if (res3 == DW_DLV_ERROR) {
13311335 return res3;
13321336 }
1333 if(res3 == DW_DLV_NO_ENTRY) {
1337 if (res3 == DW_DLV_NO_ENTRY) {
13341338 return res3;
13351339 }
13361340 if (attr_form == DW_FORM_sdata) {
13871391 _dwarf_error(dbg, error, DW_DLE_NO_TIED_ADDR_AVAILABLE);
13881392 return DW_DLV_ERROR;
13891393 }
1390 if(! context->cc_addr_base_present) {
1394 if (!context->cc_addr_base_present) {
13911395 /* Does not exist. */
13921396 return DW_DLV_NO_ENTRY;
13931397 }
13951399 context->cc_signature,
13961400 &tiedcontext,
13971401 error);
1398 if ( res == DW_DLV_ERROR) {
1402 if (res == DW_DLV_ERROR) {
13991403 /* Associate the error with dbg, not tieddbg */
14001404 _dwarf_error_mv_s_to_t(tieddbg,error,dbg,error);
14011405 return res;
14471451
14481452 CHECK_DIE(die, DW_DLV_ERROR);
14491453
1450 die_info_end = _dwarf_calculate_info_section_end_ptr(die->di_cu_context);
1454 die_info_end =
1455 _dwarf_calculate_info_section_end_ptr(die->di_cu_context);
14511456 dbg = die->di_cu_context->cc_dbg;
14521457 res = _dwarf_get_value_ptr(die,attr,&attr_form,
14531458 &info_ptr,0,error);
1454 if(res != DW_DLV_OK) {
1459 if (res != DW_DLV_OK) {
14551460 return res;
14561461 }
14571462 switch (attr_form) {
16991704
17001705 case DW_FORM_data4:
17011706 if (dwversion <= 3 && offset_size == 4) {
1702 enum Dwarf_Form_Class class = dw_get_special_offset(attrnum,
1703 dwversion);
1707 enum Dwarf_Form_Class class =
1708 dw_get_special_offset(attrnum, dwversion);
17041709 if (class != DW_FORM_CLASS_UNKNOWN) {
17051710 return class;
17061711 }
17081713 return DW_FORM_CLASS_CONSTANT;
17091714 case DW_FORM_data8:
17101715 if (dwversion <= 3 && offset_size == 8) {
1711 enum Dwarf_Form_Class class = dw_get_special_offset(attrnum,
1712 dwversion);
1716 enum Dwarf_Form_Class class =
1717 dw_get_special_offset(attrnum, dwversion);
17131718 if (class != DW_FORM_CLASS_UNKNOWN) {
17141719 return class;
17151720 }
17171722 return DW_FORM_CLASS_CONSTANT;
17181723 case DW_FORM_sec_offset:
17191724 {
1720 enum Dwarf_Form_Class class = dw_get_special_offset(attrnum,
1721 dwversion);
1725 enum Dwarf_Form_Class class =
1726 dw_get_special_offset(attrnum, dwversion);
17221727 if (class != DW_FORM_CLASS_UNKNOWN) {
17231728 return class;
17241729 }
17521757 case DW_FORM_flag: return DW_FORM_CLASS_FLAG;
17531758 case DW_FORM_flag_present: return DW_FORM_CLASS_FLAG;
17541759
1755 case DW_FORM_addrx: return DW_FORM_CLASS_ADDRESS; /* DWARF5 */
1760 case DW_FORM_addrx:
1761 return DW_FORM_CLASS_ADDRESS; /* DWARF5 */
17561762 case DW_FORM_GNU_addr_index: return DW_FORM_CLASS_ADDRESS;
1757 case DW_FORM_strx: return DW_FORM_CLASS_STRING; /* DWARF5 */
1763 case DW_FORM_strx:
1764 return DW_FORM_CLASS_STRING; /* DWARF5 */
17581765 case DW_FORM_GNU_str_index: return DW_FORM_CLASS_STRING;
17591766
1760 case DW_FORM_rnglistx: return DW_FORM_CLASS_RNGLIST; /* DWARF5 */
1761 case DW_FORM_loclistx: return DW_FORM_CLASS_LOCLIST; /* DWARF5 */
1767 case DW_FORM_rnglistx:
1768 return DW_FORM_CLASS_RNGLIST; /* DWARF5 */
1769 case DW_FORM_loclistx:
1770 return DW_FORM_CLASS_LOCLIST; /* DWARF5 */
17621771
17631772 case DW_FORM_GNU_ref_alt: return DW_FORM_CLASS_REFERENCE;
17641773 case DW_FORM_GNU_strp_alt: return DW_FORM_CLASS_STRING;
1765 case DW_FORM_strp_sup: return DW_FORM_CLASS_STRING; /* DWARF5 */
1766 case DW_FORM_implicit_const: return DW_FORM_CLASS_CONSTANT; /* DWARF5 */
1774 case DW_FORM_strp_sup: return DW_FORM_CLASS_STRING; /* DW5 */
1775 case DW_FORM_implicit_const:
1776 return DW_FORM_CLASS_CONSTANT; /* DWARF5 */
17671777
17681778 case DW_FORM_indirect:
17691779 default:
18101820 struct Dwarf_Section_s *sec = 0;
18111821
18121822 dbg = context->cc_dbg;
1813 sec = context->cc_is_info? &dbg->de_debug_info: &dbg->de_debug_types;
1823 sec = context->cc_is_info? &dbg->de_debug_info:
1824 &dbg->de_debug_types;
18141825 dataptr = sec->dss_data;
18151826 *section_len = sec->dss_size;
18161827 return dataptr;
18491860 abbrev_end = abbrev_start + sec->dss_size;
18501861 return abbrev_end;
18511862 }
1863
1864 /* New December 2020. Any Dwarf_Die will work.
1865 The values returned are about the CU itself, not a DIE.
1866 extension_size is set zero unless it offset_size
1867 is 64 and it is standard Dwarf, in which case
1868 extension_size is set to 4.
1869 If there is no signature *signature is set zero,
1870 offset_of_length is the section offset of the first
1871 byte of the compilation-unit length field.
1872 total_byte_length includes the length field and
1873 all the CU data.
1874 The offset of the first byte of the CU is therefore
1875 offset_of_lenth + offset_size + extension_size.
1876 is_info is always non-zero except if the section
1877 of the CU is DWARF4 .debug_types.
1878 */
1879 int dwarf_cu_header_basics(Dwarf_Die die,
1880 Dwarf_Half *version,
1881 Dwarf_Bool *is_info,
1882 Dwarf_Bool *is_dwo,
1883 Dwarf_Half *offset_size,
1884 Dwarf_Half *address_size,
1885 Dwarf_Half *extension_size,
1886 Dwarf_Sig8 **signature,
1887 Dwarf_Off *offset_of_length,
1888 Dwarf_Unsigned *total_byte_length,
1889 Dwarf_Error *error)
1890 {
1891 Dwarf_CU_Context context = 0;
1892 CHECK_DIE(die, DW_DLV_ERROR);
1893
1894 context= die->di_cu_context;
1895 if (version) {
1896 *version = context->cc_version_stamp;
1897 }
1898 if (is_info) {
1899 /* ASSERT: matches context->cc_is_info */
1900 *is_info = die->di_is_info;
1901 }
1902 if (is_dwo) {
1903 *is_dwo = context->cc_is_dwo;
1904 }
1905 if (offset_size) {
1906 *offset_size = context->cc_length_size;
1907 }
1908 if (address_size) {
1909 *address_size = context->cc_address_size;
1910 }
1911 if (extension_size) {
1912 *extension_size = context->cc_extension_size;
1913 }
1914 if (signature) {
1915 if (context->cc_signature_present) {
1916 *signature = &context->cc_signature;
1917 } else {
1918 *signature = 0;
1919 }
1920 }
1921 if (offset_of_length) {
1922 *offset_of_length = context->cc_debug_offset;
1923 }
1924 if (total_byte_length) {
1925 *total_byte_length = context->cc_length +
1926 context->cc_length_size + context->cc_extension_size;
1927 }
1928 return DW_DLV_OK;
1929 }
2828
2929 #include "config.h"
3030 #include <stdio.h>
31 #ifdef HAVE_STDLIB_H
3132 #include <stdlib.h>
33 #endif /* HAVE_STDLIB_H */
3234 #include "dwarf_incl.h"
3335 #include "dwarf_alloc.h"
3436 #include "dwarf_error.h"
9395 If incoming die is NULL there is no context, so do not look
9496 for a tied file, and address_size is the size
9597 of the overall object, not the address_size of the context. */
96 #define MAX_ADDR ((address_size == 8)?0xffffffffffffffffULL:0xffffffff)
98 #define MAX_ADDR ((address_size == 8)? \
99 0xffffffffffffffffULL:0xffffffff)
97100 int dwarf_get_ranges_a(Dwarf_Debug dbg,
98101 Dwarf_Off rangesoffset,
99102 Dwarf_Die die,
170173 but did get emitted, the note says, but
171174 the note is probably obsolete (so, now wrong).
172175 http://llvm.1065342.n5.nabble.com/DebugInfo\
173 -DW-AT-GNU-ranges-base-in-non-fission-td64194.html
176 -DW-AT-GNU-ranges-base-in-non-fission-\
177 td64194.html
174178 */
175179 /* ranges_base was merged from tied context. */
176180 ranges_base = cucontext->cc_ranges_base;
3131
3232 #include "config.h"
3333 #include <stdio.h>
34 #include <stdlib.h>
3534 #ifdef HAVE_STDLIB_H
3635 #include <stdlib.h>
3736 #endif /* HAVE_STDLIB_H */
4646 #ifdef HAVE_SYS_TYPES_H
4747 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
4848 #endif /* HAVE_SYS_TYPES_H */
49 #ifdef HAVE_SYS_STAT_H
4950 #include <sys/stat.h> /* for open() */
51 #endif /* HAVE_SYS_STAT_H */
5052 #include <fcntl.h> /* for open() */
5153 #include "dwarf_incl.h"
5254 #include "dwarf_alloc.h"
00 /*
1
21 Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
32 Portions Copyright (C) 2009-2020 David Anderson. All Rights Reserved.
43
7776
7877
7978 int
80 dwarf_varname(Dwarf_Var var_in, char **ret_varname, Dwarf_Error * error)
79 dwarf_varname(Dwarf_Var var_in,
80 char **ret_varname,
81 Dwarf_Error * error)
8182 {
8283 Dwarf_Global var = (Dwarf_Global) var_in;
8384
4646 #ifdef HAVE_STDLIB_H
4747 #include <stdlib.h> /* for malloc */
4848 #endif /* HAVE_STDLIB_H */
49 #ifdef HAVE_STRING_H
4950 #include <string.h> /* for strlen */
51 #endif /* HAVE_STRING_H */
5052 #ifdef HAVE_MALLOC_H
5153 /* Useful include for some Windows compilers. */
5254 #include <malloc.h>
9496 g->s_size - g->s_avail;
9597 unsigned long malloclen = newlen+1;
9698
97 if(malloclen < minimumnewlen) {
99 if (malloclen < minimumnewlen) {
98100 malloclen = minimumnewlen;
99101 }
100102 b = malloc(malloclen);
129131 }
130132
131133 int
132 dwarfstring_constructor_fixed(struct dwarfstring_s *g,unsigned long len)
134 dwarfstring_constructor_fixed(struct dwarfstring_s *g,
135 unsigned long len)
133136 {
134137 int r = FALSE;
135138
203206 {
204207 unsigned long dlen = 0;
205208
206 if(!str) {
209 if (!str) {
207210 return TRUE;
208211 }
209212 dlen = strlen(str);
246249 _dwarfstring_append_zeros(dwarfstring *data, size_t l)
247250 {
248251 int res = 0;
249 static char zeros[] = {"0000000000000000000000000000000000000000"};
252 static char zeros[] = {
253 "0000000000000000000000000000000000000000"};
250254 size_t charct = sizeof(zeros)-1;
251255
252256 while (l > charct) {
265269 int dwarfstring_append_printf_s(dwarfstring *data,
266270 char *format,char *s)
267271 {
268 size_t stringlen = strlen(s);
272 size_t stringlen = 0;
269273 size_t next = 0;
270274 long val = 0;
271275 char *endptr = 0;
277281 size_t prefixlen = 0;
278282 int res = 0;
279283
284 if (!s) {
285 s="<ERROR: null string pointer to "
286 "dwarfstring_append_printf_s>";
287 }
288 stringlen = strlen(s);
289 if (!format) {
290 format="<ERROR: null format pointer to "
291 "dwarfstring_append_printf_s>";
292 }
280293 while (format[next] && format[next] != '%') {
281294 ++next;
282295 ++prefixlen;
311324 if (leftjustify) {
312325
313326 dwarfstring_append_length(data,s,stringlen);
314 if(fixedlen) {
327 if (fixedlen) {
315328 size_t trailingspaces = fixedlen - stringlen;
316329
317330 _dwarfstring_append_spaces(data,trailingspaces);
322335 taking all the chars from s*/
323336 dwarfstring_append_length(data,s,stringlen);
324337 } else {
325 if(fixedlen) {
338 if (fixedlen) {
326339 size_t leadingspaces = fixedlen - stringlen;
327340 size_t k = 0;
328341
381394 size_t prefixlen = 0;
382395 int done = 0;
383396
397 if (!format) {
398 format="<ERROR: null format pointer to "
399 "dwarfstring_append_printf_i>";
400 }
384401 while (format[next] && format[next] != '%') {
385402 ++next;
386403 ++prefixlen;
393410 next++;
394411 if (format[next] == '-') {
395412 minuscount++;
396 return FALSE;
413 next++;
397414 }
398415 if (format[next] == '+') {
399416 pluscount++;
417 next++;
418 }
419 if (format[next] == '-') {
420 minuscount++;
400421 next++;
401422 }
402423 if (format[next] == '0') {
433454 lcount++;
434455 next++;
435456 }
457 if (format[next] == 'l') {
458 lcount++;
459 next++;
460 }
436461 if (format[next] == 'u') {
437462 ucount++;
438463 next++;
451476 }
452477 if (format[next] == 's') {
453478 /* ESBERR("ESBERR_pct_scount_in_i"); */
479 dwarfstring_append(data,
480 "<ERROR: format %s passed to "
481 "dwarfstring_append_printf_i>");
454482 return FALSE;
455483 }
456484 if (xcount || Xcount) {
458486 just copying the entire format makes
459487 it easier for coders to understand
460488 nothing much was done */
489 dwarfstring_append(data,
490 "<ERROR: format %x or %X passed to "
491 "dwarfstring_append_printf_i>");
461492 dwarfstring_append(data,format+prefixlen);
462493 return FALSE;
463494 }
464495 if (!dcount || (lcount >2) ||
465496 (Xcount+xcount+dcount+ucount) > 1) {
466497 /* error */
498 dwarfstring_append(data,
499 "<ERROR: format has too many %x/d/u/l passed to "
500 "dwarfstring_append_printf_i>");
467501 /* ESBERR("ESBERR_xcount_etc_i"); */
468502 return FALSE;
469503 }
470504 if (pluscount && minuscount) {
471505 /* We don't allow format +- */
506 dwarfstring_append(data,
507 "<ERROR: format disallowed. +- passed to "
508 "dwarfstring_append_printf_i>");
472509 return FALSE;
473510 }
474511 {
508545 remaining = -v;
509546 }
510547 }else {
548 dwarfstring_append(data,
549 "<ERROR: v passed to "
550 "dwarfstring_append_printf_i "
551 "cannot be handled:integer size>");
511552 /* ESBERR("ESBERR_sizeof_v_i"); */
512553 /* error */
513554 return FALSE;
514555 }
515556 }
516 if(!done) {
557 if (!done) {
517558 for ( ;; ) {
518559 dwarfstring_u dig = 0;
519560
585626 unsigned leadzeroscount = 0;
586627 unsigned trimoff = 0;
587628
588 for(; *cp; ++cp) {
629 for (; *cp; ++cp) {
589630 if (*cp == '0') {
590631 leadzeroscount++;
591632 continue;
628669 size_t divisor = 0;
629670 size_t prefixlen = 0;
630671
672 if (!format) {
673 format="<ERROR: null format pointer to "
674 "dwarfstring_append_printf_u>";
675 }
631676 while (format[next] && format[next] != '%') {
632677 ++next;
633678 ++prefixlen;
639684 }
640685 next++;
641686 if (format[next] == '-') {
687 dwarfstring_append(data,
688 "<ERROR: format - passed to "
689 "dwarfstring_append_printf_u "
690 "cannot be handled>");
642691 /*ESBERR("ESBERR_printf_u - format not supported"); */
643 next++;
692 return FALSE;
644693 }
645694 if (format[next] == '0') {
646695 leadingzero = 1;
676725 lcount++;
677726 next++;
678727 }
728 if (format[next] == 'l') {
729 lcount++;
730 next++;
731 }
679732 if (format[next] == 'u') {
680733 ucount++;
681734 next++;
693746 next++;
694747 }
695748 if (format[next] == 's') {
749 dwarfstring_append(data,
750 "<ERROR: format %s passed to "
751 "dwarfstring_append_printf_u "
752 "cannot be handled>");
696753 /* ESBERR("ESBERR_pct_scount_in_u"); */
697754 return FALSE;
698755 }
699
700756 if ( (Xcount +xcount+dcount+ucount) > 1) {
757 dwarfstring_append(data,
758 "<ERROR: format %x X d u repeats to "
759 "dwarfstring_append_printf_u "
760 "cannot be handled>");
701761 /* ESBERR("ESBERR_pct_xcount_etc_u"); */
702762 return FALSE;
703763 }
764 if ( (Xcount +xcount+dcount+ucount) == 0) {
765 dwarfstring_append(data,
766 "<ERROR: format %x X d u missing to "
767 "dwarfstring_append_printf_u "
768 "cannot be handled>");
769 /* ESBERR("ESBERR_pct_xcount_etc_u"); */
770 return FALSE;
771 }
704772 if (lcount > 2) {
773 dwarfstring_append(data,
774 "<ERROR: format % lll to "
775 "dwarfstring_append_printf_u "
776 "cannot be handled>");
705777 /* ESBERR("ESBERR_pct_lcount_error_u"); */
706778 /* error */
707779 return FALSE;
708780 }
709781 if (dcount > 0) {
782 dwarfstring_append(data,
783 "<ERROR: format %d to "
784 "dwarfstring_append_printf_u "
785 "cannot be handled>");
710786 /*ESBERR("ESBERR_pct_dcount_error_u");*/
711787 /* error */
712788 return FALSE;
4343 It does know of the leading ":" in the option string.
4444 See BADCH below.
4545 */
46
46 #include "config.h"
4747 #include <stdio.h>
4848 #ifdef HAVE_STDLIB_H
4949 #include <stdlib.h>
5050 #endif /* HAVE_STDLIB_H */
51 #ifdef HAVE_STRING_H
5152 #include <string.h> /* For strchr */
53 #endif /* HAVE_STRING_H */
54
5255 #include "dwgetopt.h"
5356
5457 #define STRIP_OFF_CONSTNESS(a) ((void *)(size_t)(const void *)(a))
00 /*
1
21 Copyright (C) 2000-2010 Silicon Graphics, Inc. All Rights Reserved.
32 Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
43 Portions Copyright 2008-2018 David Anderson. All rights reserved.
125124 typedef struct Dwarf_Sig8_s Dwarf_Sig8;
126125
127126 /* Contains info on an uninterpreted block of data
128 Used with certain frame information functions and
129 also used with DW_FORM_block<>.
127 Used with certain location information functions,
128 a frame expression function, and
129 also used with DW_FORM_block<> functions.
130130 */
131131 typedef struct {
132 Dwarf_Unsigned bl_len; /* length of block bl_data points at */
133 Dwarf_Ptr bl_data; /* uninterpreted data */
132 Dwarf_Unsigned bl_len; /* length of block bl_data points at */
133 Dwarf_Ptr bl_data; /* uninterpreted data */
134134
135135 /* See libdwarf.h DW_LKIND* */
136136 Dwarf_Small bl_from_loclist;
179179 Not usable with DWARF5 or DWARF4 with location
180180 operator extensions. */
181181 typedef struct {
182 Dwarf_Small lr_atom; /* location operation */
183 Dwarf_Unsigned lr_number; /* operand */
184 Dwarf_Unsigned lr_number2; /* for OP_BREGx and DW_OP_GNU_const_type*/
185 Dwarf_Unsigned lr_offset; /* offset in locexpr for OP_BRA etc */
182 Dwarf_Small lr_atom; /* location operation */
183 Dwarf_Unsigned lr_number; /* operand */
184 /* for OP_BREGx and DW_OP_GNU_const_type*/
185 Dwarf_Unsigned lr_number2;
186 Dwarf_Unsigned lr_offset; /* offset in locexpr for OP_BRA etc */
186187 } Dwarf_Loc;
187188
188189
330331 #define DW_EXPR_VAL_EXPRESSION 3
331332
332333 typedef struct Dwarf_Regtable_Entry_s {
333 /* For each index i (naming a hardware register with dwarf number
334 i) the following is true and defines the value of that register:
334 /* For each index i (naming a hardware register
335 with dwarf number i) the following is true and defines
336 the value of that register:
335337
336338 If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
337339 it is not DWARF register number but
338 a place holder indicating the register has no defined value.
340 a place holder indicating the register has
341 no defined value.
339342 If dw_regnum is Register DW_FRAME_SAME_VAL
340343 it is not DWARF register number but
341344 a place holder indicating the register has the same
350353 software register numbers in the machine hardware)
351354 and the following applies:
352355
353 if dw_value_type == DW_EXPR_OFFSET (the only case for dwarf2):
356 if dw_value_type == DW_EXPR_OFFSET (the
357 only case for dwarf2):
354358 If dw_offset_relevant is non-zero, then
355359 the value is stored at at the address CFA+N where
356360 N is a signed offset.
357361 Rule: Offset(N)
358 If dw_offset_relevant is zero, then the value of the register
359 is the value of (DWARF) register number dw_regnum.
362 If dw_offset_relevant is zero, then the
363 value of the register
364 is the value of (DWARF) register
365 number dw_regnum.
360366 Rule: register(F)
361367 Other values of dw_value_type are an error.
362368 */
386392
387393 If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
388394 it is not DWARF register number but
389 a place holder indicating the register has no defined value.
395 a place holder indicating the register
396 has no defined value.
390397 If dw_regnum is Register DW_FRAME_SAME_VAL
391398 it is not DWARF register number but
392399 a place holder indicating the register has the same
398405 DW_FRAME_* Values present on disk are in dwarf.h
399406 Because DW_FRAME_SAME_VAL and DW_FRAME_UNDEFINED_VAL
400407 and DW_FRAME_CFA_COL3 are definable at runtime
401 consider the names symbolic in this comment, not absolute.
408 consider the names symbolic in this comment,
409 not absolute.
402410
403411 Otherwise: the register number is a DWARF register number
404412 (see ABI documents for how this translates to hardware/
410418 not DW_FRAME_CFA_COL3, nor DW_FRAME_SAME_VAL, nor
411419 DW_FRAME_UNDEFINED_VAL.
412420
413 If dw_value_type == DW_EXPR_OFFSET (the only possible case for
414 dwarf2):
421 If dw_value_type == DW_EXPR_OFFSET (the only
422 possible case for dwarf2):
415423 If dw_offset_relevant is non-zero, then
416424 the value is stored at at the address
417425 CFA+N where N is a signed offset.
420428 So dw_offset_or_block_len is a signed value, really,
421429 and must be printed/evaluated as such.
422430 Rule: Offset(N)
423 If dw_offset_relevant is zero, then the value of the register
431 If dw_offset_relevant is zero, then the
432 value of the register
424433 is the value of (DWARF) register number dw_regnum.
425434 Rule: register(R)
426435 If dw_value_type == DW_EXPR_VAL_OFFSET
427 the value of this register is CFA +N where N is a signed offset.
436 the value of this register is CFA +N where
437 N is a signed offset.
428438 dw_regnum is the cfa register rule which means
429439 one ignores dw_regnum and uses the CFA appropriately.
430440 Rule: val_offset(N)
432442 The value of the register is the value at the address
433443 computed by evaluating the DWARF expression E.
434444 Rule: expression(E)
435 The expression E byte stream is pointed to by dw_block_ptr.
445 The expression E byte stream is pointed to by
446 dw_block_ptr.
436447 The expression length in bytes is given by
437448 dw_offset_or_block_len.
438449 If dw_value_type == DW_EXPR_VAL_EXPRESSION
439450 The value of the register is the value
440451 computed by evaluating the DWARF expression E.
441452 Rule: val_expression(E)
442 The expression E byte stream is pointed to by dw_block_ptr.
453 The expression E byte stream is pointed to
454 by dw_block_ptr.
443455 The expression length in bytes is given by
444456 dw_offset_or_block_len.
445457 Other values of dw_value_type are an error.
485497 If DW_DLV_OK returns the regnum and offset thru the pointers
486498 (which the consumer must use appropriately).
487499 */
488 int dwarf_frame_get_reg_register(struct Dwarf_Regtable_Entry3_s *reg_in,
500 int dwarf_frame_get_reg_register(
501 struct Dwarf_Regtable_Entry3_s *reg_in,
489502 Dwarf_Small *offset_relevant,
490503 Dwarf_Half *regnum_out,
491504 Dwarf_Signed *offset_out);
495508 The caller must pass in the address of a valid
496509 Dwarf_Block (the caller need not initialize it).
497510 */
498 int dwarf_frame_get_reg_expression(struct Dwarf_Regtable_Entry3_s *reg_in,
511 int dwarf_frame_get_reg_expression(
512 struct Dwarf_Regtable_Entry3_s *reg_in,
499513 Dwarf_Block *block_out);
500514
501515
535549
536550 typedef struct Dwarf_P_String_Attr_s * Dwarf_P_String_Attr;
537551 struct Dwarf_P_String_Attr_s {
538 Dwarf_Unsigned sa_offset; /* Offset of string attribute data */
552 /* Offset of string attribute data */
553 Dwarf_Unsigned sa_offset;
539554 Dwarf_Unsigned sa_nbytes;
540555 };
541556
577592
578593 /* error handler function
579594 */
580 typedef void (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/);
595 typedef void (*Dwarf_Handler)(Dwarf_Error /*error*/,
596 Dwarf_Ptr /*errarg*/);
581597
582598
583599 /* Begin libdwarf Object File Interface declarations.
584600
585601 As of February 2008 there are multiple dwarf_reader object access
586602 initialization methods available:
587 The traditional dwarf_elf_init() and dwarf_init() and dwarf_finish()
588 which assume libelf and POSIX file access.
589 An object-file and library agnostic dwarf_object_init() and dwarf_object_finish()
603 The traditional dwarf_elf_init() and dwarf_init() and
604 dwarf_finish() which assume libelf and POSIX file access.
605 An object-file and library agnostic dwarf_object_init()
606 and dwarf_object_finish()
590607 which allow the coder to provide object access routines
591 abstracting away the elf interface. So there is no dependence in the
608 abstracting away the elf interface.
609 So there is no dependence in the
592610 reader code on the object format and no dependence on libelf.
593611 See the code in dwarf_elf_access.c and dwarf_original_elf_init.c
594612 to see an example of initializing the structures mentioned below.
605623 split-dwarf sections can be accessed.
606624 */
607625
608 typedef struct Dwarf_Obj_Access_Interface_s Dwarf_Obj_Access_Interface;
609 typedef struct Dwarf_Obj_Access_Methods_s Dwarf_Obj_Access_Methods;
610 typedef struct Dwarf_Obj_Access_Section_s Dwarf_Obj_Access_Section;
626 typedef struct Dwarf_Obj_Access_Interface_s
627 Dwarf_Obj_Access_Interface;
628 typedef struct Dwarf_Obj_Access_Methods_s Dwarf_Obj_Access_Methods;
629 typedef struct Dwarf_Obj_Access_Section_s Dwarf_Obj_Access_Section;
611630
612631
613632 /* Used in the get_section interface function
630649 /* Size in bytes of the section. */
631650 Dwarf_Unsigned size;
632651
633 /* Having an accurate section name makes debugging of libdwarf easier.
652 /* Having an accurate section name makes
653 debugging of libdwarf easier.
634654 and is essential to find the .debug_ sections. */
635655 const char* name;
636656 /* Set link to zero if it is meaningless. If non-zero
656676 DW_OBJECT_LSB
657677 } Dwarf_Endianness;
658678
659 /* The functions we need to access object data from libdwarf are declared here.
679 /* The functions we need to access object data
680 from libdwarf are declared here.
660681
661682 In these function pointer declarations
662683 'void *obj' is intended to be a pointer (the object field in
663684 Dwarf_Obj_Access_Interface_s)
664 that hides the library-specific and object-specific data that makes
665 it possible to handle multiple object formats and multiple libraries.
666 It's not required that one handles multiple such in a single libdwarf
685 that hides the library-specific and object-specific
686 data that makes
687 it possible to handle multiple object formats
688 and multiple libraries.
689 It's not required that one handles multiple such
690 in a single libdwarf
667691 archive/shared-library (but not ruled out either).
668692 See dwarf_elf_object_access_internals_t and dwarf_elf_access.c
669693 for an example.
670
671694 */
672695 struct Dwarf_Obj_Access_Methods_s {
673696 /*
677700
678701 Parameters
679702 section_index - Zero-based index.
680 return_section - Pointer to a structure in which section info
681 will be placed. Caller must provide a valid pointer to a
682 structure area. The structure's contents will be overwritten
703 return_section - Pointer to a structure in which
704 section info will be placed. Caller must
705 provide a valid pointer to a
706 structure area. The structure's contents
707 will be overwritten
683708 by the call to get_section_info.
684 error - A pointer to an integer in which an error code may be stored.
709 error - A pointer to an integer in which an error
710 code may be stored.
685711
686712 Return
687713 DW_DLV_OK - Everything ok.
693719 /*
694720 get_byte_order
695721
696 Get whether the object file represented by this interface is big-endian
722 Get whether the object file represented by
723 this interface is big-endian
697724 (DW_OBJECT_MSB) or little endian (DW_OBJECT_LSB).
698725
699726 Parameters
739766 /*
740767 load_section
741768
742 Get a pointer to an array of bytes that represent the section.
769 Get a pointer to an array of bytes that
770 represent the section.
743771
744772 Parameters
745773 section_index - Zero-based index.
746 return_data - The address of a pointer to which the section data block
774 return_data - The address of a pointer to
775 which the section data block
747776 will be assigned.
748 error - Pointer to an integer for returning libdwarf-defined
749 error numbers.
777 error - Pointer to an integer for returning
778 libdwarf-defined error numbers.
750779
751780 Return
752781 DW_DLV_OK - No error.
753 DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
754 error number.
782 DW_DLV_ERROR - Error. Use 'error' to indicate
783 a libdwarf-defined error number.
755784 DW_DLV_NO_ENTRY - No such section. */
756785 int (*load_section)(void* obj, Dwarf_Half section_index,
757786 Dwarf_Small** return_data, int* error);
760789 relocate_a_section
761790 If relocations are not supported leave this pointer NULL.
762791
763 Get a pointer to an array of bytes that represent the section.
792 Get a pointer to an array of bytes that represent
793 the section.
764794
765795 Parameters
766 section_index - Zero-based index of the section to be relocated.
796 section_index - Zero-based index of the
797 section to be relocated.
767798 error - Pointer to an integer for returning libdwarf-defined
768799 error numbers.
769800
770801 Return
771802 DW_DLV_OK - No error.
772 DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
803 DW_DLV_ERROR - Error. Use 'error' to indicate
804 a libdwarf-defined
773805 error number.
774806 DW_DLV_NO_ENTRY - No such section. */
775807 int (*relocate_a_section)(void* obj, Dwarf_Half section_index,
794826 or dwarf_elf_init() which take care of these details.
795827 */
796828 struct Dwarf_Obj_Access_Interface_s {
797 /* object is a void* as it hides the data the object access routines
829 /* object is a void* as it hides the data the
830 object access routines
798831 need (which varies by library in use and object format).
799832 */
800833 void* object;
807840 Dwarf_dealloc() alloc_type arguments.
808841 Argument points to:
809842 */
810 #define DW_DLA_STRING 0x01 /* char* */
811 #define DW_DLA_LOC 0x02 /* Dwarf_Loc */
812 #define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */
813 #define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/
814 #define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */
815 #define DW_DLA_BLOCK 0x06 /* Dwarf_Block */
816 #define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */
817 #define DW_DLA_DIE 0x08 /* Dwarf_Die */
818 #define DW_DLA_LINE 0x09 /* Dwarf_Line */
819 #define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */
820 #define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */
821 #define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */
822 #define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */
823 #define DW_DLA_ERROR 0x0e /* Dwarf_Error */
824 #define DW_DLA_LIST 0x0f /* a list */
825 #define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */
826 #define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */
827 #define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */
828 #define DW_DLA_FRAME_OP 0x13 /* Dwarf_Frame_Op */
829 #define DW_DLA_CIE 0x14 /* Dwarf_Cie */
830 #define DW_DLA_FDE 0x15 /* Dwarf_Fde */
831 #define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc */
832 #define DW_DLA_FRAME_BLOCK 0x17 /* Dwarf_Frame Block (not used) */
833 #define DW_DLA_FUNC 0x18 /* Dwarf_Func */
834 #define DW_DLA_TYPENAME 0x19 /* Dwarf_Type */
835 #define DW_DLA_VAR 0x1a /* Dwarf_Var */
836 #define DW_DLA_WEAK 0x1b /* Dwarf_Weak */
837 #define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries */
838 #define DW_DLA_RANGES 0x1d /* Dwarf_Ranges */
843 #define DW_DLA_STRING 0x01 /* char* */
844 #define DW_DLA_LOC 0x02 /* Dwarf_Loc */
845 #define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */
846 #define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/
847 #define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */
848 #define DW_DLA_BLOCK 0x06 /* Dwarf_Block */
849 #define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */
850 #define DW_DLA_DIE 0x08 /* Dwarf_Die */
851 #define DW_DLA_LINE 0x09 /* Dwarf_Line */
852 #define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */
853 #define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */
854 #define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */
855 #define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */
856 #define DW_DLA_ERROR 0x0e /* Dwarf_Error */
857 #define DW_DLA_LIST 0x0f /* a list */
858 #define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */
859 #define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */
860 #define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */
861 #define DW_DLA_FRAME_OP 0x13 /* Dwarf_Frame_Op */
862 #define DW_DLA_CIE 0x14 /* Dwarf_Cie */
863 #define DW_DLA_FDE 0x15 /* Dwarf_Fde */
864 #define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc */
865
866 /* Dwarf_Frame Block (not used) */
867 #define DW_DLA_FRAME_BLOCK 0x17
868
869 #define DW_DLA_FUNC 0x18 /* Dwarf_Func */
870 #define DW_DLA_TYPENAME 0x19 /* Dwarf_Type */
871 #define DW_DLA_VAR 0x1a /* Dwarf_Var */
872 #define DW_DLA_WEAK 0x1b /* Dwarf_Weak */
873 #define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries */
874 #define DW_DLA_RANGES 0x1d /* Dwarf_Ranges */
839875 /* 0x1e (30) to 0x34 (52) reserved for internal to libdwarf types. */
840 #define DW_DLA_GNU_INDEX_HEAD 0x35 /* .debug_gnu_typenames/pubnames, 2020 */
841 #define DW_DLA_RNGLISTS_HEAD 0x36 /* .debug_rnglists DW5 */
842 #define DW_DLA_GDBINDEX 0x37 /* Dwarf_Gdbindex */
843 #define DW_DLA_XU_INDEX 0x38 /* Dwarf_Xu_Index_Header */
844 #define DW_DLA_LOC_BLOCK_C 0x39 /* Dwarf_Loc_c*/
845 #define DW_DLA_LOCDESC_C 0x3a /* Dwarf_Locdesc_c */
846 #define DW_DLA_LOC_HEAD_C 0x3b /* Dwarf_Loc_Head_c */
847 #define DW_DLA_MACRO_CONTEXT 0x3c /* Dwarf_Macro_Context */
876 /* .debug_gnu_typenames/pubnames, 2020 */
877 #define DW_DLA_GNU_INDEX_HEAD 0x35
878
879 #define DW_DLA_RNGLISTS_HEAD 0x36 /* .debug_rnglists DW5 */
880 #define DW_DLA_GDBINDEX 0x37 /* Dwarf_Gdbindex */
881 #define DW_DLA_XU_INDEX 0x38 /* Dwarf_Xu_Index_Header */
882 #define DW_DLA_LOC_BLOCK_C 0x39 /* Dwarf_Loc_c*/
883 #define DW_DLA_LOCDESC_C 0x3a /* Dwarf_Locdesc_c */
884 #define DW_DLA_LOC_HEAD_C 0x3b /* Dwarf_Loc_Head_c */
885 #define DW_DLA_MACRO_CONTEXT 0x3c /* Dwarf_Macro_Context */
848886 /* 0x3d (61) is for libdwarf internal use. */
849 #define DW_DLA_DSC_HEAD 0x3e /* Dwarf_Dsc_Head */
850 #define DW_DLA_DNAMES_HEAD 0x3f /* Dwarf_Dnames_Head */
851 #define DW_DLA_STR_OFFSETS 0x40 /* struct Dwarf_Str_Offsets_Table_s */
887 #define DW_DLA_DSC_HEAD 0x3e /* Dwarf_Dsc_Head */
888 #define DW_DLA_DNAMES_HEAD 0x3f /* Dwarf_Dnames_Head */
889
890 /* struct Dwarf_Str_Offsets_Table_s */
891 #define DW_DLA_STR_OFFSETS 0x40
852892
853893 /* The augmenter string for CIE */
854894 #define DW_CIE_AUGMENTER_STRING_V0 "z"
935975
936976 /* libdwarf error numbers
937977 */
938 #define DW_DLE_NE 0 /* no error */
939 #define DW_DLE_VMM 1 /* dwarf format/library version mismatch */
940 #define DW_DLE_MAP 2 /* memory map failure */
941 #define DW_DLE_LEE 3 /* libelf error */
942 #define DW_DLE_NDS 4 /* no debug section */
943 #define DW_DLE_NLS 5 /* no line section */
944 #define DW_DLE_ID 6 /* invalid descriptor for query */
945 #define DW_DLE_IOF 7 /* I/O failure */
946 #define DW_DLE_MAF 8 /* memory allocation failure */
947 #define DW_DLE_IA 9 /* invalid argument */
948 #define DW_DLE_MDE 10 /* mangled debugging entry */
949 #define DW_DLE_MLE 11 /* mangled line number entry */
950 #define DW_DLE_FNO 12 /* file not open */
951 #define DW_DLE_FNR 13 /* file not a regular file */
952 #define DW_DLE_FWA 14 /* file open with wrong access */
953 #define DW_DLE_NOB 15 /* not an object file */
954 #define DW_DLE_MOF 16 /* mangled object file header */
955 #define DW_DLE_EOLL 17 /* end of location list entries */
956 #define DW_DLE_NOLL 18 /* no location list section */
957 #define DW_DLE_BADOFF 19 /* Invalid offset */
958 #define DW_DLE_EOS 20 /* end of section */
959 #define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/
960 #define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad*/
978 #define DW_DLE_NE 0 /* no error */
979 #define DW_DLE_VMM 1 /* dwarf format/library version mismatch */
980 #define DW_DLE_MAP 2 /* memory map failure */
981 #define DW_DLE_LEE 3 /* libelf error */
982 #define DW_DLE_NDS 4 /* no debug section */
983 #define DW_DLE_NLS 5 /* no line section */
984 #define DW_DLE_ID 6 /* invalid descriptor for query */
985 #define DW_DLE_IOF 7 /* I/O failure */
986 #define DW_DLE_MAF 8 /* memory allocation failure */
987 #define DW_DLE_IA 9 /* invalid argument */
988 #define DW_DLE_MDE 10 /* mangled debugging entry */
989 #define DW_DLE_MLE 11 /* mangled line number entry */
990 #define DW_DLE_FNO 12 /* file not open */
991 #define DW_DLE_FNR 13 /* file not a regular file */
992 #define DW_DLE_FWA 14 /* file open with wrong access */
993 #define DW_DLE_NOB 15 /* not an object file */
994 #define DW_DLE_MOF 16 /* mangled object file header */
995 #define DW_DLE_EOLL 17 /* end of location list entries */
996 #define DW_DLE_NOLL 18 /* no location list section */
997 #define DW_DLE_BADOFF 19 /* Invalid offset */
998 #define DW_DLE_EOS 20 /* end of section */
999 #define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/
1000 #define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad*/
9611001 /* It is not an allowed size (64 or 32) */
9621002 /* Error codes defined by the current Libdwarf Implementation. */
9631003 #define DW_DLE_DBG_ALLOC 23
9941034 #define DW_DLE_DEBUG_LINE_LENGTH_BAD 54
9951035 #define DW_DLE_LINE_PROLOG_LENGTH_BAD 55
9961036 #define DW_DLE_LINE_NUM_OPERANDS_BAD 56
997 #define DW_DLE_LINE_SET_ADDR_ERROR 57 /* No longer used. */
1037 #define DW_DLE_LINE_SET_ADDR_ERROR 57
9981038 #define DW_DLE_LINE_EXT_OPCODE_BAD 58
9991039 #define DW_DLE_DWARF_LINE_NULL 59
10001040 #define DW_DLE_INCL_DIR_NUM_BAD 60
14181458 #define DW_DLE_DEBUG_SUP_ERROR 477
14191459 #define DW_DLE_LOCATION_ERROR 478
14201460 #define DW_DLE_DEBUGLINK_PATH_SHORT 479
1461 #define DW_DLE_SIGNATURE_MISMATCH 480
14211462
14221463 /* LAST MUST EQUAL LAST ERROR NUMBER */
1423 #define DW_DLE_LAST 479
1464 #define DW_DLE_LAST 480
14241465
14251466 #define DW_DLE_LO_USER 0x10000
14261467
14561497 #define DW_DLV_OK 0
14571498 #define DW_DLV_ERROR 1
14581499
1459 /* Special values for offset_into_exception_table field of dwarf fde's. */
1460 /* The following value indicates that there is no Exception table offset
1461 associated with a dwarf frame. */
1500 /* Special values for offset_into_exception_table field
1501 of dwarf fde's. */
1502 /* The following value indicates that there is no
1503 Exception table offset
1504 associated with a dwarf frame. */
14621505 #define DW_DLX_NO_EH_OFFSET (-1LL)
1463 /* The following value indicates that the producer was unable to analyse the
1464 source file to generate Exception tables for this function. */
1506 /* The following value indicates that the producer
1507 was unable to analyse the
1508 source file to generate Exception tables for this function. */
14651509 #define DW_DLX_EH_OFFSET_UNAVAILABLE (-2LL)
14661510
14671511 /* The dwarf specification separates FORMs into
14711515 The DWARF4 specification class definition suffices to
14721516 describe all DWARF versions.
14731517 See section 7.5.4, Attribute Encodings.
1474 A return of DW_FORM_CLASS_UNKNOWN means we could not properly figure
1518 A return of DW_FORM_CLASS_UNKNOWN means we
1519 could not properly figure
14751520 out what form-class it is.
14761521
14771522 DW_FORM_CLASS_FRAMEPTR is MIPS/IRIX only, and refers
15121557 DW_FORM_CLASS_STROFFSETSPTR /* DWARF5 */
15131558 };
15141559
1515 /* These support opening DWARF5 split dwarf objects. */
1560 /* These support opening DWARF5 split dwarf objects and
1561 Elf SHT_GROUP blocks of DWARF sections. */
15161562 #define DW_GROUPNUMBER_ANY 0
15171563 #define DW_GROUPNUMBER_BASE 1
15181564 #define DW_GROUPNUMBER_DWO 2
15191565
1520 /*===========================================================================*/
1521 /* Dwarf consumer interface initialization and termination operations */
1566 /*==================================================================*/
1567 /* Dwarf consumer interface initialization and
1568 termination operations */
15221569
15231570 /* Initialization based on path. This is new October 2018.
15241571 The path actually used is copied to true_path_out
17761823
17771824 /* dwarf_offdie_b new October 2011 */
17781825 /* Finding die given global (not CU-relative) offset.
1779 Applies to debug_info (is_info true) or debug_types (is_info false). */
1826 Applies to debug_info (is_info true) or debug_types
1827 (is_info false). */
17801828 int dwarf_offdie_b(Dwarf_Debug /*dbg*/,
17811829 Dwarf_Off /*offset*/,
17821830 Dwarf_Bool /*is_info*/,
17831831 Dwarf_Die* /*return_die*/,
17841832 Dwarf_Error* /*error*/);
17851833
1786 /* Returns the is_info flag through the pointer if the function returns
1787 DW_DLV_OK. Needed so client software knows if a DIE is in debug_info
1788 or debug_types.
1834 /* Returns the is_info flag.
1835 Needed so client software knows
1836 if a DIE is in debug_info or debug_types.
17891837 New October 2011. */
17901838 Dwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die /*die*/);
1839
1840 /* New December 2020. Any Dwarf_Die will work.
1841 The values returned are about the CU itself, not a DIE. */
1842 int dwarf_cu_header_basics(Dwarf_Die die,
1843 Dwarf_Half * /*version*/,
1844 Dwarf_Bool * /*is_info*/,
1845 Dwarf_Bool * /*is_dwo*/,
1846 Dwarf_Half * /*offset_size*/,
1847 Dwarf_Half * /*address_size*/,
1848 Dwarf_Half * /*extension_size*/,
1849 Dwarf_Sig8 ** /*signature*/,
1850 Dwarf_Off * /*offset_of_length*/,
1851 Dwarf_Unsigned * /*total_byte_length*/,
1852 Dwarf_Error * /*error*/);
17911853
17921854 /* New March 2016.
17931855 So we can associate a DIE's abbreviations with the contents
18721934 int dwarf_die_abbrev_children_flag(Dwarf_Die /*die*/,
18731935 Dwarf_Half * /*ab_has_child*/);
18741936
1875 /* Validate the sibling DIE. This only makes sense to call
1876 if the sibling's DIEs have been travsersed and
1877 dwarf_child called on each,
1878 so that the last DIE dwarf_child saw was the last.
1879 Essentially ensuring that (after such traversal) that we
1880 are in the same place a sibling attribute would identify.
1881 In case we return DW_DLV_ERROR, the global offset of the last
1882 DIE traversed by dwarf_child is returned through *offset */
1883 int dwarf_validate_die_sibling(Dwarf_Die /*sibling*/,Dwarf_Off* /*offset*/);
1937 /* Validate the sibling DIE. This only makes sense to call
1938 if the sibling's DIEs have been travsersed and
1939 dwarf_child called on each,
1940 so that the last DIE dwarf_child saw was the last.
1941 Essentially ensuring that (after such traversal) that we
1942 are in the same place a sibling attribute would identify.
1943 In case we return DW_DLV_ERROR, the global offset of the last
1944 DIE traversed by dwarf_child is returned through *offset */
1945 int dwarf_validate_die_sibling(Dwarf_Die /*sibling*/,
1946 Dwarf_Off* /*offset*/);
18841947
18851948 /* convenience functions, alternative to using dwarf_attrlist */
18861949 int dwarf_hasattr(Dwarf_Die /*die*/,
18961959 Dwarf_Unsigned * /*offcnt*/,
18971960 Dwarf_Error * /*error*/);
18981961
1899 /* BEGIN: debug_gnu_pubnames/typenames access,
1900 calling these Gnu_Index as a general reference.
1901 */
1962 /* BEGIN: debug_gnu_pubnames/typenames access,
1963 calling these Gnu_Index as a general reference. */
19021964
19031965 int dwarf_get_gnu_index_head(Dwarf_Debug /*dbg*/,
19041966 /* The following arg false to select gnu_pubtypes */
22752337 interface.
22762338 This interface only reads the line table header, so
22772339 it takes relatively little time.
2278 *is_single_table will be set non-zero for all standard dwarf line sections.
2279 *is_single_table will be set zero for line sections with the
2280 two_level line table extension (which will have *version_out 0xf006). */
2340 *is_single_table will be set non-zero for all
2341 standard dwarf line sections.
2342 *is_single_table will be set zero for
2343 line sections with the two_level line table
2344 extension (which will have *version_out 0xf006). */
22812345 int dwarf_srclines_b(Dwarf_Die /*die*/,
22822346 Dwarf_Unsigned * /* version_out*/,
22832347 Dwarf_Small * /* table_count */,
24002464
24012465 /* New October 2015. */
24022466 /* Count is the real count of include array entries. */
2403 int dwarf_srclines_include_dir_count(Dwarf_Line_Context /*line_context*/,
2467 int dwarf_srclines_include_dir_count(
2468 Dwarf_Line_Context /*line_context*/,
24042469 Dwarf_Signed * /*count*/,
24052470 Dwarf_Error * /* error*/);
24062471
24072472 /* New October 2015. */
24082473 /* Index starts with 1, last is 'count' */
2409 int dwarf_srclines_include_dir_data(Dwarf_Line_Context /*line_context*/,
2474 int dwarf_srclines_include_dir_data(
2475 Dwarf_Line_Context /*line_context*/,
24102476 Dwarf_Signed /*index*/,
24112477 const char ** /*name*/,
24122478 Dwarf_Error * /* error*/);
26002666 Dwarf_Unsigned * /*abbrev_code*/,
26012667 Dwarf_Unsigned * /*tag*/,
26022668
2603 /* The number of valid abbrev_entry values: 0 to number_of_abbrev-1
2604 */
2669 /* The number of valid abbrev_entry values:
2670 0 to number_of_abbrev-1 */
26052671 Dwarf_Unsigned * /*number_of_abbrev*/,
26062672
2607 /* The number of attr/form pairs, not counting the trailing
2608 0,0 pair. */
2673 /* The number of attr/form pairs, not counting
2674 the trailing 0,0 pair. */
26092675 Dwarf_Unsigned * /*number_of_attr_form_entries*/,
26102676 Dwarf_Error * /*error*/);
26112677
28242890 Dwarf_Off* /*cu_offset*/,
28252891 Dwarf_Error* /*error*/);
28262892
2827 /* User-defined type name operations, SGI IRIX .debug_typenames section.
2828 Same content as DWARF3 .debug_pubtypes, but defined years before
2829 .debug_pubtypes was defined. SGI IRIX only. */
2893 /* jUser-defined type name operations,
2894 SGI IRIX .debug_typenames section.
2895
2896 Same content as DWARF3 .debug_pubtypes, but
2897 defined years before .debug_pubtypes was defined.
2898 SGI IRIX only. */
28302899 int dwarf_get_types(Dwarf_Debug /*dbg*/,
28312900 Dwarf_Type** /*types*/,
28322901 Dwarf_Signed * /*number_of_types*/,
31323201 */
31333202 /* dwarf_get_fde_info_for_reg3 is useful on a single column, but
31343203 it is inefficient to iterate across all table_columns using this
3135 function. Instead call dwarf_get_fde_info_for_all_regs3() and index
3136 into the table it fills in. */
3204 function. Instead call dwarf_get_fde_info_for_all_regs3()
3205 and index into the table it fills in. */
31373206 int dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
31383207 Dwarf_Half /*table_column*/,
31393208 Dwarf_Addr /*pc_requested*/,
33503419 Dwarf_Half * /*forms_count*/,
33513420 const char ** /*macro_string*/,
33523421 Dwarf_Error * /*error*/);
3353 int dwarf_get_macro_startend_file(Dwarf_Macro_Context /*macro_context*/,
3422 int dwarf_get_macro_startend_file(
3423 Dwarf_Macro_Context /*macro_context*/,
33543424 Dwarf_Unsigned /*op_number*/,
33553425 Dwarf_Unsigned * /*line_number*/,
33563426 Dwarf_Unsigned * /*name_index_to_line_tab*/,
33893459 int * /*error_count_out */);
33903460
33913461 /* As of August 2013, dwarf_print_lines() no longer uses printf.
3392 Instead it calls back to the application using a function pointer
3393 once per line-to-print. The lines passed back already have any needed
3462 Instead it calls back to the application using a function
3463 pointer once per line-to-print. The lines passed back
3464 already have any needed
33943465 newlines. The following struct is used to initialize
33953466 the callback mechanism.
33963467
3397 Failing to call the dwarf_register_printf_callback() function will
3398 prevent the lines from being passed back but such omission
3399 is not an error.
3468 Failing to call the dwarf_register_printf_callback()
3469 function will prevent the lines from being passed back
3470 but such omission is not an error.
34003471 See libdwarf2.1.mm for further documentation.
34013472
34023473 The return value is the previous set of callback values.
36023673 Dwarf_Error * /*error*/);
36033674
36043675
3605 int dwarf_gdbindex_cuvector_inner_attributes(Dwarf_Gdbindex /*gdbindex*/,
3676 int dwarf_gdbindex_cuvector_inner_attributes(
3677 Dwarf_Gdbindex /*gdbindex*/,
36063678 Dwarf_Unsigned /*cuvector_offset*/,
36073679 Dwarf_Unsigned /*innerindex*/,
36083680 /* The attr_value is a field of bits. For expanded version
36323704
36333705 /* END gdbindex/debugfission operations. */
36343706
3635 /* START debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3707 /* START debugfission dwp .debug_cu_index
3708 and .debug_tu_index operations. */
36363709
36373710 int dwarf_get_xu_index_header(Dwarf_Debug /*dbg*/,
36383711 const char * section_type, /* "tu" or "cu" */
36463719
36473720 int dwarf_get_xu_index_section_type(Dwarf_Xu_Index_Header /*xuhdr*/,
36483721 /* the function returns a pointer to
3649 the immutable string "tu" or "cu" via this arg. Do not free. */
3722 the immutable string "tu" or "cu" via this arg.
3723 Do not free. */
36503724 const char ** /*typename*/,
36513725 /* the function returns a pointer to
36523726 the immutable section name. Do not free.
37133787 Dwarf_Unsigned unused1;
37143788 Dwarf_Unsigned unused2;
37153789 };
3716 typedef struct Dwarf_Debug_Fission_Per_CU_s Dwarf_Debug_Fission_Per_CU ;
3790 typedef struct Dwarf_Debug_Fission_Per_CU_s
3791 Dwarf_Debug_Fission_Per_CU;
37173792 /* For any Dwarf_Die in a compilation unit, return
37183793 the debug fission table data through
37193794 percu_out. Usually applications
37263801 Dwarf_Debug_Fission_Per_CU * /* percu_out */,
37273802 Dwarf_Error * /* err */);
37283803
3729 /* Given a key (hash signature) from a .o, find the per-cu information
3804 /* Given a key (hash signature) from a .o,
3805 find the per-cu information
37303806 for the CU with that key. */
37313807 int dwarf_get_debugfission_for_key(Dwarf_Debug /*dbg*/,
37323808 Dwarf_Sig8 * /*key, hash signature */,
37343810 Dwarf_Debug_Fission_Per_CU * /*percu_out */,
37353811 Dwarf_Error * /*err */);
37363812
3737 /* END debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3813 /* END debugfission dwp .debug_cu_index
3814 and .debug_tu_index operations. */
37383815
37393816
37403817 /* Utility operations */
41304207 Dwarf_Error * /*error*/);
41314208
41324209 /* August 2013 sleb creator. For any attribute. */
4133 Dwarf_P_Attribute dwarf_add_AT_any_value_sleb(Dwarf_P_Die /*ownerdie*/,
4210 Dwarf_P_Attribute dwarf_add_AT_any_value_sleb(
4211 Dwarf_P_Die /*ownerdie*/,
41344212 Dwarf_Half /*attrnum*/,
41354213 Dwarf_Signed /*signed_value*/,
41364214 Dwarf_Error * /*error*/);
41434221 Dwarf_Error * /*error*/);
41444222
41454223 /* Original sleb creator. Only for DW_AT_const_value. */
4146 Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
4224 Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(
4225 Dwarf_P_Die /*ownerdie*/,
41474226 Dwarf_Signed /*signed_value*/,
41484227 Dwarf_Error* /*error*/);
41494228
41544233 Dwarf_Error* /*error*/);
41554234
41564235 /* August 2013 uleb creator. For any attribute. */
4157 Dwarf_P_Attribute dwarf_add_AT_any_value_uleb(Dwarf_P_Die /*ownerdie*/,
4236 Dwarf_P_Attribute dwarf_add_AT_any_value_uleb(
4237 Dwarf_P_Die /*ownerdie*/,
41584238 Dwarf_Half /*attrnum*/,
41594239 Dwarf_Unsigned /*signed_value*/,
41604240 Dwarf_Error * /*error*/);
53155395
53165396 On successful call, call dwarf_str_offsets_table_entry()
53175397 to get the individual table values on the now-active table. */
5318 int dwarf_next_str_offsets_table( Dwarf_Str_Offsets_Table /*table_data*/,
5398 int dwarf_next_str_offsets_table(
5399 Dwarf_Str_Offsets_Table /*table_data*/,
53195400 Dwarf_Unsigned * /*unit_length*/,
53205401 Dwarf_Unsigned * /*unit_length_offset*/,
53215402 Dwarf_Unsigned * /*table_start_offset*/,
53275408
53285409 /* Valid index values n: 0 <= n < table_entry_count
53295410 for the active table */
5330 int dwarf_str_offsets_value_by_index(Dwarf_Str_Offsets_Table /*table_data*/,
5411 int dwarf_str_offsets_value_by_index(
5412 Dwarf_Str_Offsets_Table /*table_data*/,
53315413 Dwarf_Unsigned /*index_to_entry*/,
53325414 Dwarf_Unsigned * /*entry_value*/,
53335415 Dwarf_Error * /*error*/);
53345416
53355417 /* After all str_offsets read this reports final
53365418 wasted-bytes count. */
5337 int dwarf_str_offsets_statistics(Dwarf_Str_Offsets_Table /*table_data*/,
5419 int dwarf_str_offsets_statistics(
5420 Dwarf_Str_Offsets_Table /*table_data*/,
53385421 Dwarf_Unsigned * /*wasted_byte_count*/,
53395422 Dwarf_Unsigned * /*table_count*/,
53405423 Dwarf_Error * /*error*/);
54035486 /* The following copied from a generated dwarf_names.h */
54045487
54055488 /* BEGIN FILE */
5406 extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5407 extern int dwarf_get_ADDR_name(unsigned int /*val_in*/, const char ** /*s_out */);
5408 extern int dwarf_get_ATCF_name(unsigned int /*val_in*/, const char ** /*s_out */);
5409 extern int dwarf_get_ATE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5410 extern int dwarf_get_AT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5411 extern int dwarf_get_CC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5412 extern int dwarf_get_CFA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5413 extern int dwarf_get_children_name(unsigned int /*val_in*/, const char ** /*s_out */);
5414 extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/, const char ** /*s_out */);
5415 extern int dwarf_get_DEFAULTED_name(unsigned int /*val_in*/, const char ** /*s_out */);
5416 extern int dwarf_get_DSC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5417 extern int dwarf_get_DS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5418 extern int dwarf_get_EH_name(unsigned int /*val_in*/, const char ** /*s_out */);
5419 extern int dwarf_get_END_name(unsigned int /*val_in*/, const char ** /*s_out */);
5420 extern int dwarf_get_FORM_name(unsigned int /*val_in*/, const char ** /*s_out */);
5421 extern int dwarf_get_FRAME_name(unsigned int /*val_in*/, const char ** /*s_out */);
5422 extern int dwarf_get_GNUIKIND_name(unsigned int /*val_in*/, const char ** /*s_out */);
5423 extern int dwarf_get_GNUIVIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5424 extern int dwarf_get_ID_name(unsigned int /*val_in*/, const char ** /*s_out */);
5425 extern int dwarf_get_IDX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5426 extern int dwarf_get_INL_name(unsigned int /*val_in*/, const char ** /*s_out */);
5427 extern int dwarf_get_ISA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5428 extern int dwarf_get_LANG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5429 extern int dwarf_get_LLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5430 /* dwarf_get_LLEX_name is likely just temporary. Not standard. */
5431 extern int dwarf_get_LLEX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5432 extern int dwarf_get_LNCT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5433 extern int dwarf_get_LNE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5434 extern int dwarf_get_LNS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5435 extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5436 extern int dwarf_get_MACRO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5437 extern int dwarf_get_OP_name(unsigned int /*val_in*/, const char ** /*s_out */);
5438 extern int dwarf_get_ORD_name(unsigned int /*val_in*/, const char ** /*s_out */);
5439 extern int dwarf_get_RLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5440 extern int dwarf_get_SECT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5441 extern int dwarf_get_TAG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5442 extern int dwarf_get_UT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5443 extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/, const char ** /*s_out */);
5444 extern int dwarf_get_VIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5489 extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/,
5490 const char ** /*s_out */);
5491 extern int dwarf_get_ADDR_name(unsigned int /*val_in*/,
5492 const char ** /*s_out */);
5493 extern int dwarf_get_ATCF_name(unsigned int /*val_in*/,
5494 const char ** /*s_out */);
5495 extern int dwarf_get_ATE_name(unsigned int /*val_in*/,
5496 const char ** /*s_out */);
5497 extern int dwarf_get_AT_name(unsigned int /*val_in*/,
5498 const char ** /*s_out */);
5499 extern int dwarf_get_CC_name(unsigned int /*val_in*/,
5500 const char ** /*s_out */);
5501 extern int dwarf_get_CFA_name(unsigned int /*val_in*/,
5502 const char ** /*s_out */);
5503 extern int dwarf_get_children_name(unsigned int /*val_in*/,
5504 const char ** /*s_out */);
5505 extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/,
5506 const char ** /*s_out */);
5507 extern int dwarf_get_DEFAULTED_name(unsigned int /*val_in*/,
5508 const char ** /*s_out */);
5509 extern int dwarf_get_DSC_name(unsigned int /*val_in*/,
5510 const char ** /*s_out */);
5511 extern int dwarf_get_DS_name(unsigned int /*val_in*/,
5512 const char ** /*s_out */);
5513 extern int dwarf_get_EH_name(unsigned int /*val_in*/,
5514 const char ** /*s_out */);
5515 extern int dwarf_get_END_name(unsigned int /*val_in*/,
5516 const char ** /*s_out */);
5517 extern int dwarf_get_FORM_name(unsigned int /*val_in*/,
5518 const char ** /*s_out */);
5519 extern int dwarf_get_FRAME_name(unsigned int /*val_in*/,
5520 const char ** /*s_out */);
5521 extern int dwarf_get_GNUIKIND_name(unsigned int /*val_in*/,
5522 const char ** /*s_out */);
5523 extern int dwarf_get_GNUIVIS_name(unsigned int /*val_in*/,
5524 const char ** /*s_out */);
5525 extern int dwarf_get_ID_name(unsigned int /*val_in*/,
5526 const char ** /*s_out */);
5527 extern int dwarf_get_IDX_name(unsigned int /*val_in*/,
5528 const char ** /*s_out */);
5529 extern int dwarf_get_INL_name(unsigned int /*val_in*/,
5530 const char ** /*s_out */);
5531 extern int dwarf_get_ISA_name(unsigned int /*val_in*/,
5532 const char ** /*s_out */);
5533 extern int dwarf_get_LANG_name(unsigned int /*val_in*/,
5534 const char ** /*s_out */);
5535 extern int dwarf_get_LLE_name(unsigned int /*val_in*/,
5536 const char ** /*s_out */);
5537 /* dwarf_get_LLEX_name is for a GNU extension.
5538 Not defined by the GNU folks nor a DWARF standard
5539 but it seemed essential. */
5540 extern int dwarf_get_LLEX_name(unsigned int /*val_in*/,
5541 const char ** /*s_out */);
5542 extern int dwarf_get_LNCT_name(unsigned int /*val_in*/,
5543 const char ** /*s_out */);
5544 extern int dwarf_get_LNE_name(unsigned int /*val_in*/,
5545 const char ** /*s_out */);
5546 extern int dwarf_get_LNS_name(unsigned int /*val_in*/,
5547 const char ** /*s_out */);
5548 extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/,
5549 const char ** /*s_out */);
5550 extern int dwarf_get_MACRO_name(unsigned int /*val_in*/,
5551 const char ** /*s_out */);
5552 extern int dwarf_get_OP_name(unsigned int /*val_in*/,
5553 const char ** /*s_out */);
5554 extern int dwarf_get_ORD_name(unsigned int /*val_in*/,
5555 const char ** /*s_out */);
5556 extern int dwarf_get_RLE_name(unsigned int /*val_in*/,
5557 const char ** /*s_out */);
5558 extern int dwarf_get_SECT_name(unsigned int /*val_in*/,
5559 const char ** /*s_out */);
5560 extern int dwarf_get_TAG_name(unsigned int /*val_in*/,
5561 const char ** /*s_out */);
5562 extern int dwarf_get_UT_name(unsigned int /*val_in*/,
5563 const char ** /*s_out */);
5564 extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/,
5565 const char ** /*s_out */);
5566 extern int dwarf_get_VIS_name(unsigned int /*val_in*/,
5567 const char ** /*s_out */);
54455568 /* END FILE */
54465569
54475570 /* Convert local offset into global offset */
55185641 Dwarf_Unsigned * /*map_entry_count_out*/,
55195642 Dwarf_Error * /*error*/);
55205643
5521 /* New May 2017. Reveals the map between group numbers and section numbers.
5644 /* New May 2017. Reveals the map between group numbers and
5645 section numbers.
55225646 Caller must allocate the arrays with space for 'map_entry_count'
55235647 values and this function fills in the array entries.
55245648 Output ordered by group number and section number.
55315655 Dwarf_Error * /*error*/);
55325656
55335657 /* dwarf_get_endian_copy_function new. December 2019. */
5534 void (*dwarf_get_endian_copy_function(Dwarf_Debug /*dbg*/))(void *, const void * /*src*/, unsigned long /*srclen*/);
5658 void (*dwarf_get_endian_copy_function(Dwarf_Debug /*dbg*/))
5659 (void *, const void * /*src*/, unsigned long /*srclen*/);
55355660
55365661 /* These make the LEB encoding routines visible to libdwarf
55375662 callers. Added November, 2012. */
3737 #endif /* HAVE_STDLIB_H */
3838 #include <errno.h> /* For errno declaration. */
3939 #include <ctype.h>
40 #ifdef HAVE_STRING_H
4041 #include <string.h>
42 #endif /* HAVE_STRING_H */
4143 #include "dwgetopt.h"
4244 #include "libdwarf_version.h" /* for DW_VERSION_DATE_STR */
4345
00 /*
1
21 Copyright (C) 2000-2010 Silicon Graphics, Inc. All Rights Reserved.
32 Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
43 Portions Copyright 2008-2018 David Anderson. All rights reserved.
125124 typedef struct Dwarf_Sig8_s Dwarf_Sig8;
126125
127126 /* Contains info on an uninterpreted block of data
128 Used with certain frame information functions and
129 also used with DW_FORM_block<>.
127 Used with certain location information functions,
128 a frame expression function, and
129 also used with DW_FORM_block<> functions.
130130 */
131131 typedef struct {
132 Dwarf_Unsigned bl_len; /* length of block bl_data points at */
133 Dwarf_Ptr bl_data; /* uninterpreted data */
132 Dwarf_Unsigned bl_len; /* length of block bl_data points at */
133 Dwarf_Ptr bl_data; /* uninterpreted data */
134134
135135 /* See libdwarf.h DW_LKIND* */
136136 Dwarf_Small bl_from_loclist;
179179 Not usable with DWARF5 or DWARF4 with location
180180 operator extensions. */
181181 typedef struct {
182 Dwarf_Small lr_atom; /* location operation */
183 Dwarf_Unsigned lr_number; /* operand */
184 Dwarf_Unsigned lr_number2; /* for OP_BREGx and DW_OP_GNU_const_type*/
185 Dwarf_Unsigned lr_offset; /* offset in locexpr for OP_BRA etc */
182 Dwarf_Small lr_atom; /* location operation */
183 Dwarf_Unsigned lr_number; /* operand */
184 /* for OP_BREGx and DW_OP_GNU_const_type*/
185 Dwarf_Unsigned lr_number2;
186 Dwarf_Unsigned lr_offset; /* offset in locexpr for OP_BRA etc */
186187 } Dwarf_Loc;
187188
188189
330331 #define DW_EXPR_VAL_EXPRESSION 3
331332
332333 typedef struct Dwarf_Regtable_Entry_s {
333 /* For each index i (naming a hardware register with dwarf number
334 i) the following is true and defines the value of that register:
334 /* For each index i (naming a hardware register
335 with dwarf number i) the following is true and defines
336 the value of that register:
335337
336338 If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
337339 it is not DWARF register number but
338 a place holder indicating the register has no defined value.
340 a place holder indicating the register has
341 no defined value.
339342 If dw_regnum is Register DW_FRAME_SAME_VAL
340343 it is not DWARF register number but
341344 a place holder indicating the register has the same
350353 software register numbers in the machine hardware)
351354 and the following applies:
352355
353 if dw_value_type == DW_EXPR_OFFSET (the only case for dwarf2):
356 if dw_value_type == DW_EXPR_OFFSET (the
357 only case for dwarf2):
354358 If dw_offset_relevant is non-zero, then
355359 the value is stored at at the address CFA+N where
356360 N is a signed offset.
357361 Rule: Offset(N)
358 If dw_offset_relevant is zero, then the value of the register
359 is the value of (DWARF) register number dw_regnum.
362 If dw_offset_relevant is zero, then the
363 value of the register
364 is the value of (DWARF) register
365 number dw_regnum.
360366 Rule: register(F)
361367 Other values of dw_value_type are an error.
362368 */
386392
387393 If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
388394 it is not DWARF register number but
389 a place holder indicating the register has no defined value.
395 a place holder indicating the register
396 has no defined value.
390397 If dw_regnum is Register DW_FRAME_SAME_VAL
391398 it is not DWARF register number but
392399 a place holder indicating the register has the same
398405 DW_FRAME_* Values present on disk are in dwarf.h
399406 Because DW_FRAME_SAME_VAL and DW_FRAME_UNDEFINED_VAL
400407 and DW_FRAME_CFA_COL3 are definable at runtime
401 consider the names symbolic in this comment, not absolute.
408 consider the names symbolic in this comment,
409 not absolute.
402410
403411 Otherwise: the register number is a DWARF register number
404412 (see ABI documents for how this translates to hardware/
410418 not DW_FRAME_CFA_COL3, nor DW_FRAME_SAME_VAL, nor
411419 DW_FRAME_UNDEFINED_VAL.
412420
413 If dw_value_type == DW_EXPR_OFFSET (the only possible case for
414 dwarf2):
421 If dw_value_type == DW_EXPR_OFFSET (the only
422 possible case for dwarf2):
415423 If dw_offset_relevant is non-zero, then
416424 the value is stored at at the address
417425 CFA+N where N is a signed offset.
420428 So dw_offset_or_block_len is a signed value, really,
421429 and must be printed/evaluated as such.
422430 Rule: Offset(N)
423 If dw_offset_relevant is zero, then the value of the register
431 If dw_offset_relevant is zero, then the
432 value of the register
424433 is the value of (DWARF) register number dw_regnum.
425434 Rule: register(R)
426435 If dw_value_type == DW_EXPR_VAL_OFFSET
427 the value of this register is CFA +N where N is a signed offset.
436 the value of this register is CFA +N where
437 N is a signed offset.
428438 dw_regnum is the cfa register rule which means
429439 one ignores dw_regnum and uses the CFA appropriately.
430440 Rule: val_offset(N)
432442 The value of the register is the value at the address
433443 computed by evaluating the DWARF expression E.
434444 Rule: expression(E)
435 The expression E byte stream is pointed to by dw_block_ptr.
445 The expression E byte stream is pointed to by
446 dw_block_ptr.
436447 The expression length in bytes is given by
437448 dw_offset_or_block_len.
438449 If dw_value_type == DW_EXPR_VAL_EXPRESSION
439450 The value of the register is the value
440451 computed by evaluating the DWARF expression E.
441452 Rule: val_expression(E)
442 The expression E byte stream is pointed to by dw_block_ptr.
453 The expression E byte stream is pointed to
454 by dw_block_ptr.
443455 The expression length in bytes is given by
444456 dw_offset_or_block_len.
445457 Other values of dw_value_type are an error.
485497 If DW_DLV_OK returns the regnum and offset thru the pointers
486498 (which the consumer must use appropriately).
487499 */
488 int dwarf_frame_get_reg_register(struct Dwarf_Regtable_Entry3_s *reg_in,
500 int dwarf_frame_get_reg_register(
501 struct Dwarf_Regtable_Entry3_s *reg_in,
489502 Dwarf_Small *offset_relevant,
490503 Dwarf_Half *regnum_out,
491504 Dwarf_Signed *offset_out);
495508 The caller must pass in the address of a valid
496509 Dwarf_Block (the caller need not initialize it).
497510 */
498 int dwarf_frame_get_reg_expression(struct Dwarf_Regtable_Entry3_s *reg_in,
511 int dwarf_frame_get_reg_expression(
512 struct Dwarf_Regtable_Entry3_s *reg_in,
499513 Dwarf_Block *block_out);
500514
501515
535549
536550 typedef struct Dwarf_P_String_Attr_s * Dwarf_P_String_Attr;
537551 struct Dwarf_P_String_Attr_s {
538 Dwarf_Unsigned sa_offset; /* Offset of string attribute data */
552 /* Offset of string attribute data */
553 Dwarf_Unsigned sa_offset;
539554 Dwarf_Unsigned sa_nbytes;
540555 };
541556
577592
578593 /* error handler function
579594 */
580 typedef void (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/);
595 typedef void (*Dwarf_Handler)(Dwarf_Error /*error*/,
596 Dwarf_Ptr /*errarg*/);
581597
582598
583599 /* Begin libdwarf Object File Interface declarations.
584600
585601 As of February 2008 there are multiple dwarf_reader object access
586602 initialization methods available:
587 The traditional dwarf_elf_init() and dwarf_init() and dwarf_finish()
588 which assume libelf and POSIX file access.
589 An object-file and library agnostic dwarf_object_init() and dwarf_object_finish()
603 The traditional dwarf_elf_init() and dwarf_init() and
604 dwarf_finish() which assume libelf and POSIX file access.
605 An object-file and library agnostic dwarf_object_init()
606 and dwarf_object_finish()
590607 which allow the coder to provide object access routines
591 abstracting away the elf interface. So there is no dependence in the
608 abstracting away the elf interface.
609 So there is no dependence in the
592610 reader code on the object format and no dependence on libelf.
593611 See the code in dwarf_elf_access.c and dwarf_original_elf_init.c
594612 to see an example of initializing the structures mentioned below.
605623 split-dwarf sections can be accessed.
606624 */
607625
608 typedef struct Dwarf_Obj_Access_Interface_s Dwarf_Obj_Access_Interface;
609 typedef struct Dwarf_Obj_Access_Methods_s Dwarf_Obj_Access_Methods;
610 typedef struct Dwarf_Obj_Access_Section_s Dwarf_Obj_Access_Section;
626 typedef struct Dwarf_Obj_Access_Interface_s
627 Dwarf_Obj_Access_Interface;
628 typedef struct Dwarf_Obj_Access_Methods_s Dwarf_Obj_Access_Methods;
629 typedef struct Dwarf_Obj_Access_Section_s Dwarf_Obj_Access_Section;
611630
612631
613632 /* Used in the get_section interface function
630649 /* Size in bytes of the section. */
631650 Dwarf_Unsigned size;
632651
633 /* Having an accurate section name makes debugging of libdwarf easier.
652 /* Having an accurate section name makes
653 debugging of libdwarf easier.
634654 and is essential to find the .debug_ sections. */
635655 const char* name;
636656 /* Set link to zero if it is meaningless. If non-zero
656676 DW_OBJECT_LSB
657677 } Dwarf_Endianness;
658678
659 /* The functions we need to access object data from libdwarf are declared here.
679 /* The functions we need to access object data
680 from libdwarf are declared here.
660681
661682 In these function pointer declarations
662683 'void *obj' is intended to be a pointer (the object field in
663684 Dwarf_Obj_Access_Interface_s)
664 that hides the library-specific and object-specific data that makes
665 it possible to handle multiple object formats and multiple libraries.
666 It's not required that one handles multiple such in a single libdwarf
685 that hides the library-specific and object-specific
686 data that makes
687 it possible to handle multiple object formats
688 and multiple libraries.
689 It's not required that one handles multiple such
690 in a single libdwarf
667691 archive/shared-library (but not ruled out either).
668692 See dwarf_elf_object_access_internals_t and dwarf_elf_access.c
669693 for an example.
670
671694 */
672695 struct Dwarf_Obj_Access_Methods_s {
673696 /*
677700
678701 Parameters
679702 section_index - Zero-based index.
680 return_section - Pointer to a structure in which section info
681 will be placed. Caller must provide a valid pointer to a
682 structure area. The structure's contents will be overwritten
703 return_section - Pointer to a structure in which
704 section info will be placed. Caller must
705 provide a valid pointer to a
706 structure area. The structure's contents
707 will be overwritten
683708 by the call to get_section_info.
684 error - A pointer to an integer in which an error code may be stored.
709 error - A pointer to an integer in which an error
710 code may be stored.
685711
686712 Return
687713 DW_DLV_OK - Everything ok.
693719 /*
694720 get_byte_order
695721
696 Get whether the object file represented by this interface is big-endian
722 Get whether the object file represented by
723 this interface is big-endian
697724 (DW_OBJECT_MSB) or little endian (DW_OBJECT_LSB).
698725
699726 Parameters
739766 /*
740767 load_section
741768
742 Get a pointer to an array of bytes that represent the section.
769 Get a pointer to an array of bytes that
770 represent the section.
743771
744772 Parameters
745773 section_index - Zero-based index.
746 return_data - The address of a pointer to which the section data block
774 return_data - The address of a pointer to
775 which the section data block
747776 will be assigned.
748 error - Pointer to an integer for returning libdwarf-defined
749 error numbers.
777 error - Pointer to an integer for returning
778 libdwarf-defined error numbers.
750779
751780 Return
752781 DW_DLV_OK - No error.
753 DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
754 error number.
782 DW_DLV_ERROR - Error. Use 'error' to indicate
783 a libdwarf-defined error number.
755784 DW_DLV_NO_ENTRY - No such section. */
756785 int (*load_section)(void* obj, Dwarf_Half section_index,
757786 Dwarf_Small** return_data, int* error);
760789 relocate_a_section
761790 If relocations are not supported leave this pointer NULL.
762791
763 Get a pointer to an array of bytes that represent the section.
792 Get a pointer to an array of bytes that represent
793 the section.
764794
765795 Parameters
766 section_index - Zero-based index of the section to be relocated.
796 section_index - Zero-based index of the
797 section to be relocated.
767798 error - Pointer to an integer for returning libdwarf-defined
768799 error numbers.
769800
770801 Return
771802 DW_DLV_OK - No error.
772 DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
803 DW_DLV_ERROR - Error. Use 'error' to indicate
804 a libdwarf-defined
773805 error number.
774806 DW_DLV_NO_ENTRY - No such section. */
775807 int (*relocate_a_section)(void* obj, Dwarf_Half section_index,
794826 or dwarf_elf_init() which take care of these details.
795827 */
796828 struct Dwarf_Obj_Access_Interface_s {
797 /* object is a void* as it hides the data the object access routines
829 /* object is a void* as it hides the data the
830 object access routines
798831 need (which varies by library in use and object format).
799832 */
800833 void* object;
807840 Dwarf_dealloc() alloc_type arguments.
808841 Argument points to:
809842 */
810 #define DW_DLA_STRING 0x01 /* char* */
811 #define DW_DLA_LOC 0x02 /* Dwarf_Loc */
812 #define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */
813 #define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/
814 #define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */
815 #define DW_DLA_BLOCK 0x06 /* Dwarf_Block */
816 #define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */
817 #define DW_DLA_DIE 0x08 /* Dwarf_Die */
818 #define DW_DLA_LINE 0x09 /* Dwarf_Line */
819 #define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */
820 #define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */
821 #define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */
822 #define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */
823 #define DW_DLA_ERROR 0x0e /* Dwarf_Error */
824 #define DW_DLA_LIST 0x0f /* a list */
825 #define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */
826 #define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */
827 #define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */
828 #define DW_DLA_FRAME_OP 0x13 /* Dwarf_Frame_Op */
829 #define DW_DLA_CIE 0x14 /* Dwarf_Cie */
830 #define DW_DLA_FDE 0x15 /* Dwarf_Fde */
831 #define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc */
832 #define DW_DLA_FRAME_BLOCK 0x17 /* Dwarf_Frame Block (not used) */
833 #define DW_DLA_FUNC 0x18 /* Dwarf_Func */
834 #define DW_DLA_TYPENAME 0x19 /* Dwarf_Type */
835 #define DW_DLA_VAR 0x1a /* Dwarf_Var */
836 #define DW_DLA_WEAK 0x1b /* Dwarf_Weak */
837 #define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries */
838 #define DW_DLA_RANGES 0x1d /* Dwarf_Ranges */
843 #define DW_DLA_STRING 0x01 /* char* */
844 #define DW_DLA_LOC 0x02 /* Dwarf_Loc */
845 #define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */
846 #define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/
847 #define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */
848 #define DW_DLA_BLOCK 0x06 /* Dwarf_Block */
849 #define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */
850 #define DW_DLA_DIE 0x08 /* Dwarf_Die */
851 #define DW_DLA_LINE 0x09 /* Dwarf_Line */
852 #define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */
853 #define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */
854 #define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */
855 #define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */
856 #define DW_DLA_ERROR 0x0e /* Dwarf_Error */
857 #define DW_DLA_LIST 0x0f /* a list */
858 #define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */
859 #define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */
860 #define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */
861 #define DW_DLA_FRAME_OP 0x13 /* Dwarf_Frame_Op */
862 #define DW_DLA_CIE 0x14 /* Dwarf_Cie */
863 #define DW_DLA_FDE 0x15 /* Dwarf_Fde */
864 #define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc */
865
866 /* Dwarf_Frame Block (not used) */
867 #define DW_DLA_FRAME_BLOCK 0x17
868
869 #define DW_DLA_FUNC 0x18 /* Dwarf_Func */
870 #define DW_DLA_TYPENAME 0x19 /* Dwarf_Type */
871 #define DW_DLA_VAR 0x1a /* Dwarf_Var */
872 #define DW_DLA_WEAK 0x1b /* Dwarf_Weak */
873 #define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries */
874 #define DW_DLA_RANGES 0x1d /* Dwarf_Ranges */
839875 /* 0x1e (30) to 0x34 (52) reserved for internal to libdwarf types. */
840 #define DW_DLA_GNU_INDEX_HEAD 0x35 /* .debug_gnu_typenames/pubnames, 2020 */
841 #define DW_DLA_RNGLISTS_HEAD 0x36 /* .debug_rnglists DW5 */
842 #define DW_DLA_GDBINDEX 0x37 /* Dwarf_Gdbindex */
843 #define DW_DLA_XU_INDEX 0x38 /* Dwarf_Xu_Index_Header */
844 #define DW_DLA_LOC_BLOCK_C 0x39 /* Dwarf_Loc_c*/
845 #define DW_DLA_LOCDESC_C 0x3a /* Dwarf_Locdesc_c */
846 #define DW_DLA_LOC_HEAD_C 0x3b /* Dwarf_Loc_Head_c */
847 #define DW_DLA_MACRO_CONTEXT 0x3c /* Dwarf_Macro_Context */
876 /* .debug_gnu_typenames/pubnames, 2020 */
877 #define DW_DLA_GNU_INDEX_HEAD 0x35
878
879 #define DW_DLA_RNGLISTS_HEAD 0x36 /* .debug_rnglists DW5 */
880 #define DW_DLA_GDBINDEX 0x37 /* Dwarf_Gdbindex */
881 #define DW_DLA_XU_INDEX 0x38 /* Dwarf_Xu_Index_Header */
882 #define DW_DLA_LOC_BLOCK_C 0x39 /* Dwarf_Loc_c*/
883 #define DW_DLA_LOCDESC_C 0x3a /* Dwarf_Locdesc_c */
884 #define DW_DLA_LOC_HEAD_C 0x3b /* Dwarf_Loc_Head_c */
885 #define DW_DLA_MACRO_CONTEXT 0x3c /* Dwarf_Macro_Context */
848886 /* 0x3d (61) is for libdwarf internal use. */
849 #define DW_DLA_DSC_HEAD 0x3e /* Dwarf_Dsc_Head */
850 #define DW_DLA_DNAMES_HEAD 0x3f /* Dwarf_Dnames_Head */
851 #define DW_DLA_STR_OFFSETS 0x40 /* struct Dwarf_Str_Offsets_Table_s */
887 #define DW_DLA_DSC_HEAD 0x3e /* Dwarf_Dsc_Head */
888 #define DW_DLA_DNAMES_HEAD 0x3f /* Dwarf_Dnames_Head */
889
890 /* struct Dwarf_Str_Offsets_Table_s */
891 #define DW_DLA_STR_OFFSETS 0x40
852892
853893 /* The augmenter string for CIE */
854894 #define DW_CIE_AUGMENTER_STRING_V0 "z"
935975
936976 /* libdwarf error numbers
937977 */
938 #define DW_DLE_NE 0 /* no error */
939 #define DW_DLE_VMM 1 /* dwarf format/library version mismatch */
940 #define DW_DLE_MAP 2 /* memory map failure */
941 #define DW_DLE_LEE 3 /* libelf error */
942 #define DW_DLE_NDS 4 /* no debug section */
943 #define DW_DLE_NLS 5 /* no line section */
944 #define DW_DLE_ID 6 /* invalid descriptor for query */
945 #define DW_DLE_IOF 7 /* I/O failure */
946 #define DW_DLE_MAF 8 /* memory allocation failure */
947 #define DW_DLE_IA 9 /* invalid argument */
948 #define DW_DLE_MDE 10 /* mangled debugging entry */
949 #define DW_DLE_MLE 11 /* mangled line number entry */
950 #define DW_DLE_FNO 12 /* file not open */
951 #define DW_DLE_FNR 13 /* file not a regular file */
952 #define DW_DLE_FWA 14 /* file open with wrong access */
953 #define DW_DLE_NOB 15 /* not an object file */
954 #define DW_DLE_MOF 16 /* mangled object file header */
955 #define DW_DLE_EOLL 17 /* end of location list entries */
956 #define DW_DLE_NOLL 18 /* no location list section */
957 #define DW_DLE_BADOFF 19 /* Invalid offset */
958 #define DW_DLE_EOS 20 /* end of section */
959 #define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/
960 #define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad*/
978 #define DW_DLE_NE 0 /* no error */
979 #define DW_DLE_VMM 1 /* dwarf format/library version mismatch */
980 #define DW_DLE_MAP 2 /* memory map failure */
981 #define DW_DLE_LEE 3 /* libelf error */
982 #define DW_DLE_NDS 4 /* no debug section */
983 #define DW_DLE_NLS 5 /* no line section */
984 #define DW_DLE_ID 6 /* invalid descriptor for query */
985 #define DW_DLE_IOF 7 /* I/O failure */
986 #define DW_DLE_MAF 8 /* memory allocation failure */
987 #define DW_DLE_IA 9 /* invalid argument */
988 #define DW_DLE_MDE 10 /* mangled debugging entry */
989 #define DW_DLE_MLE 11 /* mangled line number entry */
990 #define DW_DLE_FNO 12 /* file not open */
991 #define DW_DLE_FNR 13 /* file not a regular file */
992 #define DW_DLE_FWA 14 /* file open with wrong access */
993 #define DW_DLE_NOB 15 /* not an object file */
994 #define DW_DLE_MOF 16 /* mangled object file header */
995 #define DW_DLE_EOLL 17 /* end of location list entries */
996 #define DW_DLE_NOLL 18 /* no location list section */
997 #define DW_DLE_BADOFF 19 /* Invalid offset */
998 #define DW_DLE_EOS 20 /* end of section */
999 #define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/
1000 #define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad*/
9611001 /* It is not an allowed size (64 or 32) */
9621002 /* Error codes defined by the current Libdwarf Implementation. */
9631003 #define DW_DLE_DBG_ALLOC 23
9941034 #define DW_DLE_DEBUG_LINE_LENGTH_BAD 54
9951035 #define DW_DLE_LINE_PROLOG_LENGTH_BAD 55
9961036 #define DW_DLE_LINE_NUM_OPERANDS_BAD 56
997 #define DW_DLE_LINE_SET_ADDR_ERROR 57 /* No longer used. */
1037 #define DW_DLE_LINE_SET_ADDR_ERROR 57
9981038 #define DW_DLE_LINE_EXT_OPCODE_BAD 58
9991039 #define DW_DLE_DWARF_LINE_NULL 59
10001040 #define DW_DLE_INCL_DIR_NUM_BAD 60
14181458 #define DW_DLE_DEBUG_SUP_ERROR 477
14191459 #define DW_DLE_LOCATION_ERROR 478
14201460 #define DW_DLE_DEBUGLINK_PATH_SHORT 479
1461 #define DW_DLE_SIGNATURE_MISMATCH 480
14211462
14221463 /* LAST MUST EQUAL LAST ERROR NUMBER */
1423 #define DW_DLE_LAST 479
1464 #define DW_DLE_LAST 480
14241465
14251466 #define DW_DLE_LO_USER 0x10000
14261467
14561497 #define DW_DLV_OK 0
14571498 #define DW_DLV_ERROR 1
14581499
1459 /* Special values for offset_into_exception_table field of dwarf fde's. */
1460 /* The following value indicates that there is no Exception table offset
1461 associated with a dwarf frame. */
1500 /* Special values for offset_into_exception_table field
1501 of dwarf fde's. */
1502 /* The following value indicates that there is no
1503 Exception table offset
1504 associated with a dwarf frame. */
14621505 #define DW_DLX_NO_EH_OFFSET (-1LL)
1463 /* The following value indicates that the producer was unable to analyse the
1464 source file to generate Exception tables for this function. */
1506 /* The following value indicates that the producer
1507 was unable to analyse the
1508 source file to generate Exception tables for this function. */
14651509 #define DW_DLX_EH_OFFSET_UNAVAILABLE (-2LL)
14661510
14671511 /* The dwarf specification separates FORMs into
14711515 The DWARF4 specification class definition suffices to
14721516 describe all DWARF versions.
14731517 See section 7.5.4, Attribute Encodings.
1474 A return of DW_FORM_CLASS_UNKNOWN means we could not properly figure
1518 A return of DW_FORM_CLASS_UNKNOWN means we
1519 could not properly figure
14751520 out what form-class it is.
14761521
14771522 DW_FORM_CLASS_FRAMEPTR is MIPS/IRIX only, and refers
15121557 DW_FORM_CLASS_STROFFSETSPTR /* DWARF5 */
15131558 };
15141559
1515 /* These support opening DWARF5 split dwarf objects. */
1560 /* These support opening DWARF5 split dwarf objects and
1561 Elf SHT_GROUP blocks of DWARF sections. */
15161562 #define DW_GROUPNUMBER_ANY 0
15171563 #define DW_GROUPNUMBER_BASE 1
15181564 #define DW_GROUPNUMBER_DWO 2
15191565
1520 /*===========================================================================*/
1521 /* Dwarf consumer interface initialization and termination operations */
1566 /*==================================================================*/
1567 /* Dwarf consumer interface initialization and
1568 termination operations */
15221569
15231570 /* Initialization based on path. This is new October 2018.
15241571 The path actually used is copied to true_path_out
17761823
17771824 /* dwarf_offdie_b new October 2011 */
17781825 /* Finding die given global (not CU-relative) offset.
1779 Applies to debug_info (is_info true) or debug_types (is_info false). */
1826 Applies to debug_info (is_info true) or debug_types
1827 (is_info false). */
17801828 int dwarf_offdie_b(Dwarf_Debug /*dbg*/,
17811829 Dwarf_Off /*offset*/,
17821830 Dwarf_Bool /*is_info*/,
17831831 Dwarf_Die* /*return_die*/,
17841832 Dwarf_Error* /*error*/);
17851833
1786 /* Returns the is_info flag through the pointer if the function returns
1787 DW_DLV_OK. Needed so client software knows if a DIE is in debug_info
1788 or debug_types.
1834 /* Returns the is_info flag.
1835 Needed so client software knows
1836 if a DIE is in debug_info or debug_types.
17891837 New October 2011. */
17901838 Dwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die /*die*/);
1839
1840 /* New December 2020. Any Dwarf_Die will work.
1841 The values returned are about the CU itself, not a DIE. */
1842 int dwarf_cu_header_basics(Dwarf_Die die,
1843 Dwarf_Half * /*version*/,
1844 Dwarf_Bool * /*is_info*/,
1845 Dwarf_Bool * /*is_dwo*/,
1846 Dwarf_Half * /*offset_size*/,
1847 Dwarf_Half * /*address_size*/,
1848 Dwarf_Half * /*extension_size*/,
1849 Dwarf_Sig8 ** /*signature*/,
1850 Dwarf_Off * /*offset_of_length*/,
1851 Dwarf_Unsigned * /*total_byte_length*/,
1852 Dwarf_Error * /*error*/);
17911853
17921854 /* New March 2016.
17931855 So we can associate a DIE's abbreviations with the contents
18721934 int dwarf_die_abbrev_children_flag(Dwarf_Die /*die*/,
18731935 Dwarf_Half * /*ab_has_child*/);
18741936
1875 /* Validate the sibling DIE. This only makes sense to call
1876 if the sibling's DIEs have been travsersed and
1877 dwarf_child called on each,
1878 so that the last DIE dwarf_child saw was the last.
1879 Essentially ensuring that (after such traversal) that we
1880 are in the same place a sibling attribute would identify.
1881 In case we return DW_DLV_ERROR, the global offset of the last
1882 DIE traversed by dwarf_child is returned through *offset */
1883 int dwarf_validate_die_sibling(Dwarf_Die /*sibling*/,Dwarf_Off* /*offset*/);
1937 /* Validate the sibling DIE. This only makes sense to call
1938 if the sibling's DIEs have been travsersed and
1939 dwarf_child called on each,
1940 so that the last DIE dwarf_child saw was the last.
1941 Essentially ensuring that (after such traversal) that we
1942 are in the same place a sibling attribute would identify.
1943 In case we return DW_DLV_ERROR, the global offset of the last
1944 DIE traversed by dwarf_child is returned through *offset */
1945 int dwarf_validate_die_sibling(Dwarf_Die /*sibling*/,
1946 Dwarf_Off* /*offset*/);
18841947
18851948 /* convenience functions, alternative to using dwarf_attrlist */
18861949 int dwarf_hasattr(Dwarf_Die /*die*/,
18961959 Dwarf_Unsigned * /*offcnt*/,
18971960 Dwarf_Error * /*error*/);
18981961
1899 /* BEGIN: debug_gnu_pubnames/typenames access,
1900 calling these Gnu_Index as a general reference.
1901 */
1962 /* BEGIN: debug_gnu_pubnames/typenames access,
1963 calling these Gnu_Index as a general reference. */
19021964
19031965 int dwarf_get_gnu_index_head(Dwarf_Debug /*dbg*/,
19041966 /* The following arg false to select gnu_pubtypes */
22752337 interface.
22762338 This interface only reads the line table header, so
22772339 it takes relatively little time.
2278 *is_single_table will be set non-zero for all standard dwarf line sections.
2279 *is_single_table will be set zero for line sections with the
2280 two_level line table extension (which will have *version_out 0xf006). */
2340 *is_single_table will be set non-zero for all
2341 standard dwarf line sections.
2342 *is_single_table will be set zero for
2343 line sections with the two_level line table
2344 extension (which will have *version_out 0xf006). */
22812345 int dwarf_srclines_b(Dwarf_Die /*die*/,
22822346 Dwarf_Unsigned * /* version_out*/,
22832347 Dwarf_Small * /* table_count */,
24002464
24012465 /* New October 2015. */
24022466 /* Count is the real count of include array entries. */
2403 int dwarf_srclines_include_dir_count(Dwarf_Line_Context /*line_context*/,
2467 int dwarf_srclines_include_dir_count(
2468 Dwarf_Line_Context /*line_context*/,
24042469 Dwarf_Signed * /*count*/,
24052470 Dwarf_Error * /* error*/);
24062471
24072472 /* New October 2015. */
24082473 /* Index starts with 1, last is 'count' */
2409 int dwarf_srclines_include_dir_data(Dwarf_Line_Context /*line_context*/,
2474 int dwarf_srclines_include_dir_data(
2475 Dwarf_Line_Context /*line_context*/,
24102476 Dwarf_Signed /*index*/,
24112477 const char ** /*name*/,
24122478 Dwarf_Error * /* error*/);
26002666 Dwarf_Unsigned * /*abbrev_code*/,
26012667 Dwarf_Unsigned * /*tag*/,
26022668
2603 /* The number of valid abbrev_entry values: 0 to number_of_abbrev-1
2604 */
2669 /* The number of valid abbrev_entry values:
2670 0 to number_of_abbrev-1 */
26052671 Dwarf_Unsigned * /*number_of_abbrev*/,
26062672
2607 /* The number of attr/form pairs, not counting the trailing
2608 0,0 pair. */
2673 /* The number of attr/form pairs, not counting
2674 the trailing 0,0 pair. */
26092675 Dwarf_Unsigned * /*number_of_attr_form_entries*/,
26102676 Dwarf_Error * /*error*/);
26112677
28242890 Dwarf_Off* /*cu_offset*/,
28252891 Dwarf_Error* /*error*/);
28262892
2827 /* User-defined type name operations, SGI IRIX .debug_typenames section.
2828 Same content as DWARF3 .debug_pubtypes, but defined years before
2829 .debug_pubtypes was defined. SGI IRIX only. */
2893 /* jUser-defined type name operations,
2894 SGI IRIX .debug_typenames section.
2895
2896 Same content as DWARF3 .debug_pubtypes, but
2897 defined years before .debug_pubtypes was defined.
2898 SGI IRIX only. */
28302899 int dwarf_get_types(Dwarf_Debug /*dbg*/,
28312900 Dwarf_Type** /*types*/,
28322901 Dwarf_Signed * /*number_of_types*/,
31323201 */
31333202 /* dwarf_get_fde_info_for_reg3 is useful on a single column, but
31343203 it is inefficient to iterate across all table_columns using this
3135 function. Instead call dwarf_get_fde_info_for_all_regs3() and index
3136 into the table it fills in. */
3204 function. Instead call dwarf_get_fde_info_for_all_regs3()
3205 and index into the table it fills in. */
31373206 int dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
31383207 Dwarf_Half /*table_column*/,
31393208 Dwarf_Addr /*pc_requested*/,
33503419 Dwarf_Half * /*forms_count*/,
33513420 const char ** /*macro_string*/,
33523421 Dwarf_Error * /*error*/);
3353 int dwarf_get_macro_startend_file(Dwarf_Macro_Context /*macro_context*/,
3422 int dwarf_get_macro_startend_file(
3423 Dwarf_Macro_Context /*macro_context*/,
33543424 Dwarf_Unsigned /*op_number*/,
33553425 Dwarf_Unsigned * /*line_number*/,
33563426 Dwarf_Unsigned * /*name_index_to_line_tab*/,
33893459 int * /*error_count_out */);
33903460
33913461 /* As of August 2013, dwarf_print_lines() no longer uses printf.
3392 Instead it calls back to the application using a function pointer
3393 once per line-to-print. The lines passed back already have any needed
3462 Instead it calls back to the application using a function
3463 pointer once per line-to-print. The lines passed back
3464 already have any needed
33943465 newlines. The following struct is used to initialize
33953466 the callback mechanism.
33963467
3397 Failing to call the dwarf_register_printf_callback() function will
3398 prevent the lines from being passed back but such omission
3399 is not an error.
3468 Failing to call the dwarf_register_printf_callback()
3469 function will prevent the lines from being passed back
3470 but such omission is not an error.
34003471 See libdwarf2.1.mm for further documentation.
34013472
34023473 The return value is the previous set of callback values.
36023673 Dwarf_Error * /*error*/);
36033674
36043675
3605 int dwarf_gdbindex_cuvector_inner_attributes(Dwarf_Gdbindex /*gdbindex*/,
3676 int dwarf_gdbindex_cuvector_inner_attributes(
3677 Dwarf_Gdbindex /*gdbindex*/,
36063678 Dwarf_Unsigned /*cuvector_offset*/,
36073679 Dwarf_Unsigned /*innerindex*/,
36083680 /* The attr_value is a field of bits. For expanded version
36323704
36333705 /* END gdbindex/debugfission operations. */
36343706
3635 /* START debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3707 /* START debugfission dwp .debug_cu_index
3708 and .debug_tu_index operations. */
36363709
36373710 int dwarf_get_xu_index_header(Dwarf_Debug /*dbg*/,
36383711 const char * section_type, /* "tu" or "cu" */
36463719
36473720 int dwarf_get_xu_index_section_type(Dwarf_Xu_Index_Header /*xuhdr*/,
36483721 /* the function returns a pointer to
3649 the immutable string "tu" or "cu" via this arg. Do not free. */
3722 the immutable string "tu" or "cu" via this arg.
3723 Do not free. */
36503724 const char ** /*typename*/,
36513725 /* the function returns a pointer to
36523726 the immutable section name. Do not free.
37133787 Dwarf_Unsigned unused1;
37143788 Dwarf_Unsigned unused2;
37153789 };
3716 typedef struct Dwarf_Debug_Fission_Per_CU_s Dwarf_Debug_Fission_Per_CU ;
3790 typedef struct Dwarf_Debug_Fission_Per_CU_s
3791 Dwarf_Debug_Fission_Per_CU;
37173792 /* For any Dwarf_Die in a compilation unit, return
37183793 the debug fission table data through
37193794 percu_out. Usually applications
37263801 Dwarf_Debug_Fission_Per_CU * /* percu_out */,
37273802 Dwarf_Error * /* err */);
37283803
3729 /* Given a key (hash signature) from a .o, find the per-cu information
3804 /* Given a key (hash signature) from a .o,
3805 find the per-cu information
37303806 for the CU with that key. */
37313807 int dwarf_get_debugfission_for_key(Dwarf_Debug /*dbg*/,
37323808 Dwarf_Sig8 * /*key, hash signature */,
37343810 Dwarf_Debug_Fission_Per_CU * /*percu_out */,
37353811 Dwarf_Error * /*err */);
37363812
3737 /* END debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3813 /* END debugfission dwp .debug_cu_index
3814 and .debug_tu_index operations. */
37383815
37393816
37403817 /* Utility operations */
41304207 Dwarf_Error * /*error*/);
41314208
41324209 /* August 2013 sleb creator. For any attribute. */
4133 Dwarf_P_Attribute dwarf_add_AT_any_value_sleb(Dwarf_P_Die /*ownerdie*/,
4210 Dwarf_P_Attribute dwarf_add_AT_any_value_sleb(
4211 Dwarf_P_Die /*ownerdie*/,
41344212 Dwarf_Half /*attrnum*/,
41354213 Dwarf_Signed /*signed_value*/,
41364214 Dwarf_Error * /*error*/);
41434221 Dwarf_Error * /*error*/);
41444222
41454223 /* Original sleb creator. Only for DW_AT_const_value. */
4146 Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
4224 Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(
4225 Dwarf_P_Die /*ownerdie*/,
41474226 Dwarf_Signed /*signed_value*/,
41484227 Dwarf_Error* /*error*/);
41494228
41544233 Dwarf_Error* /*error*/);
41554234
41564235 /* August 2013 uleb creator. For any attribute. */
4157 Dwarf_P_Attribute dwarf_add_AT_any_value_uleb(Dwarf_P_Die /*ownerdie*/,
4236 Dwarf_P_Attribute dwarf_add_AT_any_value_uleb(
4237 Dwarf_P_Die /*ownerdie*/,
41584238 Dwarf_Half /*attrnum*/,
41594239 Dwarf_Unsigned /*signed_value*/,
41604240 Dwarf_Error * /*error*/);
53155395
53165396 On successful call, call dwarf_str_offsets_table_entry()
53175397 to get the individual table values on the now-active table. */
5318 int dwarf_next_str_offsets_table( Dwarf_Str_Offsets_Table /*table_data*/,
5398 int dwarf_next_str_offsets_table(
5399 Dwarf_Str_Offsets_Table /*table_data*/,
53195400 Dwarf_Unsigned * /*unit_length*/,
53205401 Dwarf_Unsigned * /*unit_length_offset*/,
53215402 Dwarf_Unsigned * /*table_start_offset*/,
53275408
53285409 /* Valid index values n: 0 <= n < table_entry_count
53295410 for the active table */
5330 int dwarf_str_offsets_value_by_index(Dwarf_Str_Offsets_Table /*table_data*/,
5411 int dwarf_str_offsets_value_by_index(
5412 Dwarf_Str_Offsets_Table /*table_data*/,
53315413 Dwarf_Unsigned /*index_to_entry*/,
53325414 Dwarf_Unsigned * /*entry_value*/,
53335415 Dwarf_Error * /*error*/);
53345416
53355417 /* After all str_offsets read this reports final
53365418 wasted-bytes count. */
5337 int dwarf_str_offsets_statistics(Dwarf_Str_Offsets_Table /*table_data*/,
5419 int dwarf_str_offsets_statistics(
5420 Dwarf_Str_Offsets_Table /*table_data*/,
53385421 Dwarf_Unsigned * /*wasted_byte_count*/,
53395422 Dwarf_Unsigned * /*table_count*/,
53405423 Dwarf_Error * /*error*/);
54035486 /* The following copied from a generated dwarf_names.h */
54045487
54055488 /* BEGIN FILE */
5406 extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5407 extern int dwarf_get_ADDR_name(unsigned int /*val_in*/, const char ** /*s_out */);
5408 extern int dwarf_get_ATCF_name(unsigned int /*val_in*/, const char ** /*s_out */);
5409 extern int dwarf_get_ATE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5410 extern int dwarf_get_AT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5411 extern int dwarf_get_CC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5412 extern int dwarf_get_CFA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5413 extern int dwarf_get_children_name(unsigned int /*val_in*/, const char ** /*s_out */);
5414 extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/, const char ** /*s_out */);
5415 extern int dwarf_get_DEFAULTED_name(unsigned int /*val_in*/, const char ** /*s_out */);
5416 extern int dwarf_get_DSC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5417 extern int dwarf_get_DS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5418 extern int dwarf_get_EH_name(unsigned int /*val_in*/, const char ** /*s_out */);
5419 extern int dwarf_get_END_name(unsigned int /*val_in*/, const char ** /*s_out */);
5420 extern int dwarf_get_FORM_name(unsigned int /*val_in*/, const char ** /*s_out */);
5421 extern int dwarf_get_FRAME_name(unsigned int /*val_in*/, const char ** /*s_out */);
5422 extern int dwarf_get_GNUIKIND_name(unsigned int /*val_in*/, const char ** /*s_out */);
5423 extern int dwarf_get_GNUIVIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5424 extern int dwarf_get_ID_name(unsigned int /*val_in*/, const char ** /*s_out */);
5425 extern int dwarf_get_IDX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5426 extern int dwarf_get_INL_name(unsigned int /*val_in*/, const char ** /*s_out */);
5427 extern int dwarf_get_ISA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5428 extern int dwarf_get_LANG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5429 extern int dwarf_get_LLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5430 /* dwarf_get_LLEX_name is likely just temporary. Not standard. */
5431 extern int dwarf_get_LLEX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5432 extern int dwarf_get_LNCT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5433 extern int dwarf_get_LNE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5434 extern int dwarf_get_LNS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5435 extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5436 extern int dwarf_get_MACRO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5437 extern int dwarf_get_OP_name(unsigned int /*val_in*/, const char ** /*s_out */);
5438 extern int dwarf_get_ORD_name(unsigned int /*val_in*/, const char ** /*s_out */);
5439 extern int dwarf_get_RLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5440 extern int dwarf_get_SECT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5441 extern int dwarf_get_TAG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5442 extern int dwarf_get_UT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5443 extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/, const char ** /*s_out */);
5444 extern int dwarf_get_VIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5489 extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/,
5490 const char ** /*s_out */);
5491 extern int dwarf_get_ADDR_name(unsigned int /*val_in*/,
5492 const char ** /*s_out */);
5493 extern int dwarf_get_ATCF_name(unsigned int /*val_in*/,
5494 const char ** /*s_out */);
5495 extern int dwarf_get_ATE_name(unsigned int /*val_in*/,
5496 const char ** /*s_out */);
5497 extern int dwarf_get_AT_name(unsigned int /*val_in*/,
5498 const char ** /*s_out */);
5499 extern int dwarf_get_CC_name(unsigned int /*val_in*/,
5500 const char ** /*s_out */);
5501 extern int dwarf_get_CFA_name(unsigned int /*val_in*/,
5502 const char ** /*s_out */);
5503 extern int dwarf_get_children_name(unsigned int /*val_in*/,
5504 const char ** /*s_out */);
5505 extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/,
5506 const char ** /*s_out */);
5507 extern int dwarf_get_DEFAULTED_name(unsigned int /*val_in*/,
5508 const char ** /*s_out */);
5509 extern int dwarf_get_DSC_name(unsigned int /*val_in*/,
5510 const char ** /*s_out */);
5511 extern int dwarf_get_DS_name(unsigned int /*val_in*/,
5512 const char ** /*s_out */);
5513 extern int dwarf_get_EH_name(unsigned int /*val_in*/,
5514 const char ** /*s_out */);
5515 extern int dwarf_get_END_name(unsigned int /*val_in*/,
5516 const char ** /*s_out */);
5517 extern int dwarf_get_FORM_name(unsigned int /*val_in*/,
5518 const char ** /*s_out */);
5519 extern int dwarf_get_FRAME_name(unsigned int /*val_in*/,
5520 const char ** /*s_out */);
5521 extern int dwarf_get_GNUIKIND_name(unsigned int /*val_in*/,
5522 const char ** /*s_out */);
5523 extern int dwarf_get_GNUIVIS_name(unsigned int /*val_in*/,
5524 const char ** /*s_out */);
5525 extern int dwarf_get_ID_name(unsigned int /*val_in*/,
5526 const char ** /*s_out */);
5527 extern int dwarf_get_IDX_name(unsigned int /*val_in*/,
5528 const char ** /*s_out */);
5529 extern int dwarf_get_INL_name(unsigned int /*val_in*/,
5530 const char ** /*s_out */);
5531 extern int dwarf_get_ISA_name(unsigned int /*val_in*/,
5532 const char ** /*s_out */);
5533 extern int dwarf_get_LANG_name(unsigned int /*val_in*/,
5534 const char ** /*s_out */);
5535 extern int dwarf_get_LLE_name(unsigned int /*val_in*/,
5536 const char ** /*s_out */);
5537 /* dwarf_get_LLEX_name is for a GNU extension.
5538 Not defined by the GNU folks nor a DWARF standard
5539 but it seemed essential. */
5540 extern int dwarf_get_LLEX_name(unsigned int /*val_in*/,
5541 const char ** /*s_out */);
5542 extern int dwarf_get_LNCT_name(unsigned int /*val_in*/,
5543 const char ** /*s_out */);
5544 extern int dwarf_get_LNE_name(unsigned int /*val_in*/,
5545 const char ** /*s_out */);
5546 extern int dwarf_get_LNS_name(unsigned int /*val_in*/,
5547 const char ** /*s_out */);
5548 extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/,
5549 const char ** /*s_out */);
5550 extern int dwarf_get_MACRO_name(unsigned int /*val_in*/,
5551 const char ** /*s_out */);
5552 extern int dwarf_get_OP_name(unsigned int /*val_in*/,
5553 const char ** /*s_out */);
5554 extern int dwarf_get_ORD_name(unsigned int /*val_in*/,
5555 const char ** /*s_out */);
5556 extern int dwarf_get_RLE_name(unsigned int /*val_in*/,
5557 const char ** /*s_out */);
5558 extern int dwarf_get_SECT_name(unsigned int /*val_in*/,
5559 const char ** /*s_out */);
5560 extern int dwarf_get_TAG_name(unsigned int /*val_in*/,
5561 const char ** /*s_out */);
5562 extern int dwarf_get_UT_name(unsigned int /*val_in*/,
5563 const char ** /*s_out */);
5564 extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/,
5565 const char ** /*s_out */);
5566 extern int dwarf_get_VIS_name(unsigned int /*val_in*/,
5567 const char ** /*s_out */);
54455568 /* END FILE */
54465569
54475570 /* Convert local offset into global offset */
55185641 Dwarf_Unsigned * /*map_entry_count_out*/,
55195642 Dwarf_Error * /*error*/);
55205643
5521 /* New May 2017. Reveals the map between group numbers and section numbers.
5644 /* New May 2017. Reveals the map between group numbers and
5645 section numbers.
55225646 Caller must allocate the arrays with space for 'map_entry_count'
55235647 values and this function fills in the array entries.
55245648 Output ordered by group number and section number.
55315655 Dwarf_Error * /*error*/);
55325656
55335657 /* dwarf_get_endian_copy_function new. December 2019. */
5534 void (*dwarf_get_endian_copy_function(Dwarf_Debug /*dbg*/))(void *, const void * /*src*/, unsigned long /*srclen*/);
5658 void (*dwarf_get_endian_copy_function(Dwarf_Debug /*dbg*/))
5659 (void *, const void * /*src*/, unsigned long /*srclen*/);
55355660
55365661 /* These make the LEB encoding routines visible to libdwarf
55375662 callers. Added November, 2012. */
00 /*
1
21 Copyright (C) 2000-2010 Silicon Graphics, Inc. All Rights Reserved.
32 Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
43 Portions Copyright 2008-2018 David Anderson. All rights reserved.
125124 typedef struct Dwarf_Sig8_s Dwarf_Sig8;
126125
127126 /* Contains info on an uninterpreted block of data
128 Used with certain frame information functions and
129 also used with DW_FORM_block<>.
127 Used with certain location information functions,
128 a frame expression function, and
129 also used with DW_FORM_block<> functions.
130130 */
131131 typedef struct {
132 Dwarf_Unsigned bl_len; /* length of block bl_data points at */
133 Dwarf_Ptr bl_data; /* uninterpreted data */
132 Dwarf_Unsigned bl_len; /* length of block bl_data points at */
133 Dwarf_Ptr bl_data; /* uninterpreted data */
134134
135135 /* See libdwarf.h DW_LKIND* */
136136 Dwarf_Small bl_from_loclist;
179179 Not usable with DWARF5 or DWARF4 with location
180180 operator extensions. */
181181 typedef struct {
182 Dwarf_Small lr_atom; /* location operation */
183 Dwarf_Unsigned lr_number; /* operand */
184 Dwarf_Unsigned lr_number2; /* for OP_BREGx and DW_OP_GNU_const_type*/
185 Dwarf_Unsigned lr_offset; /* offset in locexpr for OP_BRA etc */
182 Dwarf_Small lr_atom; /* location operation */
183 Dwarf_Unsigned lr_number; /* operand */
184 /* for OP_BREGx and DW_OP_GNU_const_type*/
185 Dwarf_Unsigned lr_number2;
186 Dwarf_Unsigned lr_offset; /* offset in locexpr for OP_BRA etc */
186187 } Dwarf_Loc;
187188
188189
330331 #define DW_EXPR_VAL_EXPRESSION 3
331332
332333 typedef struct Dwarf_Regtable_Entry_s {
333 /* For each index i (naming a hardware register with dwarf number
334 i) the following is true and defines the value of that register:
334 /* For each index i (naming a hardware register
335 with dwarf number i) the following is true and defines
336 the value of that register:
335337
336338 If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
337339 it is not DWARF register number but
338 a place holder indicating the register has no defined value.
340 a place holder indicating the register has
341 no defined value.
339342 If dw_regnum is Register DW_FRAME_SAME_VAL
340343 it is not DWARF register number but
341344 a place holder indicating the register has the same
350353 software register numbers in the machine hardware)
351354 and the following applies:
352355
353 if dw_value_type == DW_EXPR_OFFSET (the only case for dwarf2):
356 if dw_value_type == DW_EXPR_OFFSET (the
357 only case for dwarf2):
354358 If dw_offset_relevant is non-zero, then
355359 the value is stored at at the address CFA+N where
356360 N is a signed offset.
357361 Rule: Offset(N)
358 If dw_offset_relevant is zero, then the value of the register
359 is the value of (DWARF) register number dw_regnum.
362 If dw_offset_relevant is zero, then the
363 value of the register
364 is the value of (DWARF) register
365 number dw_regnum.
360366 Rule: register(F)
361367 Other values of dw_value_type are an error.
362368 */
386392
387393 If dw_regnum is Register DW_FRAME_UNDEFINED_VAL
388394 it is not DWARF register number but
389 a place holder indicating the register has no defined value.
395 a place holder indicating the register
396 has no defined value.
390397 If dw_regnum is Register DW_FRAME_SAME_VAL
391398 it is not DWARF register number but
392399 a place holder indicating the register has the same
398405 DW_FRAME_* Values present on disk are in dwarf.h
399406 Because DW_FRAME_SAME_VAL and DW_FRAME_UNDEFINED_VAL
400407 and DW_FRAME_CFA_COL3 are definable at runtime
401 consider the names symbolic in this comment, not absolute.
408 consider the names symbolic in this comment,
409 not absolute.
402410
403411 Otherwise: the register number is a DWARF register number
404412 (see ABI documents for how this translates to hardware/
410418 not DW_FRAME_CFA_COL3, nor DW_FRAME_SAME_VAL, nor
411419 DW_FRAME_UNDEFINED_VAL.
412420
413 If dw_value_type == DW_EXPR_OFFSET (the only possible case for
414 dwarf2):
421 If dw_value_type == DW_EXPR_OFFSET (the only
422 possible case for dwarf2):
415423 If dw_offset_relevant is non-zero, then
416424 the value is stored at at the address
417425 CFA+N where N is a signed offset.
420428 So dw_offset_or_block_len is a signed value, really,
421429 and must be printed/evaluated as such.
422430 Rule: Offset(N)
423 If dw_offset_relevant is zero, then the value of the register
431 If dw_offset_relevant is zero, then the
432 value of the register
424433 is the value of (DWARF) register number dw_regnum.
425434 Rule: register(R)
426435 If dw_value_type == DW_EXPR_VAL_OFFSET
427 the value of this register is CFA +N where N is a signed offset.
436 the value of this register is CFA +N where
437 N is a signed offset.
428438 dw_regnum is the cfa register rule which means
429439 one ignores dw_regnum and uses the CFA appropriately.
430440 Rule: val_offset(N)
432442 The value of the register is the value at the address
433443 computed by evaluating the DWARF expression E.
434444 Rule: expression(E)
435 The expression E byte stream is pointed to by dw_block_ptr.
445 The expression E byte stream is pointed to by
446 dw_block_ptr.
436447 The expression length in bytes is given by
437448 dw_offset_or_block_len.
438449 If dw_value_type == DW_EXPR_VAL_EXPRESSION
439450 The value of the register is the value
440451 computed by evaluating the DWARF expression E.
441452 Rule: val_expression(E)
442 The expression E byte stream is pointed to by dw_block_ptr.
453 The expression E byte stream is pointed to
454 by dw_block_ptr.
443455 The expression length in bytes is given by
444456 dw_offset_or_block_len.
445457 Other values of dw_value_type are an error.
485497 If DW_DLV_OK returns the regnum and offset thru the pointers
486498 (which the consumer must use appropriately).
487499 */
488 int dwarf_frame_get_reg_register(struct Dwarf_Regtable_Entry3_s *reg_in,
500 int dwarf_frame_get_reg_register(
501 struct Dwarf_Regtable_Entry3_s *reg_in,
489502 Dwarf_Small *offset_relevant,
490503 Dwarf_Half *regnum_out,
491504 Dwarf_Signed *offset_out);
495508 The caller must pass in the address of a valid
496509 Dwarf_Block (the caller need not initialize it).
497510 */
498 int dwarf_frame_get_reg_expression(struct Dwarf_Regtable_Entry3_s *reg_in,
511 int dwarf_frame_get_reg_expression(
512 struct Dwarf_Regtable_Entry3_s *reg_in,
499513 Dwarf_Block *block_out);
500514
501515
535549
536550 typedef struct Dwarf_P_String_Attr_s * Dwarf_P_String_Attr;
537551 struct Dwarf_P_String_Attr_s {
538 Dwarf_Unsigned sa_offset; /* Offset of string attribute data */
552 /* Offset of string attribute data */
553 Dwarf_Unsigned sa_offset;
539554 Dwarf_Unsigned sa_nbytes;
540555 };
541556
577592
578593 /* error handler function
579594 */
580 typedef void (*Dwarf_Handler)(Dwarf_Error /*error*/, Dwarf_Ptr /*errarg*/);
595 typedef void (*Dwarf_Handler)(Dwarf_Error /*error*/,
596 Dwarf_Ptr /*errarg*/);
581597
582598
583599 /* Begin libdwarf Object File Interface declarations.
584600
585601 As of February 2008 there are multiple dwarf_reader object access
586602 initialization methods available:
587 The traditional dwarf_elf_init() and dwarf_init() and dwarf_finish()
588 which assume libelf and POSIX file access.
589 An object-file and library agnostic dwarf_object_init() and dwarf_object_finish()
603 The traditional dwarf_elf_init() and dwarf_init() and
604 dwarf_finish() which assume libelf and POSIX file access.
605 An object-file and library agnostic dwarf_object_init()
606 and dwarf_object_finish()
590607 which allow the coder to provide object access routines
591 abstracting away the elf interface. So there is no dependence in the
608 abstracting away the elf interface.
609 So there is no dependence in the
592610 reader code on the object format and no dependence on libelf.
593611 See the code in dwarf_elf_access.c and dwarf_original_elf_init.c
594612 to see an example of initializing the structures mentioned below.
605623 split-dwarf sections can be accessed.
606624 */
607625
608 typedef struct Dwarf_Obj_Access_Interface_s Dwarf_Obj_Access_Interface;
609 typedef struct Dwarf_Obj_Access_Methods_s Dwarf_Obj_Access_Methods;
610 typedef struct Dwarf_Obj_Access_Section_s Dwarf_Obj_Access_Section;
626 typedef struct Dwarf_Obj_Access_Interface_s
627 Dwarf_Obj_Access_Interface;
628 typedef struct Dwarf_Obj_Access_Methods_s Dwarf_Obj_Access_Methods;
629 typedef struct Dwarf_Obj_Access_Section_s Dwarf_Obj_Access_Section;
611630
612631
613632 /* Used in the get_section interface function
630649 /* Size in bytes of the section. */
631650 Dwarf_Unsigned size;
632651
633 /* Having an accurate section name makes debugging of libdwarf easier.
652 /* Having an accurate section name makes
653 debugging of libdwarf easier.
634654 and is essential to find the .debug_ sections. */
635655 const char* name;
636656 /* Set link to zero if it is meaningless. If non-zero
656676 DW_OBJECT_LSB
657677 } Dwarf_Endianness;
658678
659 /* The functions we need to access object data from libdwarf are declared here.
679 /* The functions we need to access object data
680 from libdwarf are declared here.
660681
661682 In these function pointer declarations
662683 'void *obj' is intended to be a pointer (the object field in
663684 Dwarf_Obj_Access_Interface_s)
664 that hides the library-specific and object-specific data that makes
665 it possible to handle multiple object formats and multiple libraries.
666 It's not required that one handles multiple such in a single libdwarf
685 that hides the library-specific and object-specific
686 data that makes
687 it possible to handle multiple object formats
688 and multiple libraries.
689 It's not required that one handles multiple such
690 in a single libdwarf
667691 archive/shared-library (but not ruled out either).
668692 See dwarf_elf_object_access_internals_t and dwarf_elf_access.c
669693 for an example.
670
671694 */
672695 struct Dwarf_Obj_Access_Methods_s {
673696 /*
677700
678701 Parameters
679702 section_index - Zero-based index.
680 return_section - Pointer to a structure in which section info
681 will be placed. Caller must provide a valid pointer to a
682 structure area. The structure's contents will be overwritten
703 return_section - Pointer to a structure in which
704 section info will be placed. Caller must
705 provide a valid pointer to a
706 structure area. The structure's contents
707 will be overwritten
683708 by the call to get_section_info.
684 error - A pointer to an integer in which an error code may be stored.
709 error - A pointer to an integer in which an error
710 code may be stored.
685711
686712 Return
687713 DW_DLV_OK - Everything ok.
693719 /*
694720 get_byte_order
695721
696 Get whether the object file represented by this interface is big-endian
722 Get whether the object file represented by
723 this interface is big-endian
697724 (DW_OBJECT_MSB) or little endian (DW_OBJECT_LSB).
698725
699726 Parameters
739766 /*
740767 load_section
741768
742 Get a pointer to an array of bytes that represent the section.
769 Get a pointer to an array of bytes that
770 represent the section.
743771
744772 Parameters
745773 section_index - Zero-based index.
746 return_data - The address of a pointer to which the section data block
774 return_data - The address of a pointer to
775 which the section data block
747776 will be assigned.
748 error - Pointer to an integer for returning libdwarf-defined
749 error numbers.
777 error - Pointer to an integer for returning
778 libdwarf-defined error numbers.
750779
751780 Return
752781 DW_DLV_OK - No error.
753 DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
754 error number.
782 DW_DLV_ERROR - Error. Use 'error' to indicate
783 a libdwarf-defined error number.
755784 DW_DLV_NO_ENTRY - No such section. */
756785 int (*load_section)(void* obj, Dwarf_Half section_index,
757786 Dwarf_Small** return_data, int* error);
760789 relocate_a_section
761790 If relocations are not supported leave this pointer NULL.
762791
763 Get a pointer to an array of bytes that represent the section.
792 Get a pointer to an array of bytes that represent
793 the section.
764794
765795 Parameters
766 section_index - Zero-based index of the section to be relocated.
796 section_index - Zero-based index of the
797 section to be relocated.
767798 error - Pointer to an integer for returning libdwarf-defined
768799 error numbers.
769800
770801 Return
771802 DW_DLV_OK - No error.
772 DW_DLV_ERROR - Error. Use 'error' to indicate a libdwarf-defined
803 DW_DLV_ERROR - Error. Use 'error' to indicate
804 a libdwarf-defined
773805 error number.
774806 DW_DLV_NO_ENTRY - No such section. */
775807 int (*relocate_a_section)(void* obj, Dwarf_Half section_index,
794826 or dwarf_elf_init() which take care of these details.
795827 */
796828 struct Dwarf_Obj_Access_Interface_s {
797 /* object is a void* as it hides the data the object access routines
829 /* object is a void* as it hides the data the
830 object access routines
798831 need (which varies by library in use and object format).
799832 */
800833 void* object;
807840 Dwarf_dealloc() alloc_type arguments.
808841 Argument points to:
809842 */
810 #define DW_DLA_STRING 0x01 /* char* */
811 #define DW_DLA_LOC 0x02 /* Dwarf_Loc */
812 #define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */
813 #define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/
814 #define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */
815 #define DW_DLA_BLOCK 0x06 /* Dwarf_Block */
816 #define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */
817 #define DW_DLA_DIE 0x08 /* Dwarf_Die */
818 #define DW_DLA_LINE 0x09 /* Dwarf_Line */
819 #define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */
820 #define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */
821 #define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */
822 #define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */
823 #define DW_DLA_ERROR 0x0e /* Dwarf_Error */
824 #define DW_DLA_LIST 0x0f /* a list */
825 #define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */
826 #define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */
827 #define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */
828 #define DW_DLA_FRAME_OP 0x13 /* Dwarf_Frame_Op */
829 #define DW_DLA_CIE 0x14 /* Dwarf_Cie */
830 #define DW_DLA_FDE 0x15 /* Dwarf_Fde */
831 #define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc */
832 #define DW_DLA_FRAME_BLOCK 0x17 /* Dwarf_Frame Block (not used) */
833 #define DW_DLA_FUNC 0x18 /* Dwarf_Func */
834 #define DW_DLA_TYPENAME 0x19 /* Dwarf_Type */
835 #define DW_DLA_VAR 0x1a /* Dwarf_Var */
836 #define DW_DLA_WEAK 0x1b /* Dwarf_Weak */
837 #define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries */
838 #define DW_DLA_RANGES 0x1d /* Dwarf_Ranges */
843 #define DW_DLA_STRING 0x01 /* char* */
844 #define DW_DLA_LOC 0x02 /* Dwarf_Loc */
845 #define DW_DLA_LOCDESC 0x03 /* Dwarf_Locdesc */
846 #define DW_DLA_ELLIST 0x04 /* Dwarf_Ellist (not used)*/
847 #define DW_DLA_BOUNDS 0x05 /* Dwarf_Bounds (not used) */
848 #define DW_DLA_BLOCK 0x06 /* Dwarf_Block */
849 #define DW_DLA_DEBUG 0x07 /* Dwarf_Debug */
850 #define DW_DLA_DIE 0x08 /* Dwarf_Die */
851 #define DW_DLA_LINE 0x09 /* Dwarf_Line */
852 #define DW_DLA_ATTR 0x0a /* Dwarf_Attribute */
853 #define DW_DLA_TYPE 0x0b /* Dwarf_Type (not used) */
854 #define DW_DLA_SUBSCR 0x0c /* Dwarf_Subscr (not used) */
855 #define DW_DLA_GLOBAL 0x0d /* Dwarf_Global */
856 #define DW_DLA_ERROR 0x0e /* Dwarf_Error */
857 #define DW_DLA_LIST 0x0f /* a list */
858 #define DW_DLA_LINEBUF 0x10 /* Dwarf_Line* (not used) */
859 #define DW_DLA_ARANGE 0x11 /* Dwarf_Arange */
860 #define DW_DLA_ABBREV 0x12 /* Dwarf_Abbrev */
861 #define DW_DLA_FRAME_OP 0x13 /* Dwarf_Frame_Op */
862 #define DW_DLA_CIE 0x14 /* Dwarf_Cie */
863 #define DW_DLA_FDE 0x15 /* Dwarf_Fde */
864 #define DW_DLA_LOC_BLOCK 0x16 /* Dwarf_Loc */
865
866 /* Dwarf_Frame Block (not used) */
867 #define DW_DLA_FRAME_BLOCK 0x17
868
869 #define DW_DLA_FUNC 0x18 /* Dwarf_Func */
870 #define DW_DLA_TYPENAME 0x19 /* Dwarf_Type */
871 #define DW_DLA_VAR 0x1a /* Dwarf_Var */
872 #define DW_DLA_WEAK 0x1b /* Dwarf_Weak */
873 #define DW_DLA_ADDR 0x1c /* Dwarf_Addr sized entries */
874 #define DW_DLA_RANGES 0x1d /* Dwarf_Ranges */
839875 /* 0x1e (30) to 0x34 (52) reserved for internal to libdwarf types. */
840 #define DW_DLA_GNU_INDEX_HEAD 0x35 /* .debug_gnu_typenames/pubnames, 2020 */
841 #define DW_DLA_RNGLISTS_HEAD 0x36 /* .debug_rnglists DW5 */
842 #define DW_DLA_GDBINDEX 0x37 /* Dwarf_Gdbindex */
843 #define DW_DLA_XU_INDEX 0x38 /* Dwarf_Xu_Index_Header */
844 #define DW_DLA_LOC_BLOCK_C 0x39 /* Dwarf_Loc_c*/
845 #define DW_DLA_LOCDESC_C 0x3a /* Dwarf_Locdesc_c */
846 #define DW_DLA_LOC_HEAD_C 0x3b /* Dwarf_Loc_Head_c */
847 #define DW_DLA_MACRO_CONTEXT 0x3c /* Dwarf_Macro_Context */
876 /* .debug_gnu_typenames/pubnames, 2020 */
877 #define DW_DLA_GNU_INDEX_HEAD 0x35
878
879 #define DW_DLA_RNGLISTS_HEAD 0x36 /* .debug_rnglists DW5 */
880 #define DW_DLA_GDBINDEX 0x37 /* Dwarf_Gdbindex */
881 #define DW_DLA_XU_INDEX 0x38 /* Dwarf_Xu_Index_Header */
882 #define DW_DLA_LOC_BLOCK_C 0x39 /* Dwarf_Loc_c*/
883 #define DW_DLA_LOCDESC_C 0x3a /* Dwarf_Locdesc_c */
884 #define DW_DLA_LOC_HEAD_C 0x3b /* Dwarf_Loc_Head_c */
885 #define DW_DLA_MACRO_CONTEXT 0x3c /* Dwarf_Macro_Context */
848886 /* 0x3d (61) is for libdwarf internal use. */
849 #define DW_DLA_DSC_HEAD 0x3e /* Dwarf_Dsc_Head */
850 #define DW_DLA_DNAMES_HEAD 0x3f /* Dwarf_Dnames_Head */
851 #define DW_DLA_STR_OFFSETS 0x40 /* struct Dwarf_Str_Offsets_Table_s */
887 #define DW_DLA_DSC_HEAD 0x3e /* Dwarf_Dsc_Head */
888 #define DW_DLA_DNAMES_HEAD 0x3f /* Dwarf_Dnames_Head */
889
890 /* struct Dwarf_Str_Offsets_Table_s */
891 #define DW_DLA_STR_OFFSETS 0x40
852892
853893 /* The augmenter string for CIE */
854894 #define DW_CIE_AUGMENTER_STRING_V0 "z"
935975
936976 /* libdwarf error numbers
937977 */
938 #define DW_DLE_NE 0 /* no error */
939 #define DW_DLE_VMM 1 /* dwarf format/library version mismatch */
940 #define DW_DLE_MAP 2 /* memory map failure */
941 #define DW_DLE_LEE 3 /* libelf error */
942 #define DW_DLE_NDS 4 /* no debug section */
943 #define DW_DLE_NLS 5 /* no line section */
944 #define DW_DLE_ID 6 /* invalid descriptor for query */
945 #define DW_DLE_IOF 7 /* I/O failure */
946 #define DW_DLE_MAF 8 /* memory allocation failure */
947 #define DW_DLE_IA 9 /* invalid argument */
948 #define DW_DLE_MDE 10 /* mangled debugging entry */
949 #define DW_DLE_MLE 11 /* mangled line number entry */
950 #define DW_DLE_FNO 12 /* file not open */
951 #define DW_DLE_FNR 13 /* file not a regular file */
952 #define DW_DLE_FWA 14 /* file open with wrong access */
953 #define DW_DLE_NOB 15 /* not an object file */
954 #define DW_DLE_MOF 16 /* mangled object file header */
955 #define DW_DLE_EOLL 17 /* end of location list entries */
956 #define DW_DLE_NOLL 18 /* no location list section */
957 #define DW_DLE_BADOFF 19 /* Invalid offset */
958 #define DW_DLE_EOS 20 /* end of section */
959 #define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/
960 #define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad*/
978 #define DW_DLE_NE 0 /* no error */
979 #define DW_DLE_VMM 1 /* dwarf format/library version mismatch */
980 #define DW_DLE_MAP 2 /* memory map failure */
981 #define DW_DLE_LEE 3 /* libelf error */
982 #define DW_DLE_NDS 4 /* no debug section */
983 #define DW_DLE_NLS 5 /* no line section */
984 #define DW_DLE_ID 6 /* invalid descriptor for query */
985 #define DW_DLE_IOF 7 /* I/O failure */
986 #define DW_DLE_MAF 8 /* memory allocation failure */
987 #define DW_DLE_IA 9 /* invalid argument */
988 #define DW_DLE_MDE 10 /* mangled debugging entry */
989 #define DW_DLE_MLE 11 /* mangled line number entry */
990 #define DW_DLE_FNO 12 /* file not open */
991 #define DW_DLE_FNR 13 /* file not a regular file */
992 #define DW_DLE_FWA 14 /* file open with wrong access */
993 #define DW_DLE_NOB 15 /* not an object file */
994 #define DW_DLE_MOF 16 /* mangled object file header */
995 #define DW_DLE_EOLL 17 /* end of location list entries */
996 #define DW_DLE_NOLL 18 /* no location list section */
997 #define DW_DLE_BADOFF 19 /* Invalid offset */
998 #define DW_DLE_EOS 20 /* end of section */
999 #define DW_DLE_ATRUNC 21 /* abbreviations section appears truncated*/
1000 #define DW_DLE_BADBITC 22 /* Address size passed to dwarf bad*/
9611001 /* It is not an allowed size (64 or 32) */
9621002 /* Error codes defined by the current Libdwarf Implementation. */
9631003 #define DW_DLE_DBG_ALLOC 23
9941034 #define DW_DLE_DEBUG_LINE_LENGTH_BAD 54
9951035 #define DW_DLE_LINE_PROLOG_LENGTH_BAD 55
9961036 #define DW_DLE_LINE_NUM_OPERANDS_BAD 56
997 #define DW_DLE_LINE_SET_ADDR_ERROR 57 /* No longer used. */
1037 #define DW_DLE_LINE_SET_ADDR_ERROR 57
9981038 #define DW_DLE_LINE_EXT_OPCODE_BAD 58
9991039 #define DW_DLE_DWARF_LINE_NULL 59
10001040 #define DW_DLE_INCL_DIR_NUM_BAD 60
14181458 #define DW_DLE_DEBUG_SUP_ERROR 477
14191459 #define DW_DLE_LOCATION_ERROR 478
14201460 #define DW_DLE_DEBUGLINK_PATH_SHORT 479
1461 #define DW_DLE_SIGNATURE_MISMATCH 480
14211462
14221463 /* LAST MUST EQUAL LAST ERROR NUMBER */
1423 #define DW_DLE_LAST 479
1464 #define DW_DLE_LAST 480
14241465
14251466 #define DW_DLE_LO_USER 0x10000
14261467
14561497 #define DW_DLV_OK 0
14571498 #define DW_DLV_ERROR 1
14581499
1459 /* Special values for offset_into_exception_table field of dwarf fde's. */
1460 /* The following value indicates that there is no Exception table offset
1461 associated with a dwarf frame. */
1500 /* Special values for offset_into_exception_table field
1501 of dwarf fde's. */
1502 /* The following value indicates that there is no
1503 Exception table offset
1504 associated with a dwarf frame. */
14621505 #define DW_DLX_NO_EH_OFFSET (-1LL)
1463 /* The following value indicates that the producer was unable to analyse the
1464 source file to generate Exception tables for this function. */
1506 /* The following value indicates that the producer
1507 was unable to analyse the
1508 source file to generate Exception tables for this function. */
14651509 #define DW_DLX_EH_OFFSET_UNAVAILABLE (-2LL)
14661510
14671511 /* The dwarf specification separates FORMs into
14711515 The DWARF4 specification class definition suffices to
14721516 describe all DWARF versions.
14731517 See section 7.5.4, Attribute Encodings.
1474 A return of DW_FORM_CLASS_UNKNOWN means we could not properly figure
1518 A return of DW_FORM_CLASS_UNKNOWN means we
1519 could not properly figure
14751520 out what form-class it is.
14761521
14771522 DW_FORM_CLASS_FRAMEPTR is MIPS/IRIX only, and refers
15121557 DW_FORM_CLASS_STROFFSETSPTR /* DWARF5 */
15131558 };
15141559
1515 /* These support opening DWARF5 split dwarf objects. */
1560 /* These support opening DWARF5 split dwarf objects and
1561 Elf SHT_GROUP blocks of DWARF sections. */
15161562 #define DW_GROUPNUMBER_ANY 0
15171563 #define DW_GROUPNUMBER_BASE 1
15181564 #define DW_GROUPNUMBER_DWO 2
15191565
1520 /*===========================================================================*/
1521 /* Dwarf consumer interface initialization and termination operations */
1566 /*==================================================================*/
1567 /* Dwarf consumer interface initialization and
1568 termination operations */
15221569
15231570 /* Initialization based on path. This is new October 2018.
15241571 The path actually used is copied to true_path_out
17761823
17771824 /* dwarf_offdie_b new October 2011 */
17781825 /* Finding die given global (not CU-relative) offset.
1779 Applies to debug_info (is_info true) or debug_types (is_info false). */
1826 Applies to debug_info (is_info true) or debug_types
1827 (is_info false). */
17801828 int dwarf_offdie_b(Dwarf_Debug /*dbg*/,
17811829 Dwarf_Off /*offset*/,
17821830 Dwarf_Bool /*is_info*/,
17831831 Dwarf_Die* /*return_die*/,
17841832 Dwarf_Error* /*error*/);
17851833
1786 /* Returns the is_info flag through the pointer if the function returns
1787 DW_DLV_OK. Needed so client software knows if a DIE is in debug_info
1788 or debug_types.
1834 /* Returns the is_info flag.
1835 Needed so client software knows
1836 if a DIE is in debug_info or debug_types.
17891837 New October 2011. */
17901838 Dwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die /*die*/);
1839
1840 /* New December 2020. Any Dwarf_Die will work.
1841 The values returned are about the CU itself, not a DIE. */
1842 int dwarf_cu_header_basics(Dwarf_Die die,
1843 Dwarf_Half * /*version*/,
1844 Dwarf_Bool * /*is_info*/,
1845 Dwarf_Bool * /*is_dwo*/,
1846 Dwarf_Half * /*offset_size*/,
1847 Dwarf_Half * /*address_size*/,
1848 Dwarf_Half * /*extension_size*/,
1849 Dwarf_Sig8 ** /*signature*/,
1850 Dwarf_Off * /*offset_of_length*/,
1851 Dwarf_Unsigned * /*total_byte_length*/,
1852 Dwarf_Error * /*error*/);
17911853
17921854 /* New March 2016.
17931855 So we can associate a DIE's abbreviations with the contents
18721934 int dwarf_die_abbrev_children_flag(Dwarf_Die /*die*/,
18731935 Dwarf_Half * /*ab_has_child*/);
18741936
1875 /* Validate the sibling DIE. This only makes sense to call
1876 if the sibling's DIEs have been travsersed and
1877 dwarf_child called on each,
1878 so that the last DIE dwarf_child saw was the last.
1879 Essentially ensuring that (after such traversal) that we
1880 are in the same place a sibling attribute would identify.
1881 In case we return DW_DLV_ERROR, the global offset of the last
1882 DIE traversed by dwarf_child is returned through *offset */
1883 int dwarf_validate_die_sibling(Dwarf_Die /*sibling*/,Dwarf_Off* /*offset*/);
1937 /* Validate the sibling DIE. This only makes sense to call
1938 if the sibling's DIEs have been travsersed and
1939 dwarf_child called on each,
1940 so that the last DIE dwarf_child saw was the last.
1941 Essentially ensuring that (after such traversal) that we
1942 are in the same place a sibling attribute would identify.
1943 In case we return DW_DLV_ERROR, the global offset of the last
1944 DIE traversed by dwarf_child is returned through *offset */
1945 int dwarf_validate_die_sibling(Dwarf_Die /*sibling*/,
1946 Dwarf_Off* /*offset*/);
18841947
18851948 /* convenience functions, alternative to using dwarf_attrlist */
18861949 int dwarf_hasattr(Dwarf_Die /*die*/,
18961959 Dwarf_Unsigned * /*offcnt*/,
18971960 Dwarf_Error * /*error*/);
18981961
1899 /* BEGIN: debug_gnu_pubnames/typenames access,
1900 calling these Gnu_Index as a general reference.
1901 */
1962 /* BEGIN: debug_gnu_pubnames/typenames access,
1963 calling these Gnu_Index as a general reference. */
19021964
19031965 int dwarf_get_gnu_index_head(Dwarf_Debug /*dbg*/,
19041966 /* The following arg false to select gnu_pubtypes */
22752337 interface.
22762338 This interface only reads the line table header, so
22772339 it takes relatively little time.
2278 *is_single_table will be set non-zero for all standard dwarf line sections.
2279 *is_single_table will be set zero for line sections with the
2280 two_level line table extension (which will have *version_out 0xf006). */
2340 *is_single_table will be set non-zero for all
2341 standard dwarf line sections.
2342 *is_single_table will be set zero for
2343 line sections with the two_level line table
2344 extension (which will have *version_out 0xf006). */
22812345 int dwarf_srclines_b(Dwarf_Die /*die*/,
22822346 Dwarf_Unsigned * /* version_out*/,
22832347 Dwarf_Small * /* table_count */,
24002464
24012465 /* New October 2015. */
24022466 /* Count is the real count of include array entries. */
2403 int dwarf_srclines_include_dir_count(Dwarf_Line_Context /*line_context*/,
2467 int dwarf_srclines_include_dir_count(
2468 Dwarf_Line_Context /*line_context*/,
24042469 Dwarf_Signed * /*count*/,
24052470 Dwarf_Error * /* error*/);
24062471
24072472 /* New October 2015. */
24082473 /* Index starts with 1, last is 'count' */
2409 int dwarf_srclines_include_dir_data(Dwarf_Line_Context /*line_context*/,
2474 int dwarf_srclines_include_dir_data(
2475 Dwarf_Line_Context /*line_context*/,
24102476 Dwarf_Signed /*index*/,
24112477 const char ** /*name*/,
24122478 Dwarf_Error * /* error*/);
26002666 Dwarf_Unsigned * /*abbrev_code*/,
26012667 Dwarf_Unsigned * /*tag*/,
26022668
2603 /* The number of valid abbrev_entry values: 0 to number_of_abbrev-1
2604 */
2669 /* The number of valid abbrev_entry values:
2670 0 to number_of_abbrev-1 */
26052671 Dwarf_Unsigned * /*number_of_abbrev*/,
26062672
2607 /* The number of attr/form pairs, not counting the trailing
2608 0,0 pair. */
2673 /* The number of attr/form pairs, not counting
2674 the trailing 0,0 pair. */
26092675 Dwarf_Unsigned * /*number_of_attr_form_entries*/,
26102676 Dwarf_Error * /*error*/);
26112677
28242890 Dwarf_Off* /*cu_offset*/,
28252891 Dwarf_Error* /*error*/);
28262892
2827 /* User-defined type name operations, SGI IRIX .debug_typenames section.
2828 Same content as DWARF3 .debug_pubtypes, but defined years before
2829 .debug_pubtypes was defined. SGI IRIX only. */
2893 /* jUser-defined type name operations,
2894 SGI IRIX .debug_typenames section.
2895
2896 Same content as DWARF3 .debug_pubtypes, but
2897 defined years before .debug_pubtypes was defined.
2898 SGI IRIX only. */
28302899 int dwarf_get_types(Dwarf_Debug /*dbg*/,
28312900 Dwarf_Type** /*types*/,
28322901 Dwarf_Signed * /*number_of_types*/,
31323201 */
31333202 /* dwarf_get_fde_info_for_reg3 is useful on a single column, but
31343203 it is inefficient to iterate across all table_columns using this
3135 function. Instead call dwarf_get_fde_info_for_all_regs3() and index
3136 into the table it fills in. */
3204 function. Instead call dwarf_get_fde_info_for_all_regs3()
3205 and index into the table it fills in. */
31373206 int dwarf_get_fde_info_for_reg3(Dwarf_Fde /*fde*/,
31383207 Dwarf_Half /*table_column*/,
31393208 Dwarf_Addr /*pc_requested*/,
33503419 Dwarf_Half * /*forms_count*/,
33513420 const char ** /*macro_string*/,
33523421 Dwarf_Error * /*error*/);
3353 int dwarf_get_macro_startend_file(Dwarf_Macro_Context /*macro_context*/,
3422 int dwarf_get_macro_startend_file(
3423 Dwarf_Macro_Context /*macro_context*/,
33543424 Dwarf_Unsigned /*op_number*/,
33553425 Dwarf_Unsigned * /*line_number*/,
33563426 Dwarf_Unsigned * /*name_index_to_line_tab*/,
33893459 int * /*error_count_out */);
33903460
33913461 /* As of August 2013, dwarf_print_lines() no longer uses printf.
3392 Instead it calls back to the application using a function pointer
3393 once per line-to-print. The lines passed back already have any needed
3462 Instead it calls back to the application using a function
3463 pointer once per line-to-print. The lines passed back
3464 already have any needed
33943465 newlines. The following struct is used to initialize
33953466 the callback mechanism.
33963467
3397 Failing to call the dwarf_register_printf_callback() function will
3398 prevent the lines from being passed back but such omission
3399 is not an error.
3468 Failing to call the dwarf_register_printf_callback()
3469 function will prevent the lines from being passed back
3470 but such omission is not an error.
34003471 See libdwarf2.1.mm for further documentation.
34013472
34023473 The return value is the previous set of callback values.
36023673 Dwarf_Error * /*error*/);
36033674
36043675
3605 int dwarf_gdbindex_cuvector_inner_attributes(Dwarf_Gdbindex /*gdbindex*/,
3676 int dwarf_gdbindex_cuvector_inner_attributes(
3677 Dwarf_Gdbindex /*gdbindex*/,
36063678 Dwarf_Unsigned /*cuvector_offset*/,
36073679 Dwarf_Unsigned /*innerindex*/,
36083680 /* The attr_value is a field of bits. For expanded version
36323704
36333705 /* END gdbindex/debugfission operations. */
36343706
3635 /* START debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3707 /* START debugfission dwp .debug_cu_index
3708 and .debug_tu_index operations. */
36363709
36373710 int dwarf_get_xu_index_header(Dwarf_Debug /*dbg*/,
36383711 const char * section_type, /* "tu" or "cu" */
36463719
36473720 int dwarf_get_xu_index_section_type(Dwarf_Xu_Index_Header /*xuhdr*/,
36483721 /* the function returns a pointer to
3649 the immutable string "tu" or "cu" via this arg. Do not free. */
3722 the immutable string "tu" or "cu" via this arg.
3723 Do not free. */
36503724 const char ** /*typename*/,
36513725 /* the function returns a pointer to
36523726 the immutable section name. Do not free.
37133787 Dwarf_Unsigned unused1;
37143788 Dwarf_Unsigned unused2;
37153789 };
3716 typedef struct Dwarf_Debug_Fission_Per_CU_s Dwarf_Debug_Fission_Per_CU ;
3790 typedef struct Dwarf_Debug_Fission_Per_CU_s
3791 Dwarf_Debug_Fission_Per_CU;
37173792 /* For any Dwarf_Die in a compilation unit, return
37183793 the debug fission table data through
37193794 percu_out. Usually applications
37263801 Dwarf_Debug_Fission_Per_CU * /* percu_out */,
37273802 Dwarf_Error * /* err */);
37283803
3729 /* Given a key (hash signature) from a .o, find the per-cu information
3804 /* Given a key (hash signature) from a .o,
3805 find the per-cu information
37303806 for the CU with that key. */
37313807 int dwarf_get_debugfission_for_key(Dwarf_Debug /*dbg*/,
37323808 Dwarf_Sig8 * /*key, hash signature */,
37343810 Dwarf_Debug_Fission_Per_CU * /*percu_out */,
37353811 Dwarf_Error * /*err */);
37363812
3737 /* END debugfission dwp .debug_cu_index and .debug_tu_index operations. */
3813 /* END debugfission dwp .debug_cu_index
3814 and .debug_tu_index operations. */
37383815
37393816
37403817 /* Utility operations */
41304207 Dwarf_Error * /*error*/);
41314208
41324209 /* August 2013 sleb creator. For any attribute. */
4133 Dwarf_P_Attribute dwarf_add_AT_any_value_sleb(Dwarf_P_Die /*ownerdie*/,
4210 Dwarf_P_Attribute dwarf_add_AT_any_value_sleb(
4211 Dwarf_P_Die /*ownerdie*/,
41344212 Dwarf_Half /*attrnum*/,
41354213 Dwarf_Signed /*signed_value*/,
41364214 Dwarf_Error * /*error*/);
41434221 Dwarf_Error * /*error*/);
41444222
41454223 /* Original sleb creator. Only for DW_AT_const_value. */
4146 Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(Dwarf_P_Die /*ownerdie*/,
4224 Dwarf_P_Attribute dwarf_add_AT_const_value_signedint(
4225 Dwarf_P_Die /*ownerdie*/,
41474226 Dwarf_Signed /*signed_value*/,
41484227 Dwarf_Error* /*error*/);
41494228
41544233 Dwarf_Error* /*error*/);
41554234
41564235 /* August 2013 uleb creator. For any attribute. */
4157 Dwarf_P_Attribute dwarf_add_AT_any_value_uleb(Dwarf_P_Die /*ownerdie*/,
4236 Dwarf_P_Attribute dwarf_add_AT_any_value_uleb(
4237 Dwarf_P_Die /*ownerdie*/,
41584238 Dwarf_Half /*attrnum*/,
41594239 Dwarf_Unsigned /*signed_value*/,
41604240 Dwarf_Error * /*error*/);
53155395
53165396 On successful call, call dwarf_str_offsets_table_entry()
53175397 to get the individual table values on the now-active table. */
5318 int dwarf_next_str_offsets_table( Dwarf_Str_Offsets_Table /*table_data*/,
5398 int dwarf_next_str_offsets_table(
5399 Dwarf_Str_Offsets_Table /*table_data*/,
53195400 Dwarf_Unsigned * /*unit_length*/,
53205401 Dwarf_Unsigned * /*unit_length_offset*/,
53215402 Dwarf_Unsigned * /*table_start_offset*/,
53275408
53285409 /* Valid index values n: 0 <= n < table_entry_count
53295410 for the active table */
5330 int dwarf_str_offsets_value_by_index(Dwarf_Str_Offsets_Table /*table_data*/,
5411 int dwarf_str_offsets_value_by_index(
5412 Dwarf_Str_Offsets_Table /*table_data*/,
53315413 Dwarf_Unsigned /*index_to_entry*/,
53325414 Dwarf_Unsigned * /*entry_value*/,
53335415 Dwarf_Error * /*error*/);
53345416
53355417 /* After all str_offsets read this reports final
53365418 wasted-bytes count. */
5337 int dwarf_str_offsets_statistics(Dwarf_Str_Offsets_Table /*table_data*/,
5419 int dwarf_str_offsets_statistics(
5420 Dwarf_Str_Offsets_Table /*table_data*/,
53385421 Dwarf_Unsigned * /*wasted_byte_count*/,
53395422 Dwarf_Unsigned * /*table_count*/,
53405423 Dwarf_Error * /*error*/);
54035486 /* The following copied from a generated dwarf_names.h */
54045487
54055488 /* BEGIN FILE */
5406 extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5407 extern int dwarf_get_ADDR_name(unsigned int /*val_in*/, const char ** /*s_out */);
5408 extern int dwarf_get_ATCF_name(unsigned int /*val_in*/, const char ** /*s_out */);
5409 extern int dwarf_get_ATE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5410 extern int dwarf_get_AT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5411 extern int dwarf_get_CC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5412 extern int dwarf_get_CFA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5413 extern int dwarf_get_children_name(unsigned int /*val_in*/, const char ** /*s_out */);
5414 extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/, const char ** /*s_out */);
5415 extern int dwarf_get_DEFAULTED_name(unsigned int /*val_in*/, const char ** /*s_out */);
5416 extern int dwarf_get_DSC_name(unsigned int /*val_in*/, const char ** /*s_out */);
5417 extern int dwarf_get_DS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5418 extern int dwarf_get_EH_name(unsigned int /*val_in*/, const char ** /*s_out */);
5419 extern int dwarf_get_END_name(unsigned int /*val_in*/, const char ** /*s_out */);
5420 extern int dwarf_get_FORM_name(unsigned int /*val_in*/, const char ** /*s_out */);
5421 extern int dwarf_get_FRAME_name(unsigned int /*val_in*/, const char ** /*s_out */);
5422 extern int dwarf_get_GNUIKIND_name(unsigned int /*val_in*/, const char ** /*s_out */);
5423 extern int dwarf_get_GNUIVIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5424 extern int dwarf_get_ID_name(unsigned int /*val_in*/, const char ** /*s_out */);
5425 extern int dwarf_get_IDX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5426 extern int dwarf_get_INL_name(unsigned int /*val_in*/, const char ** /*s_out */);
5427 extern int dwarf_get_ISA_name(unsigned int /*val_in*/, const char ** /*s_out */);
5428 extern int dwarf_get_LANG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5429 extern int dwarf_get_LLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5430 /* dwarf_get_LLEX_name is likely just temporary. Not standard. */
5431 extern int dwarf_get_LLEX_name(unsigned int /*val_in*/, const char ** /*s_out */);
5432 extern int dwarf_get_LNCT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5433 extern int dwarf_get_LNE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5434 extern int dwarf_get_LNS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5435 extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5436 extern int dwarf_get_MACRO_name(unsigned int /*val_in*/, const char ** /*s_out */);
5437 extern int dwarf_get_OP_name(unsigned int /*val_in*/, const char ** /*s_out */);
5438 extern int dwarf_get_ORD_name(unsigned int /*val_in*/, const char ** /*s_out */);
5439 extern int dwarf_get_RLE_name(unsigned int /*val_in*/, const char ** /*s_out */);
5440 extern int dwarf_get_SECT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5441 extern int dwarf_get_TAG_name(unsigned int /*val_in*/, const char ** /*s_out */);
5442 extern int dwarf_get_UT_name(unsigned int /*val_in*/, const char ** /*s_out */);
5443 extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/, const char ** /*s_out */);
5444 extern int dwarf_get_VIS_name(unsigned int /*val_in*/, const char ** /*s_out */);
5489 extern int dwarf_get_ACCESS_name(unsigned int /*val_in*/,
5490 const char ** /*s_out */);
5491 extern int dwarf_get_ADDR_name(unsigned int /*val_in*/,
5492 const char ** /*s_out */);
5493 extern int dwarf_get_ATCF_name(unsigned int /*val_in*/,
5494 const char ** /*s_out */);
5495 extern int dwarf_get_ATE_name(unsigned int /*val_in*/,
5496 const char ** /*s_out */);
5497 extern int dwarf_get_AT_name(unsigned int /*val_in*/,
5498 const char ** /*s_out */);
5499 extern int dwarf_get_CC_name(unsigned int /*val_in*/,
5500 const char ** /*s_out */);
5501 extern int dwarf_get_CFA_name(unsigned int /*val_in*/,
5502 const char ** /*s_out */);
5503 extern int dwarf_get_children_name(unsigned int /*val_in*/,
5504 const char ** /*s_out */);
5505 extern int dwarf_get_CHILDREN_name(unsigned int /*val_in*/,
5506 const char ** /*s_out */);
5507 extern int dwarf_get_DEFAULTED_name(unsigned int /*val_in*/,
5508 const char ** /*s_out */);
5509 extern int dwarf_get_DSC_name(unsigned int /*val_in*/,
5510 const char ** /*s_out */);
5511 extern int dwarf_get_DS_name(unsigned int /*val_in*/,
5512 const char ** /*s_out */);
5513 extern int dwarf_get_EH_name(unsigned int /*val_in*/,
5514 const char ** /*s_out */);
5515 extern int dwarf_get_END_name(unsigned int /*val_in*/,
5516 const char ** /*s_out */);
5517 extern int dwarf_get_FORM_name(unsigned int /*val_in*/,
5518 const char ** /*s_out */);
5519 extern int dwarf_get_FRAME_name(unsigned int /*val_in*/,
5520 const char ** /*s_out */);
5521 extern int dwarf_get_GNUIKIND_name(unsigned int /*val_in*/,
5522 const char ** /*s_out */);
5523 extern int dwarf_get_GNUIVIS_name(unsigned int /*val_in*/,
5524 const char ** /*s_out */);
5525 extern int dwarf_get_ID_name(unsigned int /*val_in*/,
5526 const char ** /*s_out */);
5527 extern int dwarf_get_IDX_name(unsigned int /*val_in*/,
5528 const char ** /*s_out */);
5529 extern int dwarf_get_INL_name(unsigned int /*val_in*/,
5530 const char ** /*s_out */);
5531 extern int dwarf_get_ISA_name(unsigned int /*val_in*/,
5532 const char ** /*s_out */);
5533 extern int dwarf_get_LANG_name(unsigned int /*val_in*/,
5534 const char ** /*s_out */);
5535 extern int dwarf_get_LLE_name(unsigned int /*val_in*/,
5536 const char ** /*s_out */);
5537 /* dwarf_get_LLEX_name is for a GNU extension.
5538 Not defined by the GNU folks nor a DWARF standard
5539 but it seemed essential. */
5540 extern int dwarf_get_LLEX_name(unsigned int /*val_in*/,
5541 const char ** /*s_out */);
5542 extern int dwarf_get_LNCT_name(unsigned int /*val_in*/,
5543 const char ** /*s_out */);
5544 extern int dwarf_get_LNE_name(unsigned int /*val_in*/,
5545 const char ** /*s_out */);
5546 extern int dwarf_get_LNS_name(unsigned int /*val_in*/,
5547 const char ** /*s_out */);
5548 extern int dwarf_get_MACINFO_name(unsigned int /*val_in*/,
5549 const char ** /*s_out */);
5550 extern int dwarf_get_MACRO_name(unsigned int /*val_in*/,
5551 const char ** /*s_out */);
5552 extern int dwarf_get_OP_name(unsigned int /*val_in*/,
5553 const char ** /*s_out */);
5554 extern int dwarf_get_ORD_name(unsigned int /*val_in*/,
5555 const char ** /*s_out */);
5556 extern int dwarf_get_RLE_name(unsigned int /*val_in*/,
5557 const char ** /*s_out */);
5558 extern int dwarf_get_SECT_name(unsigned int /*val_in*/,
5559 const char ** /*s_out */);
5560 extern int dwarf_get_TAG_name(unsigned int /*val_in*/,
5561 const char ** /*s_out */);
5562 extern int dwarf_get_UT_name(unsigned int /*val_in*/,
5563 const char ** /*s_out */);
5564 extern int dwarf_get_VIRTUALITY_name(unsigned int /*val_in*/,
5565 const char ** /*s_out */);
5566 extern int dwarf_get_VIS_name(unsigned int /*val_in*/,
5567 const char ** /*s_out */);
54455568 /* END FILE */
54465569
54475570 /* Convert local offset into global offset */
55185641 Dwarf_Unsigned * /*map_entry_count_out*/,
55195642 Dwarf_Error * /*error*/);
55205643
5521 /* New May 2017. Reveals the map between group numbers and section numbers.
5644 /* New May 2017. Reveals the map between group numbers and
5645 section numbers.
55225646 Caller must allocate the arrays with space for 'map_entry_count'
55235647 values and this function fills in the array entries.
55245648 Output ordered by group number and section number.
55315655 Dwarf_Error * /*error*/);
55325656
55335657 /* dwarf_get_endian_copy_function new. December 2019. */
5534 void (*dwarf_get_endian_copy_function(Dwarf_Debug /*dbg*/))(void *, const void * /*src*/, unsigned long /*srclen*/);
5658 void (*dwarf_get_endian_copy_function(Dwarf_Debug /*dbg*/))
5659 (void *, const void * /*src*/, unsigned long /*srclen*/);
55355660
55365661 /* These make the LEB encoding routines visible to libdwarf
55375662 callers. Added November, 2012. */
99 .S +2
1010 \." ==============================================
1111 \." Put current date in the following at each rev
12 .ds vE Rev 3.15, 13 October 2020
12 .ds vE Rev 3.18 29 November 2020
1313 \." ==============================================
1414 \." ==============================================
1515 .ds | |
219219 recent changes.
220220
221221 .H 2 "Items Changed"
222 .P
223 The description of dwarf_srcfiles()
224 now reflects the difference
225 in line table handling between
226 DWARF5 and other line table versions.
227 If using dwarf_srcfiles() do
228 read its documentation here
229 (Section 6.14, page 117 in this
230 version).
222231 .P
223232 Added functions dwarf_crc32()
224233 and dwarf_basic_crc32()
731740 typedef unsigned char Dwarf_Small;
732741 typedef signed long long Dwarf_Signed;
733742 typedef unsigned long long Dwarf_Addr;
734 typedef void *Dwarf_Ptr;
743 typedef void *Dwarf_Ptr;
735744 typedef void (*Dwarf_Handler)(Dwarf_Error error, Dwarf_Ptr errarg);
736745 .DE
737746
44374446 \f(CWDwarf_Bool dwarf_get_die_infotypes_flag(Dwarf_Die die)\fP
44384447 .DE
44394448 .P
4440 The function \f(CWdwarf_tag()\fP returns the section flag
4449 The function
4450 \f(CWdwarf_get_die_infotypes_flag()\fP
4451 returns the section flag
44414452 indicating which section the DIE originates from.
44424453 If the returned value is non-zero the DIE
44434454 originates from the .debug_info section.
44444455 If the returned value is zero the DIE
44454456 originates from the .debug_types section.
4457
4458 .H 3 "dwarf_cu_header_basics()"
4459 .DS
4460 \f(CWint dwarf_cu_header_basics(Dwarf_Die die
4461 Dwarf_Half *version,
4462 Dwarf_Bool *is_info,
4463 Dwarf_Bool *is_dwo,
4464 Dwarf_Half *offset_size,
4465 Dwarf_Half *address_size,
4466 Dwarf_Half *extension_size,
4467 Dwarf_Sig8 **signature,
4468 Dwarf_Off *offset_of_length,
4469 Dwarf_Unsigned *total_byte_length,
4470 Dwarf_Error *error)\fP
4471 .DE
4472 .P
4473 On success,
4474 the function \f(CWcu_header_basics()\fP
4475 various data items from the CU header
4476 and the CU die passed in.
4477 Any return-value
4478 pointer may be passed in as NULL,
4479 indicating that the value is not needed.
4480 .P
4481 Summing
4482 \f(CWoffset_size\fP
4483 and
4484 \f(CWextention_size\fP
4485 gives the length of the CU length field,
4486 which is immediately followed by
4487 the CU header.
4488 .P
4489 \f(CWis_dwo\fP
4490 field will surely always be 0
4491 as dwo/dwp .debug_info
4492 cannot be skeleton CUs.
4493 .P
4494 The
4495 \f(CWsignature\fP
4496 value is returned
4497 if there a signature in the DWARF5
4498 CU header or the CU die.
4499 .P
4500 The
4501 \f(CWoffset_of_length\fP
4502 returned is the offset of the first byte
4503 of the length field of the CU.
4504 .P
4505 The
4506 \f(CWtotal_byte_Length\fP
4507 returned is the length of data
4508 in the CU counting from the first byte
4509 at
4510 \f(CWoffset_of_length\fP.
4511
4512
44464513
44474514 .H 3 "dwarf_tag()"
44484515 .DS
48804947 When it returns \f(CWDW_DLV_OK\fP,
48814948 the function \f(CWdwarf_attr()\fP
48824949 sets
4883 \f(CW*return_attr\fP to the \f(CWDwarf_Attribute\fP
4950 \f(CW*return_attr\fP to the
4951 \f(CWDwarf_Attribute\fP
48844952 descriptor of \f(CWdie\fP having the attribute \f(CWattr\fP.
4885 It returns \f(CWDW_DLV_NO_ENTRY\fP if \f(CWattr\fP is not contained
4886 in \f(CWdie\fP.
4887 It returns \f(CWDW_DLV_ERROR\fP if an error occurred.
4888
4953 When one no longer needs the attribute call
4954 \f(CWdwarf_dealloc_attribute(return_attr)\fP.
4955 .P
4956 It returns
4957 \f(CWDW_DLV_NO_ENTRY\fP if
4958 \f(CWattr\fP is not contained
4959 in
4960 \f(CWdie\fP.
4961 .P
4962 It returns
4963 \f(CWDW_DLV_ERROR\fP
4964 and sets the *error argument if an error occurred.
48894965
48904966 .H 3 "dwarf_lowpc()"
48914967 .DS
55025578 .H 3 "dwarf_formsdata()"
55035579 .DS
55045580 \f(CWint dwarf_formsdata(
5505 Dwarf_Attribute attr,
5506 Dwarf_Signed * return_svalue,
5507 Dwarf_Error *error)\fP
5581 Dwarf_Attribute attr,
5582 Dwarf_Signed * return_svalue,
5583 Dwarf_Error *error)\fP
55085584 .DE
55095585 The function \f(CWdwarf_formsdata()\fP returns
55105586 \f(CWDW_DLV_OK\fP and sets \f(CW*return_svalue\fP
55295605 .H 3 "dwarf_formblock()"
55305606 .DS
55315607 \f(CWint dwarf_formblock(
5532 Dwarf_Attribute attr,
5533 Dwarf_Block ** return_block,
5534 Dwarf_Error * error)\fP
5608 Dwarf_Attribute attr,
5609 Dwarf_Block ** return_block,
5610 Dwarf_Error * error)\fP
55355611 .DE
55365612 The function \f(CWdwarf_formblock()\fP returns
55375613 \f(CWDW_DLV_OK\fP and sets \f(CW*return_block\fP
55545630
55555631 .DS
55565632 \f(CWint dwarf_formstring(
5557 Dwarf_Attribute attr,
5558 char ** return_string,
5559 Dwarf_Error *error)\fP
5633 Dwarf_Attribute attr,
5634 char ** return_string,
5635 Dwarf_Error *error)\fP
55605636 .DE
55615637 The function \f(CWdwarf_formstring()\fP returns
55625638 \f(CWDW_DLV_OK\fP and sets \f(CW*return_string\fP
78957971 .H 3 "dwarf_srclines()"
78967972 .DS
78977973 \f(CWint dwarf_srclines(
7898 Dwarf_Die die,
7899 Dwarf_Line **linebuf,
7900 Dwarf_Signed *linecount,
7901 Dwarf_Error *error)\fP
7974 Dwarf_Die die,
7975 Dwarf_Line **linebuf,
7976 Dwarf_Signed *linecount,
7977 Dwarf_Error *error)\fP
79027978 .DE
79037979 This function is not useful for DWARF5 skeleton line tables nor
79047980 for two-level line tables.
79708046 Table Header) are returned.
79718047 .H 3 dwarf_srcfiles()
79728048 This works for for all line tables.
8049 However indexing is different
8050 in DWARF5 than in other versions of dwarf.
8051 To understand the DWARF5 version
8052 look at the following
8053 which explains a contradiction in the DWARF5
8054 document and how libdwarf (and at least some
8055 compilers) resolve it.
8056 Join the next two strings together with no spaces
8057 to recreate the web reference.
8058 .P
8059 If the applicable file name in the line
8060 table Statement Program Prolog
8061 does not start with a '/' character
8062 the string in \f(CWDW_AT_comp_dir\fP
8063 (if applicable and present)
8064 and the applicable
8065 directory name from the line Statement Program Prolog
8066 is prepended to the
8067 file name in the line table Statement Program Prolog
8068 to make a full path.
8069 .P
8070 For all versions of dwarf this function
8071 and dwarf_linesrc() prepend the value
8072 of DW_AT_co prepend the value
8073 of DW_AT_comp_dir to the name created
8074 from the line table header file names and directory
8075 names if the line table header name(s) are not
8076 full paths.mp_dir to the name created
8077 from the line table header file names and directory
8078 names if the line table header name(s) are not
8079 full paths.
8080 .P
8081 http://wiki.dwarfstd.org/index.php?title
8082 =DWARF5_Line_Table_File_Numbers
8083 .P
8084 It may help understand the file tables
8085 and dwarf_srcfiles() to
8086 use \f(CWdwarfdump\fP.
8087 The
8088 \f(CWdwarfdump\fP
8089 utility program now
8090 will print the dwarf_srcfiles() values
8091 in addition to the compilation unit
8092 DIE and the line table header details
8093 (and much more)
8094 if one does "dwarfdump -vvv -i -l <objfilename>"
8095 or "dwarfdump -vvv -a <objfilename>"
8096 for example.
8097 Since the output can be large, with your editor
8098 focus on lines beginning with "COMPILE_UNIT"
8099 (do not type the quotes) to quickly get to the
8100 CU die and the line table for that CU as those
8101 tend to be far apart in the output.
8102
8103 .P
8104 DWARF5:
8105 \f(CWDW_MACRO_start_file\fP,
8106 \f(CWDW_LNS_set_file\fP,
8107 \f(CWDW_AT_decl_file\fP,
8108 \f(CWDW_AT_call_file\fP,
8109 and the line table state machine
8110 file numbers begin at zero. To index srcfiles
8111 use the values directly with no subtraction.
8112 .P
8113 DWARF2-4 and experimental line table:
8114 \f(CWDW_MACINFO_start_file\fP,
8115 \f(CWDW_LNS_set_file\fP,
8116 \f(CWDW_AT_decl_file\fP,
8117 and line table state machine
8118 file numbers begin at one.
8119 In all these the value of 0 means
8120 there is no source file or source file name.
8121 To index the srcfiles array
8122 subtract one from the
8123 \f(CWDW_AT_decl_file\fP (etc)
8124 file number.
8125 .P
79738126 .DS
79748127 \f(CWint dwarf_srcfiles(
79758128 Dwarf_Die die,
79898142 The given \f(CWdie\fP should have the tag
79908143 \f(CWDW_TAG_compile_unit\fP,
79918144 \f(CWDW_TAG_partial_unit\fP,
7992 or \f(CWDW_TAG_type_unit\fP
8145 or
8146 \f(CWDW_TAG_type_unit\fP
79938147 .
79948148 The location pointed to by \f(CWsrcfiles\fP is set to point to a list
79958149 of pointers to null-terminated strings that name the source
80108164 if there is no
80118165 corresponding statement program (i.e.,
80128166 if there is no line information).
8013 .P
8014 It requires a little care to index into the
8015 \f(CWsrcfiles\fP
8016 array
8017 using the
8018 \f(CWDW_AT_decl_file\fP
8019 or
8020 \f(CWDW_AT_decl_call_file\fP
8021 values.
8022 .P
8023 The value zero (0) is reserved and means
8024 such zero-value attributes do not refer to any
8025 file name.
8026 .P
8027 If value is non-zero subtract one (1) from the value
8028 and use that to index the
8029 \f(CWsrcfiles\fP
8030 array.
8031 Of course being careful that the index is
8032 not too large for the array.
8033 .P
8034 For DWARF5 an index of 0 (meaning value-1)
8035 refers to the compilation unit value identical
8036 to
8037 \f(CWDW_AT_name \fP.
8038 For earlier DWARF it refers to some file
8039 referenced in the compilation unit, but not
8040 any special file.
80418167
80428168 .P
80438169 .in +2
80768202 .H 3 "dwarf_linebeginstatement()"
80778203 .DS
80788204 \f(CWint dwarf_linebeginstatement(
8079 Dwarf_Line line,
8080 Dwarf_Bool *return_bool,
8081 Dwarf_Error *error)\fP
8205 Dwarf_Line line,
8206 Dwarf_Bool *return_bool,
8207 Dwarf_Error *error)\fP
80828208 .DE
80838209 The function \f(CWdwarf_linebeginstatement()\fP returns
80848210 \f(CWDW_DLV_OK\fP and sets \f(CW*return_bool\fP
80968222 .H 3 "dwarf_lineendsequence()"
80978223 .DS
80988224 \f(CWint dwarf_lineendsequence(
8099 Dwarf_Line line,
8100 Dwarf_Bool *return_bool,
8101 Dwarf_Error *error)\fP
8225 Dwarf_Line line,
8226 Dwarf_Bool *return_bool,
8227 Dwarf_Error *error)\fP
81028228 .DE
81038229 The function \f(CWdwarf_lineendsequence()\fP returns
81048230 \f(CWDW_DLV_OK\fP and sets \f(CW*return_bool\fP
81248250 .H 3 "dwarf_lineno()"
81258251 .DS
81268252 \f(CWint dwarf_lineno(
8127 Dwarf_Line line,
8128 Dwarf_Unsigned * returned_lineno,
8129 Dwarf_Error * error)\fP
8253 Dwarf_Line line,
8254 Dwarf_Unsigned * returned_lineno,
8255 Dwarf_Error * error)\fP
81308256 .DE
81318257 The function \f(CWdwarf_lineno()\fP returns
81328258 \f(CWDW_DLV_OK\fP and sets \f(CW*return_lineno\fP to
81398265 .H 3 "dwarf_line_srcfileno()"
81408266 .DS
81418267 \f(CWint dwarf_line_srcfileno(
8142 Dwarf_Line line,
8143 Dwarf_Unsigned * returned_fileno,
8144 Dwarf_Error * error)\fP
8268 Dwarf_Line line,
8269 Dwarf_Unsigned * returned_fileno,
8270 Dwarf_Error * error)\fP
81458271 .DE
81468272 The function \f(CWdwarf_line_srcfileno()\fP returns
81478273 \f(CWDW_DLV_OK\fP and sets \f(CW*returned_fileno\fP to
81488274 the source statement line
81498275 number corresponding to the descriptor \f(CWfile number\fP.
8276 .P
8277 DWARF2-4 and experimental:
81508278 When the number returned through \f(CW*returned_fileno\fP is zero it means
81518279 the file name is unknown (see the DWARF2/3 line table specification).
81528280 When the number returned through \f(CW*returned_fileno\fP is non-zero
81608288 the array of strings returned by \f(CWdwarf_srcfiles()\fP
81618289 because \f(CWdwarf_srcfiles()\fP does not return files names defined with
81628290 the \f(CWDW_DLE_define_file\fP operator.
8291 .P
8292 DWARF5:
8293 To index into the array of strings returned by
8294 \f(CWdwarf_srcfiles()\fP
8295 use the number returned through \f(CW*returned_fileno\fP.
8296 .P
81638297 The function \f(CWdwarf_line_srcfileno()\fP returns \f(CWDW_DLV_ERROR\fP on error.
81648298 It never returns \f(CWDW_DLV_NO_ENTRY\fP.
81658299
81678301 .H 3 "dwarf_lineaddr()"
81688302 .DS
81698303 \f(CWint dwarf_lineaddr(
8170 Dwarf_Line line,
8171 Dwarf_Addr *return_lineaddr,
8172 Dwarf_Error *error)\fP
8304 Dwarf_Line line,
8305 Dwarf_Addr *return_lineaddr,
8306 Dwarf_Error *error)\fP
81738307 .DE
81748308 The function \f(CWdwarf_lineaddr()\fP returns
81758309 \f(CWDW_DLV_OK\fP and sets \f(CW*return_lineaddr\fP to
81828316 .H 3 "dwarf_lineoff()"
81838317 .DS
81848318 \f(CWint dwarf_lineoff(
8185 Dwarf_Line line,
8186 Dwarf_Signed * return_lineoff,
8187 Dwarf_Error *error)\fP
8319 Dwarf_Line line,
8320 Dwarf_Signed * return_lineoff,
8321 Dwarf_Error *error)\fP
81888322 .DE
81898323 The function \f(CWdwarf_lineoff()\fP returns
81908324 \f(CWDW_DLV_OK\fP and sets \f(CW*return_lineoff\fP to
82138347 .H 3 "dwarf_lineoff_b()"
82148348 .DS
82158349 \f(CWint dwarf_lineoff_b(
8216 Dwarf_Line line,
8217 Dwarf_Unsigned * return_lineoff,
8218 Dwarf_Error *error)\fP
8350 Dwarf_Line line,
8351 Dwarf_Unsigned * return_lineoff,
8352 Dwarf_Error *error)\fP
82198353 .DE
82208354 The function
82218355 \f(CWdwarf_lineoff_b()\fP
82348368 .DS
82358369 \f(CWint dwarf_linesrc(
82368370 Dwarf_Line line,
8237 char ** return_linesrc,
8371 char ** return_linesrc,
82388372 Dwarf_Error *error)\fP
82398373 .DE
82408374 The function \f(CWdwarf_linesrc()\fP returns
82648398 .H 3 "dwarf_lineblock()"
82658399 .DS
82668400 \f(CWint dwarf_lineblock(
8267 Dwarf_Line line,
8268 Dwarf_Bool *return_bool,
8269 Dwarf_Error *error)\fP
8401 Dwarf_Line line,
8402 Dwarf_Bool *return_bool,
8403 Dwarf_Error *error)\fP
82708404 .DE
82718405 The function
82728406 \f(CWdwarf_lineblock()\fP returns
82818415 .H 3 "dwarf_is_addr_set()"
82828416 .DS
82838417 \f(CWint dwarf_line_is_addr_set(
8284 Dwarf_Line line,
8285 Dwarf_Bool *return_bool,
8286 Dwarf_Error *error)\fP
8418 Dwarf_Line line,
8419 Dwarf_Bool *return_bool,
8420 Dwarf_Error *error)\fP
82878421 .DE
82888422 The function
82898423 \f(CWdwarf_line_is_addr_set()\fP returns
85578691 .H 4 "dwarf_global_die_offset()"
85588692 .DS
85598693 \f(CWint dwarf_global_die_offset(
8560 Dwarf_Global global,
8561 Dwarf_Off *return_offset,
8562 Dwarf_Error *error)\fP
8694 Dwarf_Global global,
8695 Dwarf_Off *return_offset,
8696 Dwarf_Error *error)\fP
85638697 .DE
85648698 The function \f(CWdwarf_global_die_offset()\fP returns
85658699 \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
85738707 .H 4 "dwarf_global_cu_offset()"
85748708 .DS
85758709 \f(CWint dwarf_global_cu_offset(
8576 Dwarf_Global global,
8577 Dwarf_Off *return_offset,
8578 Dwarf_Error *error)\fP
8710 Dwarf_Global global,
8711 Dwarf_Off *return_offset,
8712 Dwarf_Error *error)\fP
85798713 .DE
85808714 The function \f(CWdwarf_global_cu_offset()\fP returns
85818715 \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
85898723 .H 4 "dwarf_get_cu_die_offset_given_cu_header_offset()"
85908724 .DS
85918725 \f(CWint dwarf_get_cu_die_offset_given_cu_header_offset_b(
8592 Dwarf_Debug dbg,
8593 Dwarf_Off in_cu_header_offset,
8726 Dwarf_Debug dbg,
8727 Dwarf_Off in_cu_header_offset,
85948728 Dwarf_Bool is_info,
85958729 Dwarf_Off * out_cu_die_offset,
85968730 Dwarf_Error *error)\fP
88448978 .H 4 "dwarf_get_weaks()"
88458979 .DS
88468980 \f(CWint dwarf_get_weaks(
8847 Dwarf_Debug dbg,
8848 Dwarf_Weak **weaks,
8849 Dwarf_Signed *weak_count,
8850 Dwarf_Error *error)\fP
8981 Dwarf_Debug dbg,
8982 Dwarf_Weak **weaks,
8983 Dwarf_Signed *weak_count,
8984 Dwarf_Error *error)\fP
88518985 .DE
88528986 The function \f(CWdwarf_get_weaks()\fP returns
88538987 \f(CWDW_DLV_OK\fP and sets \f(CW*weak_count\fP to
89369070 .H 4 "dwarf_weakname()"
89379071 .DS
89389072 \f(CWint dwarf_weakname(
8939 Dwarf_Weak weak,
8940 char ** return_name,
8941 Dwarf_Error *error)\fP
9073 Dwarf_Weak weak,
9074 char ** return_name,
9075 Dwarf_Error *error)\fP
89429076 .DE
89439077 The function \f(CWdwarf_weakname()\fP returns
89449078 \f(CWDW_DLV_OK\fP and sets \f(CW*return_name\fP to
89539087
89549088 .DS
89559089 \f(CWint dwarf_weak_die_offset(
8956 Dwarf_Weak weak,
8957 Dwarf_Off *return_offset,
8958 Dwarf_Error *error)\fP
9090 Dwarf_Weak weak,
9091 Dwarf_Off *return_offset,
9092 Dwarf_Error *error)\fP
89599093 .DE
89609094 The function \f(CWdwarf_weak_die_offset()\fP returns
89619095 \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to the offset in
89689102 .H 4 "dwarf_weak_cu_offset()"
89699103 .DS
89709104 \f(CWint dwarf_weak_cu_offset(
8971 Dwarf_Weak weak,
8972 Dwarf_Off *return_offset,
8973 Dwarf_Error *error)\fP
9105 Dwarf_Weak weak,
9106 Dwarf_Off *return_offset,
9107 Dwarf_Error *error)\fP
89749108 .DE
89759109 The function \f(CWdwarf_weak_cu_offset()\fP returns
89769110 \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to the offset in
89839117 .H 4 "dwarf_weak_name_offsets()"
89849118 .DS
89859119 \f(CWint dwarf_weak_name_offsets(
8986 Dwarf_Weak weak,
8987 char ** weak_name,
8988 Dwarf_Off *die_offset,
8989 Dwarf_Off *cu_offset,
8990 Dwarf_Error *error)\fP
9120 Dwarf_Weak weak,
9121 char ** weak_name,
9122 Dwarf_Off *die_offset,
9123 Dwarf_Off *cu_offset,
9124 Dwarf_Error *error)\fP
89919125 .DE
89929126 The function \f(CWdwarf_weak_name_offsets()\fP returns
89939127 \f(CWDW_DLV_OK\fP and sets \f(CW*weak_name\fP to
91329266 .H 4 "dwarf_func_die_offset()"
91339267 .DS
91349268 \f(CWint dwarf_func_die_offset(
9135 Dwarf_Func func,
9136 Dwarf_Off *return_offset,
9137 Dwarf_Error *error)\fP
9269 Dwarf_Func func,
9270 Dwarf_Off *return_offset,
9271 Dwarf_Error *error)\fP
91389272 .DE
91399273 The function \f(CWdwarf_func_die_offset()\fP, returns
91409274 \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
91489282 .H 4 "dwarf_func_cu_offset()"
91499283 .DS
91509284 \f(CWint dwarf_func_cu_offset(
9151 Dwarf_Func func,
9152 Dwarf_Off *return_offset,
9153 Dwarf_Error *error)\fP
9285 Dwarf_Func func,
9286 Dwarf_Off *return_offset,
9287 Dwarf_Error *error)\fP
91549288 .DE
91559289 The function \f(CWdwarf_func_cu_offset()\fP returns
91569290 \f(CWDW_DLV_OK\fP and sets \f(CW*return_offset\fP to
91659299 .H 4 "dwarf_func_name_offsets()"
91669300 .DS
91679301 \f(CWint dwarf_func_name_offsets(
9168 Dwarf_Func func,
9169 char **func_name,
9170 Dwarf_Off *die_offset,
9302 Dwarf_Func func,
9303 char **func_name,
9304 Dwarf_Off *die_offset,
91719305 Dwarf_Off *cu_offset,
91729306 Dwarf_Error *error)\fP
91739307 .DE
95369670 .H 4 "dwarf_var_name_offsets()"
95379671 .DS
95389672 \f(CWint dwarf_var_name_offsets(
9539 Dwarf_Var var,
9540 char **returned_name,
9541 Dwarf_Off *die_offset,
9542 Dwarf_Off *cu_offset,
9543 Dwarf_Error *error)\fP
9673 Dwarf_Var var,
9674 char **returned_name,
9675 Dwarf_Off *die_offset,
9676 Dwarf_Off *cu_offset,
9677 Dwarf_Error *error)\fP
95449678 .DE
95459679 The function \f(CWdwarf_var_name_offsets()\fP returns
95469680 \f(CWDW_DLV_OK\fP and sets \f(CW*returned_name\fP to
1151511649 .H 3 "dwarf_get_cie_info()"
1151611650 .DS
1151711651 \f(CWint dwarf_get_cie_info(
11518 Dwarf_Cie cie,
11519 Dwarf_Unsigned *bytes_in_cie,
11520 Dwarf_Small *version,
11521 char **augmenter,
11522 Dwarf_Unsigned *code_alignment_factor,
11523 Dwarf_Signed *data_alignment_factor,
11524 Dwarf_Half *return_address_register_rule,
11525 Dwarf_Ptr *initial_instructions,
11526 Dwarf_Unsigned *initial_instructions_length,
11527 Dwarf_Error *error);\fP
11652 Dwarf_Cie cie,
11653 Dwarf_Unsigned *bytes_in_cie,
11654 Dwarf_Small *version,
11655 char **augmenter,
11656 Dwarf_Unsigned *code_alignment_factor,
11657 Dwarf_Signed *data_alignment_factor,
11658 Dwarf_Half *return_address_register_rule,
11659 Dwarf_Ptr *initial_instructions,
11660 Dwarf_Unsigned *initial_instructions_length,
11661 Dwarf_Error *error);\fP
1152811662 .DE
1152911663 \f(CWdwarf_get_cie_info()\fP is primarily for Internal-level Interface
1153011664 consumers.
1156611700 .H 3 "dwarf_get_fde_instr_bytes()"
1156711701 .DS
1156811702 \f(CWint dwarf_get_fde_instr_bytes(
11569 Dwarf_Fde fde,
11570 Dwarf_Ptr *outinstrs,
11571 Dwarf_Unsigned *outlen,
11572 Dwarf_Error *error);\fP
11703 Dwarf_Fde fde,
11704 Dwarf_Ptr *outinstrs,
11705 Dwarf_Unsigned *outlen,
11706 Dwarf_Error *error);\fP
1157311707 .DE
1157411708 \f(CWdwarf_get_fde_instr_bytes()\fP returns
1157511709 \f(CWDW_DLV_OK\fP and sets \f(CW*outinstrs\fP to
1159111725 \f(CWint dwarf_get_fde_info_for_reg3\fP.
1159211726 .DS
1159311727 \f(CWint dwarf_get_fde_info_for_reg(
11594 Dwarf_Fde fde,
11595 Dwarf_Half table_column,
11596 Dwarf_Addr pc_requested,
11597 Dwarf_Signed *offset_relevant,
11598 Dwarf_Signed *register_num,
11599 Dwarf_Signed *offset,
11600 Dwarf_Addr *row_pc,
11601 Dwarf_Error *error);\fP
11728 Dwarf_Fde fde,
11729 Dwarf_Half table_column,
11730 Dwarf_Addr pc_requested,
11731 Dwarf_Signed *offset_relevant,
11732 Dwarf_Signed *register_num,
11733 Dwarf_Signed *offset,
11734 Dwarf_Addr *row_pc,
11735 Dwarf_Error *error);\fP
1160211736 .DE
1160311737 \f(CWdwarf_get_fde_info_for_reg()\fP returns
1160411738 \f(CWDW_DLV_OK\fP and sets \f(CW*offset_relevant\fP to
1164111775 .H 3 "dwarf_get_fde_info_for_all_regs()"
1164211776 .DS
1164311777 \f(CWint dwarf_get_fde_info_for_all_regs(
11644 Dwarf_Fde fde,
11645 Dwarf_Addr pc_requested,
11646 Dwarf_Regtable *reg_table,
11647 Dwarf_Addr *row_pc,
11648 Dwarf_Error *error);\fP
11778 Dwarf_Fde fde,
11779 Dwarf_Addr pc_requested,
11780 Dwarf_Regtable *reg_table,
11781 Dwarf_Addr *row_pc,
11782 Dwarf_Error *error);\fP
1164911783 .DE
1165011784 \f(CWdwarf_get_fde_info_for_all_regs()\fP returns
1165111785 \f(CWDW_DLV_OK\fP and sets \f(CW*reg_table\fP for the row specified by
1214212276 \f(CWint dwarf_get_fde_info_for_all_regs3(
1214312277 Dwarf_Fde fde,
1214412278 Dwarf_Addr pc_requested,
12145 Dwarf_Regtable3 *reg_table,
12279 Dwarf_Regtable3 *reg_table,
1214612280 Dwarf_Addr *row_pc,
1214712281 Dwarf_Error *error)\fP
1214812282 .DE
1217612310 .H 3 "dwarf_get_fde_n()"
1217712311 .DS
1217812312 \f(CWint dwarf_get_fde_n(
12179 Dwarf_Fde *fde_data,
12180 Dwarf_Unsigned fde_index,
12181 Dwarf_Fde *returned_fde
12182 Dwarf_Error *error)\fP
12313 Dwarf_Fde *fde_data,
12314 Dwarf_Unsigned fde_index,
12315 Dwarf_Fde *returned_fde
12316 Dwarf_Error *error)\fP
1218312317 .DE
1218412318 \f(CWdwarf_get_fde_n()\fP returns
1218512319 \f(CWDW_DLV_OK\fP and sets \f(CWreturned_fde\fP to
1239412528 .DE
1239512529 The function \f(CWdwarf_get_abbrev()\fP returns
1239612530 \f(CWDW_DLV_OK\fP and sets \f(CW*returned_abbrev\fP to
12397 \f(CWDwarf_Abbrev\fP
12398 descriptor for an abbreviation at offset \f(CW*offset\fP in the abbreviations
12531 \f(CWDwarf_Abbrev\fP,
12532 a descriptor for the abbreviation
12533 that begins
12534 at offset
12535 \f(CW*offset\fP in the abbreviations
1239912536 section (i.e .debug_abbrev) on success.
1240012537 The user is responsible for making sure that
12401 a valid abbreviation begins at \f(CWoffset\fP in the abbreviations section.
12402 The location pointed to by \f(CWlength\fP
12403 is set to the length in bytes of the abbreviation in the abbreviations
12538 a valid abbreviation begins at
12539 \f(CWoffset\fP in the abbreviations section.
12540 The location pointed to by
12541 \f(CWlength\fP
12542 is set to the length in bytes of the
12543 abbreviation set in the abbreviations
1240412544 section.
12405 The location pointed to by \f(CWattr_count\fP is set to the
12545 The location pointed to by
12546 \f(CWattr_count\fP is set to the
1240612547 number of attributes in the abbreviation.
1240712548 An abbreviation entry with a
12408 length of 1 is the 0 byte of the last abbreviation entry of a compilation
12549 length of 1 is the 0 byte of the last
12550 abbreviation entry of a compilation
1240912551 unit.
1241012552 .P
12411 \f(CWdwarf_get_abbrev()\fP returns \f(CWDW_DLV_ERROR\fP on error.
12553 \f(CWdwarf_get_abbrev()\fP returns
12554 \f(CWDW_DLV_NO_ENTRY\fP if the .debug_abbrev
12555 section is missing or if the offset passed
12556 in is past the end of the section.
12557 .P
12558 \f(CWdwarf_get_abbrev()\fP returns
12559 \f(CWDW_DLV_ERROR\fP on error.
1241212560 If the call succeeds, the storage pointed to
1241312561 by \f(CW*returned_abbrev\fP
1241412562 should be freed, using
1241512563 \f(CWdwarf_dealloc()\fP with the
1241612564 allocation type
12417 \f(CWDW_DLA_ABBREV\fP when no longer needed.
12418
12565 \f(CWDW_DLA_ABBREV\fP
12566 when no longer needed.
1241912567
1242012568 .H 3 "dwarf_get_abbrev_tag()"
1242112569 .DS
1242212570 \f(CWint dwarf_get_abbrev_tag(
12423 Dwarf_abbrev abbrev,
12424 Dwarf_Half *return_tag,
12425 Dwarf_Error *error);\fP
12571 Dwarf_Abbrev abbrev,
12572 Dwarf_Half *return_tag,
12573 Dwarf_Error *error);\fP
1242612574 .DE
1242712575 If successful,
1242812576 \f(CWdwarf_get_abbrev_tag()\fP returns
1243512583 .H 3 "dwarf_get_abbrev_code()"
1243612584 .DS
1243712585 \f(CWint dwarf_get_abbrev_code(
12438 Dwarf_abbrev abbrev,
12439 Dwarf_Unsigned *return_code,
12440 Dwarf_Error *error);\fP
12586 Dwarf_Abbrev abbrev,
12587 Dwarf_Unsigned *return_code,
12588 Dwarf_Error *error);\fP
1244112589 .DE
1244212590 If successful,
1244312591 \f(CWdwarf_get_abbrev_code()\fP returns
1245012598 .H 3 "dwarf_get_abbrev_children_flag()"
1245112599 .DS
1245212600 \f(CWint dwarf_get_abbrev_children_flag(
12453 Dwarf_Abbrev abbrev,
12454 Dwarf_Signed *returned_flag,
12455 Dwarf_Error *error)\fP
12601 Dwarf_Abbrev abbrev,
12602 Dwarf_Signed *returned_flag,
12603 Dwarf_Error *error)\fP
1245612604 .DE
1245712605 The function \f(CWdwarf_get_abbrev_children_flag()\fP returns
1245812606 \f(CWDW_DLV_OK\fP and sets \f(CWreturned_flag\fP to
1264412792 .H 3 "dwarf_get_str()"
1264512793 .DS
1264612794 \f(CWint dwarf_get_str(
12647 Dwarf_Debug dbg,
12648 Dwarf_Off offset,
12649 char **string,
12650 Dwarf_Signed *returned_str_len,
12651 Dwarf_Error *error)\fP
12795 Dwarf_Debug dbg,
12796 Dwarf_Off offset,
12797 char **string,
12798 Dwarf_Signed *returned_str_len,
12799 Dwarf_Error *error)\fP
1265212800 .DE
1265312801 The function \f(CWdwarf_get_str()\fP returns
1265412802 \f(CWDW_DLV_OK\fP and sets \f(CW*returned_str_len\fP to
1306313211 .H 3 "dwarf_get_arange()"
1306413212 .DS
1306513213 \f(CWint dwarf_get_arange(
13066 Dwarf_Arange *aranges,
13067 Dwarf_Unsigned arange_count,
13068 Dwarf_Addr address,
13069 Dwarf_Arange *returned_arange,
13070 Dwarf_Error *error);\fP
13214 Dwarf_Arange *aranges,
13215 Dwarf_Unsigned arange_count,
13216 Dwarf_Addr address,
13217 Dwarf_Arange *returned_arange,
13218 Dwarf_Error *error);\fP
1307113219 .DE
1307213220 The function \f(CWdwarf_get_arange()\fP takes as input a pointer
1307313221 to a block of \f(CWDwarf_Arange\fP pointers, and a count of the
1319813346 .H 3 "dwarf_get_offset_size()"
1319913347 .DS
1320013348 \f(CWint dwarf_get_offset_size(Dwarf_Debug dbg,
13201 Dwarf_Half *offset_size,
13202 Dwarf_Error *error)\fP
13349 Dwarf_Half *offset_size,
13350 Dwarf_Error *error)\fP
1320313351 .DE
1320413352 The function \f(CWdwarf_get_offset_size()\fP
1320513353 returns \f(CWDW_DLV_OK\fP on success and sets
1321813366 .H 3 "dwarf_get_address_size()"
1321913367 .DS
1322013368 \f(CWint dwarf_get_address_size(Dwarf_Debug dbg,
13221 Dwarf_Half *addr_size,
13222 Dwarf_Error *error)\fP
13369 Dwarf_Half *addr_size,
13370 Dwarf_Error *error)\fP
1322313371 .DE
1322413372 The function \f(CWdwarf_get_address_size()\fP
1322513373 returns \f(CWDW_DLV_OK\fP on success and sets
1324113389 .H 3 "dwarf_get_die_address_size()"
1324213390 .DS
1324313391 \f(CWint dwarf_get_die_address_size(Dwarf_Die die,
13244 Dwarf_Half *addr_size,
13245 Dwarf_Error *error)\fP
13392 Dwarf_Half *addr_size,
13393 Dwarf_Error *error)\fP
1324613394 .DE
1324713395 The function \f(CWdwarf_get_die_address_size()\fP
1324813396 returns \f(CWDW_DLV_OK\fP on success and sets
Binary diff not shown
33 and is modified from time to time.
44 */
55
6 #define DW_VERSION_DATE_STR " 2020-10-20 18:22:29-07:00 "
6 #define DW_VERSION_DATE_STR " 2020-11-30 11:14:43-08:00 "
3030 #include "config.h"
3131 #include "libdwarfdefs.h"
3232 #include <stdio.h>
33
34 #ifdef HAVE_STRING_H
3335 #include <string.h>
36 #endif /* HAVE_STRING_H */
3437 #ifdef HAVE_ELFACCESS_H
3538 #include <elfaccess.h>
3639 #endif
2828 #include "config.h"
2929 #include "libdwarfdefs.h"
3030 #include <stdio.h>
31 #ifdef HAVE_STRING_H
3132 #include <string.h>
33 #endif /* HAVE_STRING_H */
3234 #ifdef HAVE_STDLIB_H
3335 #include <stdlib.h>
3436 #endif /* HAVE_STDLIB_H */
4141 #ifdef HAVE_STDINT_H
4242 #include <stdint.h> /* For uintptr_t */
4343 #endif /* HAVE_STDINT_H */
44 #ifdef HAVE_STRING_H
4445 #include <string.h>
46 #endif /* HAVE_STRING_H */
4547 #include <stddef.h>
4648 #include "pro_incl.h"
4749 #include "dwarf.h"
2828 #include "config.h"
2929 #include "libdwarfdefs.h"
3030 #include <stdio.h>
31 #ifdef HAVE_STRING_H
3132 #include <string.h>
33 #endif /* HAVE_STRING_H */
3234 #ifdef HAVE_ELFACCESS_H
3335 #include <elfaccess.h>
34 #endif
36 #endif /* HAVE_ELFACCESS_H */
3537 #include "pro_incl.h"
3638 #include <stddef.h>
3739 #include "dwarf.h"
2929
3030 #include "config.h"
3131 #include "libdwarfdefs.h"
32 #ifdef HAVE_STRING_H
3233 #include <string.h>
34 #endif /* HAVE_STRING_H */
3335 #include "dwarf.h"
3436 #include "libdwarf.h"
3537 #include "pro_encode_nm.h"
3131 #include "libdwarfdefs.h"
3232
3333 #include <stdio.h>
34 #ifdef HAVE_SYS_STAT_H
3435 #include <sys/stat.h>
36 #endif /* HAVE_SYS_STAT_H */
3537 #ifdef HAVE_SYS_TYPES_H
3638 #include <sys/types.h> /* open(), off_t, size_t, ssize_t */
3739 #endif /* HAVE_SYS_TYPES_H */
3131 #include "config.h"
3232 #include "libdwarfdefs.h"
3333 #include <stdio.h>
34 #ifdef HAVE_STRING_H
3435 #include <string.h>
36 #endif /* HAVE_STRING_H */
3537 #include <limits.h>
3638 #include "pro_incl.h"
3739 #include <stddef.h>
3030 #include "config.h"
3131 #include "libdwarfdefs.h"
3232 #include <stdio.h>
33 #ifdef HAVE_STRING_H
3334 #include <string.h>
35 #endif /* HAVE_STRING_H */
3436 #include <limits.h>
3537 #include "pro_incl.h"
3638 #include <stddef.h>
2929 #include "config.h"
3030 #include "libdwarfdefs.h"
3131 #include <stdio.h>
32 #ifdef HAVE_STRING_H
3233 #include <string.h>
34 #endif /* HAVE_STRING_H */
3335 #ifdef HAVE_ELFACCESS_H
3436 #include <elfaccess.h>
35 #endif
37 #endif /* HAVE_ELFACCESS_H */
3638 #include "pro_incl.h"
3739 #include <stddef.h>
3840 #include "dwarf.h"
3131 #include "config.h"
3232 #include "libdwarfdefs.h"
3333 #include <stdio.h>
34 #ifdef HAVE_STRING_H
3435 #include <string.h>
36 #endif /* HAVE_STRING_H */
3537 #include <stddef.h>
3638 #ifdef HAVE_STDINT_H
3739 #include <stdint.h> /* For uintptr_t */
2929 #include "config.h"
3030 #include "libdwarfdefs.h"
3131 #include <stdio.h>
32 #ifdef HAVE_STRING_H
3233 #include <string.h>
33
34 #endif /* HAVE_STRING_H */
3435 #include "pro_incl.h"
3536 #include <stddef.h>
3637 #include "dwarf.h"
3131 #include "config.h"
3232 #include "libdwarfdefs.h"
3333 #include <stdio.h>
34 #ifdef HAVE_STRING_H
3435 #include <string.h>
36 #endif /* HAVE_STRING_H */
3537 #include <stddef.h>
3638 #ifdef HAVE_STDINT_H
3739 #include <stdint.h> /* For uintptr_t */
2727 */
2828
2929 #include "config.h"
30 #include <stdio.h>
31 #ifdef HAVE_STRING_H
32 #include <string.h>
33 #endif /* HAVE_STRING_H */
34 #include <stddef.h>
3035 #include "libdwarfdefs.h"
31 #include <stdio.h>
32 #include <string.h>
3336 #include "pro_incl.h"
34 #include <stddef.h>
3537 #include "dwarf.h"
3638 #include "libdwarf.h"
3739 #include "pro_opaque.h"
2828 */
2929
3030 #include "config.h"
31 #include "libdwarfdefs.h"
3231 #include <stdio.h>
32 #ifdef HAVE_STRING_H
3333 #include <string.h>
34 #endif /* HAVE_STRING_H */
3435 #ifdef HAVE_ELFACCESS_H
3536 #include <elfaccess.h>
3637 #endif
38 #include "libdwarfdefs.h"
3739 #include "pro_incl.h"
3840 #include <stddef.h>
3941 #include "dwarf.h"
131131 /* in this call a %x is not allowed */
132132 res = dwarfstring_append_printf_i(&g,"\nabc%x\n",-54);
133133 check_value("expected error ",FALSE,res,__LINE__);
134 check_string("expected ",(char *)"\nabc%x\n",dwarfstring_string(&g),__LINE__);
134 check_string("expected ",
135 (char *)"\nabc<ERROR: format %x or %X passed to dwarfstring_append_printf_i>%x\n",
136 dwarfstring_string(&g),__LINE__);
135137 dwarfstring_reset(&g);
136138
137139 res = dwarfstring_append_printf_u(&g,"\nabc%x\n",-54);
354356 check_string("from pct-s",(char *)expstr,d,__LINE__);
355357 dwarfstring_destructor(&g);
356358 return 0;
357 return 0;
359 }
360 static int
361 test6(int tnum)
362 {
363 dwarfstring g;
364 char *d = 0;
365 const char *expstr = 0;
366
367 dwarfstring_constructor(&g);
368 dwarfstring_append(&g,0);
369 d = dwarfstring_string(&g);
370 expstr = "";
371 check_string("from append",(char *)expstr,d,__LINE__);
372 dwarfstring_destructor(&g);
373
374 dwarfstring_constructor(&g);
375 dwarfstring_append_printf_s(&g,"%s",0);
376 d = dwarfstring_string(&g);
377 expstr="<ERROR: null string pointer to "
378 "dwarfstring_append_printf_s>";
379 check_string("from _s",(char *)expstr,d,__LINE__);
380 dwarfstring_destructor(&g);
381
382 dwarfstring_constructor(&g);
383 dwarfstring_append_printf_s(&g,0,"abc");
384 d = dwarfstring_string(&g);
385 expstr="<ERROR: null format pointer to "
386 "dwarfstring_append_printf_s>";
387 check_string("from _s",(char *)expstr,d,__LINE__);
388 dwarfstring_destructor(&g);
389
390 dwarfstring_constructor(&g);
391 dwarfstring_append_printf_u(&g,0,12);
392 d = dwarfstring_string(&g);
393 expstr="<ERROR: null format pointer to "
394 "dwarfstring_append_printf_u>";
395 check_string("from _u",(char *)expstr,d,__LINE__);
396 dwarfstring_destructor(&g);
397
398 dwarfstring_constructor(&g);
399 dwarfstring_append_printf_i(&g,0,12);
400 d = dwarfstring_string(&g);
401 expstr="<ERROR: null format pointer to "
402 "dwarfstring_append_printf_i>";
403 check_string("from _i",(char *)expstr,d,__LINE__);
404 dwarfstring_destructor(&g);
405
406
407 dwarfstring_constructor(&g);
408 dwarfstring_append_printf_i(&g,"%s",12);
409 d = dwarfstring_string(&g);
410 expstr="<ERROR: format %s passed to "
411 "dwarfstring_append_printf_i>";
412 check_string("from _i",(char *)expstr,d,__LINE__);
413 dwarfstring_destructor(&g);
414
415 dwarfstring_constructor(&g);
416 dwarfstring_append_printf_i(&g,"%x",12);
417 d = dwarfstring_string(&g);
418 expstr="<ERROR: format %x or %X passed to "
419 "dwarfstring_append_printf_i>%x";
420 check_string("from _i",(char *)expstr,d,__LINE__);
421 dwarfstring_destructor(&g);
422
423 dwarfstring_constructor(&g);
424 dwarfstring_append_printf_i(&g,"%Xx",12);
425 d = dwarfstring_string(&g);
426 expstr="<ERROR: format %x or %X passed to "
427 "dwarfstring_append_printf_i>%Xx";
428 check_string("from _i",(char *)expstr,d,__LINE__);
429 dwarfstring_destructor(&g);
430
431 dwarfstring_constructor(&g);
432 dwarfstring_append_printf_i(&g,"%llld",12);
433 d = dwarfstring_string(&g);
434 expstr="<ERROR: format has too many %x/d/u/l passed to "
435 "dwarfstring_append_printf_i>";
436 check_string("from _i",(char *)expstr,d,__LINE__);
437 dwarfstring_destructor(&g);
438
439 dwarfstring_constructor(&g);
440 dwarfstring_append_printf_i(&g,"%+-d",12);
441 d = dwarfstring_string(&g);
442 expstr="<ERROR: format disallowed. +- passed to "
443 "dwarfstring_append_printf_i>";
444 check_string("from _i",(char *)expstr,d,__LINE__);
445 dwarfstring_destructor(&g);
446
447 dwarfstring_constructor(&g);
448 dwarfstring_append_printf_u(&g,0,43);
449 d = dwarfstring_string(&g);
450 expstr="<ERROR: null format pointer to "
451 "dwarfstring_append_printf_u>";
452 check_string("from _s",(char *)expstr,d,__LINE__);
453 dwarfstring_destructor(&g);
454
455 dwarfstring_constructor(&g);
456 dwarfstring_append_printf_u(&g,"aa%- bb",100);
457 d = dwarfstring_string(&g);
458 expstr="aa<ERROR: format - passed to "
459 "dwarfstring_append_printf_u "
460 "cannot be handled>";
461 check_string("from _u",(char *)expstr,d,__LINE__);
462 dwarfstring_destructor(&g);
463
464 dwarfstring_constructor(&g);
465 dwarfstring_append_printf_u(&g,"aa%s bb",77);
466 d = dwarfstring_string(&g);
467 expstr="aa<ERROR: format %s passed to "
468 "dwarfstring_append_printf_u "
469 "cannot be handled>";
470 check_string("from _u",(char *)expstr,d,__LINE__);
471 dwarfstring_destructor(&g);
472
473 dwarfstring_constructor(&g);
474 dwarfstring_append_printf_u(&g,"aa%xXd ubb",77);
475 d = dwarfstring_string(&g);
476 expstr="aa<ERROR: format %x X d u repeats to "
477 "dwarfstring_append_printf_u "
478 "cannot be handled>";
479 check_string("from _u",(char *)expstr,d,__LINE__);
480 dwarfstring_destructor(&g);
481
482 dwarfstring_constructor(&g);
483 dwarfstring_append_printf_u(&g,"aa%llld ubb",77);
484 d = dwarfstring_string(&g);
485 expstr="aa<ERROR: format % lll to "
486 "dwarfstring_append_printf_u "
487 "cannot be handled>";
488 check_string("from _u",(char *)expstr,d,__LINE__);
489 dwarfstring_destructor(&g);
490
491 dwarfstring_constructor(&g);
492 dwarfstring_append_printf_u(&g,"aa%ld ubb",77);
493 d = dwarfstring_string(&g);
494 expstr="aa<ERROR: format %d to "
495 "dwarfstring_append_printf_u "
496 "cannot be handled>";
497 check_string("from _u",(char *)expstr,d,__LINE__);
498 dwarfstring_destructor(&g);
358499 }
359500
360501
363504 test1(1);
364505 test2(2);
365506 test3(3);
366 test4(3);
367 test5(3);
507 test4(4);
508 test5(5);
509 test6(6);
368510 if (errcount) {
369511 exit(1);
370512 }
11 This is an checklist of the steps in creating a new release.
22 In hopes this will prevent omissions.
33
4 DavidA. 30 November 2012
4 DavidA. 1 December 2020
55
6 Source here means libdwarf/dwarfdump/dwarfgen source (in Git).
6 Source here means libdwarf/dwarfdump/dwarfgen/dwarfexample
7 source (in Git).
78 Tests here means the regression tests (in another Git repository).
89
910 In the Source:
3031
3132 In the Tests:
3233
33 Create any new tests that seem applicable.
34 Add the appropriate lines to DWARFTEST.sh which
35 actually does the test running.
34 From the code directory one can run all tests (assuming
35 regressiontests is alongside code).
36
37 sh scripts/run-all-tests.sh
38 Verifies a lot of different things. This will take 40 to
39 120 minutes to run depending on your hardware or VM.
40
41 sh scripts/buildandreleasetest.sh
42 is also useful as it creates a release and using that
43 (temporary) release rebuilds everything including 3 different
44 cmake builds. The primary purpose of this is to ensure all
45 the needed files get into the release, and the secondary
46 purpose is to ensure the CMakeLists.txt files work properly.
47
48
49 Or just run the regression tests.
50 mkdir /tmp/dwarfregr
51 cd /tmp/dwarfregr
52 /path/to/regressiontests/configure
53 make
54
55 Create any new tests that seem applicable. Add the appropriate
56 lines to DWARFTEST.sh which actually does the test running.
3657
3758 RUNALL.sh
3859 Runs one test of the new dwarfdump/libdwarf executable
3960 against the previously saved dwarfdump/libdwarf executable.
61 it actually runs around 30,000 individual tests.
4062
4163 The notion of keeping baseline test output and simply
42 comparing output of a previous release vs the new
43 candidate release would involve saving some really large files.
44 So the present test suite instead runs each test with
45 two dwarfdump* versions and compares the output.
64 comparing output of a previous release vs the new candidate
65 release would involve saving some really large files. So the
66 present test suite instead runs tests with dwarfdump.
4667
4768 To run all the tests, most of which
4869 compare the (committed in tests) dwarfdump
5071 sh PICKUPBIN # This picks up latest source and compiles
5172 # (for some files multiple times)
5273 # It is essential before each test run.
53 sh RUNALL.sh # This runs the tests 3 times with different
54 # dwarfdump[2] and different comparisons
74 sh RUNALL.sh # This runs the tests.
5575
5676 To check for failure:
5777 grep FAIL ALL*
6080 the output change that is expected given the Source changes.
6181
6282 In case all tests pass:
63 cp dwarfdump dwarfdump.O
83 cp dwarfdump dwarfdump<something>.O
84 (each environment has a unique name for the .O)
6485 commit the updated .O executables as the new baseline good
6586 dwarfdump for the next test run.
6687
6889 sh UPDATEDWARFDUMPVERSION.sh #updates the version string
6990 a libdwarf header file (libdwarf/dwarf_version.h).
7091
71 Update dwarfdump[2]/ChangeLog files to reflect the new version.
92 Update dwarfdump/ChangeLog files to reflect the new version.
7293 commit the new version string. If this has been done recently
7394 enough that users won't see the current version string
7495 it need not be done at this time.
7596
7697 The release version is in configure.ac.
77 Currently 20181024
98 Currently 20201201
7899
79100 git push origin master # Push to sourceforge.
80 # We use 20181024 as an example below, use the current date.
101 # We use 20201201 as an example below, use the current date.
81102
82103 mkdir /tmp/bld
83104 cd /tmp/bld
84105 <sourcelocation>/configure
85106 make dist
86107
87 md5sum libdwarf-20181024.tar.gz
88 sha512sum libdwarf-20181024.tar.gz | fold -w 32
108 md5sum libdwarf-20201201.tar.gz
109 sha512sum libdwarf-20201201.tar.gz | fold -w 32
89110 # To get unforgeable checksums for the tar.gz file
90111 # md5sum is weak, but the pair should be
91112 # a strong confirmation.
92113 # The fold(1) is just to make the web
93114 # release page easier to work with.
94115
95 git tag -a 20181024 -m 'Release 20181024'
96 git push origin 20181024 # push the tag
116 git tag -a 20201201 -m 'Release 20201201'
117 git push origin 20201201 # push the tag
97118
98119 In the Tests:
99120 git push origin master
100 git tag -a 20181024 -m 'Release 20181024'
101 git push origin 20181024 # push the tag
121 git tag -a 20201201 -m 'Release 20201201'
122 git push origin 20201201 # push the tag
102123
103124 Update web pages so that the new release is visible to users
104125 and copy the tar.gz to the appropriate web site.
0 2020-11-24 David Anderson
1 * buildandreleasetest.sh: Now does additional cmake builds
2 to verify -DDWARF_WITH_LIBELF=OFF and -DBUILD_SHARED=ON
3 work.
4 2020-10-21 David Anderson
5 * run-all-tests.sh: getting directory right
6 for modified regressiontests configre.
07 2020-10-21 David Anderson
18 * buildandreleasetest.sh: Now uses temp files under
29 /tmp/bart and if all passes removes that directory
11 # A script verifying the distribution gets all needed files
22 # for building, including "make check"
33 # First, get the current configure.ac version into v:
4
54 # if stdint.h does not define uintptr_t and intptr_t
65 # Then dwarfgen (being c++) will not build
76 # Use --disable-libelf to disable reliance on libelf
87 # and dwarfgen.
98 # To just eliminate dwarfgen build/test/install use --disable-dwarfgen.
9
1010 genopta="--enable-dwarfgen"
1111 genoptb="-DBUILD_DWARFGEN=ON"
1212 libelfopt=''
1313 wd=`pwd`
1414 nonstdprintf=
15 # If passes, remove the /tmp/bart working directory.
16 # Useful to consider if all intended files actually present,
17 # including any possibly not used.
18 savebart=n
1519 while [ $# -ne 0 ]
1620 do
1721 case $1 in
22 --savebart ) savebart=y ; shift ;;
1823 --disable-libelf ) genopta='' ; genoptb=''
1924 libelfopt=$1 ; shift ;;
2025 --enable-libelf ) shift ;;
2328 * ) echo "Unknown buildandreleasetest.sh option $1. Error." ; exit 1 ;;
2429 esac
2530 done
26
31 echo "savebart flag about temp files:...: $savebart"
2732 if [ -f ./configure.ac ]
2833 then
2934 f=./configure.ac
8792 cinstrelp=$bart/c-installrelp
8893 dbigend=$bart/d-bigendian
8994 ecmakebld=$bart/e-cmakebld
95 fcmakebld=$bart/f-cmakebld
96 gcmakebld=$bart/g-cmakebld
9097 mdirs $bart $abld $ainstall $binstrelp $binstrelbld $crelbld
91 mdirs $cinstrelp $dbigend $ecmakebld
98 mdirs $cinstrelp $dbigend $ecmakebld $fcmakebld $gcmakebld
9299 relset=$bart/a-gzfilelist
93100 atfout=$bart/a-tarftout
94101 btfout=$bart/b-tarftout
200207 ctest -R self
201208 chkres $? "FAIL C10e ctest -R self in $ecmakebld"
202209 else
203 echo "cmake is not installed so not tested."
210 echo "cmake not installed so Test section E not tested."
204211 fi
205212 echo " End Section E $bart (ls output follows)"
206213 ls $bart
207214 ############ End Section E
215 ################### Cmake test F
216 safecd $fcmakebld "FAIL C11 Section F cd"
217 havecmake=n
218 which cmake >/dev/null
219 if [ $? -eq 0 ]
220 then
221 havecmake=y
222 echo "We have cmake and can test it."
223 fi
224 if [ $havecmake = "y" ]
225 then
226 echo "TEST: Now cmake from source dir $blibsrc/ in build dir $fcmakebld"
227 cmake $genoptb -DWALL=ON -DDWARF_WITH_LIBELF=OFF -DBUILD_DWARFEXAMPLE=ON -DDO_TESTING=ON $blibsrc
228 chkres $? "FAIL Sec F C11b cmake in $ecmakdbld"
229 make
230 chkres $? "FAIL Sec F C11c cmake make in $fcmakebld"
231 make test
232 chkres $? "FAIL Sec F C11d cmake make test in $fcmakebld"
233 ctest -R self
234 chkres $? "FAIL Sec F C11e ctest -R self in $fcmakebld"
235 else
236 echo "cmake not installed so -DDWARF_WITH_LIBELF=OFF (sec. F) not tested."
237 fi
238 echo " End Section F $bart (ls output follows)"
239 ls $bart
240 ############ End Section F
241 ################### Cmake test G
242 safecd $gcmakebld "FAIL C11 Section G cd"
243 havecmake=n
244 which cmake >/dev/null
245 if [ $? -eq 0 ]
246 then
247 havecmake=y
248 echo "We have cmake and can test it."
249 fi
250 if [ $havecmake = "y" ]
251 then
252 echo "TEST: Now cmake from source dir $blibsrc/ in build dir $gcmakebld"
253 cmake $genoptb -DWALL=ON -DBUILD_NON_SHARED=OFF -DBUILD_SHARED=ON -DBUILD_DWARFGEN=ON -DBUILD_DWARFEXAMPLE=ON $blibsrc
254 chkres $? "FAIL Sec F C11b cmake in $ecmakdbld"
255 make
256 chkres $? "FAIL Sec F C11c cmake make in $gcmakebld"
257 make test
258 chkres $? "FAIL Sec F C11d cmake make test in $gcmakebld"
259 ctest -R self
260 chkres $? "FAIL Sec F C11e ctest -R self in $gcmakebld"
261 else
262 echo "cmake not installed so Section G not tested."
263 fi
264 echo " End Section G $bart (ls output follows)"
265 ls $bart
266 ############ End Section G
208267
209268
210269 echo "PASS scripts/buildandreleasetest.sh"
211 rm -rf $bart
270 if [ "$savebart" = "n" ]
271 then
272 rm -rf $bart
273 fi
212274 exit 0