Commit Graph

27 Commits

Author SHA1 Message Date
David Anderson
6fa3f710ee modified: bugxml/data.txt
modified:   bugxml/readbugs.py

Fixed an incorrect length check to prevent a crash.
modified:   dwarfdump/print_frames.c

Set a macro structure field that was left unset.
No longer creates a zero-length malloc field.
modified:   libdwarf/dwarf_macro5.c
2016-05-22 08:46:35 -07:00
David Anderson
10ca310f64 Updated bug text for clarity.
bugxml/data.txt

Harden to account for corrupt relocation records.
libdwarf/dwarf_elf_access.c

Remove trailing whitespace.
libdwarf/dwarf_macro5.c
2016-05-17 07:03:22 -07:00
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
b6ec2dfd85 More to do here.
bugxml/data.txt

libdwarf
* dwarf_errmsg_list.c: Added DW_DLE_ZLIB_SECTION_SHORT.
    * dwarf_form.c: Now checking for section overrun.
    * dwarf_init_finish.c: Now checking zlib reading
      for section overrun.
    * dwarf_macro5.c: Now checking for section overrun and
      also fixing double delete caused by having
      _dwarf_get_alloc() space pointing at other _dwarf_get_alloc()
      space. Because in case of error the order of free
      of such is unpredictable!
    * dwarf_macro5.h: Added comment on mc_srcfiles member.
    * libdwarf.h.in: Added DW_DLE_ZLIB_SECTION_SHORT.
2016-05-06 17:16:15 -07:00
David Anderson
43612f3866 Move up 3 lines of code( a test for NULL) so we do
not dereference a NULL pointer.
libdwarf/dwarf_macro5.c
2016-05-04 07:25:49 -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
0c259d4b70 libdwarf
* dwarf_die_deliv.c: Deleted unused local variable.
    * dwarf_form.c,dwarf_macro.c, dwarf_macro5.c: Now uses
      DCODE_LEB128*_CK nearly everywhere
      for better checking for corrupted data.
    * dwarf_opaque.h:New argument to _dwarf_get_addr_index_itself()
      for better data checks..
    * dwarf_query.c: Uses revised _dwarf_get_addr_index_itself()
      interface.
    * dwarf_util.c: Fixed formatting errors.
2016-04-30 07:15:22 -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
ebf7f8b181 * dwarf_die_deliv.c: Fixed issues with handling NULL
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.
2016-03-11 12:41:28 -08: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
2d92dd4d6d Improving the print of constant types by trying to figure out
signedness.  Now prints the 'as signed' value as (-1)
for example instead of (as signed = -1) when signedness
is not clear.

dwarfdump/Makefile.in
dwarfdump/dwarfdump.c
dwarfdump/helpertree.c
dwarfdump/helpertree.h
dwarfdump/print_die.c

Remove a blank line.
libdwarf/dwarf_abbrev.c
add a check for
libdwarf/dwarf_macro5.c
2016-01-26 17:45:09 -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
3e442d6a40 Better compiler checking with --enable-wall..
Now all with prototypes.
Local functions now declared static.
One crucial bug in macrocheck.c in calling dwarf_twalk fixed.
dwarfdump/configure
dwarfdump/configure.in
dwarfdump/dwarf_tsearchbal.c delete unused function
dwarfdump/dwarfdump.c
dwarfdump/dwconf.c
dwarfdump/dwgetopt.c
dwarfdump/globals.h
dwarfdump/macrocheck.c
dwarfdump/naming.c
dwarfdump/print_gdbindex.c
dwarfdump/tag_attr.c
dwarfdump/tag_common.c

Better compiler checking with --enable-wall..
Now all with prototypes.
Local functions now declared static.
Some old and new functions documented in mm.
libdwarf/Makefile.in
libdwarf/configure
libdwarf/configure.in
libdwarf/dwarf_macro5.c
libdwarf/dwarf_original_elf_init.c
libdwarf/dwarf_query.c
libdwarf/dwarf_stubs.c
libdwarf/dwarf_util.c
libdwarf/dwgetopt.c
libdwarf/libdwarf.h.in
libdwarf/libdwarf2.1.mm
libdwarf/libdwarf2.1.pdf Regenerated. V 2.39
libdwarf/pro_alloc.c
libdwarf/pro_alloc.h

delete unused function.
tsearch/dwarf_tsearchbal.c

files:
2016-01-20 10:32:39 -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
64c45e521d Some statements had trailing ;;
Removed second semicolon.
dwarfdump/print_die.c
dwarfdump/tag_tree.c

libdwarf/dwarf_frame.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line_table_reader_common.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_query.c
libdwarf/pro_die.c
2016-01-19 10:27:03 -08:00
David Anderson
ba0b90f77c Now dwarfdump -m and dwarfdump -kw work meaningfully
on the DWARF5-style .debug_macro section.

dwarfdump/Makefile.in
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c
dwarfdump/print_macro.c

libdwarf/dwarf_macro5.c
libdwarf/libdwarf.h.in
2016-01-12 11:37:40 -08:00
David Anderson
2e5e4b4d8b Fixing -m and getting good output of dwarf5 macros.
Still no handling of macro import.
dwarfdump/dwarfdump.c
dwarfdump/print_lines.c
dwarfdump/print_macro.c

Fixing handling of DWARF5 macros.
libdwarf/dwarf_line.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_macro5.h
libdwarf/dwarf_opaque.h
2015-12-20 20:08:17 -08: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
ade09dd9fc Removed a pair of global variables in favor of a new global function.
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c
dwarfdump/print_lines.c
dwarfdump/print_macro.c
dwarfdump/print_pubnames.c
dwarfdump/print_ranges.c

libdwarf/dwarf_macro5.c Fixed _import handling. Off by one.
libdwarf/dwarf_query.c trailing whitespace removed
2015-12-18 10:09:34 -08:00
David Anderson
7a6a2c793f This now does nearly all of DWARF5 macro printing.
dwarfdump/print_macro.c

libdwarf/dwarf_form.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_macro5.h
libdwarf/dwarf_opaque.h
libdwarf/libdwarf.h.in
2015-12-15 12:57:33 -08:00
David Anderson
4cb9e7a304 Additional DWARF5 macro support.
dwarfdump/print_macro.c

libdwarf/dwarf_error.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_macro5.h
libdwarf/libdwarf.h.in
2015-12-13 15:26:19 -08:00
David Anderson
7eb69bc2ab Now prints CU die of the macros when 2 or more -v.
Now avoids printing .debug_macro string when there is no section.

dwarfdump/print_macro.c
dwarfdump/print_macros.c

libdwarf:
dwarf_error.c
dwarf_macro5.c
libdwarf.h.in
2015-12-12 15:50:02 -08:00
David Anderson
9c2082211e * naming.h,naming.c: Added get_MACRO_name().
* print_macro.c: Now reads and prints macro5 header.
dwarfdump/naming.c
dwarfdump/naming.h
dwarfdump/print_macro.c

     * dwarf_alloc.c: Remove () around simple return value.
     * dwarf_error.c: Two new error codes for DWARF5 macro section.
     * dwarf5_macro.c,dwarf5_macro.h: Add functions
       to let reader read/print
       .debug_macro section header.  Fixed _dwarf_macro_constructor
       declaration and implementation to return DW_DLV_OK.
     * libdwarf.h.in: Add functions to let reader read/print
       .debug_macro section header.

libdwarf/dwarf_alloc.c
libdwarf/dwarf_error.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_macro5.h
libdwarf/libdwarf.h.in
2015-12-11 14:06:01 -08:00
David Anderson
540cf814cb spelling: sentinal -> sentinel
dwarf_macro5.c
dwarf_macro5.h
2015-12-03 12:14:25 -08:00
David Anderson
7d6f7353f2 Remove trailing whitespace and fix a couple indents.
dwarfdump/print_frames.c
libdwarf/dwarf_alloc.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_macro5.h
libdwarf/libdwarf.h.in
2015-11-30 19:19:52 -08:00
David Anderson
e3f80a3867 First cut at reading and printing DWARF5 .debug_macro section.
dwarfdump/Makefile.in
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c

libdwarf/Makefile.in
libdwarf/dwarf.h
libdwarf/dwarf_alloc.c
libdwarf/dwarf_alloc.h
libdwarf/dwarf_error.c
libdwarf/dwarf_init_finish.c
libdwarf/dwarf_macro5.c
libdwarf/dwarf_macro5.h
libdwarf/libdwarf.h.in
2015-11-30 16:19:59 -08:00