diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2022-03-08 16:09:00 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2022-03-11 20:28:57 -0500 |
| commit | 4c88144acfbb58e29742e27949e5b02ef4c4108e (patch) | |
| tree | 44491ec556214084d9e3259453406256dd59b59b /python | |
| parent | 4cdb1af22efb7374470668919bb19795a64622fd (diff) | |
Add bulk symbol management API to improve performance when adding/removing large numbers of symbols
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 9439af5e..37d85580 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -4774,6 +4774,26 @@ class BinaryView: self.handle, import_addr_sym.handle, func.handle, None if type is None else type.handle ) + def bulk_modify_symbols(self): + """ + ``bulk_modify_symbols`` returns a context manager that improves performance when adding or + removing a large number of symbols. Symbols added within the Python `with` keyword will + defer processing until the end of the block. Many symbol getter APIs will return stale + results inside the `with` block, so this function should only be used when symbol + queries are not needed at the same time as the modifications. + """ + class BulkModify: + def __init__(self, view: 'BinaryView'): + self._view = view + + def __enter__(self): + core.BNBeginBulkModifySymbols(self._view.handle) + + def __exit__(self, type, value, traceback): + core.BNEndBulkModifySymbols(self._view.handle) + + return BulkModify(self) + def create_tag_type(self, name: str, icon: str) -> 'TagType': """ ``create_tag_type`` creates a new Tag Type and adds it to the view |
