Skip to content

Commit 0b1ffb5

Browse files
committed
Fixes
1 parent b5b08bf commit 0b1ffb5

File tree

4 files changed

+34
-26
lines changed

4 files changed

+34
-26
lines changed

dwex/__main__.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from .treedlg import TreeDlg
2020

2121
# Sync with version in setup.py
22-
version = (4, 48)
22+
version = (4, 49)
2323
the_app = None
2424

2525
# TODO:
@@ -397,28 +397,29 @@ def on_switchslice(self):
397397

398398
# Index is a tree index - the DIE is the data object within
399399
def display_die(self, index):
400-
die = index.internalPointer()
401-
die_table = self.die_table
402-
if not self.die_model:
403-
self.die_model = DIETableModel(die, self.prefix, self.lowlevel, self.hex, self.dwarfregnames)
404-
die_table.setModel(self.die_model)
405-
die_table.selectionModel().currentChanged.connect(self.on_attribute_selection)
406-
else:
407-
self.die_model.display_DIE(die)
408-
self.die_table.resizeColumnsToContents()
409-
self.details_table.setModel(None)
410-
self.followref_menuitem.setEnabled(False)
411-
self.followref_tbitem.setEnabled(False)
412-
self.cuproperties_menuitem.setEnabled(True)
413-
self.die_table.setCurrentIndex(QModelIndex()) # Will cause on_attribute_selection
414-
415-
#TODO: resize the attribute table vertically dynamically
416-
#attr_count = self.die_model.rowCount(None)
417-
#die_table.resize(die_table.size().width(),
418-
# die_table.rowViewportPosition(attr_count-1) +
419-
# die_table.rowHeight(attr_count-1) +
420-
# die_table.horizontalHeader().size().height() + 1 + attr_count)
421-
#self.rpane_layout.update()
400+
if self.details_table and self.die_table: # Short out for #1753
401+
die = index.internalPointer()
402+
die_table = self.die_table
403+
if not self.die_model:
404+
self.die_model = DIETableModel(die, self.prefix, self.lowlevel, self.hex, self.dwarfregnames)
405+
die_table.setModel(self.die_model)
406+
die_table.selectionModel().currentChanged.connect(self.on_attribute_selection)
407+
else:
408+
self.die_model.display_DIE(die)
409+
self.die_table.resizeColumnsToContents()
410+
self.details_table.setModel(None)
411+
self.followref_menuitem.setEnabled(False)
412+
self.followref_tbitem.setEnabled(False)
413+
self.cuproperties_menuitem.setEnabled(True)
414+
self.die_table.setCurrentIndex(QModelIndex()) # Will cause on_attribute_selection
415+
416+
#TODO: resize the attribute table vertically dynamically
417+
#attr_count = self.die_model.rowCount(None)
418+
#die_table.resize(die_table.size().width(),
419+
# die_table.rowViewportPosition(attr_count-1) +
420+
# die_table.rowHeight(attr_count-1) +
421+
# die_table.horizontalHeader().size().height() + 1 + attr_count)
422+
#self.rpane_layout.update()
422423

423424
# Invoked for tree clicks and keyboard navigation, ref follow, back-forward
424425
def on_tree_selection(self, index, prev = None):

dwex/crash.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def make_exc_report(exc, tb, version, catchpoint, ctxt=None):
7070
report += "DWEX " + '.'.join(str(v) for v in version) + "\n"
7171
report += "Python " + sys.version + "\n"
7272
report += "System: " + platform.platform() + "\n"
73+
try:
74+
import elftools
75+
if hasattr(elftools, '__version__'):
76+
report += "Pyelftools: " + elftools.__version__ + "\n"
77+
except ImportError:
78+
pass
7379
if _binary_desc:
7480
report += "Binary: " + _binary_desc + "\n"
7581
try:

dwex/patch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import elftools.dwarf.dwarf_expr
99
import elftools.dwarf.locationlists
1010
import elftools.elf.elffile
11+
import elftools.elf.dynamic
1112
import elftools.dwarf.dwarfinfo
1213
import filebytes.mach_o
1314
import filebytes.pe
@@ -17,7 +18,7 @@
1718
from elftools.dwarf.dwarfinfo import DebugSectionDescriptor
1819
from elftools.elf.relocation import RelocationHandler
1920
from elftools.elf.sections import Section
20-
from elftools.elf.dynamic import DynamicSection, Dynamic
21+
from elftools.elf.dynamic import Dynamic
2122
from elftools.dwarf.locationlists import LocationLists, LocationListsPair
2223
from elftools.construct.core import StaticField
2324
from filebytes.mach_o import LSB_64_Section, MH, SectionData, LoadCommand, LoadCommandData, LC
@@ -105,7 +106,7 @@ def DynamicSection_init(self, header, name, elffile):
105106
stringtable = elffile.get_section(header['sh_link'], ('SHT_STRTAB', 'SHT_NOBITS', 'SHT_NULL'))
106107
Dynamic.__init__(self, self.stream, self.elffile, stringtable,
107108
self['sh_offset'], self['sh_type'] == 'SHT_NOBITS')
108-
DynamicSection.__init__ = DynamicSection_init
109+
elftools.elf.dynamic.DynamicSection.__init__ = DynamicSection_init
109110

110111
# Short out import directory parsing for now
111112
filebytes.pe.PE._parseDataDirectory = lambda self,a,b,c: None

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def run(self):
123123

124124
setup(
125125
name='dwex',
126-
version='4.48', # Sync with version in __main__
126+
version='4.49', # Sync with version in __main__
127127
packages=['dwex'],
128128
url="https://github.com/sevaa/dwex/",
129129
entry_points={"gui_scripts": ["dwex = dwex.__main__:main"]},

0 commit comments

Comments
 (0)