pyelftools.git
6 years agoSimplify arm reloc test file
Eli Bendersky [Wed, 5 Sep 2018 12:35:33 +0000 (05:35 -0700)]
Simplify arm reloc test file

6 years agoRename input files for arm relocation test to be more consistent
Eli Bendersky [Wed, 5 Sep 2018 12:32:04 +0000 (05:32 -0700)]
Rename input files for arm relocation test to be more consistent

6 years agoRedo the new arm reloc test as a proper unit test, aligned with other tests
Eli Bendersky [Wed, 5 Sep 2018 12:29:44 +0000 (05:29 -0700)]
Redo the new arm reloc test as a proper unit test, aligned with other tests

6 years agoCall relocation for ARM V3 (#194)
Dmitry Koltunov [Wed, 5 Sep 2018 12:25:28 +0000 (15:25 +0300)]
Call relocation for ARM V3 (#194)

* Add support for 'R_ARM_CALL' relocation type

* Add test script and test files to verify support for 'R_ARM_CALL'

Signed-off-by: Koltunov Dmitry <koltunov@ispras.ru>
6 years agoAdd .o test files to manifest v0.25
Eli Bendersky [Sat, 1 Sep 2018 13:14:35 +0000 (06:14 -0700)]
Add .o test files to manifest

6 years agoUpdate version to 0.25 to prepare for release
Eli Bendersky [Sat, 1 Sep 2018 13:07:39 +0000 (06:07 -0700)]
Update version to 0.25 to prepare for release

6 years agoUpdate CHANGES, add 3.6 testing to Travis and fixup README
Eli Bendersky [Sat, 1 Sep 2018 13:03:53 +0000 (06:03 -0700)]
Update CHANGES, add 3.6 testing to Travis and fixup README

6 years agoHandle ARM relocations (#121)
Frederik Sdun [Mon, 16 Jul 2018 13:22:55 +0000 (15:22 +0200)]
Handle ARM relocations (#121)

* relocation: handle ARM binaries

* relocation: handle R_ARM_ABS32 for ARM machines

* testfiles: add reloc_arm_gcc.o.elf

Generated on Ubuntu 14.04 using: arm-linux-gnueabi-gcc-4.7 -c -g -o reloc_armhf_gcc.o.elf hello.c

* testfiles: add reloc_armhf_gcc.o.elf

Generated on Ubuntu 14.04 using: arm-linux-gnueabihf-gcc-4.7 -c -g -o reloc_armhf_gcc.o.elf hello.c

* readelf: print soft-float abi for ARM if EF_ARM_ABI_FLOAT_SOFT in flags

* readelf: print hard-float abi for ARM if EF_ARM_ABI_FLOAT_HARD in flags

* readelf: print BE8 info for armeb binaries

* testfiles: add simple_armhf_gcc.o.elf

    Generated on Ubuntu 14.04 using: arm-linux-gnueabihf-gcc-4.7  -g -o simple_armhf_gcc.o.elf hello.c

* elf: remove unwind from dicts and set ARM_EXIDX description

* testfiles: add  reloc_armsf_gcc.o.elf as soft float testcase taken from binutils 2.30

* testfiles: add reloc_armeb_gcc.o.elf as arm big endian testcase taken from binutils 2.30 testcase arm-be8

* readelf: print endian info LE8 if flag was set in header flags

6 years agoEnable --parallel tests for readelf in the tox config
Eli Bendersky [Wed, 7 Mar 2018 13:23:18 +0000 (05:23 -0800)]
Enable --parallel tests for readelf in the tox config

6 years agoMerge branch 'master' of github.com:eliben/pyelftools
Eli Bendersky [Wed, 7 Mar 2018 13:21:02 +0000 (05:21 -0800)]
Merge branch 'master' of github.com:eliben/pyelftools

6 years agoAdd basic parallel execution capabilities to readelf tests
Eli Bendersky [Tue, 6 Mar 2018 20:59:47 +0000 (12:59 -0800)]
Add basic parallel execution capabilities to readelf tests

6 years agoAdd timings for steps of execution in running these tests
Eli Bendersky [Tue, 6 Mar 2018 20:07:15 +0000 (12:07 -0800)]
Add timings for steps of execution in running these tests

6 years agoUpdate CHANGES
Eli Bendersky [Tue, 6 Mar 2018 13:56:18 +0000 (05:56 -0800)]
Update CHANGES

6 years agoSwitch readelf.py to using argparse instead of optparse
Eli Bendersky [Tue, 6 Mar 2018 13:55:28 +0000 (05:55 -0800)]
Switch readelf.py to using argparse instead of optparse

6 years agoSwitch run_readelf_tests to use argparse instead of optparse
Eli Bendersky [Tue, 6 Mar 2018 13:41:08 +0000 (05:41 -0800)]
Switch run_readelf_tests to use argparse instead of optparse

6 years agoFix DW_CFA_remember_state (#184)
emersion [Tue, 6 Mar 2018 13:16:41 +0000 (14:16 +0100)]
Fix DW_CFA_remember_state (#184)

* Fix #103

* Fix description for DW_CFA_def_cfa_expression

* Add test file for issue #103

6 years agoChoose members of the dynamic tag enum based on the current machine (#183)
Audrey Dutcher [Fri, 23 Feb 2018 13:30:52 +0000 (05:30 -0800)]
Choose members of the dynamic tag enum based on the current machine (#183)

* Only use processor/os specific dynamic tags if that processor or os is in use

* Add testcase for machine-specific dynamic tags

* Clarify layout of ENUM_D_TAG

6 years agoConvert all ascii decoding to utf-8 decoding (#182)
Audrey Dutcher [Fri, 23 Feb 2018 13:28:51 +0000 (05:28 -0800)]
Convert all ascii decoding to utf-8 decoding (#182)

* Convert all ascii-decoding to utf-8 decoding

* Add testcase for unicode symbols

6 years agoFix #181 for real
Eli Bendersky [Sat, 17 Feb 2018 13:12:52 +0000 (05:12 -0800)]
Fix #181 for real

EM_BLAKCFIN --> EM_BLACKFIN

6 years agoMerge branch 'master' of github.com:eliben/pyelftools
Eli Bendersky [Fri, 16 Feb 2018 13:59:14 +0000 (05:59 -0800)]
Merge branch 'master' of github.com:eliben/pyelftools

6 years agoFix a typo EM_BLAFKIN --> EM_BLACKFIN
Eli Bendersky [Fri, 16 Feb 2018 13:58:44 +0000 (05:58 -0800)]
Fix a typo EM_BLAFKIN --> EM_BLACKFIN

Fixes #181

6 years agoUpdate README
Eli Bendersky [Wed, 14 Feb 2018 23:58:39 +0000 (15:58 -0800)]
Update README

6 years agoDo not crash if CIE doesn't define CFA (#177)
emersion [Sat, 20 Jan 2018 17:18:09 +0000 (18:18 +0100)]
Do not crash if CIE doesn't define CFA (#177)

6 years agoMention recent changes in CHANGES
Eli Bendersky [Tue, 16 Jan 2018 13:43:00 +0000 (05:43 -0800)]
Mention recent changes in CHANGES

6 years agoe_machine-dependent p_type parsing;
Eli Bendersky [Mon, 15 Jan 2018 22:31:31 +0000 (14:31 -0800)]
e_machine-dependent p_type parsing;

This should address #71 and #121, hopefully

6 years agoImplement e_machine-based section type decoding
Eli Bendersky [Mon, 15 Jan 2018 22:14:11 +0000 (14:14 -0800)]
Implement e_machine-based section type decoding

6 years agoAdding a dict-merging utility
Eli Bendersky [Mon, 15 Jan 2018 13:50:13 +0000 (05:50 -0800)]
Adding a dict-merging utility

6 years agoSome whitespace fixes
Eli Bendersky [Tue, 9 Jan 2018 14:56:24 +0000 (06:56 -0800)]
Some whitespace fixes

6 years agoDon't include 'meta-tag' markers in descriptions of ENUM_D_TAG (#176)
Audrey Dutcher [Fri, 5 Jan 2018 21:54:59 +0000 (13:54 -0800)]
Don't include 'meta-tag' markers in descriptions of ENUM_D_TAG (#176)

Fixes #150

6 years agoAdd a local .vimrc for pyelftools
Eli Bendersky [Fri, 5 Jan 2018 13:52:11 +0000 (05:52 -0800)]
Add a local .vimrc for pyelftools

6 years agoFix merge conflicts for ABIFLAGS branch (#168)
AG [Sun, 26 Nov 2017 21:41:15 +0000 (16:41 -0500)]
Fix merge conflicts for ABIFLAGS branch (#168)

6 years agoArm exidx (#172)
AG [Sun, 26 Nov 2017 21:41:04 +0000 (16:41 -0500)]
Arm exidx (#172)

* Fix merge conflicts for ABIFLAGS branch

* Fix EXIDX output to match binutils readelf -e

6 years agoMany improvements to MIPS flags handling to make output consistent with GNU binutils...
AG [Sun, 26 Nov 2017 13:57:43 +0000 (08:57 -0500)]
Many improvements to MIPS flags handling to make output consistent with GNU binutils readelf + typo (#165)

* Add EF_MIPS_PIC for E_FLAGS for statically linked MIPS-I executable produced by MUSL

pyelftools picked up CPIC but not PIC

binutils readelf says:
  Flags:                             0x1007, noreorder, pic, cpic, o32, mips1

pyelftools said (before this change):
  Flags:                             0x1007, noreorder, cpic, o32, mips1

Reproduce with the binary available at:

https://github.com/mzpqnxow/embedded-toolkit/blob/master/prebuilt_static_bins/gdbserver/gdbserver-6.8-mips-i-rtl819x-lexra

* Fix order of fix, was "cpic, pic" needs to be "pic, cpic", reordered the if statement to address this

* - Improve reporting on MIPS flags, fix many inconsistencies with GNU binutils
- Fix `desrciption` typo that raises fatal exception when encountering an unknown ABI
- Add E_FLAGS_MASKS constants to simplify ABI logic

* Add masks for E_FLAGS to simplify ABI logic

6 years agoAdd TLS and PowerPC to Machine and Program Headers description tables to match binuti...
AG [Sun, 26 Nov 2017 13:50:49 +0000 (08:50 -0500)]
Add TLS and PowerPC to Machine and Program Headers description tables to match binutils output (#163)

Before:
...
  Machine:                           <unknown>
...
Program Headers:
...
  <unknown>      0x0bcd0c 0x100ccd0c 0x100ccd0c 0x00000 0x00008 R   0x4
...

After:
...
  Machine:                           PowerPC
Program Headers:
...
  TLS            0x0bcd0c 0x100ccd0c 0x100ccd0c 0x00000 0x00008 R   0x4
...

Reproduced and then tested change against statically linked PPC binary produced by MUSL:

https://github.com/mzpqnxow/embedded-toolkit/blob/master/prebuilt_static_bins/gdbserver/gdbserver-7.12-ppc-sysv

7 years agoARM build attributes section parsing (#160)
tyb0807 [Tue, 21 Nov 2017 05:00:08 +0000 (06:00 +0100)]
ARM build attributes section parsing (#160)

7 years agoDIE.__repr__ typo: s/chidren/children/ (#161)
alon [Tue, 21 Nov 2017 04:54:13 +0000 (06:54 +0200)]
DIE.__repr__ typo: s/chidren/children/ (#161)

7 years agoClean up some whitespace
Eli Bendersky [Sat, 18 Nov 2017 17:37:45 +0000 (09:37 -0800)]
Clean up some whitespace

7 years agoFix - ELFFile#address_offsets should consider PT_LOAD only (#159)
david942j [Fri, 13 Oct 2017 02:56:29 +0000 (10:56 +0800)]
Fix - ELFFile#address_offsets should consider PT_LOAD only (#159)

* fix - ELFFile#address_offsets should consider PT_LOAD only

7 years agocreate inital wheel support (#158)
David Schneider [Wed, 4 Oct 2017 03:17:09 +0000 (05:17 +0200)]
create inital wheel support (#158)

7 years agoUpdate the shipped `readelf` (#157)
Pierre-Marie de Rodat [Sun, 10 Sep 2017 16:35:26 +0000 (18:35 +0200)]
Update the shipped `readelf` (#157)

* elftools.elf.description: re-indent describe_note according to PEP8

* Update the embedded `readelf`, update readelf.py accordingly

7 years agoClean up py3compat a bit and add some tests
Eli Bendersky [Wed, 30 Aug 2017 13:28:56 +0000 (06:28 -0700)]
Clean up py3compat a bit and add some tests

7 years agoAdd parsing and readelf dumping for .eh_frame (#155)
Pierre-Marie de Rodat [Tue, 29 Aug 2017 02:05:58 +0000 (22:05 -0400)]
Add parsing and readelf dumping for .eh_frame (#155)

* Fix the byte size for R_X86_64_PC32 relocations

* Describe the address for DW_CFA_advance_loc with only 8 columns

* Add .eh_frame section decoding and dump in readelf.py

7 years agoMinor testsuite improvements (#154)
Pierre-Marie de Rodat [Fri, 18 Aug 2017 01:33:44 +0000 (21:33 -0400)]
Minor testsuite improvements (#154)

* run_readelf_tests.py: add an option to continue tests after a failure

Also add a counter to display the number of failed tests over the number
of tests run.

* run_readelf_tests.py: run tests in alphabetical order

This gives deterministic runs, which is handy to run edit/test
development cycles.

7 years agoCompressed sections (#152)
Pierre-Marie de Rodat [Thu, 17 Aug 2017 03:52:45 +0000 (05:52 +0200)]
Compressed sections (#152)

* Add constants, enums and structs for compressed section

* ELFStructs: update comments for new section numbers in Oracle docs

* Make the ELFFile's stream/structs available to all Section instances

This harmonizes the signature of Section constructors. Besides, structs
will be required to read compressed sections.

* ELFFile._read_dwarf_section: use Section.data to read the section

An upcoming change will add compressed sections handling. In this
context, the DWARF must be parsed from the decompressed data, so reading
the ELFFile stream will be wrong.

* Add ELF compressed debug sections handling

7 years agoAdding new OS ABI to ELF header parsing (#153)
tyb0807 [Wed, 16 Aug 2017 12:18:50 +0000 (14:18 +0200)]
Adding new OS ABI to ELF header parsing (#153)

* Add OS ABI to ELF header

* Add new OS ABI to description

7 years agoCosmetic fixups
Eli Bendersky [Sun, 2 Jul 2017 16:11:50 +0000 (09:11 -0700)]
Cosmetic fixups

7 years agoBetter support for core dumps (in particular, fix issue #93) (#147)
Max Akhmedov [Sun, 2 Jul 2017 16:06:16 +0000 (19:06 +0300)]
Better support for core dumps (in particular, fix issue #93) (#147)

* Better support for core dumps (in particular, fix notes issue)

* Fix readelf.py for python3.

* Edits after code review. Introduce structure for NT_PRPSINFO. Add unittest.

7 years agoUpdate reserved machine arch idents (#148)
Matt Gregory [Tue, 27 Jun 2017 12:04:44 +0000 (08:04 -0400)]
Update reserved machine arch idents (#148)

* Update reserved machine arch idents

* Accidentally repeated a value

7 years agoClean up a bit after previous PR
Eli Bendersky [Thu, 15 Jun 2017 13:56:14 +0000 (06:56 -0700)]
Clean up a bit after previous PR

7 years agoNULL termination with IAR Embedded Workbench compiler (#146)
gerthmar [Thu, 15 Jun 2017 13:51:32 +0000 (15:51 +0200)]
NULL termination with IAR Embedded Workbench compiler (#146)

* Exectued changes for IAR Embedded Workbench output .elf File

* applied review findings

7 years agoMake elffile and elfstructs on Dynamic public (#141)
int10h [Sat, 6 May 2017 03:08:45 +0000 (23:08 -0400)]
Make elffile and elfstructs on Dynamic public (#141)

7 years agoFix running tests on Travis
Eli Bendersky [Sun, 26 Feb 2017 14:47:57 +0000 (06:47 -0800)]
Fix running tests on Travis

7 years agoRemove setup_syspath entirely
Eli Bendersky [Sun, 26 Feb 2017 14:26:33 +0000 (06:26 -0800)]
Remove setup_syspath entirely

It's vestigial remains from the early days of pyelftools which was originally
developed on Windows, running the tests through an editor rather than on the
command line.

Not setting the run path in the code is safer - it's more reliable to control where the code is found outside the code itself now

7 years agoRemove conditional unittest2 imports from tests
Eli Bendersky [Sun, 26 Feb 2017 14:23:06 +0000 (06:23 -0800)]
Remove conditional unittest2 imports from tests

We require 2.7+ now

Also remove setup_syspath calls

7 years agoReformat new test and add comment header
Eli Bendersky [Sat, 25 Feb 2017 15:53:16 +0000 (07:53 -0800)]
Reformat new test and add comment header

7 years agoAdd .stab section parser (#137)
PromyLOPh [Sat, 25 Feb 2017 15:50:52 +0000 (16:50 +0100)]
Add .stab section parser (#137)

* Add .stab section parser

* Replace tabs with spaces

* Add unit test for stabs parser

7 years ago Fix parsing string table (#134)
gcmoreira [Thu, 2 Feb 2017 13:47:30 +0000 (00:47 +1100)]
 Fix parsing string table (#134)

If for any reason parse_cstring_from_stream() cannot get a string in the given offset, it'll return None causing the following line raises an exception when it tries to get the decoded ascii string from the None object.

7 years agoMerge pull request #132 from jwilk/spelling
Eli Bendersky [Thu, 19 Jan 2017 13:15:16 +0000 (05:15 -0800)]
Merge pull request #132 from jwilk/spelling

Remove duplicated word

7 years agoRemove duplicated word
Jakub Wilk [Tue, 17 Jan 2017 22:06:09 +0000 (23:06 +0100)]
Remove duplicated word

7 years agoMerge pull request #131 from shuxin/patch-2
Eli Bendersky [Mon, 16 Jan 2017 16:54:34 +0000 (08:54 -0800)]
Merge pull request #131 from shuxin/patch-2

Update enums.py

7 years agoUpdate enums.py
shuxin [Mon, 16 Jan 2017 10:53:49 +0000 (18:53 +0800)]
Update enums.py

add an mips tag

7 years agoFix more potential Python 3 issues in construct
Eli Bendersky [Sat, 24 Dec 2016 16:26:43 +0000 (08:26 -0800)]
Fix more potential Python 3 issues in construct

Use b"" strings for paddings/align and anything else dealing with binary data

7 years agoMerge pull request #127 from mefistotelis/pullrequest
Eli Bendersky [Sat, 24 Dec 2016 16:22:45 +0000 (08:22 -0800)]
Merge pull request #127 from mefistotelis/pullrequest

Fix for padding encoding in Python 3.

7 years agoFix for padding encoding in Python 3.
mefistotelis [Tue, 20 Dec 2016 21:04:52 +0000 (22:04 +0100)]
Fix for padding encoding in Python 3.

The padding used a string literal instead of byte literal for the
pattern character, which caused invalid type error in Python 3.

This fix marks the pattern as byte literal, which does nothing on
Python >= 2.7 and creates byres array instead of str in Python >= 3.

8 years agoMerge pull request #126 from chriscz/master
Eli Bendersky [Fri, 4 Nov 2016 03:11:23 +0000 (20:11 -0700)]
Merge pull request #126 from chriscz/master

Fix typo relocation_bytesize  --> relocation.bytesize

8 years agoFix relocation_bytesize typo
Chris Coetzee [Wed, 2 Nov 2016 13:18:08 +0000 (15:18 +0200)]
Fix relocation_bytesize typo

8 years agoUpdate CHANGES + cosmetic cleanup
Eli Bendersky [Wed, 26 Oct 2016 13:39:49 +0000 (06:39 -0700)]
Update CHANGES + cosmetic cleanup

8 years agoCosmetic changes
Eli Bendersky [Wed, 26 Oct 2016 03:32:31 +0000 (20:32 -0700)]
Cosmetic changes

8 years agoRemove the PT_ARM_UNWIND enum
Eli Bendersky [Wed, 26 Oct 2016 03:07:43 +0000 (20:07 -0700)]
Remove the PT_ARM_UNWIND enum

According to the ARM ABI it's an alias for PT_ARM_EXIDX; having them both in the
same enum value confuses parsing. Keeping EXIDX rather than UNWIND because
binutils seems to be using it.

Related to #121

8 years agoIssue #119: readelf - don't do hex/string dumps for SHT_NOBITS sections
Eli Bendersky [Sat, 15 Oct 2016 21:08:50 +0000 (14:08 -0700)]
Issue #119: readelf - don't do hex/string dumps for SHT_NOBITS sections

8 years agoAdd py35 to tox.ini
Eli Bendersky [Thu, 6 Oct 2016 13:53:19 +0000 (06:53 -0700)]
Add py35 to tox.ini

8 years agoMerge pull request #118 from tezeb/patch-1
Eli Bendersky [Thu, 6 Oct 2016 13:50:48 +0000 (06:50 -0700)]
Merge pull request #118 from tezeb/patch-1

Check for header attribute when comparing

8 years agoCheck for header attribute when comparing
tezeb [Sun, 25 Sep 2016 18:18:02 +0000 (20:18 +0200)]
Check for header attribute when comparing

When checking against None it throws exception, while it's quite
easy to prevent(and check against None seems quite obvious).

8 years agofromdos setup.py v0.24
Eli Bendersky [Fri, 5 Aug 2016 03:18:13 +0000 (20:18 -0700)]
fromdos setup.py

8 years agoGetting ready to release 0.24
Eli Bendersky [Fri, 5 Aug 2016 03:17:55 +0000 (20:17 -0700)]
Getting ready to release 0.24

8 years agoAdd Python 3.5 testing to travis
Eli Bendersky [Tue, 2 Aug 2016 20:02:21 +0000 (13:02 -0700)]
Add Python 3.5 testing to travis

8 years agoUpdate CHANGES with a few more recent changes
Eli Bendersky [Tue, 2 Aug 2016 19:55:44 +0000 (12:55 -0700)]
Update CHANGES with a few more recent changes

8 years agoWhitespace cleanup
Eli Bendersky [Mon, 1 Aug 2016 16:17:20 +0000 (09:17 -0700)]
Whitespace cleanup

8 years agoMerge pull request #109 from gbenson/master
Eli Bendersky [Mon, 1 Aug 2016 11:14:35 +0000 (04:14 -0700)]
Merge pull request #109 from gbenson/master

Support SHT_NOTE sections

8 years agoSupport SHT_NOTE sections
Gary Benson [Thu, 14 Jul 2016 10:00:08 +0000 (11:00 +0100)]
Support SHT_NOTE sections

This commit adds a new NoteSection class with an iter_notes
iterator which operates in much the same way as NoteSegment's
iter_notes.  An example to illustrate usage is added, and its
reference output is added for the test suite.

8 years agoMerge pull request #108 from dorothychen/aranges
Eli Bendersky [Thu, 14 Jul 2016 12:00:41 +0000 (05:00 -0700)]
Merge pull request #108 from dorothychen/aranges

parse .debug_aranges section

8 years agoparsed .debug_aranges section, simple interface mapping address ranges to CU offsets
Dorothy Chen [Fri, 1 Jul 2016 20:44:36 +0000 (16:44 -0400)]
parsed .debug_aranges section, simple interface mapping address ranges to CU offsets

fixed bug in finding correct arange entry, given an addr

cosmetic changes per pull request thread #108, and updated relevant tests

minor arange test changes

filled in comments

update test formatting for aranges

update test formatting for aranges

Fix off-by-one bug

For real this time. If the query addr == beginning address, bisect_left won't work.

8 years agoMerge pull request #107 from DavidSpickett/master
Eli Bendersky [Mon, 4 Jul 2016 12:10:31 +0000 (05:10 -0700)]
Merge pull request #107 from DavidSpickett/master

Fix Windows import error by getting page size using 'mmap' module if 'resource' is not available.

8 years agoGet page size using 'mmap' module if 'resource' is not available.
David Spickett [Fri, 1 Jul 2016 10:43:49 +0000 (11:43 +0100)]
Get page size using 'mmap' module if 'resource' is not available.
The resource module is Unix only, use mmap for Windows.

8 years agoMerge pull request #102 from ttsugriy/master
Eli Bendersky [Mon, 20 Jun 2016 22:42:35 +0000 (15:42 -0700)]
Merge pull request #102 from ttsugriy/master

Support ZLIB compressed debug sections

8 years agoSupport ZLIB compressed debug sections
ttsugrii [Tue, 24 May 2016 01:45:32 +0000 (18:45 -0700)]
Support ZLIB compressed debug sections

objcopy --compress-debug-sections uses ZLIB compression to reduce debug
sections, which can sometimes be larger than the size of the binary
itself. This change makes pyelftools consider compressed debug sections
when checking for DWARF data.

readelf tool supports other types of compressed sections
(https://github.com/facebook/binutils/blob/master/binutils/readelf.c#L12038)
but their support is outside of scope of this change.

Test plan:
  $ ./test/run_all_unittests.py

Signed-off-by: Stanislas P1kachu Lejay <p1kachu@lse.epita.fr>
8 years agoMerge pull request #104 from P1kachu/master
Eli Bendersky [Sun, 19 Jun 2016 15:10:40 +0000 (08:10 -0700)]
Merge pull request #104 from P1kachu/master

Fix case where struct is None

8 years agoFix case where struct is None
Stanislas P1kachu Lejay [Sun, 19 Jun 2016 12:12:41 +0000 (14:12 +0200)]
Fix case where struct is None

Signed-off-by: Stanislas P1kachu Lejay <p1kachu@lse.epita.fr>
8 years agoFix descriptions._data_member_location_extra to handle DW_FORM_sdata
Eli Bendersky [Wed, 2 Mar 2016 12:15:33 +0000 (04:15 -0800)]
Fix descriptions._data_member_location_extra to handle DW_FORM_sdata

Taken from #98 - contributed by @bseifers

8 years agoMerge pull request #89 from sethml/feature/improved-DWARFv4
Eli Bendersky [Fri, 11 Dec 2015 02:29:34 +0000 (18:29 -0800)]
Merge pull request #89 from sethml/feature/improved-DWARFv4

Improved DWARFv4 support.

8 years agoMerge pull request #91 from sethml/feature/DW_TAG_GNU_call_site
Eli Bendersky [Fri, 11 Dec 2015 02:28:24 +0000 (18:28 -0800)]
Merge pull request #91 from sethml/feature/DW_TAG_GNU_call_site

Add DW_TAG_GNU_call_site* for better dumping.

8 years agoImproved DWARFv4 support.
Seth LaForge [Thu, 3 Dec 2015 04:43:36 +0000 (20:43 -0800)]
Improved DWARFv4 support.

Handle DW_AT_data_member_location attributes with type DW_FORM_data*, which
store a simple integer offset rather than dwarf expression. This seems to come
up with struct members, at least on ARM.

Handle DW_AT_location attributes with type DW_FORM_sec_offset as not having
dwarf expressions, as allowed by the DWARFv4 standard. This seems to come up
with some local variables, at least on ARM.

Test DW_FORM_sec_offset support in location lists and DW_AT_data_member_location formatting support.
Test code, compiled with gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 on x86-64:

struct Foo {
  char bim : 8;
  char bar : 3;
  char baz : 5;
};

int get_bar(struct Foo foo) {
  return foo.bar;
}

int f1(int a, char b) {
  return a+b;
}

8 years agoAdd DW_TAG_GNU_call_site* for better tail-call debug descriptions.
Seth LaForge [Thu, 3 Dec 2015 04:40:56 +0000 (20:40 -0800)]
Add DW_TAG_GNU_call_site* for better tail-call debug descriptions.

This comes up for functions which have tail-calls optimized.
Describe location list for DW_AT_GNU_call_site_* to match readelf.
Add test elf file to demonstrate that we match readelf for DW_AT_GNU_call_site_*. C source is:
  extern int f2(int a, char b);
  extern char var;
  int f1(void) { return f2(666, var); }

8 years agoMerge pull request #90 from sethml/feature/readelf-formatting
Eli Bendersky [Sat, 5 Dec 2015 17:56:49 +0000 (09:56 -0800)]
Merge pull request #90 from sethml/feature/readelf-formatting

Minor changes to readelf formatting.

8 years agoMinor changes to readelf formatting.
Seth LaForge [Thu, 3 Dec 2015 04:33:45 +0000 (20:33 -0800)]
Minor changes to readelf formatting.

This makes the output more similar to GNU readelf.
It's not identical - in particular there are still a lot of whitespace
differences - but at least gets you within striking distance of no changes when
comparing with "diff -w".

9 years agoCosmetic changes
Eli Bendersky [Tue, 25 Aug 2015 12:18:45 +0000 (05:18 -0700)]
Cosmetic changes

9 years agoMerge pull request #82 from Tustvold/master
Eli Bendersky [Tue, 25 Aug 2015 12:12:44 +0000 (05:12 -0700)]
Merge pull request #82 from Tustvold/master

Added support for DWARF v4 line program headers.

9 years agoAdded support for DWARF v4 lineprograms
Raphael Taylor-Davies [Mon, 17 Aug 2015 14:27:53 +0000 (15:27 +0100)]
Added support for DWARF v4 lineprograms

DWARF v4 lineprograms add additional debugging information for VLIW architectures, specifically they add an op_index field identifying the operation within the instruction to which this lineprogram refers.

This field has been added to the LineState object. On non-VLIW architectures and for non DWARF v4 lineprograms this field will always be 0.

9 years agoRun dwarf/constants.py through fromdos
Eli Bendersky [Thu, 9 Jul 2015 13:37:54 +0000 (06:37 -0700)]
Run dwarf/constants.py through fromdos

9 years agoBetter DWARF v4 support for decoding function ranges.
Eli Bendersky [Thu, 9 Jul 2015 13:37:01 +0000 (06:37 -0700)]
Better DWARF v4 support for decoding function ranges.