Commit Graph

37 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
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
6b65d5f0e0 dwarfdump
* print_abbrevs.c(dwarf_get_array_info): Initialize local variable.
     * print_die.c(get_location_list): Initialize local variable.:
     * dwarf_loc.h: Add declaration of _dwarf_loc_block_sanity_check().
     * dwarf_loc.c: Call new function  _dwarf_loc_block_sanity_check
     * dwarf_loc2.c: Implement and call new function
       _dwarf_loc_block_sanity_check to avoid duplicating code.

libdwarf
* dwarf_opaque.h: Delete two useless blank lines.
2015-11-11 15:55:20 -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
c20ba5c31a Fixing errors from refactoring the location expression operation
reader.

Add a new configure option --enable-wall (regenerate configure).
Revise the interfaces for the not-implemented new
location expression and loclist interfaces.

dwarfdump/print_die.c

libdwarf/Makefile.in
libdwarf/configure
libdwarf/configure.in
libdwarf/dwarf_error.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_loc.h
libdwarf/libdwarf.h.in
2015-10-26 16:20:31 -07: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
8857cf5fea Now supports experimental two-level line tables,
though -vvv -l (printing internal details) does not
yet work.
Some dead variables deleted and indent mistakes fixed too.
dwarfdump/common.c
dwarfdump/dwarfdump.c
dwarfdump/print_lines.c
libdwarf/dw-linetableheader.txt
libdwarf/dwarf_abbrev.c
libdwarf/dwarf_die_deliv.c
libdwarf/dwarf_form.c
libdwarf/dwarf_init_finish.c
libdwarf/dwarf_line.c
libdwarf/dwarf_loc.c
libdwarf/dwarf_macro.c
libdwarf/dwarf_query.c
libdwarf/dwarf_tied.c
libdwarf/dwarf_xu_index.c
2015-09-23 13:08:30 -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
1a51e18826 Now defining and using
DW_CIE_VERSION* DW_CU_VERSION**
       DW_ARANGES_VERSION* DW_LINE_VERSION* DW_LOC_VERSION*
       DW_LINE_STR_VERSION5, DW_MACRO_VERSION5,
       DW_LINE_LOC, DW_NAMES_VERSION5, DW_PUBNAMES_VERSION*,
       DW_PUBTYPES_VERSION*, DW_STR_OFFSETS_VERSION5,
       DW_SUP_VERSION*, DW_CU_INDEX_VERSION5

exclusively. Deleting the CURRENT_VERSION_STAMP* macros.
The intent is to improve readability given we now have
4 versions of DWARF to deal with.
2015-04-23 13:37:37 -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
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
2be4cef410 libdwarf: dwarf_loc.: Fixed offset update for DW_OP_constx/addrx. 2014-05-18 11:52:13 -07:00
David Anderson
ac36af2ee0 libdwarf: dwarf_form.c dwarf_loc.c: fixed whitespace,
added commentary.
2014-05-18 11:44:36 -07:00
David Anderson
f5e2be3ebd Now handles most of Debug Fission, but
this version needs small corrections to finish the
DebugFission support.
2014-05-18 10:29:33 -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
26e306335e Changes support DW_FORM_exprloc.
Changes support, to a limited extent, DW_FORM_GNU_ref_alt
       and DW_FORM_GNU_strp_alt.
Updated libdwarfdoc about DW_FORM_exprloc support.
2014-01-30 16:29:14 -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
cc781ea02f Revised libdwarf.h to restore interface binary compatibility
with releases before 25Jan 2013.
Updated libdwarf2.1.mm and pdf to reflect handling
DW_OP_GNU_const_type.
2013-01-26 10:03:38 -08:00
David Anderson
558aae674e Handling of DW_OP_GNU_const_type was incorrect leading
to an error dumping modern gcc output, such as the Fedora 18
debug libc.  Fixing this required changing the public struct Dwarf_Loc
and some related data inside libdwarf.
Making this change does introduce the sort of inconsistency
meaning the new libdwarf cannot be used to access location
data without
recompiling callers.
2013-01-25 15:58:34 -08:00
David Anderson
f2509d0f4d Fix nasty bug where cc_length was used where cc_length_size
was needed to get offset size.
2013-01-25 10:43:22 -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
b446e23dc2 libdwarf now handles DW_OP_GNU_implicit_pointer and other GNU
ops more correctly and completely. As do dwarfdump[2].
dwarf.h has more DW_OP_GNU listed.
2012-11-30 15:01:47 -08:00
David Anderson
ef511586b9 In libdwarf fix all lines that dicheck shows are
not  following the indent rules.
2012-11-29 14:46:04 -08:00
David Anderson
b2c3545cfb Removed the last dbg->de_length_size reference from _dwarf_get_locdesc()
in libdwarf/dwarf_loc.c
as that value is in incoming arguments.
2012-11-23 08:15:04 -08:00
David Anderson
3002d9dab1 Correcting the argument list for the new Nov 2012 libdwarf function
dwarf_loclist_from_expr_b() so calling clients have the opportunity
to apply CU-specific address and length sizes.
2012-11-21 10:30:14 -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
29e4865d97 Merge branch 'carlos_enciso'
This incorporates improvements to the checking
and new options. For dwarfdump and dwarfdump2.
It makes formatting of if/for/while more
consistent across the source.
It removes many double-quote characters around strings that
turned out not to be as useful (in the dwarfdump output)
as had been thought.
It adds the ability to handle additional relocations
so more relocatable objects can be handled by libdwarf.
2012-11-17 10:15:06 -08:00
David Anderson
39bd821b78 dwarf_loc.c
libdwarf.h
libdwarf2.1.mm
libdwarf2.1.pdf

DW_OP_GNU_implicit_pointer requires a version stamp
to work correctly.  Created a new function
to allow clients to expicitly pass the version stamp.
Most clients can continue to use the old interface.
2012-11-13 09:28:24 -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
571e1b87d3 BLD now builds all the executables, and we now handle
DW_OP_GNU operators better.
2011-12-14 11:38:42 -08:00
David Anderson
a32a29a3ef Updating libdwarf_dwarf_loc.c by testing for incorrectly-ended
expression block.  Update dwarfdump version strings.
2011-09-02 14:30:57 -07: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
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