hilda 3.0.1__py3-none-any.whl → 3.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hilda/_version.py +16 -3
- hilda/breakpoints.py +30 -7
- hilda/decorators.py +46 -0
- hilda/exceptions.py +1 -6
- hilda/hilda_client.py +21 -70
- hilda/ipython_extensions/events.py +14 -18
- hilda/objective_c_class.py +86 -29
- hilda/objective_c_symbol.py +5 -16
- hilda/snippets/libmalloc.py +9 -9
- hilda/symbol.py +48 -12
- hilda/symbols.py +595 -0
- hilda/watchpoints.py +41 -9
- {hilda-3.0.1.dist-info → hilda-3.2.1.dist-info}/METADATA +107 -183
- {hilda-3.0.1.dist-info → hilda-3.2.1.dist-info}/RECORD +18 -18
- {hilda-3.0.1.dist-info → hilda-3.2.1.dist-info}/WHEEL +1 -1
- hilda/hilda_ascii_art.html +0 -40
- hilda/symbols_jar.py +0 -208
- {hilda-3.0.1.dist-info → hilda-3.2.1.dist-info}/entry_points.txt +0 -0
- {hilda-3.0.1.dist-info → hilda-3.2.1.dist-info/licenses}/LICENSE +0 -0
- {hilda-3.0.1.dist-info → hilda-3.2.1.dist-info}/top_level.txt +0 -0
hilda/symbols_jar.py
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
from contextlib import suppress
|
|
2
|
-
|
|
3
|
-
from hilda.exceptions import AddingLldbSymbolError, SymbolAbsentError
|
|
4
|
-
from hilda.lldb_importer import lldb
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class SymbolsJar(dict):
|
|
8
|
-
@staticmethod
|
|
9
|
-
def create(client):
|
|
10
|
-
"""
|
|
11
|
-
Factory method for creating symbols jars
|
|
12
|
-
:param client: Hilda client
|
|
13
|
-
:rtype: SymbolsJar
|
|
14
|
-
"""
|
|
15
|
-
jar = SymbolsJar()
|
|
16
|
-
jar.__dict__['_client'] = client
|
|
17
|
-
return jar
|
|
18
|
-
|
|
19
|
-
def get_lazy(self, name):
|
|
20
|
-
client = self.__dict__['_client']
|
|
21
|
-
if '{' in name:
|
|
22
|
-
# remove module name from symbol
|
|
23
|
-
name = name.split('{', 1)[0]
|
|
24
|
-
for s in client.target.FindSymbols(name):
|
|
25
|
-
with suppress(AddingLldbSymbolError):
|
|
26
|
-
return client.add_lldb_symbol(s.symbol)
|
|
27
|
-
return None
|
|
28
|
-
|
|
29
|
-
def __getitem__(self, item):
|
|
30
|
-
if item not in self:
|
|
31
|
-
symbol = self.get_lazy(item)
|
|
32
|
-
if symbol:
|
|
33
|
-
return symbol
|
|
34
|
-
return dict.__getitem__(self, item)
|
|
35
|
-
|
|
36
|
-
def __getattr__(self, name):
|
|
37
|
-
if name not in self:
|
|
38
|
-
client = self.__dict__['_client']
|
|
39
|
-
for s in client.target.FindSymbols(name):
|
|
40
|
-
with suppress(AddingLldbSymbolError):
|
|
41
|
-
return client.add_lldb_symbol(s.symbol)
|
|
42
|
-
raise SymbolAbsentError(f'no such symbol: {name}')
|
|
43
|
-
|
|
44
|
-
return self.get(name)
|
|
45
|
-
|
|
46
|
-
def __setattr__(self, key, value):
|
|
47
|
-
return self.__setitem__(key, value)
|
|
48
|
-
|
|
49
|
-
def __delattr__(self, item):
|
|
50
|
-
return self.__delitem__(item)
|
|
51
|
-
|
|
52
|
-
def __sub__(self, other):
|
|
53
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
54
|
-
for k1, v1 in self.items():
|
|
55
|
-
if k1 not in other:
|
|
56
|
-
retval[k1] = v1
|
|
57
|
-
return retval
|
|
58
|
-
|
|
59
|
-
def __add__(self, other):
|
|
60
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
61
|
-
for k, v in other.items():
|
|
62
|
-
retval[k] = v
|
|
63
|
-
for k, v in self.items():
|
|
64
|
-
retval[k] = v
|
|
65
|
-
return retval
|
|
66
|
-
|
|
67
|
-
def bp(self, callback=None, **args):
|
|
68
|
-
"""
|
|
69
|
-
Place a breakpoint on all symbols in current jar.
|
|
70
|
-
Look for the bp command for more details.
|
|
71
|
-
:param callback: callback function to be executed upon an hit
|
|
72
|
-
:param args: optional args for the bp command
|
|
73
|
-
"""
|
|
74
|
-
for k, v in self.items():
|
|
75
|
-
v.bp(callback, **args)
|
|
76
|
-
|
|
77
|
-
def by_module(self):
|
|
78
|
-
"""
|
|
79
|
-
Filter to only names containing their module names
|
|
80
|
-
:return: reduced symbol jar
|
|
81
|
-
"""
|
|
82
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
83
|
-
for k, v in self.items():
|
|
84
|
-
if '{' not in k or '}' not in k:
|
|
85
|
-
continue
|
|
86
|
-
retval[k] = v
|
|
87
|
-
return retval
|
|
88
|
-
|
|
89
|
-
def by_type(self, lldb_type):
|
|
90
|
-
"""
|
|
91
|
-
Filter by LLDB symbol types (for example: lldb.eSymbolTypeCode,
|
|
92
|
-
lldb.eSymbolTypeData, ...)
|
|
93
|
-
:param lldb_type: symbol type from LLDB consts
|
|
94
|
-
:return: symbols matching the type filter
|
|
95
|
-
"""
|
|
96
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
97
|
-
for k, v in self.items():
|
|
98
|
-
if v.type_ == lldb_type:
|
|
99
|
-
retval[k] = v
|
|
100
|
-
return retval
|
|
101
|
-
|
|
102
|
-
def code(self):
|
|
103
|
-
"""
|
|
104
|
-
Filter only code symbols
|
|
105
|
-
:return: symbols with type lldb.eSymbolTypeCode
|
|
106
|
-
"""
|
|
107
|
-
return self.by_type(lldb.eSymbolTypeCode)
|
|
108
|
-
|
|
109
|
-
def data(self):
|
|
110
|
-
"""
|
|
111
|
-
Filter only data symbols
|
|
112
|
-
:return: symbols with type lldb.eSymbolTypeCode
|
|
113
|
-
"""
|
|
114
|
-
return self.by_type(lldb.eSymbolTypeData)
|
|
115
|
-
|
|
116
|
-
def objc_class(self):
|
|
117
|
-
"""
|
|
118
|
-
Filter only objc meta classes
|
|
119
|
-
:return: symbols with type lldb.eSymbolTypeObjCMetaClass
|
|
120
|
-
"""
|
|
121
|
-
return self.clean().by_type(lldb.eSymbolTypeObjCMetaClass)
|
|
122
|
-
|
|
123
|
-
def clean(self):
|
|
124
|
-
"""
|
|
125
|
-
Filter only symbols without module suffix
|
|
126
|
-
:return: reduced symbol jar
|
|
127
|
-
"""
|
|
128
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
129
|
-
for k, v in self.items():
|
|
130
|
-
if '{' in k:
|
|
131
|
-
continue
|
|
132
|
-
retval[k] = v
|
|
133
|
-
return retval
|
|
134
|
-
|
|
135
|
-
def monitor(self, **args):
|
|
136
|
-
"""
|
|
137
|
-
Perform monitor for all symbols in current jar.
|
|
138
|
-
See monitor command for more details.
|
|
139
|
-
:param args: given arguments for monitor command
|
|
140
|
-
"""
|
|
141
|
-
for name, address in self.items():
|
|
142
|
-
options = args.copy()
|
|
143
|
-
if name == '_client':
|
|
144
|
-
continue
|
|
145
|
-
if self.__dict__['_client'].configs.objc_verbose_monitor:
|
|
146
|
-
arg_count = name.count(':')
|
|
147
|
-
if arg_count > 0:
|
|
148
|
-
arg_count = min(6, arg_count)
|
|
149
|
-
options['expr'] = {f'$arg{i + 3}': 'po' for i in range(arg_count)}
|
|
150
|
-
name = options.get('name', name)
|
|
151
|
-
address.monitor(name=name, **options)
|
|
152
|
-
|
|
153
|
-
def startswith(self, exp, case_sensitive=True):
|
|
154
|
-
"""
|
|
155
|
-
Filter only symbols with given prefix
|
|
156
|
-
:param exp: prefix
|
|
157
|
-
:param case_sensitive: is case sensitive
|
|
158
|
-
:return: reduced symbol jar
|
|
159
|
-
"""
|
|
160
|
-
if not case_sensitive:
|
|
161
|
-
exp = exp.lower()
|
|
162
|
-
|
|
163
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
164
|
-
for k, v in self.items():
|
|
165
|
-
orig_k = k
|
|
166
|
-
if not case_sensitive:
|
|
167
|
-
k = k.lower()
|
|
168
|
-
if k.startswith(exp):
|
|
169
|
-
retval[orig_k] = v
|
|
170
|
-
return retval
|
|
171
|
-
|
|
172
|
-
def endswith(self, exp, case_sensitive=True):
|
|
173
|
-
"""
|
|
174
|
-
Filter only symbols with given prefix
|
|
175
|
-
:param exp: prefix
|
|
176
|
-
:param case_sensitive: is case sensitive
|
|
177
|
-
:return: reduced symbol jar
|
|
178
|
-
"""
|
|
179
|
-
if not case_sensitive:
|
|
180
|
-
exp = exp.lower()
|
|
181
|
-
|
|
182
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
183
|
-
for k, v in self.items():
|
|
184
|
-
orig_k = k
|
|
185
|
-
if not case_sensitive:
|
|
186
|
-
k = k.lower()
|
|
187
|
-
if k.endswith(exp):
|
|
188
|
-
retval[orig_k] = v
|
|
189
|
-
return retval
|
|
190
|
-
|
|
191
|
-
def find(self, exp, case_sensitive=True):
|
|
192
|
-
"""
|
|
193
|
-
Filter symbols containing a given expression
|
|
194
|
-
:param exp: given expression
|
|
195
|
-
:param case_sensitive: is case sensitive
|
|
196
|
-
:return: reduced symbol jar
|
|
197
|
-
"""
|
|
198
|
-
if not case_sensitive:
|
|
199
|
-
exp = exp.lower()
|
|
200
|
-
|
|
201
|
-
retval = SymbolsJar.create(self.__dict__['_client'])
|
|
202
|
-
for k, v in self.items():
|
|
203
|
-
orig_k = k
|
|
204
|
-
if not case_sensitive:
|
|
205
|
-
k = k.lower()
|
|
206
|
-
if exp in k:
|
|
207
|
-
retval[orig_k] = v
|
|
208
|
-
return retval
|
|
File without changes
|
|
File without changes
|
|
File without changes
|