summaryrefslogtreecommitdiffstats
path: root/debuggerd/crasher.c
diff options
context:
space:
mode:
Diffstat (limited to 'debuggerd/crasher.c')
-rw-r--r--debuggerd/crasher.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/debuggerd/crasher.c b/debuggerd/crasher.c
index 134fe80..630d980 100644
--- a/debuggerd/crasher.c
+++ b/debuggerd/crasher.c
@@ -101,6 +101,21 @@ int do_action_on_thread(const char* arg)
return (int) result;
}
+__attribute__((noinline)) int crash3(int a) {
+ *((int*) 0xdead) = a;
+ return a*4;
+}
+
+__attribute__((noinline)) int crash2(int a) {
+ a = crash3(a) + 2;
+ return a*3;
+}
+
+__attribute__((noinline)) int crash(int a) {
+ a = crash2(a) + 1;
+ return a*2;
+}
+
int do_action(const char* arg)
{
if(!strncmp(arg, "thread-", strlen("thread-"))) {
@@ -111,6 +126,7 @@ int do_action(const char* arg)
if(!strcmp(arg,"nostack")) crashnostack();
if(!strcmp(arg,"ctest")) return ctest();
if(!strcmp(arg,"exit")) exit(1);
+ if(!strcmp(arg,"crash")) return crash(42);
if(!strcmp(arg,"abort")) maybeabort();
pthread_t thr;