hilda 2.0.0__py3-none-any.whl → 2.0.2__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 +4 -4
- hilda/common.py +9 -0
- hilda/exceptions.py +6 -1
- hilda/hilda_client.py +16 -9
- hilda/ipython_extensions/keybindings.py +2 -2
- hilda/launch_lldb.py +15 -2
- {hilda-2.0.0.dist-info → hilda-2.0.2.dist-info}/METADATA +6 -1
- {hilda-2.0.0.dist-info → hilda-2.0.2.dist-info}/RECORD +13 -13
- {hilda-2.0.0.dist-info → hilda-2.0.2.dist-info}/LICENSE +0 -0
- {hilda-2.0.0.dist-info → hilda-2.0.2.dist-info}/WHEEL +0 -0
- {hilda-2.0.0.dist-info → hilda-2.0.2.dist-info}/entry_points.txt +0 -0
- {hilda-2.0.0.dist-info → hilda-2.0.2.dist-info}/top_level.txt +0 -0
hilda/_version.py
CHANGED
hilda/cli.py
CHANGED
|
@@ -54,10 +54,10 @@ def attach(name: str, pid: int, startup_files: Optional[List[str]] = None) -> No
|
|
|
54
54
|
@click.argument('exec_path')
|
|
55
55
|
@click.option('--argv', multiple=True, help='Command line arguments to pass to the process')
|
|
56
56
|
@click.option('--envp', multiple=True, callback=parse_envp, help='Environment variables in the form KEY=VALUE')
|
|
57
|
-
@click.option('--stdin', type=
|
|
58
|
-
@click.option('--stdout', type=
|
|
59
|
-
@click.option('--stderr', type=
|
|
60
|
-
@click.option('--cwd', type=
|
|
57
|
+
@click.option('--stdin', type=str, help='Redirect stdin from this file path')
|
|
58
|
+
@click.option('--stdout', type=str, help='Redirect stdout to this file path')
|
|
59
|
+
@click.option('--stderr', type=str, help='Redirect stderr to this file path')
|
|
60
|
+
@click.option('--cwd', type=str, help='Set the working directory for the process')
|
|
61
61
|
@click.option('--flags', type=click.INT, default=0, help='Launch flags (bitmask)')
|
|
62
62
|
@click.option('--stop-at-entry', is_flag=True, help='Stop the process at the entry point')
|
|
63
63
|
@startup_files_option
|
hilda/common.py
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from typing import Any, List, Mapping, Tuple, Union
|
|
3
3
|
|
|
4
|
+
import inquirer3
|
|
5
|
+
from inquirer3.themes import GreenPassion
|
|
6
|
+
|
|
4
7
|
CfSerializable = Union[
|
|
5
8
|
Mapping[str, Any], List, Tuple[Any, ...], str, bool, float, bytes, datetime, None]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def selection_prompt(options_list: List):
|
|
12
|
+
question = [inquirer3.List('choice', message='choose device', choices=options_list, carousel=True)]
|
|
13
|
+
result = inquirer3.prompt(question, theme=GreenPassion(), raise_keyboard_interrupt=True)
|
|
14
|
+
return result['choice']
|
hilda/exceptions.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
__all__ = ['HildaException', 'SymbolAbsentError', 'EvaluatingExpressionError', 'CreatingObjectiveCSymbolError',
|
|
2
2
|
'ConvertingToNsObjectError', 'ConvertingFromNSObjectError', 'DisableJetsamMemoryChecksError',
|
|
3
3
|
'GettingObjectiveCClassError', 'AccessingRegisterError', 'AccessingMemoryError',
|
|
4
|
-
'BrokenLocalSymbolsJarError', 'AddingLldbSymbolError', 'LLDBException']
|
|
4
|
+
'BrokenLocalSymbolsJarError', 'AddingLldbSymbolError', 'LLDBException', 'InvalidThreadIndexError']
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class HildaException(Exception):
|
|
@@ -70,3 +70,8 @@ class BrokenLocalSymbolsJarError(HildaException):
|
|
|
70
70
|
class AddingLldbSymbolError(HildaException):
|
|
71
71
|
""" Raise when failing to convert a LLDB symbol to Hilda's symbol. """
|
|
72
72
|
pass
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class InvalidThreadIndexError(HildaException):
|
|
76
|
+
""" Raise when thread idx invalid """
|
|
77
|
+
pass
|
hilda/hilda_client.py
CHANGED
|
@@ -30,10 +30,11 @@ from tqdm import tqdm
|
|
|
30
30
|
from traitlets.config import Config
|
|
31
31
|
|
|
32
32
|
from hilda import objective_c_class
|
|
33
|
-
from hilda.common import CfSerializable
|
|
33
|
+
from hilda.common import CfSerializable, selection_prompt
|
|
34
34
|
from hilda.exceptions import AccessingMemoryError, AccessingRegisterError, AddingLldbSymbolError, \
|
|
35
35
|
BrokenLocalSymbolsJarError, ConvertingFromNSObjectError, ConvertingToNsObjectError, CreatingObjectiveCSymbolError, \
|
|
36
|
-
DisableJetsamMemoryChecksError, EvaluatingExpressionError, HildaException,
|
|
36
|
+
DisableJetsamMemoryChecksError, EvaluatingExpressionError, HildaException, InvalidThreadIndexError, \
|
|
37
|
+
SymbolAbsentError
|
|
37
38
|
from hilda.lldb_importer import lldb
|
|
38
39
|
from hilda.objective_c_symbol import ObjectiveCSymbol
|
|
39
40
|
from hilda.registers import Registers
|
|
@@ -340,8 +341,6 @@ class HildaClient:
|
|
|
340
341
|
|
|
341
342
|
if not self.process.Stop().Success():
|
|
342
343
|
self.log_critical('failed to stop process')
|
|
343
|
-
else:
|
|
344
|
-
self.log_info('Process Stopped')
|
|
345
344
|
|
|
346
345
|
def cont(self, *args) -> None:
|
|
347
346
|
""" Continue process. """
|
|
@@ -357,8 +356,6 @@ class HildaClient:
|
|
|
357
356
|
|
|
358
357
|
if not self.process.Continue().Success():
|
|
359
358
|
self.log_critical('failed to continue process')
|
|
360
|
-
else:
|
|
361
|
-
self.log_info('Process Continued')
|
|
362
359
|
|
|
363
360
|
def detach(self):
|
|
364
361
|
"""
|
|
@@ -514,7 +511,7 @@ class HildaClient:
|
|
|
514
511
|
if options.get('name', False):
|
|
515
512
|
name = options['name']
|
|
516
513
|
|
|
517
|
-
log_message = f'🚨 #{bp.id} 0x{symbol:x} {name}'
|
|
514
|
+
log_message = f'🚨 #{bp.id} 0x{symbol:x} {name} - Thread #{self.thread.idx}:{hex(self.thread.id)}'
|
|
518
515
|
|
|
519
516
|
if 'regs' in options:
|
|
520
517
|
log_message += '\nregs:'
|
|
@@ -528,7 +525,7 @@ class HildaClient:
|
|
|
528
525
|
value = hilda.symbol(hilda.evaluate_expression(name))
|
|
529
526
|
log_message += f'\n\t{name} = {hilda._monitor_format_value(fmt, value)}'
|
|
530
527
|
|
|
531
|
-
if options.get('force_return',
|
|
528
|
+
if options.get('force_return', None) is not None:
|
|
532
529
|
hilda.force_return(options['force_return'])
|
|
533
530
|
log_message += f'\nforced return: {options["force_return"]}'
|
|
534
531
|
|
|
@@ -537,7 +534,7 @@ class HildaClient:
|
|
|
537
534
|
hilda.finish()
|
|
538
535
|
hilda.bt()
|
|
539
536
|
|
|
540
|
-
if options.get('retval',
|
|
537
|
+
if options.get('retval', None) is not None:
|
|
541
538
|
# return from function
|
|
542
539
|
hilda.finish()
|
|
543
540
|
value = hilda.evaluate_expression('$arg1')
|
|
@@ -884,6 +881,16 @@ class HildaClient:
|
|
|
884
881
|
spec.loader.exec_module(m)
|
|
885
882
|
return m
|
|
886
883
|
|
|
884
|
+
def set_selected_thread(self, idx: Optional[int] = None) -> None:
|
|
885
|
+
if idx is None:
|
|
886
|
+
thread = selection_prompt(self.process.threads)
|
|
887
|
+
else:
|
|
888
|
+
try:
|
|
889
|
+
thread = [t for t in self.process.threads if t.idx == idx][0]
|
|
890
|
+
except IndexError:
|
|
891
|
+
raise InvalidThreadIndexError()
|
|
892
|
+
self.process.SetSelectedThread(thread)
|
|
893
|
+
|
|
887
894
|
def unwind(self) -> bool:
|
|
888
895
|
""" Unwind the stack (useful when get_evaluation_unwind() == False) """
|
|
889
896
|
return self.thread.UnwindInnermostExpression().Success()
|
|
@@ -8,8 +8,8 @@ def load_ipython_extension(ipython):
|
|
|
8
8
|
hilda = ipython.user_ns['p']
|
|
9
9
|
keys_mapping = {Keys.F7: hilda.step_into,
|
|
10
10
|
Keys.F8: hilda.step_over,
|
|
11
|
-
Keys.F9: hilda.cont,
|
|
12
|
-
Keys.F10: hilda.stop}
|
|
11
|
+
Keys.F9: lambda _: (hilda.log_info('Sending continue'), hilda.cont()),
|
|
12
|
+
Keys.F10: lambda _: (hilda.log_info('Sending stop'), hilda.stop())}
|
|
13
13
|
|
|
14
14
|
insert_mode = ViInsertMode() | EmacsInsertMode()
|
|
15
15
|
registry = ipython.pt_app.key_bindings
|
hilda/launch_lldb.py
CHANGED
|
@@ -70,9 +70,22 @@ class LLDBListenerThread(Thread, ABC):
|
|
|
70
70
|
logger.debug(f'Process Exited with status {self.process.GetExitStatus()}')
|
|
71
71
|
self.should_quit = True
|
|
72
72
|
elif state == lldb.eStateRunning and last_state == lldb.eStateStopped:
|
|
73
|
-
logger.debug(
|
|
73
|
+
logger.debug('Process Continued')
|
|
74
74
|
elif state == lldb.eStateStopped and last_state == lldb.eStateRunning:
|
|
75
75
|
logger.debug('Process Stopped')
|
|
76
|
+
for thread in self.process:
|
|
77
|
+
frame = thread.GetFrameAtIndex(0)
|
|
78
|
+
stop_reason = thread.GetStopReason()
|
|
79
|
+
logger.debug(f'tid = {hex(thread.GetThreadID())} pc = {frame.GetPC()}')
|
|
80
|
+
if stop_reason not in [lldb.eStopReasonSignal, lldb.eStopReasonException,
|
|
81
|
+
lldb.eStopReasonBreakpoint,
|
|
82
|
+
lldb.eStopReasonWatchpoint, lldb.eStopReasonPlanComplete,
|
|
83
|
+
lldb.eStopReasonTrace,
|
|
84
|
+
lldb.eStopReasonSignal]:
|
|
85
|
+
continue
|
|
86
|
+
self.process.SetSelectedThread(thread)
|
|
87
|
+
break
|
|
88
|
+
|
|
76
89
|
last_state = state
|
|
77
90
|
|
|
78
91
|
|
|
@@ -114,7 +127,7 @@ class LLDBAttachName(LLDBListenerThread):
|
|
|
114
127
|
return self.debugger.CreateTargetWithFileAndArch(None, None)
|
|
115
128
|
|
|
116
129
|
def _create_process(self) -> lldb.SBProcess:
|
|
117
|
-
logger.debug(f'Attaching to {self.
|
|
130
|
+
logger.debug(f'Attaching to {self.proc_name}')
|
|
118
131
|
return self.target.AttachToProcessWithName(self.listener, self.proc_name, self.wait_for, self.error)
|
|
119
132
|
|
|
120
133
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hilda
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
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>
|
|
@@ -51,6 +51,7 @@ Requires-Dist: construct
|
|
|
51
51
|
Requires-Dist: pymobiledevice3
|
|
52
52
|
Requires-Dist: keystone-engine
|
|
53
53
|
Requires-Dist: tabulate
|
|
54
|
+
Requires-Dist: inquirer3
|
|
54
55
|
Provides-Extra: test
|
|
55
56
|
Requires-Dist: pytest ; extra == 'test'
|
|
56
57
|
|
|
@@ -370,6 +371,10 @@ Here is a gist of methods you can access from `p`:
|
|
|
370
371
|
- Import & reload given python module (intended mainly for external snippets)
|
|
371
372
|
- `unwind`
|
|
372
373
|
- Unwind the stack (useful when get_evaluation_unwind() == False)
|
|
374
|
+
- `set_selected_thread`
|
|
375
|
+
- sets the currently selected thread, which is used in other parts of the program, such as displaying disassembly or
|
|
376
|
+
checking registers.
|
|
377
|
+
This ensures the application focuses on the specified thread for these operations.
|
|
373
378
|
|
|
374
379
|
## Magic functions
|
|
375
380
|
|
|
@@ -3,13 +3,13 @@ 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=
|
|
8
|
-
hilda/common.py,sha256=
|
|
9
|
-
hilda/exceptions.py,sha256=
|
|
6
|
+
hilda/_version.py,sha256=ld-j3TUpFlKQqUdd5gCrvB3csNXi_lXdKFr5cuIfSdk,411
|
|
7
|
+
hilda/cli.py,sha256=XCL9vD4zWkK2GHnkeBXZ5AC08iC4rtHYBydgi6SzGJI,3325
|
|
8
|
+
hilda/common.py,sha256=VFtpOH9IRqbu6lONM6Hz-PxcdJfktgS3akJv5UCHO0s,523
|
|
9
|
+
hilda/exceptions.py,sha256=a2EGckJ66ArG2LZJVnUz91gRkqQyc9AEtbS_mfZuI3s,2141
|
|
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=QQowZuvTu0Z9heGaBmLoKqjRa7BdjezEnkx15Jt-y7Y,43997
|
|
12
|
+
hilda/launch_lldb.py,sha256=OeZjIILxt6lVQdZnD67E2QHfEK2XU_B-HTa5ZI0NTkw,7920
|
|
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
|
|
@@ -18,7 +18,7 @@ hilda/registers.py,sha256=moGS9MXrfm8vmnqDKWZSg4wmZNydGUadui9uwEwzhsI,856
|
|
|
18
18
|
hilda/symbol.py,sha256=_TSQqFysRs82BFNGX9o_ZbkrwzSsWq3FiMbX92VKoPo,7200
|
|
19
19
|
hilda/symbols_jar.py,sha256=1GPgrbXdsxiirMufrWqVi-DHF9qDXgy_HMtWJD4dJuE,6447
|
|
20
20
|
hilda/ipython_extensions/events.py,sha256=uV30ZJMwpRw9YwGnQ40uAOh9Mtr8QGJFB7cZeY-pCow,1960
|
|
21
|
-
hilda/ipython_extensions/keybindings.py,sha256=
|
|
21
|
+
hilda/ipython_extensions/keybindings.py,sha256=2NiTwfakowCj1VT6eEDvMeMiFx_pBvkhVDaQPuX69uM,957
|
|
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.2.dist-info/LICENSE,sha256=M-LVJ0AFAYB82eueyl8brh-QLPe-iLNVgbCi79-3TDo,1078
|
|
50
|
+
hilda-2.0.2.dist-info/METADATA,sha256=agMwzWcpALitue6mJodwdAa3VHvhvfNdlOAKd3GIukk,23891
|
|
51
|
+
hilda-2.0.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
52
|
+
hilda-2.0.2.dist-info/entry_points.txt,sha256=9n3O3j6V3XnVR_GcFqCWNgRAbalfukTSW2WvghsLVmA,46
|
|
53
|
+
hilda-2.0.2.dist-info/top_level.txt,sha256=TVD7l1WkE1noT866YqPFhiQnjYCYZM5Xz54v_3EYpnI,11
|
|
54
|
+
hilda-2.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|