def __init__(self, app, flags=None): super(QDebugPanel, self).__init__(flags) self.setDockOptions(QMainWindow.AnimatedDocks | QMainWindow.AllowNestedDocks | QMainWindow.AllowTabbedDocks) self.app = app self.q_settings = app.q_settings self.functions_list = DwarfListView() self.functions_list_model = QStandardItemModel(0, 1) self.functions_list_model.setHeaderData(0, Qt.Horizontal, '') self.functions_list.setModel(self.functions_list_model) self.functions_list.setHeaderHidden(True) self.functions_list.doubleClicked.connect( self._function_double_clicked) self.dock_functions_list = QDockWidget('Functions', self) self.dock_functions_list.setObjectName('functions') self.dock_functions_list.setWidget(self.functions_list) self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_functions_list) self.resizeDocks([self.dock_functions_list], [100], Qt.Horizontal) self.app.debug_view_menu.addAction( self.dock_functions_list.toggleViewAction()) screen_size = QtWidgets.QDesktopWidget().screenGeometry(-1) m_width = screen_size.width() self.memory_panel = HexEditor(self.app) self.memory_panel.debug_panel = self self.memory_panel.dataChanged.connect(self.on_memory_modified) self.disassembly_panel = DisassemblyView(self.app) self.disassembly_panel.debug_panel = self self.dock_memory_panel = QDockWidget('Memory', self) self.dock_memory_panel.setWidget(self.memory_panel) self.dock_memory_panel.setObjectName('memory') self.dock_disassembly_panel = QDockWidget('Disassembly', self) self.dock_disassembly_panel.setWidget(self.disassembly_panel) self.dock_disassembly_panel.setObjectName('disassembly') self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_memory_panel, Qt.Horizontal) self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_disassembly_panel, Qt.Horizontal) if m_width >= 1920: self.splitDockWidget(self.dock_memory_panel, self.dock_disassembly_panel, Qt.Horizontal) else: self.tabifyDockWidget(self.dock_memory_panel, self.dock_disassembly_panel) self.restoreUiState()
def __init__(self, app, flags=None): super(QDebugPanel, self).__init__(flags) self.setDockOptions(QMainWindow.AnimatedDocks | QMainWindow.AllowNestedDocks | QMainWindow.AllowTabbedDocks) self.app = app self.q_settings = app.q_settings screen_size = QtWidgets.QDesktopWidget().screenGeometry(-1) m_width = screen_size.width() self.memory_panel = HexEditor(self.app) self.memory_panel.debug_panel = self self.memory_panel.dataChanged.connect(self.on_memory_modified) self.disassembly_panel = DisassemblyView(self.app) self.disassembly_panel.debug_panel = self self.dock_memory_panel = QDockWidget('Memory', self) self.dock_memory_panel.setWidget(self.memory_panel) self.dock_memory_panel.setObjectName('memory') self.dock_disassembly_panel = QDockWidget('Disassembly', self) self.dock_disassembly_panel.setWidget(self.disassembly_panel) self.dock_disassembly_panel.setObjectName('disassembly') self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_memory_panel, Qt.Horizontal) self.addDockWidget(Qt.LeftDockWidgetArea, self.dock_disassembly_panel, Qt.Horizontal) if m_width >= 1920: self.splitDockWidget(self.dock_memory_panel, self.dock_disassembly_panel, Qt.Horizontal) else: self.tabifyDockWidget(self.dock_memory_panel, self.dock_disassembly_panel) self.restoreUiState()
def __init__(self, plugin, *__args): super().__init__(*__args) self.plugin = plugin self.app = plugin.app self.emulator = plugin.emulator self.until_address = 0 self._uc_user_arch = None self._uc_user_mode = None self._cs_user_arch = None self._cs_user_mode = None layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self._toolbar_container = QHBoxLayout() self._toolbar = QToolBar() self._toolbar.addAction('Start', self.handle_start) self._toolbar.addAction('Step', self.handle_step) self._toolbar.addAction('Step next call', self.handle_step_next_call) self._toolbar.addAction('Stop', self.handle_stop) self._toolbar.addAction('Clear', self.handle_clear) self._toolbar.addAction('Options', self.handle_options) self._toolbar_container.addWidget(self._toolbar) selection_layout = QHBoxLayout() selection_layout.setAlignment(Qt.AlignRight) self.cpu_selection = QComboBox(self) index = 0 for v in unicorn_const.__dict__: if 'UC_ARCH_' in v: item = '_'.join(v.split('_')[2:]).lower() if self.app.dwarf.arch == item: index = self.cpu_selection.count() elif self.app.dwarf.arch == 'x64' and item == 'x86' or self.app.dwarf == 'ia32' and item == 'x86': index = self.cpu_selection.count() self.cpu_selection.addItem(item, unicorn_const.__dict__[v]) self.cpu_selection.activated[str].connect(self._on_cpu_selection) self.cpu_selection.setCurrentIndex(index) self.mode_selection = QComboBox(self) index = 0 for v in unicorn_const.__dict__: if 'UC_MODE_' in v: item = '_'.join(v.split('_')[2:]).lower() if self.app.dwarf.arch == item: index = self.mode_selection.count() elif (self.app.dwarf.arch == 'x64' or self.app.dwarf.arch == 'arm64') and item == '64': index = self.mode_selection.count() elif self.app.dwarf.arch == 'ia32' and item == '32': index = self.mode_selection.count() self.mode_selection.addItem(item, unicorn_const.__dict__[v]) self.mode_selection.activated[str].connect(self._on_mode_selection) self.mode_selection.setCurrentIndex(index) selection_layout.addWidget(self.cpu_selection) selection_layout.addWidget(self.mode_selection) self._toolbar_container.addLayout(selection_layout) layout.addLayout(self._toolbar_container) self.tabs = QTabWidget() self.assembly = DisassemblyView(self.app) self.assembly.display_jumps = False self.assembly.follow_jumps = False #self.memory_table = HexEditor(self.app) #self.memory_table._read_only = True self.tabs.addTab(self.assembly, 'Code') #self.tabs.addTab(self.memory_table, 'Memory') layout.addWidget(self.tabs) self.ranges_list = DwarfListView(self.app) self.ranges_list.doubleClicked.connect(self.ranges_item_double_clicked) self._ranges_model = QStandardItemModel(0, 2) self._ranges_model.setHeaderData(0, Qt.Horizontal, 'Memory') self._ranges_model.setHeaderData(0, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._ranges_model.setHeaderData(1, Qt.Horizontal, 'Size') self.ranges_list.setModel(self._ranges_model) self.tabs.addTab(self.ranges_list, 'Ranges') self._access_list = DwarfListView(self.app) self._access_list.doubleClicked.connect( self.access_item_double_clicked) self._access_model = QStandardItemModel(0, 3) self._access_model.setHeaderData(0, Qt.Horizontal, 'Address') self._access_model.setHeaderData(0, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._access_model.setHeaderData(1, Qt.Horizontal, 'Access') self._access_model.setHeaderData(1, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._access_model.setHeaderData(2, Qt.Horizontal, 'Value') self._access_list.setModel(self._access_model) self.tabs.addTab(self._access_list, 'Access') layout.setSpacing(0) self.setLayout(layout) self.console = plugin.console self.emulator.onEmulatorSetup.connect(self.on_emulator_setup) self.emulator.onEmulatorStart.connect(self.on_emulator_start) self.emulator.onEmulatorStop.connect(self.on_emulator_stop) # self.emulator.onEmulatorStep.connect(self.on_emulator_step) self.emulator.onEmulatorHook.connect(self.on_emulator_hook) self.emulator.onEmulatorMemoryHook.connect( self.on_emulator_memory_hook) self.emulator.onEmulatorMemoryRangeMapped.connect( self.on_emulator_memory_range_mapped) self.emulator.onEmulatorLog.connect(self.on_emulator_log) self._require_register_result = None self._last_instruction_address = 0