Fix REPL hang when target crashes during evaluation of expression

This commit is contained in:
Ole André Vadla Ravnås
2015-06-15 18:30:11 +02:00
parent b22a895ddd
commit 4eba79d000
+5 -1
View File
@@ -155,6 +155,8 @@ def main():
output = hexdump(value).rstrip("\n")
else:
output = json.dumps(value, sort_keys=True, indent=4, separators=(",", ": "))
except frida.InvalidOperationError:
return
except Exception as ex:
error = ex.message
output = Fore.RED + Style.BRIGHT + error['name'] + Style.RESET_ALL + ": " + error['message']
@@ -268,7 +270,9 @@ def main():
self._reactor.schedule(lambda: self._script.post_message({'name': '.evaluate', 'payload': {'expression': text}}))
with self._response_cond:
while self._response_data is None:
self._response_cond.wait()
if not self._reactor.is_running():
raise frida.InvalidOperationError("Invalid operation while stopping")
self._response_cond.wait(0.5)
response = self._response_data
self._response_data = None
stanza, data = response