Commit Graph

17 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
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
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
1a51e18826 Now defining and using
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.
2015-04-23 13:37:37 -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
0fed4afaa7 libdwarf:
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.
2014-07-05 10:14:12 -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
791398ca4d Makes it easier to build under FreeBSD.
Fixes signed/unsigned comparison issues noted by -Wsign-compare
2013-01-16 15:51:41 -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
a08a8549e3 Now we support .debug_types (type unit DIEs) in -i output. 2011-10-29 16:32:34 -07:00
David Anderson
96f004c528 Add tests for some dwarf-generation mistakes in a particular compiler -- so we
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.
2011-09-23 18:55:54 -07: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
db3833f2d5 * NEWS: Mention the non-elf documentation oversight.
* 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.
2011-06-04 16:03:48 -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
637442ea0b Initial commit. Content is the libdwarf-20110113.tar.gz
last-released-libdwarf and dwarfdump.
2011-03-19 11:38:11 -07:00