diff --git a/README.md b/README.md index 896d906..948d6ae 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,14 @@ debugging information in executable files, built on top of of [pyelftools](https - Mach-O (MacOS X, iOS) - PE (Windows, Cygwin) -This project came from my desire to see and navigate the DWARF tree of compiled binaries. Seeing the DIEs is easy enough with utilities like `readelf` or `dwarfdump`. However, chasing inter-DIE references back and forth is not straightforward with those. +This project came from my desire to see and navigate the DWARF tree of compiled Android and iOS binaries. Seeing the DIEs is easy enough with utilities like `readelf` or `dwarfdump`. However, chasing inter-DIE references back and forth is not straightforward with those. The utility might be of use for anyone who is building DWARF parsers for one or another reason, especially if their preferred parsing library is `pyelftools`. +Note that regular Windows executables (EXE/DLL files) are PE files but don't, as a rule, contain DWARF information. The Microsoft toolchains (Visual Studio and the like) produce debugging information in Microsoft's own format, Program Database (PDB). There are, though, a couple of toolchains that produce PE files with DWARF debug info in them - notably GCC under Cygwin. DWARF Explorer is compatible with those. + +DWARF Explorer supports DWARF version 2-4, like the pyelftools library it's based on. + Requirements ------------ - Python 3.5+ @@ -19,15 +23,16 @@ Requirements Installlation ------------- -Run `pip install dwex`, under `sudo` if necessary. +Run `pip install dwex` from the command line, under `sudo` or elevated command line if necessary. + +On Windows, if `pip` and/or Python is not in PATH, use `c:\Python38\python -m pip install dwex`, substituting your own path to Python 3. -Alternatively, get the Python sources from Github, and run `python setup.py install` using your favorite Python 3 interpreter in the root folder of the package. In this scenario, you'd have -to install PyQt5 separately - with `pip install pyqt5`. +Alternatively, get the Python source tree from Github, and run `python setup.py install` in the root folder of the package. In this scenario, you'd have to install PyQt5 separately - with `pip install pyqt5`. -On Windows, if `pip` and/or Python is not in PATH, use `c:\Python35\python -m pip install pyqt5`, substituting your own path to Python. +On Linux, sometimes the `python` command defaults to Python 2 while Python 3 is installed side by side. In this case, use `python3` and `pip3`, respectively. Use `python -V` to check. Once you install it, there will be a `dwex` command. On Windows, there will be a `dwex.exe` in -`Scripts` under the Python folder, and also a start menu item "DWARF Explorer". +the `Scripts` folder under the Python folder, and also a start menu item "DWARF Explorer". Usage ----- diff --git a/dwex/__main__.py b/dwex/__main__.py index 4e24aea..528b12c 100644 --- a/dwex/__main__.py +++ b/dwex/__main__.py @@ -1,4 +1,4 @@ -import sys, os, io +import sys, os, io, platform from PyQt5.QtCore import Qt, QAbstractItemModel, QAbstractTableModel, QModelIndex, QSettings, QUrl from PyQt5.QtGui import QFontMetrics, QKeySequence, QDesktopServices from PyQt5.QtWidgets import * @@ -7,7 +7,7 @@ from .tree import DWARFTreeModel, has_code_location from .scriptdlg import ScriptDlg -version=(0,51) +version=(0,52) # TODO: # Low level raw bytes for expressions in location lists @@ -15,6 +15,7 @@ # What else is section_offset? # const_value as FORM_block1: an array of 4 bytes, found in iOS/4.69.8/ARMv7/DecompItem.mm # Test back-forward mouse buttons +# On MacOS, start without a main window, instead show the Open dialog #----------------------------------------------------------------- @@ -446,7 +447,6 @@ def on_updatecheck(self): try: self.start_wait() resp = urlopen('https://api.github.com/repos/sevaa/dwex/releases') - #resp = urlopen('https://api.github.com/repos/jazzband/pip-tools/releases') if resp.getcode() == 200: releases = resp.read() self.end_wait() @@ -572,5 +572,6 @@ def main(): the_window = TheWindow() the_app.exec_() +# For running via "python -m dwex" if __name__ == "__main__": main() \ No newline at end of file diff --git a/dwex/die.py b/dwex/die.py index 31410ea..188bcde 100644 --- a/dwex/die.py +++ b/dwex/die.py @@ -151,7 +151,7 @@ def format_value(self, attr): elif val == b'': return '[]' else: - return hex(val) + return val.hex() elif form == 'DW_FORM_addr' and isinstance(val, int): return hex(val) elif form == 'DW_FORM_flag_present': diff --git a/setup.py b/setup.py index 2bb1571..b25c94a 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def run(self): setup( name='dwex', - version='0.51', + version='0.52', packages=['dwex', 'dwex.dwex_elftools', 'dwex.dwex_elftools.elf', diff --git a/test/testall.py b/test/testall.py index d063261..20e4e15 100644 --- a/test/testall.py +++ b/test/testall.py @@ -1,10 +1,10 @@ import os, sys from PyQt5.QtCore import Qt, QAbstractItemModel, QAbstractTableModel, QModelIndex sys.path.insert(1, os.path.join(os.getcwd(), "dwex")) -from elftools.dwarf.locationlists import LocationParser, LocationExpr -from formats import read_dwarf -from die import DIETableModel -from tree import strip_path +from dwex.dwex_elftools.dwarf.locationlists import LocationParser, LocationExpr +from dwex.formats import read_dwarf +from dwex.die import DIETableModel +from dwex.tree import strip_path def test_dwarfinfo(di): # Some global cache setup in line with the app proper