(instance: PythonScriptingInstance, old_value: Any, new_value: Any)
| 1412 | |
| 1413 | |
| 1414 | def _set_current_raw_offset(instance: PythonScriptingInstance, old_value: Any, new_value: Any): |
| 1415 | if instance.interpreter.active_view is None: |
| 1416 | return |
| 1417 | |
| 1418 | if isinstance(new_value, str): |
| 1419 | new_value = instance.interpreter.active_view.parse_expression( |
| 1420 | new_value, |
| 1421 | instance.interpreter.active_addr |
| 1422 | ) |
| 1423 | if type(new_value) is not int: |
| 1424 | raise ValueError("Can only replace this variable with an integer") |
| 1425 | |
| 1426 | addr = instance.interpreter.active_view.get_address_for_data_offset(new_value) |
| 1427 | if addr is not None: |
| 1428 | if not instance.interpreter.active_view.file.navigate( |
| 1429 | instance.interpreter.active_view.file.view, addr |
| 1430 | ): |
| 1431 | binaryninja.mainthread.execute_on_main_thread( |
| 1432 | lambda: instance.interpreter.locals["current_ui_context"].navigateForBinaryView( |
| 1433 | instance.interpreter.active_view, |
| 1434 | new_value |
| 1435 | ) |
| 1436 | ) |
| 1437 | |
| 1438 | |
| 1439 | PythonScriptingProvider.register_magic_variable( |
nothing calls this directly
no test coverage detected