hilda 2.0.11__py3-none-any.whl → 2.0.13__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 +2 -2
- hilda/hilda_client.py +43 -14
- hilda/objective_c_class.py +2 -3
- hilda/objective_c_symbol.py +1 -2
- hilda/symbol.py +2 -2
- {hilda-2.0.11.dist-info → hilda-2.0.13.dist-info}/METADATA +4 -2
- {hilda-2.0.11.dist-info → hilda-2.0.13.dist-info}/RECORD +11 -11
- {hilda-2.0.11.dist-info → hilda-2.0.13.dist-info}/WHEEL +1 -1
- {hilda-2.0.11.dist-info → hilda-2.0.13.dist-info}/LICENSE +0 -0
- {hilda-2.0.11.dist-info → hilda-2.0.13.dist-info}/entry_points.txt +0 -0
- {hilda-2.0.11.dist-info → hilda-2.0.13.dist-info}/top_level.txt +0 -0
hilda/_version.py
CHANGED
hilda/hilda_client.py
CHANGED
|
@@ -125,9 +125,29 @@ def stop_is_needed(func: Callable):
|
|
|
125
125
|
return wrapper
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
class
|
|
129
|
-
|
|
128
|
+
class HildaBreakpoint:
|
|
129
|
+
def __init__(self, hilda_client: 'HildaClient', lldb_breakpoint: lldb.SBBreakpoint,
|
|
130
|
+
address: Union[str, int], forced: bool = False, options: Optional[typing.Mapping] = None,
|
|
131
|
+
callback: Optional[Callable] = None) -> None:
|
|
132
|
+
self._hilda_client = hilda_client
|
|
133
|
+
self.address = address
|
|
134
|
+
self.forced = forced
|
|
135
|
+
self.options = options
|
|
136
|
+
self.callback = callback
|
|
137
|
+
self.lldb_breakpoint = lldb_breakpoint
|
|
138
|
+
|
|
139
|
+
def __repr__(self) -> str:
|
|
140
|
+
return (f'<{self.__class__.__name__} LLDB:{self.lldb_breakpoint} FORCED:{self.forced} OPTIONS:{self.options} '
|
|
141
|
+
f'CALLBACK:{self.callback}>')
|
|
142
|
+
|
|
143
|
+
def __str__(self) -> str:
|
|
144
|
+
return repr(self)
|
|
130
145
|
|
|
146
|
+
def remove(self) -> None:
|
|
147
|
+
self._hilda_client.remove_hilda_breakpoint(self.lldb_breakpoint.id)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class HildaClient:
|
|
131
151
|
RETVAL_BIT_COUNT = 64
|
|
132
152
|
|
|
133
153
|
def __init__(self, debugger: lldb.SBDebugger):
|
|
@@ -146,6 +166,7 @@ class HildaClient:
|
|
|
146
166
|
self._dynamic_env_loaded = False
|
|
147
167
|
self._symbols_loaded = False
|
|
148
168
|
self.globals: typing.MutableMapping[str, Any] = globals()
|
|
169
|
+
self._hilda_root = Path(__file__).parent
|
|
149
170
|
|
|
150
171
|
# the frame called within the context of the hit BP
|
|
151
172
|
self._bp_frame = None
|
|
@@ -168,7 +189,7 @@ class HildaClient:
|
|
|
168
189
|
Get dictionary of all open FDs
|
|
169
190
|
:return: Mapping between open FDs and their paths
|
|
170
191
|
"""
|
|
171
|
-
data = (
|
|
192
|
+
data = (self._hilda_root / 'objective_c' / 'lsof.m').read_text()
|
|
172
193
|
result = json.loads(self.po(data))
|
|
173
194
|
# convert FDs into int
|
|
174
195
|
return {int(k): v for k, v in result.items()}
|
|
@@ -347,6 +368,16 @@ class HildaClient:
|
|
|
347
368
|
if not self.process.Stop().Success():
|
|
348
369
|
self.log_critical('failed to stop process')
|
|
349
370
|
|
|
371
|
+
def run_for(self, seconds: float) -> None:
|
|
372
|
+
"""
|
|
373
|
+
Run the process for a given time
|
|
374
|
+
:return:
|
|
375
|
+
"""
|
|
376
|
+
self.cont()
|
|
377
|
+
self.logger.info(f'Running for {seconds} seconds')
|
|
378
|
+
time.sleep(seconds)
|
|
379
|
+
self.stop()
|
|
380
|
+
|
|
350
381
|
def cont(self, *args) -> None:
|
|
351
382
|
""" Continue process. """
|
|
352
383
|
is_running = self.process.GetState() == lldb.eStateRunning
|
|
@@ -462,7 +493,7 @@ class HildaClient:
|
|
|
462
493
|
with self.stopped():
|
|
463
494
|
return self.evaluate_expression(call_expression)
|
|
464
495
|
|
|
465
|
-
def monitor(self, address, condition: str = None, **options) ->
|
|
496
|
+
def monitor(self, address, condition: str = None, **options) -> HildaBreakpoint:
|
|
466
497
|
"""
|
|
467
498
|
Monitor every time a given address is called
|
|
468
499
|
|
|
@@ -602,7 +633,7 @@ class HildaClient:
|
|
|
602
633
|
if remove_forced or not bp.forced:
|
|
603
634
|
self.remove_hilda_breakpoint(bp_id)
|
|
604
635
|
|
|
605
|
-
def remove_hilda_breakpoint(self, bp_id):
|
|
636
|
+
def remove_hilda_breakpoint(self, bp_id: int) -> None:
|
|
606
637
|
"""
|
|
607
638
|
Remove a single breakpoint placed by Hilda
|
|
608
639
|
:param bp_id: Breakpoint's ID
|
|
@@ -636,7 +667,7 @@ class HildaClient:
|
|
|
636
667
|
print(highlight(entitlements, XmlLexer(), TerminalTrueColorFormatter()))
|
|
637
668
|
|
|
638
669
|
def bp(self, address_or_name: Union[int, str], callback: Optional[Callable] = None, condition: str = None,
|
|
639
|
-
forced=False, module_name: Optional[str] = None, **options) ->
|
|
670
|
+
forced=False, module_name: Optional[str] = None, **options) -> HildaBreakpoint:
|
|
640
671
|
"""
|
|
641
672
|
Add a breakpoint
|
|
642
673
|
:param address_or_name:
|
|
@@ -665,15 +696,14 @@ class HildaClient:
|
|
|
665
696
|
bp.SetCondition(condition)
|
|
666
697
|
|
|
667
698
|
# add into Hilda's internal list of breakpoints
|
|
668
|
-
self.breakpoints[bp.id] =
|
|
669
|
-
|
|
670
|
-
)
|
|
699
|
+
self.breakpoints[bp.id] = HildaBreakpoint(self, bp, address=address_or_name, forced=forced, options=options,
|
|
700
|
+
callback=callback)
|
|
671
701
|
|
|
672
702
|
if callback is not None:
|
|
673
703
|
bp.SetScriptCallbackFunction('lldb.hilda_client.bp_callback_router')
|
|
674
704
|
|
|
675
705
|
self.log_info(f'Breakpoint #{bp.id} has been set')
|
|
676
|
-
return bp
|
|
706
|
+
return self.breakpoints[bp.id]
|
|
677
707
|
|
|
678
708
|
def bp_callback_router(self, frame, bp_loc, *_):
|
|
679
709
|
"""
|
|
@@ -828,8 +858,7 @@ class HildaClient:
|
|
|
828
858
|
json_data = json.dumps({'root': data}, default=self._to_ns_json_default)
|
|
829
859
|
except TypeError as e:
|
|
830
860
|
raise ConvertingToNsObjectError from e
|
|
831
|
-
|
|
832
|
-
obj_c_code = (Path(__file__).parent / 'objective_c' / 'to_ns_from_json.m').read_text()
|
|
861
|
+
obj_c_code = (self._hilda_root / 'objective_c' / 'to_ns_from_json.m').read_text()
|
|
833
862
|
expression = obj_c_code.replace('__json_object_dump__', json_data.replace('"', r'\"'))
|
|
834
863
|
try:
|
|
835
864
|
return self.evaluate_expression(expression)
|
|
@@ -842,7 +871,7 @@ class HildaClient:
|
|
|
842
871
|
:param address: NS object.
|
|
843
872
|
:return: Python object.
|
|
844
873
|
"""
|
|
845
|
-
obj_c_code = (
|
|
874
|
+
obj_c_code = (self._hilda_root / 'objective_c' / 'from_ns_to_json.m').read_text()
|
|
846
875
|
address = f'0x{address:x}' if isinstance(address, int) else address
|
|
847
876
|
expression = obj_c_code.replace('__ns_object_address__', address)
|
|
848
877
|
try:
|
|
@@ -1212,7 +1241,7 @@ class HildaClient:
|
|
|
1212
1241
|
continue
|
|
1213
1242
|
objc_classlist = m.FindSection('__DATA').FindSubSection('__objc_classlist')
|
|
1214
1243
|
objc_classlist_addr = self.symbol(objc_classlist.GetLoadAddress(self.target))
|
|
1215
|
-
obj_c_code = (
|
|
1244
|
+
obj_c_code = (self._hilda_root / 'objective_c' / 'get_objectivec_class_by_module.m').read_text()
|
|
1216
1245
|
obj_c_code = obj_c_code.replace('__count_objc_class', f'{objc_classlist.size // 8}').replace(
|
|
1217
1246
|
'__objc_class_list',
|
|
1218
1247
|
f'{objc_classlist_addr}')
|
hilda/objective_c_class.py
CHANGED
|
@@ -3,7 +3,6 @@ import time
|
|
|
3
3
|
from collections import namedtuple
|
|
4
4
|
from dataclasses import dataclass, field
|
|
5
5
|
from functools import partial
|
|
6
|
-
from pathlib import Path
|
|
7
6
|
from typing import Any
|
|
8
7
|
from uuid import uuid4
|
|
9
8
|
|
|
@@ -120,7 +119,7 @@ class Class(object):
|
|
|
120
119
|
:param hilda.hilda_client.HildaClient client: Hilda client.
|
|
121
120
|
:param class_name: Class name.
|
|
122
121
|
"""
|
|
123
|
-
obj_c_code = (
|
|
122
|
+
obj_c_code = (client._hilda_root / 'objective_c' / 'get_objectivec_class_description.m').read_text()
|
|
124
123
|
obj_c_code = obj_c_code.replace('__class_address__', '0').replace('__class_name__', class_name)
|
|
125
124
|
class_symbol = Class(client, class_data=json.loads(client.po(obj_c_code)))
|
|
126
125
|
if class_symbol.name != class_name:
|
|
@@ -143,7 +142,7 @@ class Class(object):
|
|
|
143
142
|
Reload class object data.
|
|
144
143
|
Should be used whenever the class layout changes (for example, during method swizzling)
|
|
145
144
|
"""
|
|
146
|
-
obj_c_code = (
|
|
145
|
+
obj_c_code = (self._client._hilda_root / 'objective_c' / 'get_objectivec_class_description.m').read_text()
|
|
147
146
|
obj_c_code = obj_c_code.replace('__class_address__', f'{self._class_object:d}')
|
|
148
147
|
obj_c_code = obj_c_code.replace('__class_name__', self.name)
|
|
149
148
|
self._load_class_data(json.loads(self._client.po(obj_c_code)))
|
hilda/objective_c_symbol.py
CHANGED
|
@@ -2,7 +2,6 @@ import json
|
|
|
2
2
|
from contextlib import suppress
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from functools import partial
|
|
5
|
-
from pathlib import Path
|
|
6
5
|
|
|
7
6
|
from objc_types_decoder.decode import decode as decode_type
|
|
8
7
|
from pygments import highlight
|
|
@@ -60,7 +59,7 @@ class ObjectiveCSymbol(Symbol):
|
|
|
60
59
|
self.methods.clear()
|
|
61
60
|
self.class_ = None
|
|
62
61
|
|
|
63
|
-
obj_c_code = (
|
|
62
|
+
obj_c_code = (self._client._hilda_root / 'objective_c' / 'get_objectivec_symbol_data.m').read_text()
|
|
64
63
|
obj_c_code = obj_c_code.replace('__symbol_address__', f'{self:d}')
|
|
65
64
|
data = json.loads(self._client.po(obj_c_code))
|
|
66
65
|
|
hilda/symbol.py
CHANGED
|
@@ -139,10 +139,10 @@ class Symbol(int):
|
|
|
139
139
|
def peek_str(self) -> str:
|
|
140
140
|
return self._client.peek_str(self)
|
|
141
141
|
|
|
142
|
-
def monitor(self, **args)
|
|
142
|
+
def monitor(self, **args):
|
|
143
143
|
return self._client.monitor(self, **args)
|
|
144
144
|
|
|
145
|
-
def bp(self, callback=None, **args)
|
|
145
|
+
def bp(self, callback=None, **args):
|
|
146
146
|
return self._client.bp(self, callback, **args)
|
|
147
147
|
|
|
148
148
|
def disass(self, size, **args) -> lldb.SBInstructionList:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hilda
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.13
|
|
4
4
|
Summary: LLDB wrapped and empowered by iPython's features
|
|
5
5
|
Author-email: doronz88 <doron88@gmail.com>, matan <matan1008@gmail.com>, netanel cohen <netanelc305@protonmail.com>
|
|
6
6
|
Maintainer-email: doronz88 <doron88@gmail.com>, matan <matan1008@gmail.com>, netanel cohen <netanelc305@protonmail.com>
|
|
@@ -53,7 +53,7 @@ Requires-Dist: keystone-engine
|
|
|
53
53
|
Requires-Dist: tabulate
|
|
54
54
|
Requires-Dist: inquirer3
|
|
55
55
|
Provides-Extra: test
|
|
56
|
-
Requires-Dist: pytest
|
|
56
|
+
Requires-Dist: pytest; extra == "test"
|
|
57
57
|
|
|
58
58
|
# Hilda
|
|
59
59
|
|
|
@@ -189,6 +189,8 @@ Here is a gist of methods you can access from `p`:
|
|
|
189
189
|
- Stop process.
|
|
190
190
|
- `cont`
|
|
191
191
|
- Continue process.
|
|
192
|
+
- `run_for`
|
|
193
|
+
- Run the process for given interval.
|
|
192
194
|
- `detach`
|
|
193
195
|
- Detach from process.
|
|
194
196
|
Useful in order to exit gracefully so process doesn't get killed
|
|
@@ -3,19 +3,19 @@ gifs/ui.png,sha256=iaRwNZ9qVWUkUe2TJb_6VPsTu--7HrElA2duWiyZ-Oc,131
|
|
|
3
3
|
gifs/xpc_print_message.gif,sha256=i5S8Y9bJm9n-NtOipFTAC8_jUR4uZCM4sOap_ccJX0k,939935
|
|
4
4
|
hilda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
hilda/__main__.py,sha256=KWRqvukK4wraxCMtvH5nO25mFXLO5aWXa7z_VfAtbO8,90
|
|
6
|
-
hilda/_version.py,sha256=
|
|
6
|
+
hilda/_version.py,sha256=03q6muYYEHl3bICYdLw7UcLk8T_DpKy5-BjpwZM00Nk,413
|
|
7
7
|
hilda/cli.py,sha256=1-COYHseHcWPhuNXaf-SbAOum_iW4WkAp3K_YGa2Ero,3624
|
|
8
8
|
hilda/common.py,sha256=VFtpOH9IRqbu6lONM6Hz-PxcdJfktgS3akJv5UCHO0s,523
|
|
9
9
|
hilda/exceptions.py,sha256=8L1OvOqns4O4ieiH4YlrMbZkk_PvuyCq4UyqFAodkF8,2042
|
|
10
10
|
hilda/hilda_ascii_art.html,sha256=-9YCjAKdGbjtdd6uoKrxkkcJq7j16r4dGka2bZ27b4o,120119
|
|
11
|
-
hilda/hilda_client.py,sha256=
|
|
11
|
+
hilda/hilda_client.py,sha256=N1vAjODqQaTcuLaD4uLPmpReyLyvZrVFCPQkz-LwJZ8,48027
|
|
12
12
|
hilda/launch_lldb.py,sha256=ziRQd1LUz8URcJdV1mjjUs09Uo6NeO4TZfENPhan-3g,8038
|
|
13
13
|
hilda/lldb_entrypoint.py,sha256=vTiClzfiTtjorlxEfIsI-W657KEGobx74qDhaZ8nPhM,1007
|
|
14
14
|
hilda/lldb_importer.py,sha256=LrIQnigDG3wgmIPXya67oBlWubkDgV-rEpzfWNEYCoc,553
|
|
15
|
-
hilda/objective_c_class.py,sha256=
|
|
16
|
-
hilda/objective_c_symbol.py,sha256=
|
|
15
|
+
hilda/objective_c_class.py,sha256=gdYpwSMW-unHII6VIzBBj65H3zGIbUfWSn9ACEMcJGQ,11735
|
|
16
|
+
hilda/objective_c_symbol.py,sha256=oTyAlaPrxr2s6HFVPOvlsv0mk1xoadNEbP5kztloUQs,8378
|
|
17
17
|
hilda/registers.py,sha256=moGS9MXrfm8vmnqDKWZSg4wmZNydGUadui9uwEwzhsI,856
|
|
18
|
-
hilda/symbol.py,sha256=
|
|
18
|
+
hilda/symbol.py,sha256=BywATxg8SypKCWLRGrXSHgpM87G7PFgXuXOthWsKlaY,7475
|
|
19
19
|
hilda/symbols_jar.py,sha256=Vqdv6iH92P6aSfcz5XiR0FbNRqKuUu48mi-GxvPr32w,6504
|
|
20
20
|
hilda/ipython_extensions/events.py,sha256=w_4V8FoJJMarWArEE8uzb2UXk1mqfslmI7XCyVb_XuE,1976
|
|
21
21
|
hilda/ipython_extensions/keybindings.py,sha256=Ai9wHCla6HhgZGGxc0UEOCYODcavyef_zzUC9A9GcTE,1081
|
|
@@ -46,9 +46,9 @@ hilda/snippets/macho/macho_load_commands.py,sha256=OsajG2xWuRwhYhj9f-lnUiNe43Yum
|
|
|
46
46
|
hilda/ui/colors.json,sha256=f-ITquY3IInQreviTy23JfmxfJrGM1_MivACf1GKGqM,262
|
|
47
47
|
hilda/ui/ui_manager.py,sha256=BmzI1sBx0PYCQDlB9Al7wsTEAMJxaJ7NW0DS4C7g5-0,2265
|
|
48
48
|
hilda/ui/views.py,sha256=1u_eZzw7wAEP1bm_-9nkqgGhMSX__woiUuoBgnsAKVM,7843
|
|
49
|
-
hilda-2.0.
|
|
50
|
-
hilda-2.0.
|
|
51
|
-
hilda-2.0.
|
|
52
|
-
hilda-2.0.
|
|
53
|
-
hilda-2.0.
|
|
54
|
-
hilda-2.0.
|
|
49
|
+
hilda-2.0.13.dist-info/LICENSE,sha256=M-LVJ0AFAYB82eueyl8brh-QLPe-iLNVgbCi79-3TDo,1078
|
|
50
|
+
hilda-2.0.13.dist-info/METADATA,sha256=vOG673zpKqn0isEEWRh5-gzxdft7ifO0gID7En_FxK0,23377
|
|
51
|
+
hilda-2.0.13.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
52
|
+
hilda-2.0.13.dist-info/entry_points.txt,sha256=9n3O3j6V3XnVR_GcFqCWNgRAbalfukTSW2WvghsLVmA,46
|
|
53
|
+
hilda-2.0.13.dist-info/top_level.txt,sha256=TVD7l1WkE1noT866YqPFhiQnjYCYZM5Xz54v_3EYpnI,11
|
|
54
|
+
hilda-2.0.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|