Commit Graph

23 Commits

Author SHA1 Message Date
David Anderson
82d8e00785 bugxml/data.txt
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
2016-05-12 07:39:36 -07:00
David Anderson
eb1472afac New bugr reports.
bugxml/data.txt

Now prints strings so that
control characters do not
cause problems. Easier to read too.
dwarfdump/Makefile.in
dwarfdump/NEWS
dwarfdump/dwarfdump.1
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_lines.c
dwarfdump/print_macro.c
dwarfdump/print_macros.c
dwarfdump/sanitized.c

Removed trailing whitespace.
dwarfexample/simplereader.c

New checking for corrupt input.
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_form.c
libdwarf/dwarf_line.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_query.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
2016-05-06 08:26:36 -07:00
David Anderson
98a3da1e82 Improve some error checks. Fix line printing for
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
2016-05-04 06:45:00 -07:00
David Anderson
cbea749340 libdwarf:
* 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.
2016-04-30 15:58:55 -07:00
David Anderson
d15483a528 libdwarf: Catching leb errors/corruption
and simplifying the code.
   dwarf_line_table_reader_common.c
   dwarf_macro.c
   dwarf_macro5.c
   dwarf_util.c
   dwarf_util.h
2016-04-29 15:41:16 -07:00
David Anderson
6e55f02d7e libdwarf:
* dwarf_die_deliv.c: Now _dwarf_next_die_info_ptr() has
      a section end argument.
    * dwarf_query.c, dwarf_util.c: Now uses the checked version
      of leb reading.
    * dwarf_util.h: Now _dwarf_get_size_of_val() has
      section_end_ptr argument for checking leb values
      do not overrun end of section.
2016-04-28 17:49:03 -07:00
David Anderson
76b6fb5846 Remove duplicative print of error number.
dwarfdump/dwarfdump.c

Ensure dependency on dwarf_errmsg_list.c
libdwarf/Makefile.in

Do much much more testing to ensure we do not
run off the end of section or accept a bogus
leb number.
libdwarf/dwarf_abbrev.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
libdwarf/dwarf_frame3.c
libdwarf/dwarf_leb.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_query.c
libdwarf/dwarf_util.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
2016-04-27 13:00:06 -07:00
David Anderson
e68baed644 Making the macro printing more correct.
Not yet quite right or complete.
dwarfdump/ChangeLog
dwarfdump/print_macro.c
libdwarf/ChangeLog
libdwarf/dwarf_init_finish.c
libdwarf/dwarf_line.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_macro5.h
libdwarf/dwarf_opaque.h
libdwarf/dwarf_util.c
libdwarf/dwarf_util.h
2015-12-20 10:36:29 -08:00
David Anderson
da724a0bc5 Now check FORM codes in abbrevs for sensible values.
Error off if invalid.
dwarf_abbrev.c
dwarf_die_deliv.c
dwarf_error.c
dwarf_opaque.h
dwarf_query.c
dwarf_util.c
dwarf_util.h
libdwarf.h.in
2015-12-08 10:46:23 -08:00
David Anderson
5a0bb4c7bc dwarfdump
* 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.
2015-11-08 10:26:49 -08:00
David Anderson
f5650ae6ec This ensures that non-terminated DWARF strings
are caught so we avoid some coredumps.

Such strings in DWARF are created by 'fuzzing' or
by a bug in a compiler or linker.

libdwarf/dwarf_error.c
libdwarf/dwarf_form.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
libdwarf/dwarf_global.c
libdwarf/dwarf_line.c
libdwarf/dwarf_macro.c
libdwarf/dwarf_string.c
libdwarf/dwarf_util.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
2015-09-13 16:05:10 -07:00
David Anderson
2d88cea086 libdwarf: Complete the removal of obsolete SGI postal address and
oss.sgi.com from copyright notices.
libdwarf/LIBDWARFCOPYRIGHT has an original example of copyright
and explains the change.
2015-01-31 10:09:02 -08:00
David Anderson
46a28e7d5f Now getopt is hard coded (NetBSD BSD license) in libdwarf
so we get consistent behavior.  Specifically allowing the
notion of :: in the option list.
Fixed issues with handling files with both .debug_types and
.debug_info (got spurious warnings with -ky -kd, for example)
on a .dwp object.
Corrected a couple places where we needed to reset a static
variable (renamed the static variable for readability and removed
it from the globals variables).
2015-01-24 16:28:25 -08:00
David Anderson
3ff5a4a024 Updated dwarfdump version strings.
Improved error checking in libdwarf.
2014-12-31 16:45:14 -08:00
David Anderson
f471b3786b Adds support and refactoring for reading and printing
DebugFission data.  There are new attributes (with GNU
forms and standard forms) and DW_OP's too.
Libdwarf reader code refactored so the new sections are
easily handled.
2014-05-16 19:10:52 -07:00
David Anderson
0b74b13808 Update version string.
dwarfdump/common.c
dwarfdump/dwarfdump.c
dwarfdump2/ChangeLog
dwarfdump2/common.cc
dwarfdump2/dwarfdump.cc

Changed the implementation of DW_FORM_ref_addr
to properly reflect the V2 vs V3 and later
specifications.
libdwarf/dwarf_addr_finder.c libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_form.c        libdwarf/dwarf_query.c
libdwarf/dwarf_util.c        libdwarf/dwarf_util.h
libdwarf/pro_forms.c         libdwarf/pro_section.c
2014-04-13 16:45:17 -07:00
David Anderson
affafa89fb Removed trailing (and useless) whitespace from all the lines
containing it.  Many many files had such.
2014-01-29 15:02:07 -08:00
David Anderson
22cc16439d Update copyright year on a large number of files.
Everthing touched recently.
2012-11-17 13:31:29 -08:00
Carlos Alberto Enciso
b7ebde5e56 Changes requested by David Anderson and described below. Also a small
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.
2012-11-02 10:40:48 +00:00
Carlos Alberto Enciso
82491fc2c7 Changes requested by David Anderson and described below. Also a general
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;
2012-11-01 12:35:57 +00:00
David Anderson
a08a8549e3 Now we support .debug_types (type unit DIEs) in -i output. 2011-10-29 16:32:34 -07:00
David Anderson
052474a336 These are small changes for DWARF4 and for Makefile cleanup
lines in 'clean' and 'distclean' .  And to match the newest
line formats (uri format) for file names from the line section.
2011-03-19 12:00:52 -07:00
David Anderson
637442ea0b Initial commit. Content is the libdwarf-20110113.tar.gz
last-released-libdwarf and dwarfdump.
2011-03-19 11:38:11 -07:00