diff --git a/api/python/debuggercontroller.py b/api/python/debuggercontroller.py index 47570178..767ea2c4 100644 --- a/api/python/debuggercontroller.py +++ b/api/python/debuggercontroller.py @@ -1652,3 +1652,15 @@ def __ne__(self, other): def __hash__(self): return hash(ctypes.addressof(self.handle.contents)) + + +def _get_debugger(instance: binaryninja.PythonScriptingInstance): + if instance.interpreter.active_view is None: + return None + return DebuggerController(instance.interpreter.active_view) + + +binaryninja.PythonScriptingProvider.register_magic_variable( + "dbg", + _get_debugger +)