def dump_memory(self, file_path=None, ptr=0, length=0): if ptr == 0: ptr, inp = InputDialog.input_pointer(self._app_window) if ptr > 0: if length == 0: accept, length = InputDialog.input(self._app_window, hint='insert length', placeholder='1024') if not accept: return try: if length.startswith('0x'): length = int(length, 16) else: length = int(length) except: return if file_path is None: r = QFileDialog.getSaveFileName( self._app_window, caption='Save binary dump to file') if len(r) == 0 or len(r[0]) == 0: return file_path = r[0] data = self.read_memory(ptr, length) if data is not None: with open(file_path, 'wb') as f: f.write(data)
def hook_native(self, input_=None, pending_args=None, own_input=None): if input_ is None or not isinstance(input_, str): ptr, input_ = InputDialog.input_pointer(self._app_window) else: ptr = utils.parse_ptr( self._app_window.dwarf.dwarf_api('evaluatePtr', input_)) if ptr > 0: self.temporary_input = input_ if own_input is not None: self.temporary_input = own_input self.native_pending_args = pending_args self.dwarf_api('hookNative', ptr)
def _create_bookmark(self, index=-1, ptr=''): note = '' if ptr == '': if isinstance(index, int) and index >= 0: ptr = self._bookmarks_model.item(index, 0).text() note = self._bookmarks_model.item(index, 1).text() ptr, _ = InputDialog.input_pointer(parent=self._app_window, input_content=ptr) else: if not isinstance(ptr, int): try: if ptr.startswith('0x'): ptr = int(ptr, 16) else: ptr = int(ptr) except ValueError: ptr = 0 if ptr > 0: ptr = hex(ptr) if self._bookmarks_list.uppercase_hex: ptr = ptr.upper().replace('0X', '0x') index = self._bookmarks_model.findItems(ptr, Qt.MatchExactly) if len(index) > 0: index = index[0].row() note = self._bookmarks_model.item(index, 1).text() else: index = -1 accept, note = InputDialog.input(hint='Insert notes for %s' % ptr, input_content=note) if accept: if index < 0: self.insert_bookmark(ptr, note) else: item = self._bookmarks_model.item(index, 0) item.setText(ptr) item = self._bookmarks_model.item(index, 1) item.setText(note) self.bookmarks[ptr] = note
def add_watcher(self, ptr=None): if ptr is None: ptr, input = InputDialog.input_pointer(self._app_window) if ptr == 0: return return self.dwarf_api('addWatcher', ptr)
def on_cm_jump_to_address(self, view=DEBUG_VIEW_MEMORY): ptr, _ = InputDialog.input_pointer(self.app) if ptr > 0: self.jump_to_address(ptr, view=view)