summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2024-01-11 14:23:54 +0800
committerXusheng <xusheng@vector35.com>2024-01-11 14:23:54 +0800
commit3ac99aa88c7019c8313304ef74dd5bbb468a74bc (patch)
treea3b32aa0810255559dafaff2319a94d9af329f3a /python
parent17aca5059072a5167a0d10eaee70c529083d569b (diff)
Expose the BinaryView::ForgetUndoActions API and use avoid undo actions warning in the debugger
Diffstat (limited to 'python')
-rw-r--r--python/filemetadata.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/python/filemetadata.py b/python/filemetadata.py
index b21537f2..ec0e16bb 100644
--- a/python/filemetadata.py
+++ b/python/filemetadata.py
@@ -399,6 +399,34 @@ class FileMetadata:
id = ""
core.BNCommitUndoActions(self.handle, id)
+ def forget_undo_actions(self, id: Optional[str] = None) -> None:
+ """
+ ``forget_undo_actions`` removes the actions taken since a call to :py:func:`begin_undo_actions`
+ Pass as `id` the value returned by :py:func:`begin_undo_actions`. Empty values of
+ `id` will remove all changes since the last call to :py:func:`begin_undo_actions`.
+
+ :param Optional[str] id: id of undo state, from :py:func:`begin_undo_actions`
+ :rtype: None
+ :Example:
+
+ >>> bv.get_disassembly(0x100012f1)
+ 'xor eax, eax'
+ >>> state = bv.begin_undo_actions()
+ >>> bv.convert_to_nop(0x100012f1)
+ True
+ >>> bv.commit_undo_actions(state)
+ >>> bv.get_disassembly(0x100012f1)
+ 'nop'
+ >>> bv.undo()
+ >>> bv.get_disassembly(0x100012f1)
+ 'nop'
+ >>>
+ """
+
+ if id is None:
+ id = ""
+ core.BNForgetUndoActions(self.handle, id)
+
def revert_undo_actions(self, id: Optional[str] = None) -> None:
"""
``revert_undo_actions`` reverts the actions taken since a call to :py:func:`begin_undo_actions`