Commit Graph

27 Commits

Author SHA1 Message Date
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
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
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
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
7f6c71bc75 dwarf_line.c,dwarf_line.h,dwarf_print_lines.c: made li_ and lr_
line register structs agree on spelling of suffix of each name.
Now dwarf_srclines (and two-level) use the
line register struct instead of a list of local variables.

This in preparation for a revamp of dwarf_print lines
and a simplification of dwarf_print_lines.
2015-09-28 11:00:07 -07:00
David Anderson
7eec6b060a Fixed memset call bug in reading prefix of line table.
Tweaked the detailed print of line table data (-l -vvv).
Fixed indent errors and removed trailing spaces.
2015-09-27 08:33:23 -07:00
David Anderson
730a47a519 dwarf_print_lines.c now prints the Locals and Actuals
tables from two-level line tables.
2015-09-25 15:02:52 -07:00
David Anderson
220378fa0b dwarfdump/common.c update date string.
dwarfdump/dwarfdump.c   update date string
dwarfdump/print_lines.c IA is really IS.

libdwarf/dwarf_elf_access.c: Added ifdef/define/endif for relocation types
   for better test coverage in FreeBSD and Ubuntu. That is, let it
   relocate objects without quite the required relocation names on
   the libdwarf/dwarfdump build system.
libdwarf/dwarf_line.c Fixed errors and omissions.
libdwarf/dwarf_line.h
2015-09-24 16:39:03 -07:00
David Anderson
249dac9069 Corrected indentation and a string in line table output.
dwarfdump/print_lines.c

Corrected indentation and an error introduced a couple
days ago in computing the end of the line table for a CU.

libdwarf/dwarf.h
libdwarf/dwarf_elf_access.c
libdwarf/dwarf_form.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
2015-09-22 13:57:48 -07:00
David Anderson
456fe6c3c8 Changed an internal function to have a leading _ in the name
and added a Dwarf_CU_Context argument so we can get address
size and segment size when not in the line table.
All this related to two-level line tables.

dwarfdump/print_lines.c
libdwarf/dwarf.h
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_line.c
libdwarf/dwarf_line.h
libdwarf/dwarf_opaque.h
libdwarf/dwarf_print_lines.c
libdwarf/dwarf_sort_line.c
libdwarf/libdwarf.h.in
2015-09-19 18:21:52 -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
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
Carlos Alberto Enciso
c6da2c7817 Merge branch 'master' into carlos_enciso
* master: (97 commits)
  3 one-line fixes, removing three compiler warnings.
  dwarfdump/print_gdbindex.c: Fixed indents of a comment.
  Update dwarfdump[2] version strings.
  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
  dwarfdump, dwarfdump2: Now both print the gdbindex and .debug_[tc]u_index sections.
  Dwarfdump: Now we use the new gdbindex and debugfission section-name strings instead of hard coding Elf section names.
  libdwarf: minor correction addeing section name to one function and now documents the new gdbindx and debug fission (DWP) interfaces.
  libdwarf has a new interface: dwarf_get_die_section_name() so clients can get the object section names (of .debug_info of .debug_types or the same with .dwo names). Fixed indent and trailing whitespace a couple places too.
  libdwarf/dwarf_opaque.h: One new comment had a bad indent. Fixed.
  libdwarf/dwarf_opaque.h:  Clarified the meaning of various CU context struct fields by adding comments.
  libdwarf/dwarf_opaque.h:  Altered a couple comments to make them clearer.
  Now -I now prints the entire  .debug_cu_index and .debug_tu_index sections.
  Refine that same comment again. It was actually wrong before, not just hard to read. the *next_cu* functions in libdwarf dwarf_die_deliv.c return -1 (DW_DLV_NO_ENTRY), not 0, when we have gotten through all the CUs in a section.
  Clarify a comment in dwarf_die_deliv.c.
  Fixed the libdwarf ChangeLog. Minor typo in a just-commited entry.
  Now we can print the hash table data from the  .debug_tu_index and .debug_cu_index sections ( debug fission, the .dwp object file index data).
  Removed some newly introduced trailing whitespace characters.
  libdwarf and dwarfdump now begin to support the DWARF5 sections .debug_tu_index and .debug_cu_index.
  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.
  Fixes a mistake in checking a offset in dwarf_die_deliv.c The mistake resulted in an error-return on a really really short .debug_types section where there was no error.
  ...

Conflicts:
	dwarfdump/dwarfdump.c
	libdwarf/dwarf_elf_access.c
2014-09-05 12:35:34 +01: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
Carlos Alberto Enciso
c4aa296ea7 Merge branch 'master' into carlos_enciso
# By David Anderson
# Via David Anderson
* master:
  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.
  dwarfdump[2]: commentary and indenting fixes (very few). dwarfexample: Adds a --check option to show in detail      when the DW_AT_high_pc is a constant vs offset,      at least for subprograms. dwarfgen: Now handles class constant (writes to output)      and fixes missing handling of DW_FORM_data4/8 in      global references.      Adds -h option telling dwarfgen to alter a high pc      from address class to const class (and adjusts      the value appropriately).  So we can create      testcases without having a too-recent compiler. libdwarf: Fix an error no one should ever see (programmer      failed to run a simple test!) so it returns DW_DLV_ERROR      in case it happens.      Add dwarf_highpc_b() function to consumer code.      dwarf_add_AT_any_value_sleb() and  dwarf_add_AT_any_value_uleb()      to producer code.      Update libdwarf2.1.mm and libdwarf2p.1.mm to reflect the      new functions.
  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.
  Change intended to handle FORM_string in debug_types. libdwarf/dwarf_form.c
  Removed duplicate call to get_scndata() from print_reloc.c
  Moves all but fatal messages to stdout/cout, a very few basic fatal errors in dwarfdump come out on stderr/cerr. removed duplicated source line (print_reloc.cc). updated version strings.

Conflicts:
	dwarfdump/dwarfdump.c
	libdwarf/dwarf_alloc.c
	libdwarf/dwarf_line.c
	libdwarf/dwarf_opaque.h
2013-08-21 11:19:53 +01: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
67aea7c780 Updated version strings:
dwarfdump/common.c
dwarfdump/dwarfdump.c
dwarfdump2/common.cc
dwarfdump2/dwarfdump.cc

Thanks to Carlos Alberto Enciso for the following:
Add const to remove compiler warnings.
dwarfdump/print_reloc.c
A couple more places now match our if style, somehow
not noticed earlier.
libdwarf/dwarf_line.h
2012-11-20 10:35:53 -08:00
Carlos Alberto Enciso
1963b2b93d Add const qualifier in print_reloc.c
Under Windows, the MS compiler generates the following warning message:
print_reloc.c(xxx) : warning C4090: '=' : different 'const' qualifiers

where xxx: lines 155, 162, 169, 176, 183
----
Minor issues with layout for 'if' statements in dwarf_line.h
2012-11-20 16:14:28 +00:00
David Anderson
bf0831bdac Carlos found 4 lines where his if( consistency
changes were somehow lost.   libdwarf/dwarf_line.h
libdwarf/pro_init.c.  Fixing those 4 places with
this commit.  Considering that part of the previous
libdwarf/ChangeLog, so no new ChangeLog entry.
2012-11-19 11:08:28 -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
David Anderson
2dde85eb87 2011-12-13 DavidAnderson <davea42@earthlink.net>
* dwarf.h: Added some GNU extensions.
     * libdwarf.h: Added dwarf_lineoff_b() as
       dwarf_lineoff() wrongly returns a signed column number.
       Added dwarf_add_lineentry_b() as preparation for creating
       DWARF3/4 output.
     * dwarf_line.h: Added new struct fields to accomodate
       DWARF3/4 isa and discriminator fields.
     * dwarf_line.c: Now deals with the VLIW line calculations
       in DWARF4.  Adds support for computing the discriminator
       and isa fields.  Adds dwarf_lineoff_b() (and dwarf_lineoff
       is now deprecated).  Adds dwarf_prologue_end_etc() which
       returns some DWARF3/4 line fields.
     * dwarf_print_lines.c: Adds handling of DWARF3/4
       line operations and fields and prints the details.
     * libdwarf2.1.mm: Documents the new functions in dwarf_line.c
       Version set to 2.02.
     * libdwarf2.1.pdf: Regenerated.
     * libdwarf2p.1.mm: Documents the new function
       dwaf_add_line_entry_b().
       Version set to 1.32.
     * libdwarf2p.1.pdf: Regenerated.
     * pro_incl.h:  Add parentheses so the WRITE_UNALIGNED macro
       works correctly in all circumtances.
     * pro_opaque.h: Add DEBUG_RANGES and dEBUG_TYPES to the list
       of sections we could generate.  Define struct Dwarf_P_Line_Inits_s
       to hold initialization values for line table data so we can later
       make the choices at runtime rather than compile time.
       The new struct is a field of the Dwarf_P_Debug struct.
     * pro_line.h: Added some DWARF3/4 support and preparations
       for emitting DWARF3/4.
     * pro_line.c: Define dwarf_add_line_entry_b() for DWARF3/4
       line fields, and _dwarf_init_default_line_header_vals()
       to provide a default set of values, the defaults match
       what was previously done.
       Add support for the new DWARF3/4 line table fields.
     * pro_section.c:  Add the beginnings of support for creating
       new DWARF3/4 sections and the new standard opcodes.
       Move the field-writing code to small functions making
       the line table writing smaller and easier to read.
       Added the beginnings of allowing writing DWARF3/4
       line table fields. Some if() missing {} were
       modified by adding {} to avoid future problems.
2011-12-13 09:38:09 -08: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