MCPcopy Create free account
hub / github.com/Vector35/debugger / DebugAdapterType

Class DebugAdapterType

api/python/debugadaptertype.py:26–83  ·  view source on GitHub ↗

The ``DebugAdapterType`` object is used to access the DebugAdapters. DebugAdapterType should not be directly instantiated; instead, use ``get_by_name`` to get an instance of DebugAdapter by name. Right now, the DebugAdapterType class cannot be used to create a DebuggerController. This

Source from the content-addressed store, hash-verified

24
25
26class DebugAdapterType:
27 """
28 The ``DebugAdapterType`` object is used to access the DebugAdapters. DebugAdapterType should not be directly
29 instantiated; instead, use ``get_by_name`` to get an instance of DebugAdapter by name.
30
31 Right now, the DebugAdapterType class cannot be used to create a DebuggerController. This is planned for the future.
32 """
33
34 def __init__(self, hande: dbgcore.BNDebugAdapterType):
35 self.handle = hande
36
37 @classmethod
38 def get_by_name(cls, name: str) -> None:
39 """
40 Get a DebugAdapterType by its name.
41
42 :param name: the name of the DebugAdapterType
43 :return:
44 """
45 cls.handle = dbgcore.BNGetDebugAdapterTypeByName(name)
46
47 def can_execute(self, bv: binaryninja.BinaryView) -> bool:
48 """
49 Whether the current DebugAdapterType can execute the specified BinaryView
50
51 :param bv: the BinaryView to check for
52 :return:
53 """
54 bv_obj = ctypes.cast(bv.handle, ctypes.POINTER(dbgcore.BNBinaryView))
55 return dbgcore.BNDebugAdapterTypeCanExecute(self.handle, bv_obj)
56
57 def can_connect(self, bv: binaryninja.BinaryView) -> bool:
58 """
59 Whether the current DebugAdapterType can connect to a remote host for the specified BinaryView
60
61 :param bv: the BinaryView to check for
62 :return:
63 """
64 bv_obj = ctypes.cast(bv.handle, ctypes.POINTER(dbgcore.BNBinaryView))
65 return dbgcore.BNDebugAdapterTypeCanConnect(self.handle, bv_obj)
66
67 @staticmethod
68 def get_available_adapters(bv: binaryninja.BinaryView) -> List[str]:
69 """
70 Get a list of available DebugAdapters for the specified BinaryView. The DebugAdapters in the list can be used to
71 debug the BinaryView.
72
73 :param bv: the BinaryView to check for
74 :return: list of available DebugAdapters
75 """
76 count = ctypes.c_ulonglong()
77 bv_obj = ctypes.cast(bv.handle, ctypes.POINTER(dbgcore.BNBinaryView))
78 adapters = dbgcore.BNGetAvailableDebugAdapterTypes(bv_obj, count)
79 result = []
80 for i in range(count.value):
81 result.append(adapters[i].decode('utf-8'))
82 dbgcore.BNDebuggerFreeStringList(adapters, count)
83 return result

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected