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
Dwarf_Error* and with mistakes treating DW_DLV_NO_ENTRY
as if it were DW_DLV_ERROR.
* dwarf_form.c: Only do dwarf_errno(*error) when error is non-null.
* dwarf_macro5.c, dwarf_query.c, dwarf_ranges.c: Avoid the
possibility of
doing dwarf_errno(*error) when error is null.
* dwarf_util.c(_dwarf_error_mv_s_to_t): Added code to
ensure that nothing crash-worthy happens
even if a future internal caller calls it with one or more NULL
arguments.
* libdwarf2.1.mm: Added a few words about Error Handling in general
to clarify earlier wording (earlier wording was not as explicit
as it should have been).
* libdwarf2.1.pdf: Regenerated. Version 2.45
* dwarf_sort_line.c: Though no longer built or used, added
an initializer to a local variable for correctness.
if the gcc '__attribute__ ((name))' compiles ok.
* config.h.in, configure: Regenerated.
* libdwarfdefs.h: Test HAVE_UNUSED_ATTRIBUTE and define
UNUSEDARG appropriately.
* dwarf_alloc.c,dwarf_elf_access.c,dwarf_form.c,dwarf_frame2.c,
dwarf_gdbindex.c,dwarf_global.c,dwarf_init_finish.c,dwarf_line.c,
dwarf_line_table_reader_common.c,dwarf_macro5.c,
dwarf_original_elf_init.c,dwarf_print_lines.c,dwarf_ranges.c,
dwarf_tsearchhash.c,dwarf_util.c,dwarf_xu_index.c,
pro_alloc.c,pro_frame.c,pro_init.c,pro_reloc.c,
pro_reloc_stream.c,pro_section.c: Use UNUSEDARG to suppress
meaningless unused-parameter warnings from gcc.
* print_die.c: Fixed indents, removed trailing whitespace.
* dwarfdump.c, common.c: Update version string.
libdwarf
* dwarf_alloc.c: Fixed indents, trailing whitespace.
* dwarf_loc2.c: Fixed indents, trailing whitespace.
* dwarf_form.c: Made too-long line into 2 lines.
* dwarf_loc.h: Removed duplicate Dwarf_Loc_c_s etc declarations.
* dwarf_util.c(_dwarf_error_mv_s_to_t),dwarf_util.h: New
function to eliminate duplicative code.:
* dwarf_query.c): Fix bug in dwarf_get_offset_size().
Use new _dwarf_error_mv_s_to_t() to get error on correct dbg.
Fixed indents, trailing whitespace.
* dwarf_ranges.c: Use new _dwarf_error_mv_s_to_t()
to get error on correct dbg.
Fixed indents, trailing whitespace.
* dwarfdump.c: Revised -g so it no longer turns on -i.
Revised the meaning of -g to mean use old loclist interfaces
(for testing the older interfaces with dwarfdump).
* print_die.c(get_small_encoding_integer_and_name): a dwarf_dealloc
referenced err whereas *err was correct.
Revised loclist output making it look a bit like DWARF5
even for DWARF2,3,4 output. Reads better, I think.
* print_locs.c: -l gets a 'no longer supported' message
dwarfdump/dwarfdump.1
dwarfdump/dwarfdump.c
dwarfdump/print_die.c
dwarfdump/print_locs.c
* dwarf_alloc.c: Added new checks so user mixing up
tied dbg with regular dbg won't lead to crashes
when calling dwarf_dealloc or dwarf_finish().
Zeroed out some fields to recognize space deallocated.
* dwarf_die_deliv.c: Added support of split dwarf
DW_AT_[GNU_]ranges_base
* dwarf_form.c: Load string from tieddbg when appropriate.
* dwarf_harmless.c: On free() zero out a field to show that was done.
* dwarf_loc.c: Correct the handling of split dwarf loclist.
* dwarf_opaque.h: Add cc_ranges_base_present for split dwarf.
Add _dwarf_get_ranges_base_attr_from_tied() for split dwarf.
* dwarf_query.c: Get and remember skeleton compilaton unit
DW_AT_[GNU_]ranges_base from tied objects for split dwarf.
* dwarf_ranges.c: If a tied object present, look for ranges
there, not in split dwarf object.
* dwarf_util.c: Housekeeping zeros out fields to ensure not
used after dealloc.
libdwarf/dwarf_alloc.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_form.c
libdwarf/dwarf_harmless.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_loc2.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_original_elf_init.c
libdwarf/dwarf_query.c
libdwarf/dwarf_ranges.c
libdwarf/dwarf_util.c
layout change for some macros in dwarf_util.h.
=====================
dwarfdump/dwarfdump.c line 1143: abbrev_flag = TRUE
is the do_all() setting, yet that is not (in general) safe to print
as a section. And the comment following says that.
It is not safe to set abbrev_flag to TRUE. Even valid DWARF
may have garbage in that section in places not referenced by .debug_info.
We just cannot set abbrev_flag TRUE with -a, not safely.
==============================
dwarfdump/dwarfdump.c line 1160,1161: usage_text and
usage_debug_text are file-static, not
visible outside this source file. Get rid of the extern declarations.
Ah. I see why you did that for usage_debug_text,
it is actually a forward-declaration
in this context. Well... I would rather you moved the usage_debug_text
itself up to just after usage_text so the forward-declarations are no longer needed.
Admittedly my reason is not too strong, but it would be my preference
to eliminate those two forward declarations. gcc -Wall -pedantic
does not much like what you did here either :-)
==============================
dwarfdump/dwarfdump.c line 2357. The commit is incorrect now,
we don't quote strings internally in your new work
here. So delete that comment line.
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;
* 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.