@@ -67,19 +67,19 @@ class CallbackHandler(object):
67
67
def __init__ (self ):
68
68
self .callbacks = {} # Key -> [callback list]
69
69
70
- def add_callback (self , name , callback ):
71
- """Add a callback to the key @name , iff the @callback isn't already
70
+ def add_callback (self , key , callback ):
71
+ """Add a callback to the key @key , iff the @callback isn't already
72
72
assigned to it"""
73
- if callback not in self .callbacks .get (name , []):
74
- self .callbacks [name ] = self .callbacks .get (name , []) + [callback ]
73
+ if callback not in self .callbacks .get (key , []):
74
+ self .callbacks [key ] = self .callbacks .get (key , []) + [callback ]
75
75
76
- def set_callback (self , name , * args ):
77
- "Set the list of callback for key 'name '"
78
- self .callbacks [name ] = list (args )
76
+ def set_callback (self , key , * args ):
77
+ "Set the list of callback for key 'key '"
78
+ self .callbacks [key ] = list (args )
79
79
80
- def get_callbacks (self , name ):
81
- "Return the list of callbacks associated to key 'name '"
82
- return self .callbacks .get (name , [])
80
+ def get_callbacks (self , key ):
81
+ "Return the list of callbacks associated to key 'key '"
82
+ return self .callbacks .get (key , [])
83
83
84
84
def remove_callback (self , callback ):
85
85
"""Remove the callback from the list.
@@ -101,30 +101,30 @@ def remove_callback(self, callback):
101
101
102
102
return empty_keys
103
103
104
- def has_callbacks (self , name ):
105
- return name in self .callbacks
104
+ def has_callbacks (self , key ):
105
+ return key in self .callbacks
106
106
107
- def remove_name (self , name ):
108
- """Remove and return all callbacks associated to @name """
109
- callbacks = self .callbacks .get (name , [])
110
- del self .callbacks [name ]
107
+ def remove_key (self , key ):
108
+ """Remove and return all callbacks associated to @key """
109
+ callbacks = self .callbacks .get (key , [])
110
+ del self .callbacks [key ]
111
111
return callbacks
112
112
113
- def call_callbacks (self , name , * args ):
114
- """Call callbacks associated to key 'name ' with arguments args. While
113
+ def call_callbacks (self , key , * args ):
114
+ """Call callbacks associated to key 'key ' with arguments args. While
115
115
callbacks return True, continue with next callback.
116
116
Iterator on other results."""
117
117
118
118
res = True
119
119
120
- for c in self .get_callbacks (name ):
120
+ for c in self .get_callbacks (key ):
121
121
res = c (* args )
122
122
if res is not True :
123
123
yield res
124
124
125
- def __call__ (self , name , * args ):
125
+ def __call__ (self , key , * args ):
126
126
"Wrapper for call_callbacks"
127
- return self .call_callbacks (name , * args )
127
+ return self .call_callbacks (key , * args )
128
128
129
129
130
130
class CallbackHandlerBitflag (CallbackHandler ):
@@ -309,7 +309,7 @@ def remove_breakpoints_by_address(self, address):
309
309
"""Remove all breakpoints associated with @address.
310
310
@address: address of breakpoints to remove
311
311
"""
312
- callbacks = self .breakpoints_handler .remove_name (address )
312
+ callbacks = self .breakpoints_handler .remove_key (address )
313
313
if callbacks :
314
314
self .jit .remove_disassembly_splits (address )
315
315
0 commit comments