hilda 2.0.7__py3-none-any.whl → 2.0.9__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/cli.py +1 -1
- hilda/hilda_client.py +13 -1
- hilda/ipython_extensions/keybindings.py +1 -0
- hilda/launch_lldb.py +22 -0
- hilda/symbol.py +7 -0
- {hilda-2.0.7.dist-info → hilda-2.0.9.dist-info}/METADATA +28 -27
- {hilda-2.0.7.dist-info → hilda-2.0.9.dist-info}/RECORD +12 -12
- {hilda-2.0.7.dist-info → hilda-2.0.9.dist-info}/WHEEL +1 -1
- {hilda-2.0.7.dist-info → hilda-2.0.9.dist-info}/LICENSE +0 -0
- {hilda-2.0.7.dist-info → hilda-2.0.9.dist-info}/entry_points.txt +0 -0
- {hilda-2.0.7.dist-info → hilda-2.0.9.dist-info}/top_level.txt +0 -0
hilda/_version.py
CHANGED
hilda/cli.py
CHANGED
|
@@ -53,7 +53,7 @@ def attach(name: Optional[str], pid: Optional[int], startup_files: List[str]) ->
|
|
|
53
53
|
if name is not None:
|
|
54
54
|
hilda_client = create_hilda_client_using_attach_by_name(name)
|
|
55
55
|
elif pid is not None:
|
|
56
|
-
hilda_client = create_hilda_client_using_attach_by_pid(
|
|
56
|
+
hilda_client = create_hilda_client_using_attach_by_pid(pid)
|
|
57
57
|
else:
|
|
58
58
|
raise click.UsageError('You must specify a process name or pid')
|
|
59
59
|
hilda_client.interact(startup_files=startup_files)
|
hilda/hilda_client.py
CHANGED
|
@@ -58,7 +58,8 @@ GREETING = f"""
|
|
|
58
58
|
<b>Hilda has been successfully loaded! 😎
|
|
59
59
|
Usage:
|
|
60
60
|
<span style="color: magenta">p</span> Global to access all features.
|
|
61
|
-
<span style="color: magenta">F1</span> UI
|
|
61
|
+
<span style="color: magenta">F1</span> Show UI.
|
|
62
|
+
<span style="color: magenta">F2</span> Toggle enabling of stdout & stderr.
|
|
62
63
|
<span style="color: magenta">F7</span> Step Into.
|
|
63
64
|
<span style="color: magenta">F8</span> Step Over.
|
|
64
65
|
<span style="color: magenta">F9</span> Continue.
|
|
@@ -92,6 +93,8 @@ class Configs:
|
|
|
92
93
|
'doc': 'Whether to exclude NSObject during evaluation - reduce ipython autocomplete results.'})
|
|
93
94
|
objc_verbose_monitor: bool = field(default=False, metadata={
|
|
94
95
|
'doc': 'When set to True, using monitor() will automatically print objc methods arguments.'})
|
|
96
|
+
enable_stdout_stderr: bool = field(default=True, metadata={
|
|
97
|
+
'doc': 'When set to True, will enable process stdout and stderr.'})
|
|
95
98
|
|
|
96
99
|
def __repr__(self):
|
|
97
100
|
return self.__str__()
|
|
@@ -1089,6 +1092,10 @@ class HildaClient:
|
|
|
1089
1092
|
sys.argv = ['a']
|
|
1090
1093
|
IPython.start_ipython(config=ipython_config, user_ns=namespace)
|
|
1091
1094
|
|
|
1095
|
+
def toggle_enable_stdout_stderr(self, *args) -> None:
|
|
1096
|
+
self.configs.enable_stdout_stderr = not self.configs.enable_stdout_stderr
|
|
1097
|
+
self.logger.info(f'Changed stdout and stderr status to: {self.configs.enable_stdout_stderr}')
|
|
1098
|
+
|
|
1092
1099
|
def __enter__(self) -> 'HildaClient':
|
|
1093
1100
|
return self
|
|
1094
1101
|
|
|
@@ -1185,6 +1192,11 @@ class HildaClient:
|
|
|
1185
1192
|
else:
|
|
1186
1193
|
return f'{value:x} (unsupported format)'
|
|
1187
1194
|
|
|
1195
|
+
@cached_property
|
|
1196
|
+
def _object_identifier(self) -> Symbol:
|
|
1197
|
+
return self.symbols.objc_getClass('VMUObjectIdentifier').objc_call('alloc').objc_call(
|
|
1198
|
+
'initWithTask:', self.symbols.mach_task_self())
|
|
1199
|
+
|
|
1188
1200
|
@cached_property
|
|
1189
1201
|
def _ks(self) -> Optional['Ks']:
|
|
1190
1202
|
if not lldb.KEYSTONE_SUPPORT:
|
|
@@ -7,6 +7,7 @@ def load_ipython_extension(ipython):
|
|
|
7
7
|
def register_keybindings():
|
|
8
8
|
hilda = ipython.user_ns['p']
|
|
9
9
|
keys_mapping = {Keys.F1: hilda.ui_manager.show,
|
|
10
|
+
Keys.F2: hilda.toggle_enable_stdout_stderr,
|
|
10
11
|
Keys.F7: hilda.step_into,
|
|
11
12
|
Keys.F8: hilda.step_over,
|
|
12
13
|
Keys.F9: lambda _: (hilda.log_info('Sending continue'), hilda.cont()),
|
hilda/launch_lldb.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
+
import sys
|
|
3
4
|
from abc import ABC, abstractmethod
|
|
4
5
|
from threading import Thread
|
|
5
6
|
from typing import List, Optional
|
|
@@ -46,6 +47,20 @@ class LLDBListenerThread(Thread, ABC):
|
|
|
46
47
|
return
|
|
47
48
|
raise LLDBError(self.error.description)
|
|
48
49
|
|
|
50
|
+
def _process_stdout(self) -> None:
|
|
51
|
+
stdout = self.process.GetSTDOUT(1024)
|
|
52
|
+
while stdout:
|
|
53
|
+
if lldb.hilda_client is not None and lldb.hilda_client.configs.enable_stdout_stderr:
|
|
54
|
+
sys.stdout.write(stdout)
|
|
55
|
+
stdout = self.process.GetSTDOUT(1024)
|
|
56
|
+
|
|
57
|
+
def _process_stderr(self) -> None:
|
|
58
|
+
stderr = self.process.GetSTDERR(1024)
|
|
59
|
+
while stderr:
|
|
60
|
+
if lldb.hilda_client is not None and lldb.hilda_client.configs.enable_stdout_stderr:
|
|
61
|
+
sys.stderr.write(stderr)
|
|
62
|
+
stderr = self.process.GetSTDERR(1024)
|
|
63
|
+
|
|
49
64
|
def run(self):
|
|
50
65
|
event = lldb.SBEvent()
|
|
51
66
|
last_state = lldb.eStateStopped
|
|
@@ -54,6 +69,13 @@ class LLDBListenerThread(Thread, ABC):
|
|
|
54
69
|
continue
|
|
55
70
|
if not lldb.SBProcess.EventIsProcessEvent(event):
|
|
56
71
|
continue
|
|
72
|
+
|
|
73
|
+
event_type = event.GetType()
|
|
74
|
+
if event_type & lldb.SBProcess.eBroadcastBitSTDOUT:
|
|
75
|
+
self._process_stdout()
|
|
76
|
+
if event_type & lldb.SBProcess.eBroadcastBitSTDERR:
|
|
77
|
+
self._process_stderr()
|
|
78
|
+
|
|
57
79
|
state = self.process.GetStateFromEvent(event)
|
|
58
80
|
if state == lldb.eStateDetached:
|
|
59
81
|
logger.debug('Process Detached')
|
hilda/symbol.py
CHANGED
|
@@ -104,6 +104,13 @@ class Symbol(int):
|
|
|
104
104
|
"""
|
|
105
105
|
return self._client.symbols.CFCopyDescription(self).po()
|
|
106
106
|
|
|
107
|
+
@property
|
|
108
|
+
def name(self) -> str:
|
|
109
|
+
symbol_info = int(self._client.po(f'[{self._client._object_identifier} symbolForAddress:{self}]', '__int128'))
|
|
110
|
+
arg1 = symbol_info & 0xffffffffffffffff
|
|
111
|
+
arg2 = symbol_info >> 64
|
|
112
|
+
return self._client.symbols.CSSymbolGetName(arg1, arg2).peek_str()
|
|
113
|
+
|
|
107
114
|
@contextmanager
|
|
108
115
|
def change_item_size(self, new_item_size: int) -> None:
|
|
109
116
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hilda
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.9
|
|
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>
|
|
@@ -207,38 +207,39 @@ Here is a gist of methods you can access from `p`:
|
|
|
207
207
|
- Call function at given address with given parameters
|
|
208
208
|
- `monitor`
|
|
209
209
|
- Monitor every time a given address is called
|
|
210
|
+
|
|
210
211
|
The following options are available:
|
|
211
212
|
|
|
212
213
|
```
|
|
213
214
|
regs={reg1: format}
|
|
214
|
-
|
|
215
|
+
will print register values
|
|
215
216
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
Available formats:
|
|
218
|
+
x: hex
|
|
219
|
+
s: string
|
|
220
|
+
cf: use CFCopyDescription() to get more informative description of the object
|
|
221
|
+
po: use LLDB po command
|
|
222
|
+
User defined function, will be called like `format_function(hilda_client, value)`.
|
|
222
223
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
224
|
+
For example:
|
|
225
|
+
regs={'x0': 'x'} -> x0 will be printed in HEX format
|
|
226
|
+
expr={lldb_expression: format}
|
|
227
|
+
lldb_expression can be for example '$x0' or '$arg1'
|
|
228
|
+
format behaves just like 'regs' option
|
|
229
|
+
retval=format
|
|
230
|
+
Print function's return value. The format is the same as regs format.
|
|
231
|
+
stop=True
|
|
232
|
+
force a stop at every hit
|
|
233
|
+
bt=True
|
|
234
|
+
print backtrace
|
|
235
|
+
cmd=[cmd1, cmd2]
|
|
236
|
+
run several LLDB commands, one by another
|
|
237
|
+
force_return=value
|
|
238
|
+
force a return from function with the specified value
|
|
239
|
+
name=some_value
|
|
240
|
+
use `some_name` instead of the symbol name automatically extracted from the calling frame
|
|
241
|
+
override=True
|
|
242
|
+
override previous break point at same location
|
|
242
243
|
```
|
|
243
244
|
|
|
244
245
|
- `show_current_source`
|
|
@@ -3,22 +3,22 @@ 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=
|
|
7
|
-
hilda/cli.py,sha256=
|
|
6
|
+
hilda/_version.py,sha256=rF4QVJXh5PVN4TNvtStp2GIbnRo15dNx_feVf-c471k,411
|
|
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=
|
|
12
|
-
hilda/launch_lldb.py,sha256=
|
|
11
|
+
hilda/hilda_client.py,sha256=q18etn3_zYbrCncZp60N2otQyb8mNOJ3fMxgGmeyIcQ,46902
|
|
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
15
|
hilda/objective_c_class.py,sha256=Xyw7FucNVcu8NqhB0Gy-OjaN_2DmCywn6pjUEwyd1Hk,11760
|
|
16
16
|
hilda/objective_c_symbol.py,sha256=VpNzVcfvbvZxX3x-7zh_20GZ_17akr1WsdpI4KRNgt4,8400
|
|
17
17
|
hilda/registers.py,sha256=moGS9MXrfm8vmnqDKWZSg4wmZNydGUadui9uwEwzhsI,856
|
|
18
|
-
hilda/symbol.py,sha256=
|
|
18
|
+
hilda/symbol.py,sha256=_A-ivRttf7f1Fxclj23pC807r08GQ1KwHvEXnyw7FT4,7517
|
|
19
19
|
hilda/symbols_jar.py,sha256=1GPgrbXdsxiirMufrWqVi-DHF9qDXgy_HMtWJD4dJuE,6447
|
|
20
20
|
hilda/ipython_extensions/events.py,sha256=w_4V8FoJJMarWArEE8uzb2UXk1mqfslmI7XCyVb_XuE,1976
|
|
21
|
-
hilda/ipython_extensions/keybindings.py,sha256=
|
|
21
|
+
hilda/ipython_extensions/keybindings.py,sha256=Ai9wHCla6HhgZGGxc0UEOCYODcavyef_zzUC9A9GcTE,1081
|
|
22
22
|
hilda/ipython_extensions/magics.py,sha256=ULb63-OyIaWwvSfwRvEG_65ibaI2RTxeX8yPJK8pbc0,1300
|
|
23
23
|
hilda/objective_c/from_ns_to_json.m,sha256=5Ddl0UJLQXlDYwR_yjE4yZk1aOsJGxoy1oRnhZHPrTw,2847
|
|
24
24
|
hilda/objective_c/get_objectivec_class_by_module.m,sha256=DC8S8XaWsQSOJZWVWhATr98SZQobA3MmclLsBJGZTcU,704
|
|
@@ -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.9.dist-info/LICENSE,sha256=M-LVJ0AFAYB82eueyl8brh-QLPe-iLNVgbCi79-3TDo,1078
|
|
50
|
+
hilda-2.0.9.dist-info/METADATA,sha256=VgAJ0HIioD35ZJX5ch0bhpzUHNlp_57WeZWhs0FWQK0,23325
|
|
51
|
+
hilda-2.0.9.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
52
|
+
hilda-2.0.9.dist-info/entry_points.txt,sha256=9n3O3j6V3XnVR_GcFqCWNgRAbalfukTSW2WvghsLVmA,46
|
|
53
|
+
hilda-2.0.9.dist-info/top_level.txt,sha256=TVD7l1WkE1noT866YqPFhiQnjYCYZM5Xz54v_3EYpnI,11
|
|
54
|
+
hilda-2.0.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|