Skip to content

Commit 2cfd1eb

Browse files
committed
Support getting and setting adapter properties from the Python API
1 parent 67e37a6 commit 2cfd1eb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

api/python/debuggercontroller.py

+13
Original file line numberDiff line numberDiff line change
@@ -1250,3 +1250,16 @@ def execute_backend_command(self, command: str) -> str:
12501250
"""
12511251
return dbgcore.BNDebuggerInvokeBackendCommand(self.handle, command)
12521252

1253+
def get_adapter_property(self, name: str) -> 'binaryninja.metadata.MetadataValueType':
1254+
md_handle = dbgcore.BNDebuggerGetAdapterProperty(self.handle, name)
1255+
if md_handle is None:
1256+
raise KeyError(name)
1257+
md_handle_BN = ctypes.cast(md_handle, ctypes.POINTER(binaryninja.core.BNMetadata))
1258+
return binaryninja.metadata.Metadata(handle=md_handle_BN).value
1259+
1260+
def set_adapter_property(self, name: str, value: binaryninja.metadata.MetadataValueType) -> bool:
1261+
_value = value
1262+
if not isinstance(_value, binaryninja.metadata.Metadata):
1263+
_value = binaryninja.metadata.Metadata(_value)
1264+
handle = ctypes.cast(_value.handle, ctypes.POINTER(dbgcore.BNMetadata))
1265+
return dbgcore.BNDebuggerSetAdapterProperty(self.handle, name, handle)

0 commit comments

Comments
 (0)