Commit Graph

40 Commits

Author SHA1 Message Date
Carlos Alberto Enciso
e8701c78b8 Memory corruption due to incorrect usage of memory allocator type.
dwarf_alloc.h, dwarf_alloc.c, dwarf_base_types.h, dwarf_opaque.h:
  New allocator type (DW_DLA_CHAIN_2), to allow a list of addressed
  types (address, offset).

dwarf_query.c: Use the new allocator type.
2016-02-19 14:39:14 +00:00
David Anderson
d02c7b92b5 Some places in the hash functions were not
using DW_TSHASHTYPE. Now they are.
libdwarf/dwarf_alloc.c
libdwarf/dwarf_tied.c
libdwarf/dwarf_tsearchhash.c
2016-02-08 09:11:40 -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
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
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
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
8b2ac2b95a * dwarfdump.1: Documented -x line5=.
* dwarfdump.c: Revised -g so it no longer turns on -i.
       Revised the meaning of -g to mean use old loclist interfaces
       (for testing the older interfaces with dwarfdump).
     * print_die.c(get_small_encoding_integer_and_name): a dwarf_dealloc
       referenced err whereas *err was correct.
       Revised loclist output making it look a bit like DWARF5
       even for DWARF2,3,4 output. Reads better, I think.
     * print_locs.c: -l gets a 'no longer supported' message

dwarfdump/dwarfdump.1
dwarfdump/dwarfdump.c
dwarfdump/print_die.c
dwarfdump/print_locs.c

     * dwarf_alloc.c: Added new checks so  user mixing up
       tied dbg with regular dbg won't lead to crashes
       when calling dwarf_dealloc or dwarf_finish().
       Zeroed out some fields to recognize space deallocated.
     * dwarf_die_deliv.c: Added support of split dwarf
       DW_AT_[GNU_]ranges_base
     * dwarf_form.c: Load string from tieddbg when appropriate.
     * dwarf_harmless.c: On free() zero out a field to show that was done.
     * dwarf_loc.c: Correct the handling of split dwarf loclist.
     * dwarf_opaque.h: Add cc_ranges_base_present for split dwarf.
       Add _dwarf_get_ranges_base_attr_from_tied() for split dwarf.
     * dwarf_query.c: Get and remember skeleton compilaton unit
       DW_AT_[GNU_]ranges_base from tied objects for split dwarf.
     * dwarf_ranges.c: If a tied object present, look for ranges
       there, not in split dwarf object.
     * dwarf_util.c: Housekeeping zeros out fields to ensure not
       used after dealloc.

libdwarf/dwarf_alloc.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_form.c
libdwarf/dwarf_harmless.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_loc2.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_original_elf_init.c
libdwarf/dwarf_query.c
libdwarf/dwarf_ranges.c
libdwarf/dwarf_util.c
2015-11-07 14:42:52 -08:00
David Anderson
0052aa52f4 Revisions for DWARF5 expression handling complete, one thinks.
Next is testing.

   dwarfdump/Makefile.in
   dwarfdump/configure
   dwarfdump/configure.in
   dwarfdump/dwarfdump.c
   dwarfdump/globals.h
   dwarfdump/print_die.c
   dwarfdump/print_frames.c
   dwarfdump/print_frames.h
   dwarfdump/print_lines.c
   dwarfdump/print_locs.c

   libdwarf/Makefile.in
   libdwarf/dwarf_alloc.c
   libdwarf/dwarf_alloc.h
   libdwarf/dwarf_error.c
   libdwarf/dwarf_frame.c
   libdwarf/dwarf_loc.c
   libdwarf/dwarf_loc.h
   libdwarf/dwarf_loc2.c
   libdwarf/dwarf_opaque.h
   libdwarf/dwarf_query.c
   libdwarf/libdwarf.h.in
2015-11-01 08:30:30 -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
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
8a2ad457fb These files are a partial implementation
(not complete) of two-level line tables,
and experiment in line table design.
dwarfdump/ChangeLog
dwarfdump/print_lines.c
libdwarf/ChangeLog
libdwarf/dwarf.h
libdwarf/dwarf_alloc.c
libdwarf/dwarf_base_types.h
libdwarf/dwarf_init_finish.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
libdwarf/dwarf_line2.c
libdwarf/dwarf_util.c
libdwarf/libdwarf.h.in
2015-09-17 14:53:03 -07:00
David Anderson
c5ab119f8c Adding -x tied=<path> option to dwarfdump and added
code in libdwarf to go to the other, the tied, object
and retrieve .debug_addr data.
dwarfdump/ChangeLog
dwarfdump/dwarfdump.1
dwarfdump/dwarfdump.c
dwarfdump/print_die.c
libdwarf/ChangeLog
libdwarf/Makefile.in
libdwarf/dwarf_alloc.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_error.c
libdwarf/dwarf_form.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_original_elf_init.c
libdwarf/dwarf_query.c
dwarf_tied.c
libdwarf/libdwarf.h.in
2015-09-11 09:04:05 -07:00
David Anderson
c665613423 libdwarf: major changes to support DWP Package Files
in DWARF5.   Some support of DWARF5 generally.

DWP support itself not well tested, but for non-DWP
objects things work as before.
2015-05-01 17:10:42 -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
b6ea605c1e Changes to support debugfission added, so we can
dump dwarf from .dwp files.
Some additional change an testing will be added.
2015-01-18 12:48:41 -08:00
David Anderson
71cd071eb2 Now the new dwarfdump checking options work. 2015-01-08 13:09:21 -08:00
David Anderson
795295a95f libdwarf: fixed indents and removed trailing whitespace. 2015-01-06 13:52:34 -08:00
David Anderson
9a2dfcfe02 Rearrange the code so we do not touch arguments
till we have need for them.
dwarf_alloc.c

Somehow a cast was omitted from return from _dwarf_get_alloc().
Added in the call, removing a warning message.
dwarf_frame.c

In case of elf read error, was using stale Dwarf_Error pointer.
Fixed.
dwarf_init_finish.c
2015-01-06 07:16:21 -08:00
David Anderson
199a913e2f libdwarf minor enhancements.
dwarf_allo.c: Comment the allocation table base
       more carefully.
dwarf_base_types.h: Making DW_DLA defines more
       readable, more consistent with other instances.
libdwarf.h.in: Adding producer error codes.
       The producer library has some places error values
       are misidentified. Main effect: documentation.
dwarf_error.c:  Add the strings for the new error codes.
2015-01-03 12:53:23 -08:00
David Anderson
c02096a5d8 These files no longer reference dwarfdump2.
BLD
BLDLIBDWARF
BLDTESTDIR
CREATINGARELEASE
Makefile.in
README
UPDATEDWARFDUMPVERSION.sh
configure (regenerated)
configure.in
dwarfdump2/NEWS

This adds improved error reporting in case
of major libdwarf error.
dwarfgen/createirepfrombinary.cc

These are not normally used, but they
enable simple tests of the malloc-fail case.
dwarfgen/TESTmallocfail
dwarfgen/fakemalloc.c

These implement and document new handling
of malloc-space-exhausted special case
for Dwarf_Error.  Using a global.
This has no effect on any client code,
it just enables sensible reports (from libdwarf)
in case the malloc arena exhausted.
libdwarf/dwarf_alloc.c
libdwarf/dwarf_error.c
libdwarf/dwarf_error.h
libdwarf/libdwarf.h.in

Document malloc-fail special case
error handling.
libdwarf/libdwarf2.1.mm

Regenerated: v 2.23 libdwarf/libdwarf2.1.pdf
2014-12-28 10:03:42 -08:00
David Anderson
6caed6d274 Here we fix some warnings and get gdbindex
to print better.  And get some section names to
come out exactly right (but not all, yet).
dwarfdump/dwarfdump.1
dwarfdump/dwarfdump.c
dwarfdump/print_gdbindex.c
dwarfdump2/dwarfdump.1
dwarfdump2/dwarfdump.cc
dwarfdump2/print_debugfission.cc
dwarfdump2/print_die.cc
dwarfdump2/print_gdbindex.cc

Here we fix some warnings.
libdwarf/dwarf_alloc.c
libdwarf/dwarf_alloc.h
libdwarf/dwarf_gdbindex.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_query.c
libdwarf/dwarf_sort_line.c

Here we fix some warnings.
libdwarf/dwarf_tsearchhash.c
tsearch/dwarf_tsearchhash.c

Here we fix some warnings
libdwarf/dwarf_util.c
libdwarf/libdwarf.h.in
libdwarf/pro_alloc.c
libdwarf/pro_arange.c
libdwarf/pro_forms.c
libdwarf/pro_reloc.c
libdwarf/pro_types.c
2014-08-04 13:48:31 -07:00
David Anderson
2eccd90196 Removed some newly introduced trailing whitespace characters. 2014-07-09 14:51:37 -07:00
David Anderson
f8caa95d63 libdwarf and dwarfdump now begin to support the DWARF5
sections .debug_tu_index and .debug_cu_index.
2014-07-09 14:45:30 -07:00
David Anderson
a7096d4360 libdwarf: removed newly introduced indent errors and removed
newly introduced trailing whitespace.
2014-07-01 17:00:08 -07:00
David Anderson
b37e94d0a7 Adds printing of the .gdb_index section header
and the -I dwarfdump option to select that section.
2014-06-29 11:55:51 -07:00
David Anderson
bf7eeb1c30 Just fixing trailing-whitespace and a pair of indent
issues in libdwarf.
2014-02-02 09:21:52 -08:00
David Anderson
1ca3a407d7 libdwarf/dwarf_alloc.c: Removed a long list of if()
tests referring to debug section addresses
in favor of a single dwarf_tfind().
It will continue to work over time, the earlier
approach was error-prone in the face of new DWARF
sections.
2014-02-02 09:00:24 -08:00
David Anderson
5211b541d2 Final small changes for a new release.
Ensuring it builds where it should.
2014-02-01 08:06:09 -08:00
David Anderson
86784da7c2 libdwarf:
* dwarf_alloc.c: Refactored and added relevant commentary.
      Added a check for debug_types in dwarf_dealloc().
    * dwarf_init_finish.c: Corrected a comment and made one line
      declation-is-initialization.
    * dwarf_opaque.h: Added commentary.
2014-01-30 13:05:57 -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
545d698072 Now using tsearch style calls with
dwarf_tsearch implementation.
Fixed a small memory curruption in dwarfdump2/print_pubnames.cc
Added tsearch directory with various sorts of tree searches
(all written from scratch, not copied from anywhere).
2014-01-29 11:41:39 -08:00
David Anderson
a33289863d Now dwarf_print_lines() works via callback instead of using
stdout directly.
dwarfdump[2] use this new feature now.
The new interfaces in libdwarf.h to support this are documented.
Some minor botches in libdwarf2.1.mm (bad formatting) fixed.
2013-08-15 12:42:44 -07:00
David Anderson
6a5256fa35 Fix non-fatal dwarf_alloc.c to use stdout, not stderr. (debugging warn).
Rename misnamed variable in dwarf_init_finish.c and fix documentation
on dwarf_set_stringcheck() to be correct. Going along with
correction to misnamed variable.
No real change to what the code does.
2013-08-09 14:32:27 -07: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
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
a08a8549e3 Now we support .debug_types (type unit DIEs) in -i output. 2011-10-29 16:32:34 -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
637442ea0b Initial commit. Content is the libdwarf-20110113.tar.gz
last-released-libdwarf and dwarfdump.
2011-03-19 11:38:11 -07:00