Commit Graph

17 Commits

Author SHA1 Message Date
David Anderson
acae971371 added new error code
libdwarf/dwarf_errmsg_list.c
libdwarf/libdwarf.h.in

Test for inconsistent line table header data
and provide a default string indicating failure
in case the inconsistency test is inadequate.
libdwarf/dwarf_line.c
libdwarf/dwarf_line_table_reader_common.c
2016-05-22 12:55:53 -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
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
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
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
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
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
4b54aad40f libdwarf for DWARF5 loclists
examples.c: Add commentary to example9.
dwarf_alloc.c: Add DW_DLA_LOC_BLOCK_C and DW_CLA_LOCDESC_C
       allocation descriptions to array.
dwarf_alloc.h: Increase ALLOC_AREA_INDEX_TABLE_MAX to match.
dwarf_base_types.h: Increase MAX_DW_DLA to match.
dwarf_die_deliv.c: Switch some returns from pointer to
       the standard int DW_DLV_OK etc and return pointer through
       an argument.  Identify which CUs are dwo by checking name
       for a .dwo ending. Fix whitespace endings.
dwarf_error.c: Add DW_DLE 309 to 311 errors to descriptions array.
dwarf_form.c: Remove trailing whitespace. Reformat one line
       so it is not so long.
dwarf_line.c: Add {} on if for clarity.
       Fix whitespace endings.
dwarf_line_table_reader.c: Fix whitespace endings.
dwarf_loc.c: Refactor loc. expr. reader into a
       routine that reads one expression, _darf_read_loc_expr_op()..
       Add DWARF5 operators.
       Add preliminary dwo expression support (which will change
       but this is a start).  Old expression interface now
       explicitly supports only DWARF 2,3,4. No DWARF5.
       Add preliminary loclist_c support (it will change).
       Add commentary about the old loclist interface.
dwarf_loc.h: First cut of new interfaces (functional, not
       public structs).
dwarf_opaque.h: Add cc_is_dwo flag to cu context struct.
libdwarf.h.in: Rework some loclist commentary.
       Add first try at new loclist interfaces for DWARF2,3,4,5.
       New error codes for new loclist/dwo code.
libdwarf2.1.mm: Rev 2.32. New wording on old loclist
       interfaces.
2015-10-25 09:41:39 -07:00
David Anderson
4130f07d25 dwarfdump
* dwarfdump.c: Add enum line_flag_type_e so we can test
       all the srclines interfaces (4 of them). Expand -x
       for that too.
     * print_die.c: Support DW_FORM_GNU_strp_alt.
     * print_lines.c: Update for old and new srclines
       interfaces.
     * globals.h: Added the enum line_flag_e variable for
       recording -x line5= value.

libdwarf
     * checkexamples.c: Fixed data type in the example code.
     * dwarf.h: Updated comment about DW_FORM_GNU_strp_alt
     * dwarf_elf_access.c: Fixed trailing whitespace and
       removed debug printf that got left in.
     * dwarf_error.c: Add new TIED file errors.
       DW_DLE_NO_TIED_FILE_AVAILABLE, DW_DLE_NO_TIED_STRING_AVAILABLE.
     * dwarf_form.c: Added support for DW_FORM_GNU_strp_alt.
     * dwarf_init_finish.c: #if 0 routine all_sig8bits_zero().
    * dwarf_line.c: Now always notice windows-like c: etc
       as start of a full path. Ensure directories with \ are
       turned to / in line tables. (for full such transforms
       configure with --enable-windowspath ) Remove some debug #ifdef
       lines.
       Alter the linecontext interface to pass back table count,
       not linecount.
    * dwarf_line.h: Add commentary and lc_table_count field.
     * dwarf_line_table_reader_common.c: Fix indent/trailing whitespace.
       Now sets lc_table_count;
     * dwarf_opaque.h: Add _dwarf_get_string_from_tied() interface.
     * dwarf_print_lines.c: Remove trailing whitespace and some debug printf..
     * libdwarf.h.in: New error codes. Fix trailing whitespace. Expand
       commentary.
2015-10-15 09:27:28 -07:00
David Anderson
3fe4d2bb58 libdwarf
Makefile.in: Removed source files from the build that
       are only useful to IRIX and only in the context of building
       an IRIX runtime system.
dwarf_alloc.c: Added constructor/destructor code to
       Dwarf_Line_Context allocator.
dwarf_elf_access.c: Added additional #defines so we
       have the IA64 defines we need to compile certain
       test cases on freebsd.
dwarf_error.c: Two new error codes for Dwarf_Line_Context
       checking.
dwarf_line_table_reader_common.c: New file. We can compile
       the line reading with and without detailed print lines
       for dwarfdump.  Now only one body of line reading code
       to maintain.
dwarf_line.c: Moved code out to dwarf_line_table_reader_common.c
       Refactored to support skeleton line tables (DWARF5)
       Eliminated an internal struct, it is no longer needed.
       a little better.
       Supports experimental two-level line tables too.
dwarf_print_lines.c: Uses dwarf_line_table_reader_common.c
       to do much of its work now.
libdwarf.h.in: New interfaces for nicer access to
       line table headers.
libdwarf2.1.mm: Partial documentation of the new
       libdwarf line table interfaces.
2015-10-06 16:52:35 -07:00
David Anderson
20aa79e719 libdwarf:
dwarf_global.c,dwarf_line.c,dwarf_line.h,dwarf_line2.c,
       dwarf_line_table_reader_common.c,dwarf_sort_line.c,libdwarf.h.in:
       The SGI IRIX only fields in dwarf_line.h ifdef __sgi now.
       And all code referencing them that way too. Balancing
       #endif has /* __sgi */ now for searchability.
       Functions only usable on SGI IRIX only compiled in if __sgi
       macro defined.
libdwarf2.1.mm: Added a comment related to experimental
       two-level line tables.
2015-09-30 16:07:27 -07:00
David Anderson
b25b8835b8 Moved the prefix code into the common source.
So code can be added there to print more
and better information on the header.

libdwarf:
dwarf_line.c
dwarf_line.h
dwarf_line_table_reader_common.c
dwarf_print_lines.c
2015-09-29 12:49:10 -07:00
David Anderson
bb0dce2567 Moved some code from dwarf_line_table_reader_common.c to dwarf_line.c.
Fixed indent and trailing whitespace. Fixed the 'section offset'
       code by using the proper value from dss_data..

libdwarf:
dwarf_line.c
dwarf_line.h
dwarf_line2.c
dwarf_line_table_reader_common.c
dwarf_print_lines.c
libdwarf.h.in
2015-09-29 11:26:26 -07:00
David Anderson
7e53148332 * dwarf_line_table_reader_common.c: New file is the line table reader
extracted from dwarf_line.c. Now compiled into dwarf_line.c
       and dwarf_print_lines.c with correct two-level line table
       calculations. No more coding the table twice.
* dwarf_line.c,dwarf_print_lines.c: Now #include
       dwarf_line_table_reader_common.c
* Makefile.in: Reflects new source depedencies.
* dwarf_line2.c: An internal function interface changed,
       so accomodated it here.
* libdwarf.h.in, dwarf_error.c: New error code, DW_DLE_BAD_LINE_TABLE_OPERATION.
2015-09-28 20:17:50 -07:00