Commit Graph

374 Commits

Author SHA1 Message Date
David Anderson
a9b1aa627f Regenerate configure in dwarfdump, libdwarf, dwarfdump2.
Add a comment about a libdwarf reference to HAVE_ELF_C_READ_MMAP.
That define looks like it belongs in config.h but
does not appear there nor in config.h.in
-- because it is not really necessary.
2012-11-17 14:18:03 -08:00
David Anderson
5e6968d94f Document the new convenience functions in libdwarf/libdwarf2.1.mm
dwarf_encode_leb128() dwarf_encode_signed_leb128()
2012-11-17 13:58:26 -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
48124e0d00 dwarfdump[2] and libdwarf ChangeLog files
now reflect all the recent changes.
2012-11-17 12:43:10 -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
a41fcbf58e libdwarf/ChangeLog: Documented dwarf_loclist_from_expr_b()
addition, required by  a surprise in
the DW_OP_GNU_implicit_pointer implementation
in gcc.
2012-11-15 07:41:20 -08:00
Carlos Alberto Enciso
3f6db8e08f Added ChangeLog file for changes done to libdwarf, including:
* layout changes (if, for, switch statements)
    * new algorithm to setup debug section during initialization
    * new header files with relocation definitions for ARM, MIPS,
      PPC, PPC64, X86_64.
2012-11-15 10:24:58 +00:00
David Anderson
a406a94877 Merge branch 'carlos_enciso' of ssh://git.code.sf.net/p/libdwarf/code into carlos_enciso
C

dwarfdump/ChangeLog2012
dwarfdump/dwarfdump.1 : tweaks to match what Linux does for new E and Sv.
dwarfdump/dwarfdump.c : Commentary enhancement.
dwarfdump2/checkutil.cc : Make it work properly, as in dwarfdump.
dwarfdump2/checkutil.h : Make it work like dwarfdump version.
dwarfdump2/dwarfdump.1 : tweaks to match what Linux does for E and Sv
dwarfdump2/dwarfdump.cc : To match dwarfdump output.
dwarfdump2/print_die.cc : To match dwarfdump output.
dwarfdump2/print_reloc.cc : To match dwarfdump output.
dwarfdump2/print_reloc.h : now present as in dwarfdump
libdwarf/dwarf.h : fix copyright date
libdwarf/dwarf_reloc_arm.h : fix copyright date
libdwarf/dwarf_reloc_mips.h : fix copyright date
libdwarf/dwarf_reloc_ppc.h : fix copyright date
libdwarf/dwarf_reloc_ppc64.h : fix copyright date
libdwarf/dwarf_reloc_x86_64.h : fix copyright date
libdwarf/libdwarf.h : fix uncommented argument names to be comments.
2012-11-14 16:19:01 -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
David Anderson
5e1b8c560e dwarf_reloc_mips.h
dwarf_reloc_ppc.h
dwarf_reloc_ppc64.h
dwarf_reloc_x86_64.h
All these now refer to LGPL 2.1 properly.
2012-11-08 14:19:58 -08:00
David Anderson
62f183b7b3 dwarfdump/checkutil.h: Two functions named here are not actually global, hence not appropriate here.
dwarfdump/dwarfdump.c: #include uri.h so it will compile without error.
dwarfdump/print_reloc.c: Fix printf to be %lx to match argument type.
dwarfdump2/dwarfdump.cc: Using C++ bool here and changing fprintf to cerr.
dwarfdump2/print_die.cc: Obvious trivial changes to get it to compile.
dwarfdump2/print_lines.cc:Obvious trivial changes to get it to comp
ile.
dwarfdump2/tag_tree.cc:#include naming.h
libdwarf/dwarf_elf_access.c: Fix typo in PPC64 #if
libdwarf/dwarf_reloc_arm.h: tweak comments at top.
libdwarf/dwarf_reloc_mips.h: tweak comments at top.
libdwarf/dwarf_reloc_ppc.h: tweak comments at top.
libdwarf/dwarf_reloc_ppc64.h: tweak comments at top.
libdwarf/dwarf_reloc_x86_64.h: tweak comments at top.
2012-11-08 13:52:49 -08:00
David Anderson
ab1989f370 REstoring libdwarf/config.h.in to the stock version.
And restoring one entry there lost by accident.
2012-11-08 12:48:16 -08:00
Carlos Alberto Enciso
33124f1a20 Merge branch 'master' of ssh://caej@git.code.sf.net/p/libdwarf/code into carlos_enciso
# By David Anderson
# Via David Anderson
* 'master' of ssh://caej@git.code.sf.net/p/libdwarf/code:
  Minor tweak to libdwarf/CODINGSTYLE
  Added small refinements to libdwarf/CODINGSTYLE.
2012-11-06 16:06:48 +00:00
Carlos Alberto Enciso
b3952b7b97 Changes requested by David Anderson and described below.
For the new relocation header files, update the copyright year and
remove the references to SGI as the files need to be considered in
that any truly new (as opposed to moved from existing libdwarf file).
2012-11-05 11:17:48 +00:00
Carlos Alberto Enciso
3bba034455 Changes requested by David Anderson and described below.
===========
dwarfdump/print_die.c line 1279, 1280, 1293,1294:  The comments
are pretty useless, since we don't use 'errno' here any longer.
Now the comments look random.

===========
print_lines.c, line 69: I don't understand why line_print_pc
controls printing this particular offset value.    Maybe you are right
here, but it's not at all obvious why this is the right thing to do.
Or perhaps just add a comment about why condition the output
on line_print_pc for code readers ?

===========
libdwarf/ reloc .h files with defines,  the  new header files:
    delete the $Header: comment line, it  is not relevant
    for the new header files, and is in fact irrelevant everywhere,
    but let's just ignore the irrelevance  for the old files.

===========
libdwarf/libdwarf.h line 2951, 2952:
How about the comment revised as follows
/*  These make the  LEB encoding routines visible to libdwarf
     callers.   Added November, 2012.  */
2012-11-05 10:26:12 +00:00
David Anderson
1995db926a Minor tweak to libdwarf/CODINGSTYLE 2012-11-02 16:28:21 -07:00
Carlos Alberto Enciso
b7ebde5e56 Changes requested by David Anderson and described below. Also a small
layout change for some macros in dwarf_util.h.

=====================
dwarfdump/dwarfdump.c line 1143:  abbrev_flag  = TRUE
is the do_all() setting, yet that is not (in general) safe to print
as a section.  And the comment following says that.
It is not safe to set abbrev_flag to TRUE.  Even valid DWARF
may have garbage in that section in places not referenced by .debug_info.
We just cannot set abbrev_flag TRUE with -a, not safely.

==============================
dwarfdump/dwarfdump.c line 1160,1161: usage_text and
usage_debug_text are file-static, not
visible outside this source file. Get rid of the extern declarations.
Ah. I see why you did that for usage_debug_text,
it is actually a  forward-declaration
in this context.   Well...  I would rather you moved the usage_debug_text
itself up to just after usage_text so the forward-declarations are no longer needed.
Admittedly my reason is not too strong, but it would be my preference
to eliminate those two forward declarations.  gcc -Wall -pedantic
does not much like what you did here either  :-)

==============================
dwarfdump/dwarfdump.c line 2357. The commit is incorrect now,
we don't quote strings internally in your new work
here. So delete that comment line.
2012-11-02 10:40:48 +00: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
f05390445d Added small refinements to libdwarf/CODINGSTYLE. 2012-10-31 10:41:58 -07: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
f57039e07c Isolate the relocations definitions for the Windows version;
also the string names for those values have been moved from Dwarfdump
into Libdwarf and put in separate files: dwarf_reloc_xxx.h, where xxx
is one of: arm, mips, ppc, ppc64 and x86_64.
2012-09-26 09:02:40 +01: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
77bc6bf80c As we are dealing with EM_PPC64, the relocation types are prefixed
with R_PPC64. Misspelling relocation type for the PPC64.
2012-08-16 13:03:52 +01:00
Carlos Alberto Enciso
1460b25188 Refactor the way Dwarfdump handle the RELA sections, to be independent
of the section name and use the section type (SHT_RELA) instead, to able
to decode properly object files, that do not use the conventional prefix
.rela for those sections.

The GNU readelf tool, manages to decode those files.
2012-08-06 12:29:30 +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
482b55091a Handle new relocations to thread-local-storage.
Across a number of different object types.
See the test cases in the tests git repository
in the directory there named relocerr64.
2012-07-24 16:23:27 -07:00
David Anderson
bdcd02fded Adds relocation of some TLS (thread local storage)
relocation types as these appear in object files
now.
2012-07-18 18:29:37 -07:00
David Anderson
353a3bf6c1 Added provisional LANG codes (DWARF5) to dwarf.h.
Otherwise just cleaning up (or commenting, where cleanup
not sensible) where there
were -Wall warnings.
2012-07-18 13:26:30 -07:00
David Anderson
bde56d6b2d Fixed a comment in libdwarf.h (said 32 when 64 meant and vice versa) 2012-04-10 10:04:25 -07:00
David Anderson
af0677e762 Fixing a C99 accidental dependency and a small
typo one compiler complained about in libdwarf.h
2012-04-10 09:54:49 -07:00
David Anderson
13312bac9e Removing ChangeLog (but will recreate) 2012-01-04 10:11:09 -08:00
David Anderson
5ddf43dc09 Finished with 2011 changes. Saving ChangeLog2011. 2012-01-04 10:10:13 -08: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
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
b2a4765ffc dwarf_frame.c: Fix commentary typo.
libdwarf2p.1.mm: Fix botched sentence. Change version to 1.31.
libdwarf2p.1.pdf: regenerate.
ChangeLog: describe above changes.
2011-12-08 13:45:02 -08:00
David Anderson
0c95039ad2 Fixed a spelling mistake in a comment in dwarf.h.
Rearranged nearby comments for a better appearance in dwarf.h.
2011-11-02 08:22:25 -07:00
David Anderson
d6d807533d Updated NEWS files to mention the new support of .debug_types data. 2011-10-29 16:34:43 -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
691efac892 Updating Makefile.in and README (3 of each) making it easier
to build with libdwarf/libelf in non-standard places.
2011-10-26 16:53:33 -07:00
David Anderson
3602e0b07e Fix indentation in dwarfdump[2] and libdwarf (just a few files
had issues).
2011-10-09 10:43:19 -07:00
David Anderson
e8727469b7 libdwarf/ChangeLog and dwarf_line.c gave trouble in the merge
of dd2liked.  This ensures they are right (by making trivial
change in comments) and committing.
2011-10-08 15:51:55 -07:00
David Anderson
eba1310691 Merge branch 'dd2liked'
Conflicts:
	libdwarf/ChangeLog
2011-10-08 15:50:05 -07:00
David Anderson
293619fcec These changes make dwarfdump/dwarfdump2 substantially identical
in output, and fix some bugs too.
2011-10-05 16:48:15 -07:00
David Anderson
7b98449471 Serious revisions to get dwarfdump and dwarfdump2 to work alike.
Mostly changing dwarfdump2.
2011-10-03 11:37:05 -07:00
David Anderson
96f004c528 Add tests for some dwarf-generation mistakes in a particular compiler -- so we
error off instead of getting a divide-by-zero error or a libdwarf
crash (and so we don't read off the end of a section given erroneous
input).  Has no effect when reading correct dwarf.
2011-09-23 18:55:54 -07:00
David Anderson
51d5389295 libdwarf: adding checks so small elf mistakes by compiler/linker
which result in a a bad object file are noticed by libdwarf, which
returns an error instead of seg-faulting or reading past
the end of malloc spaces.
2011-09-16 14:20:13 -07:00
David Anderson
cef68a7c1d New checks in Elf reading code notices errors in Elf
files and avoids coredumps in libdwarf.
2011-09-15 15:59:21 -07:00
David Anderson
b07af3d90f Now check for an erroneous address_size or segment size in
dwarf headers.
2011-09-14 16:59:56 -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
David Anderson
954044ac3c libdwarf: Adding a 'set' the address size so dwconf address_size:
takes effect.
dwarfdump,  dwarfdump2: Modify the dwarfdump.conf reader so we
can do the new includeabi: and address_size: commands in dwarfdump.conf.
Documented the new libdwarf call for address size and regenerated
the pdf.
2011-09-08 14:01:56 -07:00