Commit Graph

27 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
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
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
f8d021008f dwarf_die_deliv.c,dwarf_line.c,dwarf_print_lines.c: Now look for
and adds the extra offset from debug_fission: DW_SECT_LINE.
2015-09-30 07:35:26 -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
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
fde8f7b825 Made a small change in the appearance of a two-line-table header.
dwarf_print_lines.c
2015-09-27 09:58:42 -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
a37ced05d4 Updated version strings.
dwarfdump/common.c
dwarfdump/dwarfdump.c

Sort of works for two-level line tables.
libdwarf/dwarf_print_lines.c
2015-09-26 09:01:55 -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
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
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
a4a854003e libdwarf:
dwarf_print_lines.c,dwarf_macro.c: Remove trailing whitespace.
dwarf_ranges.c, dwarf_sort_lines.c: Remove trailing whitespace.
dwarf_query.c, dwarf_pubtypes.c: Remove trailing whitespace.
dwarf_original_elf_init.c,dwarf_loc.c: Remove trailing whitespace.
gennames.c: Fix a printf so the generated dwarf_names.c
        does not have a trailing space.
2014-01-10 16:21:01 -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
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
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
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
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
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