From 0d28293999682389b0eb09128dba99b2723a6efb Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Thu, 5 Nov 2020 12:43:25 -0500 Subject: Allow force rebase in python API when UI is enabled. --- python/binaryview.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'python') diff --git a/python/binaryview.py b/python/binaryview.py index fe052ccc..16127873 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -5171,19 +5171,22 @@ class BinaryView(object): """ core.BNReanalyzeAllFunctions(self.handle) - def rebase(self, address, progress_func = None): + def rebase(self, address, force = False, progress_func = None): """ ``rebase`` rebase the existing :py:class:`BinaryView` into a new :py:class:`BinaryView` at the specified virtual address - .. note:: This method should not be called from the UI and is intended for headless operation only. + .. note:: This method does not update cooresponding UI components. If the `BinaryView` is associated with + UI components then initiate the rebase operation within the UI, e.g. using the command palette. If working with views that + are not associated with UI components while the UI is active, then set ``force`` to ``True`` to enable rebasing. :param int address: virtual address of the start of the :py:class:`BinaryView` + :param bool force: enable rebasing while the UI is active :return: the new :py:class:`BinaryView` object or ``None`` on failure :rtype: :py:class:`BinaryView` or ``None`` """ result = False - if core.BNIsUIEnabled(): - log.log_warn("The BinaryView.rebase API is for headless operation only.") + if core.BNIsUIEnabled() and not force: + log.log_warn("The BinaryView rebase API does not update cooresponding UI components. If the BinaryView is not associated with the UI rerun with 'force = True'.") return None if progress_func is None: result = core.BNRebase(self.handle, address) -- cgit v1.3.1