From 8a04709a1d4086fecf352cc079c97e394f1a4ba3 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 21 Jan 2008 00:13:28 +0000 Subject: [PATCH] Added option for crashing via assert(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23676 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/servers/debug/crashing_app.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tests/servers/debug/crashing_app.cpp b/src/tests/servers/debug/crashing_app.cpp index a0e69b99d5..6238dea630 100644 --- a/src/tests/servers/debug/crashing_app.cpp +++ b/src/tests/servers/debug/crashing_app.cpp @@ -1,4 +1,7 @@ +#undef NDEBUG + +#include #include #include #include @@ -22,6 +25,8 @@ static const char *kUsage = " segv2 - strcmp() using a 0x1 pointer\n" " div - executes a division by zero\n" " debugger - invokes debugger()\n" + " assert - failed assert(), which should invoke the " + " debugger\n" "\n" "[x86 specific]\n" " int3 - executes the int3 (breakpoint) instruction\n" @@ -76,6 +81,15 @@ crash_debugger() return 0; } + +static int +crash_assert() +{ + assert(0 > 1); + return 0; +} + + #if __INTEL__ static int @@ -109,6 +123,8 @@ get_crash_function(const char* mode) return (crash_function_t*)crash_div; } else if (strcmp(mode, "debugger") == 0) { return crash_debugger; + } else if (strcmp(mode, "assert") == 0) { + return crash_assert; #if __INTEL__ } else if (strcmp(mode, "int3") == 0) { return crash_int3;