diff --git a/libredex/PassManager.cpp b/libredex/PassManager.cpp index b4063c69fb..6698486e62 100644 --- a/libredex/PassManager.cpp +++ b/libredex/PassManager.cpp @@ -141,7 +141,7 @@ class CheckerConfig { "input with `-J ir_type_checker.run_on_input_ignore_access=true`.\n " "You may turn off all input checking with `-J " "ir_type_checker.run_on_input=false`."; - fail_error(msg); + fail_error(std::move(msg)); } res = check_no_overwrite_this(false).validate_access(false).run_verifier( @@ -155,7 +155,7 @@ class CheckerConfig { msg += "\n If you are confident that this does not matter, turn off input " "checking with `-J ir_type_checker.run_on_input=false`."; - fail_error(msg); + fail_error(std::move(msg)); } bool run_after_pass(const Pass* pass) { @@ -278,12 +278,14 @@ class CheckerConfig { return boost::none; } - static void fail_error(const std::string& error_msg, size_t errors = 1) { - std::cerr << error_msg << std::endl; + static void fail_error(std::string error_msg, size_t errors = 1) { if (errors > 1) { - std::cerr << "(" << (errors - 1) << " more issues!)" << std::endl; + error_msg.append("\n("); + error_msg.append(std::to_string(errors - 1)); + error_msg.append(" more issues!)"); } - _exit(EXIT_FAILURE); + assert_fail_impl("type-checker", RedexError::TYPE_CHECK_ERROR, "%s", + error_msg.c_str()); } private: diff --git a/libredex/RedexException.h b/libredex/RedexException.h index de0c4cc9d8..a3558111e9 100644 --- a/libredex/RedexException.h +++ b/libredex/RedexException.h @@ -26,7 +26,8 @@ enum RedexError { REJECTED_CODING_PATTERN = 8, INVALID_BETAMAP = 9, BUFFER_END_EXCEEDED = 10, - MAX = 10, + TYPE_CHECK_ERROR = 11, + MAX = 11, }; class RedexException : public std::exception { diff --git a/tools/redex-all/main.cpp b/tools/redex-all/main.cpp index 1d5b060fbb..568f4fe2c0 100644 --- a/tools/redex-all/main.cpp +++ b/tools/redex-all/main.cpp @@ -1719,6 +1719,10 @@ int main(int argc, char* argv[]) { redex_debug::disable_stack_trace_for_exc_type( RedexError::REJECTED_CODING_PATTERN); + // Input type check issues are a straight issue, not a Redex crash. + redex_debug::set_exc_type_as_abort(RedexError::TYPE_CHECK_ERROR); + redex_debug::disable_stack_trace_for_exc_type(RedexError::TYPE_CHECK_ERROR); + auto maybe_global_profile = ScopedCommandProfiling::maybe_from_env("GLOBAL_", "global");