Commit Graph

29 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
b3c1706d48 Update version strings.
dwarfdump/common.c
dwarfdump/dwarfdump.c

Inserted local variable initialization-at-definition.
dwarfdump/print_frames.c

Notice frame data corruption and generate an error.
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
libdwarf/dwarf_line.c
libdwarf/libdwarf.h.in
2016-05-07 13:50:17 -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
6d1f2536d0 switch to using DECODE_LEB*_CK everywhere applicable..
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
2016-04-30 13:01:56 -07:00
David Anderson
f01360225d Update version string.
dwarfdump/common.c
dwarfdump/dwarfdump.c

Add a new test that chatches an object
file with bad DWARF (corrupted DWARF).
libdwarf/dwarf_frame2.c
2016-04-27 18:25:41 -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
4e8d8c0f10 Add local Dwarf_Error and
rename variables to avoid shadowing confusion.

dwarfdump/configure
dwarfdump/configure.in
dwarfdump/dwarf_tsearchbal.c
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_abbrevs.c
dwarfdump/print_aranges.c
dwarfdump/print_debugfission.c
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_gdbindex.c
dwarfdump/print_lines.c
dwarfdump/print_pubnames.c
dwarfdump/print_ranges.c
dwarfdump/print_sections.c
dwarfdump/tag_attr.c
dwarfdump/tag_tree.c

Add local Dwarf_Error and
rename variables to avoid shadowing confusion.
Make cross-build a littl easier.

libdwarf/Makefile.in
libdwarf/README
libdwarf/common.c
libdwarf/common.h
libdwarf/configure
libdwarf/configure.in
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_frame2.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_print_lines.c
libdwarf/dwarf_ranges.c
libdwarf/gennames.c
2016-02-13 08:37:24 -08:00
David Anderson
e9cf490520 * configure.in: defines HAVE_UNUSED_ATTRIBUTE
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.
2016-02-06 09:20:41 -08:00
David Anderson
6f9106f254 Fixing the formatting of fde/cie.
fdes were not printing properly.
We were testing the wrong thing to determine if
we should print.
dwarfdump/print_frames.c

The code for frames was basically ok.
But clearer now with better comments for eh_frame.
And clearer 'no entry' for fde augmentation bytes.
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
2016-02-06 08:16:22 -08:00
David Anderson
9a2f20d354 Cleaning up comments about .eh_frame
and removing un-needed  casts.
Fixing commentary about CIE_id
libdwarf/dwarf_frame2.c

Fixing signed/unsigned comparison.
libdwarf/dwarf_loc2.c

Removing ; after function definition as not
being proper C90/C90
libdwarf/pro_init.c
2016-02-05 16:04:42 -08:00
David Anderson
d9d40e4d80 Add additional flags to the --enable-wall option.
dwarfdump/configure.in
libdwarf/configure.in

dwarfdump/configure (regenerate)
libdwarf/configure (regenerate)

These fix compiler warnings
dwarfdump/dwarf_tsearchbal.c
dwarfdump/dwarfdump.c
dwarfdump/dwconf.c
dwarfdump/dwconf.h
dwarfdump/esb.c
dwarfdump/globals.h
dwarfdump/print_debugfission.c
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_sections.c

libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame2.c
libdwarf/dwarf_gdbindex.c
libdwarf/dwarf_gdbindex.h
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_query.c
libdwarf/dwarf_tsearchhash.c
2016-01-21 15:42:58 -08:00
David Anderson
9565964f26 Remove ;; where it was just an accident.
Make header reading idempotent with ifndef/define
dwarfdump/dwarfdump.c
dwarfdump/esb.c  (avoid doing append of empty string).
dwarfdump/esb.h
dwarfdump/globals.h
dwarfdump/naming.h
dwarfdump/print_frames.c
dwarfdump/print_lines.c

Ensure declarations first in a block (avoid C99 isms).
libdwarf/dwarf_form.c
libdwarf/dwarf_frame2.c (check for too-short section)
libdwarf/dwarf_loc.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_query.c
libdwarf/dwarf_util.c
2016-01-19 16:25:30 -08:00
David Anderson
5dbb08417f Fix indentation and remove trailing whitespace.
dwarfdump/ChangeLog
dwarfdump/print_frames.c
libdwarf/ChangeLog
libdwarf/dwarf_form.c
libdwarf/dwarf_frame2.c
2016-01-19 10:34:47 -08:00
David Anderson
2192c62b5c Additional checks for frame issues in bad objects.
Better reporting of such problems.

modified:   dwarfdump/common.c
modified:   dwarfdump/dwarfdump.c
modified:   dwarfdump/globals.h
modified:   dwarfdump/print_frames.c

modified:   libdwarf/dwarf_frame2.c
2016-01-17 18:53:01 -08:00
David Anderson
9f9545d63c New version string.
dwarfdump/common.c
dwarfdump/dwarfdump.c
Added metaware augmentation string handling.
dwarfdump/print_frames.c

Added DW_CFA_metaware and augmentation string "HC" handling.
libdwarf/dwarf.h
libdwarf/dwarf_frame.c
libdwarf/dwarf_frame.h
libdwarf/dwarf_frame2.c
libdwarf/dwarf_util.c
2015-12-08 17:24:33 -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
b272f04131 Dead code surrounded by #if 0 either removed
or commented so output of grep 'if 0' is smaller and less
surprising.

   dwarf_die_deliv.c
   dwarf_frame.c
   dwarf_frame2.c
   dwgetopt.c
   pro_forms.c
   pro_section.c
2015-05-07 13:03:20 -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
3ff5a4a024 Updated dwarfdump version strings.
Improved error checking in libdwarf.
2014-12-31 16:45:14 -08: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
bb01f040f9 libdwarf: gcc -ansi found a // and needed getopt.h include
so those now fixed to support older environments (and newer).
2014-01-10 15:02:46 -08:00
David Anderson
8af1c48a6a Now compiles close to clean with
-std=gnu90
-Wsystem-headers
-Wall  -Wsign-compare
-Wno-format-y2k -W
-Wno-unused-parameter -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith
-Wreturn-type -Wcast-qual -Wwrite-strings
-Wswitch -Wshadow -Wunused-parameter
-Wcast-align -Wchar-subscripts -Winline
-Wnested-externs -Wredundant-decls
-Wold-style-definition -Wno-pointer-sign
2013-01-25 16:19:13 -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
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
b07af3d90f Now check for an erroneous address_size or segment size in
dwarf headers.
2011-09-14 16:59:56 -07:00
David Anderson
02b5816fd1 libdwarf/dwarf_alloc.c dwarf_form.c dwarf_frame.c dwarf_frame2.c
dwarf_line.c dwarf_print_lines.c  all had minor issues
that -Wall found (none of them correctness issues).
2011-06-04 10:39:42 -07:00
David Anderson
a3eb288589 All the files changed, a massive correction to inconsistent
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.
2011-03-29 13:31:47 -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