diff options
author | Linus Groh <mail@linusgroh.de> | 2021-01-25 22:44:36 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-25 23:22:21 +0100 |
commit | 5978424cf9e48f95db2d00fecd7bac6b90979172 (patch) | |
tree | c722348a6ca0cfd1267e655f8e0b332081e6314a /Userland | |
parent | 6568cba731f34653fc2ada9e27a508722aabbade (diff) | |
download | serenity-5978424cf9e48f95db2d00fecd7bac6b90979172.zip |
crash: Add option for failing assertion
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Utilities/crash.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Utilities/crash.cpp b/Userland/Utilities/crash.cpp index a3a9c0cc1d..7e96360ddf 100644 --- a/Userland/Utilities/crash.cpp +++ b/Userland/Utilities/crash.cpp @@ -122,6 +122,7 @@ int main(int argc, char** argv) bool do_use_io_instruction = false; bool do_read_cpu_counter = false; bool do_pledge_violation = false; + bool do_failing_assertion = false; auto args_parser = Core::ArgsParser(); args_parser.set_general_help( @@ -145,6 +146,7 @@ int main(int argc, char** argv) args_parser.add_option(do_use_io_instruction, "Use an x86 I/O instruction in userspace", nullptr, 'I'); args_parser.add_option(do_read_cpu_counter, "Read the x86 TSC (Time Stamp Counter) directly", nullptr, 'c'); args_parser.add_option(do_pledge_violation, "Violate pledge()'d promises", nullptr, 'p'); + args_parser.add_option(do_failing_assertion, "Perform a failing assertion", nullptr, 'n'); if (argc != 2) { args_parser.print_usage(stderr, argv[0]); @@ -338,5 +340,12 @@ int main(int argc, char** argv) }).run(run_type); } + if (do_failing_assertion || do_all_crash_types) { + Crash("Perform a failing assertion", [] { + ASSERT(1 == 2); + return Crash::Failure::DidNotCrash; + }).run(run_type); + } + return 0; } |