Skip to content

Commit

Permalink
hilda_client: Buxfix _generate_call_expression and stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
netanelc305 committed Jul 5, 2023
1 parent eb23868 commit 6b1b3dc
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions hilda/hilda_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from hilda.snippets.mach import CFRunLoopServiceMachPort_hooks
from hilda.symbol import Symbol
from hilda.symbols_jar import SymbolsJar
from launch_lldb import disable_logs
from hilda.launch_lldb import disable_logs

IsaMagic = namedtuple('IsaMagic', 'mask value')
ISA_MAGICS = [
Expand Down Expand Up @@ -605,7 +605,7 @@ def bp(self, address, callback=None, condition: str = None, forced=False, **opti

def bp_callback_router(self, frame, bp_loc, *_):
"""
Route the breakpoint callback the the specific breakpoint callback.
Route the breakpoint callback the specific breakpoint callback.
:param lldb.SBFrame frame: LLDB Frame object.
:param lldb.SBBreakpointLocation bp_loc: LLDB Breakpoint location object.
"""
Expand Down Expand Up @@ -899,13 +899,13 @@ def stopped(self, interval=0):

if is_running:
self.stop()
time.sleep(1)
time.sleep(interval)

try:
yield
finally:
if is_running:
time.sleep(1)
time.sleep(interval)
self.cont()

@contextmanager
Expand Down Expand Up @@ -1113,12 +1113,11 @@ def _serialize_call_params(self, argv):
raise NotImplementedError('cannot serialize argument')
return args_conv

@staticmethod
def _generate_call_expression(address, params):
def _generate_call_expression(self, address, params):
args_type = ','.join(['intptr_t'] * len(params))
args_conv = ','.join(params)

if self.target.modules[0].triple.split('-')[0] == 'arm64e':
if self.arch == 'arm64e':
address = f'ptrauth_sign_unauthenticated((void *){address}, ptrauth_key_asia, 0)'

return f'((intptr_t(*)({args_type}))({address}))({args_conv})'
Expand Down

0 comments on commit 6b1b3dc

Please sign in to comment.