Moved a couple functions between source files
and made them static. A couple commentary changes.
print_frames.c, though, needed hardening against
corrupt frame data.
dwarfdump/globals.h
dwarfdump/print_aranges.c
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_sections.c
All data reads from an object ensure the
read is actually in a section.
It is always possible something was overlooked, but
all the reading macros and functions now do checks.
libdwarf/dwarf_arange.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_form.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame2.c
libdwarf/dwarf_global.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_loc2.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_print_lines.c
libdwarf/dwarf_query.c
libdwarf/dwarf_ranges.c
libdwarf/dwarf_util.c
libdwarf/dwarf_util.h
libdwarf/dwarf_xu_index.c
libdwarf/libdwarf.h.in
standard tables: header says lno now,
for line number (row was incorrect).
dwarfdump/dwarfdump.c
dwarfdump/print_die.c
dwarfdump/print_lines.c
New checks for correctness and section overrun.
Fixed duplicate free due to bug in DWARF5 macro
handling.
libdwarf/dwarf_arange.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_elf_access.c
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_frame2.c
libdwarf/dwarf_leb.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
* dwarf_arange.c,dwarf_util.c: first use of READ_UNALIGNED_CK.
* dwarf_errmsg_list.c, libdwarf.h.in: DW_DLE_READ_LITTLEENDIAN_ERROR
and DW_DLE_READ_BIGENDIAN_ERROR are errors possible
in READ_UNALIGNED_CK.
* dwarf_query.c: Using local variables for shorter lines.
* dwarf_util.h: Implement READ_UNALIGNED_CK macros.
Preventing a wide class of crashes due to damaged
object files.
libdwarf/dwarf_arange.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_loc2.c
DW_CIE_VERSION* DW_CU_VERSION**
DW_ARANGES_VERSION* DW_LINE_VERSION* DW_LOC_VERSION*
DW_LINE_STR_VERSION5, DW_MACRO_VERSION5,
DW_LINE_LOC, DW_NAMES_VERSION5, DW_PUBNAMES_VERSION*,
DW_PUBTYPES_VERSION*, DW_STR_OFFSETS_VERSION5,
DW_SUP_VERSION*, DW_CU_INDEX_VERSION5
exclusively. Deleting the CURRENT_VERSION_STAMP* macros.
The intent is to improve readability given we now have
4 versions of DWARF to deal with.
dwarf_arange.c(dwarf_get_aranges_list): Remove the length variable
as its calculated value is unused. rename length to area_length
for clarity. Calculate arange_ptr_past_end early and
correctly. Ensure that the test for version 4 is a >=
to reflect normal standards upgrades.
dwarf_die_deliv.c(dwarf_find_offdie_CU_Context): Add commentary
about offsets and lengths for clarity.
Rename fields for clarity about local vs global offset.
Use the newly named fields for precise tests of section overflow of
a type unit.
Other changes in libdwarf were additions and modifications of commentary.
change to make consistent use of 'if', 'for' and 'while'.
===================
dwarfdump.c lines 73-78 Any time an 'extern foo' appears in a .c or a .cc
file it represents a current or future error that cannot be easily detected
at compile time. Bad.
Instead, put print_attributes_encoding and current_cu_die_for_print_frames
declarations into appropriate .h files (possibly new one or ones?) and
include the header in each .c/.cc where it is needed. That prevents future
spelling errors from causing mysterious runtime failures due to argument
errors: the compiler will catch argument errors.
Now line 56-58 is special in that it refers to some windows thing, not
defined in dwarfdump. So that one perhaps should or must stay as written.
===================
dwarfdump.c line 549: the variable 'bitmap' should be named something else.
bitmap is just too generic, not helpful to the reader. Easier for a
reviewer to see this sort of issue than the author :-)
Possibly local_section_bitmap? Somehow get 'section' in there in that
function-argument-name?
=======
dwarfdump.c: good catch on the indent errors in qsort_compare_compiler(),
I have no idea how I failed to run dicheck on that.
======
dwarfdump.c line 1043. The 'Just for the moment' comment is odd. What
does that mean? Why 'for the moment'? I am not going to try to guess
why you did that, but it has to be somehow wrong?
Either the code or the comment?
========
dwarfdump.c line 1162. The comment says do not do reloc_flag = TRUE
yet you added exactly that! Yikes! I don't know what to do about
this, but something has to change. Comment or statement. Can we detect
non-elf somehow? We probably already do, but...
===================
dwarfdump.c line 1630. Oops. Good catch on removing the mistaken extra
break;
error off instead of getting a divide-by-zero error or a libdwarf
crash (and so we don't read off the end of a section given erroneous
input). Has no effect when reading correct dwarf.
* dwarf_arange.c,dwarf_elf_access.c, dwarf_frame3.c,
dwarf_funcs.c,dwarf_global.c,dwarf_init_finish.c,
dwarf_line.c,dwarf_loc.c,dwarf_macro.c,dwarf_print_lines.c,
dwarf_pubtypes.c,dwarf_query.c,dwarf_ranges.c,dwarf_string.c,
dwarf_types.c,dwarf_vars.c, dwarf_weaks.c: Everything loading
a section now checks the result for 'empty' and returns
DW_DLV_NO_ENTRY explicitly. This makes it easier to
do nothing safely when there is no data.
indentation. No interfaces changed. One new and
not very significant (to most people) interface added which
returns a count of abbreviations in an abbreviation section.
Copyrights updated for 2011.