Commit Graph

53 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
eb1472afac New bugr reports.
bugxml/data.txt

Now prints strings so that
control characters do not
cause problems. Easier to read too.
dwarfdump/Makefile.in
dwarfdump/NEWS
dwarfdump/dwarfdump.1
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_lines.c
dwarfdump/print_macro.c
dwarfdump/print_macros.c
dwarfdump/sanitized.c

Removed trailing whitespace.
dwarfexample/simplereader.c

New checking for corrupt input.
libdwarf/dwarf_errmsg_list.c
libdwarf/dwarf_form.c
libdwarf/dwarf_line.c
libdwarf/dwarf_opaque.h
libdwarf/dwarf_query.c
libdwarf/dwarf_util.h
libdwarf/libdwarf.h.in
2016-05-06 08:26:36 -07:00
David Anderson
08efeebcf3 Remove the unneccessary typedef for 'string'
and just use char*.

Ensure the getopt tests still work.

modified:   dwarfdump/dwarfdump.c
modified:   dwarfdump/dwgetopt.c
modified:   dwarfdump/esb.c
modified:   dwarfdump/esb.h
modified:   dwarfdump/getopttest.c
modified:   dwarfdump/globals.h
modified:   dwarfdump/print_die.c
modified:   dwarfdump/print_frames.c
modified:   dwarfdump/print_lines.c
modified:   dwarfdump/print_strings.c
modified:   dwarfdump/tag_attr.c
modified:   dwarfdump/tag_tree.c

Fixing errnumber->string array and arranging
that we test it during build.

modified:   libdwarf/Makefile.in
renamed:    libdwarf/dwarf_error.c -> libdwarf/dwarf_errmsg_list.c
modified:   libdwarf/dwarf_error.c
2016-04-25 13:01:30 -07:00
Carlos Alberto Enciso
ab7dbdbcc9 * For a C/C++ build, do not define 'string' as it clashes with the
std::string definition.
    * Minor type in 'traverse_one_die' function.
2016-04-21 10:01:11 +01:00
David Anderson
86a5812582 dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_aranges.c
dwarfdump/print_die.c
dwarfdump/print_frames.c
dwarfdump/print_lines.c
dwarfdump/print_macro.c
dwarfdump/print_pubnames.c
      print_lines.c,print_macro.c,print_pubnames.c:
      Remove the global dieprint_cu_offset, use local vars and pass around instead.
      Ensure the traverse() logic when checking type references do not evaluate
      references to other sections. Many argument lists got an additional argument or two.

libdwarf/dwarf_form.c
fix a comment
2016-03-09 08:42:50 -08:00
David Anderson
ce158c52c5 dwarfdump:
* dwarfdump.c: Update version string. Added CU_low_address so
      CU_base_address is properly used only for the DWARF
      CU 'base address' notion. Print CU_low_address in PRINT_CU_INFO().
* common.c: Update version string
* globals.h: New macro DROP_ERROR_INSTANCE(d,r,e) improves consistency
      where we need to drop a Dwarf_Error instance.
* print_die.c: Support for CU_low_address. Use DROP_ERROR_INSTANCE
      where appropriate.
* print_frames.c: Use DROP_ERROR_INSTANCE
      where appropriate.
2016-03-07 16:41:11 -08:00
Carlos Alberto Enciso
2464b8ac1d * dwarfdump.c:
Missing '_' just for consistency.
    Print any harmless errors only the required in command line

* globals.h:
    Unused declaration.

* print_die.c:
    When displaying a DW_AT_type offset error, uses the standard
    0xdddddddd format.
    Wrap to 80 columns, a long line.
2016-03-03 09:46:02 +00:00
David Anderson
3f7aba30b8 dwarfdump.c,globals.h,print_aranges.c,print_die.c,
print_frames.c,print_lines.c,print_locs.c,print_macro.c,
      print_pubnames.c,print_reloc.ckprint_static_funcs.c,
      print_static_vars.c,print_strings.c,print_types.c,
      print_weaknames.c: Removed global Dwarf_Error err
      and provided local Dwarf_Error as needed.

libdwarf2.1.mm: Added dwarf_lineoff_b() documentation.
Fixed a typo in dwarf_formexprloc() documentation.
libdwarf2.1.pdf: Regenerated. Version 2.41
2016-02-13 12:53:11 -08: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
3eb0df65d8 Renamed an enum value from 'std' to singledw5 to
better reflect the meaning and avoid 'std'
as 'std' seems to be a keyword
in at least one environment.
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_lines.c
2016-02-10 15:15:09 -08:00
David Anderson
d76395da7d Merge branch 'unattr'
Conflicts:
	libdwarf/ChangeLog
2016-02-06 14:28:35 -08:00
David Anderson
a7f5fc2b92 Now DWARF2,3,4 macro style printed per-CU
And new checks for wasted space made.
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/macrocheck.c
dwarfdump/macrocheck.h
dwarfdump/print_die.c
dwarfdump/print_macros.c
2016-02-03 11:22:38 -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
3e442d6a40 Better compiler checking with --enable-wall..
Now all with prototypes.
Local functions now declared static.
One crucial bug in macrocheck.c in calling dwarf_twalk fixed.
dwarfdump/configure
dwarfdump/configure.in
dwarfdump/dwarf_tsearchbal.c delete unused function
dwarfdump/dwarfdump.c
dwarfdump/dwconf.c
dwarfdump/dwgetopt.c
dwarfdump/globals.h
dwarfdump/macrocheck.c
dwarfdump/naming.c
dwarfdump/print_gdbindex.c
dwarfdump/tag_attr.c
dwarfdump/tag_common.c

Better compiler checking with --enable-wall..
Now all with prototypes.
Local functions now declared static.
Some old and new functions documented in mm.
libdwarf/Makefile.in
libdwarf/configure
libdwarf/configure.in
libdwarf/dwarf_macro5.c
libdwarf/dwarf_original_elf_init.c
libdwarf/dwarf_query.c
libdwarf/dwarf_stubs.c
libdwarf/dwarf_util.c
libdwarf/dwgetopt.c
libdwarf/libdwarf.h.in
libdwarf/libdwarf2.1.mm
libdwarf/libdwarf2.1.pdf Regenerated. V 2.39
libdwarf/pro_alloc.c
libdwarf/pro_alloc.h

delete unused function.
tsearch/dwarf_tsearchbal.c

files:
2016-01-20 10:32:39 -08: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
2192c62b5c Additional checks for frame issues in bad objects.
Better reporting of such problems.

modified:   dwarfdump/common.c
modified:   dwarfdump/dwarfdump.c
modified:   dwarfdump/globals.h
modified:   dwarfdump/print_frames.c

modified:   libdwarf/dwarf_frame2.c
2016-01-17 18:53:01 -08:00
David Anderson
ba0b90f77c Now dwarfdump -m and dwarfdump -kw work meaningfully
on the DWARF5-style .debug_macro section.

dwarfdump/Makefile.in
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c
dwarfdump/print_macro.c

libdwarf/dwarf_macro5.c
libdwarf/libdwarf.h.in
2016-01-12 11:37:40 -08:00
David Anderson
ade09dd9fc Removed a pair of global variables in favor of a new global function.
dwarfdump/dwarfdump.c
dwarfdump/globals.h
dwarfdump/print_die.c
dwarfdump/print_lines.c
dwarfdump/print_macro.c
dwarfdump/print_pubnames.c
dwarfdump/print_ranges.c

libdwarf/dwarf_macro5.c Fixed _import handling. Off by one.
libdwarf/dwarf_query.c trailing whitespace removed
2015-12-18 10:09:34 -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
67e30ba3ae Ensure we get true section name where it matters,
and comment the other places (where not critical).
dwarfdump/globals.h
dwarfdump/print_frames.c
dwarfdump/print_lines.c
dwarfdump/print_locs.c
dwarfdump/print_macros.c
dwarfdump/print_pubnames.c
dwarfdump/print_static_funcs.c
dwarfdump/print_static_vars.c
dwarfdump/print_types.c
dwarfdump/print_weaknames.c

Enable retrieving true section name from object file.
libdwarf/dwarf_frame.c
libdwarf/libdwarf.h.in
2015-11-28 11:08:32 -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
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
180fa313cd dwarfdump.c: Now allow selecting alternate line table
reading code so line table routines can be tested thoroughly.
print_lines.c: Uses one of the selected line table routine
       .  Adds new line access routine calls to test those too.
globals.h: Declares new flag line_skeleton_flag;
print_die.c: Moved a local declaration to where it is used.
       Added a missing DW_DLV_ERROR check so in case of error
       we do not leak memory.
2015-10-06 16:41:20 -07:00
David Anderson
bf8a826f73 dwarfdump.
print_frames.c, globals.h:
  print_frame_inst_bytes() defined and used
  in one file, so made a static function, removed from globals.h
2015-09-14 14:59:45 -07:00
Carlos Alberto Enciso
d7e16285dc Changes to support the checking of ranges generated by a compiler
that emits DWARF4. The check failed when:

a) The DW_TAG_compile_unit, does have a DW_AT_low_pc and DW_AT_ranges.
   Dwarfdump is expecting the pair DW_AT_low_pc and DW_AT_high_pc values.

b) The DW_AT_high_pc is an offset from DW_AT_low_pc.
   Dwarfdump is expecting the DW_AT_high_pc to be a relocated address.
2015-03-03 09:48:24 +00:00
David Anderson
0d603ac5d3 Removed obsolete incorrect SGI address and web site from copyrights
in libdwarf .h files.
2015-01-31 09:20:42 -08:00
David Anderson
b004f18f43 Changing the hash return from the debugfission
from an integer to an 8 byte glob: Dwarf_Sig8
2015-01-31 09:03:03 -08:00
David Anderson
46a28e7d5f Now getopt is hard coded (NetBSD BSD license) in libdwarf
so we get consistent behavior.  Specifically allowing the
notion of :: in the option list.
Fixed issues with handling files with both .debug_types and
.debug_info (got spurious warnings with -ky -kd, for example)
on a .dwp object.
Corrected a couple places where we needed to reset a static
variable (renamed the static variable for readability and removed
it from the globals variables).
2015-01-24 16:28:25 -08:00
David Anderson
68ee12715f use of va_list requires stdarg.h, but that was not
everywhere it needed to be.
By accident, GNU libc hid that omission.
Also removed a couple unused variables and some
trailing whitespace.
2015-01-15 16:15:45 -08:00
Carlos Alberto Enciso
7e527974f5 Fixing an issue discovered with printing debug information, due to
conflicts with -kG code, that bypaased the printing of the attributes.
2014-09-12 15:14:41 +01:00
Carlos Alberto Enciso
5294a3d9b3 New command line -kG, to print only unique errors generated by any of
the -k check options
2014-09-10 11:52:00 +01:00
Carlos Alberto Enciso
66969601bd New command line option, -kD to check for duplicated attributes in a DIE 2014-09-10 11:48:01 +01:00
Carlos Alberto Enciso
39ed87559a New command line option -ku[f]
It prints tag-tree and tag-attr usage (basic and full format).
Controlled by the symbol HAVE_USAGE_TAG_ATTR
2014-09-10 11:42:47 +01:00
Carlos Alberto Enciso
07813995d0 Create a generic function supporting variable number of arguments to
print the DWARF error messages found while using any of the -k options
2014-09-10 10:20:05 +01: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
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
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
b7453e661a dwarfdump now uses esb_s more instead of char*.
Now checks for DA_AT_sibling errors.
dwarfdump2 now checks for DW_AT_sibling errors too.
2013-02-06 21:48:31 -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
Carlos Alberto Enciso
093d86020b Changes done, after David Anderson reviewed the previous modifications. 2012-10-31 12:01:08 +00:00
Carlos Alberto Enciso
1c08f55102 New command line option: -kE
Check the encoding form used for those attributes that use constant values
and determine if the number of bytes used to represent the attribute data
can be reduced by using unsigned LEB128 encoding. Gives a table with the
current usage, the usage if LEB128 is used and a percentage rate.

Signed-off-by: Carlos Alberto Enciso <carlos.alberto.enciso@gmail.com>
2012-08-30 14:01:45 +01:00
Carlos Alberto Enciso
12bc391634 Clean up the way -E<option> process the bitmap, to make
it easy to add more section names.
2012-07-27 12:01:15 +01:00
Carlos Alberto Enciso
d8980cb4f4 Incorrect mask value; it is used with the -Ed command line option to display basic information on the sections (.text and any existing debug related sections) 2012-07-26 14:20:57 +01:00
unknown
2c52668c4c Changes by SN Systems (Carlos Alberto Enciso), that include our modifications. 2012-07-25 16:03:36 +01:00
David Anderson
fd02ceba56 This completes the addition of .debug_types output and
refines the error-report generation to aviod some bogus
output.
2011-10-30 12:49:58 -07: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
5a2d823fa7 Now we do uri-to-text translation on command options and strings.
Fixed some indent issues.
Fixed some constness issues.
Updated the dwarfdump.1 man page to be complete and more readable
than before.
2011-10-23 13:51:27 -07:00
David Anderson
f2dfb675be We are doing a decent job in dwarfdump2 matching dwarfdump
and producing good output.
2011-10-07 18:41:30 -07:00
David Anderson
bac6b0e641 libdwarf/dwarf_frame.c: Fixed indents.
config.h.in, configure.in now use a configure-time dependency
on HAVE_STDAFX_H rather than the older built-in ifdef.
So folks using mingw have an easier time.
2011-09-08 17:24:47 -07:00