Skip to content

Commit

Permalink
Fix register_event_callback calls BNDebuggerRegisterEventCallback wit…
Browse files Browse the repository at this point in the history
…h wrong parameters. Fix Vector35#429
  • Loading branch information
xusheng6 committed Feb 15, 2023
1 parent 4fffb8a commit 3730dc8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api/python/debuggercontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@ class DebuggerEventWrapper:
_debugger_events = {}

@classmethod
def register(cls, controller: 'DebuggerController', callback: DebuggerEventCallback) -> int:
def register(cls, controller: 'DebuggerController', callback: DebuggerEventCallback, name: str) -> int:
callback_obj = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.POINTER(dbgcore.BNDebuggerEvent))\
(lambda ctxt, event: cls._notify(event[0], callback))
handle = dbgcore.BNDebuggerRegisterEventCallback(controller.handle, callback_obj, None)
handle = dbgcore.BNDebuggerRegisterEventCallback(controller.handle, callback_obj, name, None)
cls._debugger_events[handle] = callback_obj
return handle

Expand Down Expand Up @@ -1240,16 +1240,17 @@ def exit_code(self) -> int:
"""
return dbgcore.BNDebuggerGetExitCode(self.handle)

def register_event_callback(self, callback: DebuggerEventCallback) -> int:
def register_event_callback(self, callback: DebuggerEventCallback, name: str = '') -> int:
"""
Register a debugger event callback to receive notification when various events happen.
The callback receives DebuggerEvent object that contains the type of the event and associated data.
:param callback:
:param callback: the callback to register
:param name: name of the callback
:return: an integer handle to the registered event callback
"""
return DebuggerEventWrapper.register(self, callback)
return DebuggerEventWrapper.register(self, callback, name)

def remove_event_callback(self, index: int):
"""
Expand Down

0 comments on commit 3730dc8

Please sign in to comment.