mirror of
https://github.com/frida/frida-tools.git
synced 2026-11-07 09:35:59 -10:00
repl: Fix crash on eval after %unload
Evaluating after %unload hit a bare assert, killing the whole REPL with an AssertionError instead of just failing the command.
This commit is contained in:
1 parent
7fcf5593bb
commit
cbc3a02de3
1 file changed
+11
-2
+11
-2
@@ -503,6 +503,9 @@ class REPLApplication(ConsoleApplication):
|
||||
fragments.append(("", "\n" + "\n".join(trimmed_stack)))
|
||||
|
||||
output = FormattedText(fragments)
|
||||
except NoScriptError:
|
||||
self._print("No script loaded, use %reload to load one")
|
||||
return success
|
||||
except frida.InvalidOperationError:
|
||||
return success
|
||||
if output != "undefined":
|
||||
@@ -676,12 +679,14 @@ class REPLApplication(ConsoleApplication):
|
||||
return prompt_string
|
||||
|
||||
def _evaluate_expression(self, expression: str) -> Tuple[str, bytes]:
|
||||
assert self._script is not None
|
||||
if self._script is None:
|
||||
raise NoScriptError("no script loaded")
|
||||
result = self._script.exports_sync.frida_evaluate_expression(expression)
|
||||
return self._parse_evaluate_result(result)
|
||||
|
||||
def _evaluate_quick_command(self, tokens: List[str]) -> Tuple[str, bytes]:
|
||||
assert self._script is not None
|
||||
if self._script is None:
|
||||
raise NoScriptError("no script loaded")
|
||||
result = self._script.exports_sync.frida_evaluate_quick_command(tokens)
|
||||
return self._parse_evaluate_result(result)
|
||||
|
||||
@@ -1154,6 +1159,10 @@ class JavaScriptError(Exception):
|
||||
self.error = error
|
||||
|
||||
|
||||
class NoScriptError(frida.InvalidOperationError):
|
||||
pass
|
||||
|
||||
|
||||
class DumbStdinReader:
|
||||
def __init__(self, valid_until: Callable[[], bool]) -> None:
|
||||
self._valid_until = valid_until
|
||||
|
||||
Reference in new issue
Block a user