diff options
author | Christopher Ferris <cferris@google.com> | 2017-09-25 19:16:59 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-09-25 19:16:59 +0000 |
commit | 9b91324cb032c5aa4ace8deecdaa4163189925a3 (patch) | |
tree | b10afcbaa6ec33bdd807a5d29ad9ce4374a90781 /debuggerd | |
parent | baea76dba79712cac7395c571b9bcd5a266622be (diff) | |
parent | b9de87f7edefd7a2473134b267716c5fd750e89f (diff) | |
download | system_core-9b91324cb032c5aa4ace8deecdaa4163189925a3.tar.gz system_core-9b91324cb032c5aa4ace8deecdaa4163189925a3.tar.bz2 system_core-9b91324cb032c5aa4ace8deecdaa4163189925a3.zip |
Merge "Add a new unwind method on error."
Diffstat (limited to 'debuggerd')
-rw-r--r-- | debuggerd/crasher/crasher.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/debuggerd/crasher/crasher.cpp b/debuggerd/crasher/crasher.cpp index f57349b16..e9a3ebd5b 100644 --- a/debuggerd/crasher/crasher.cpp +++ b/debuggerd/crasher/crasher.cpp @@ -114,6 +114,11 @@ noinline int do_action_on_thread(const char* arg) { return reinterpret_cast<uintptr_t>(result); } +noinline int crash_null() { + int (*null_func)() = nullptr; + return null_func(); +} + noinline int crash3(int a) { *reinterpret_cast<int*>(0xdead) = a; return a*4; @@ -169,6 +174,7 @@ static int usage() { fprintf(stderr, " nostack crash with a NULL stack pointer\n"); fprintf(stderr, "\n"); fprintf(stderr, " heap-usage cause a libc abort by abusing a heap function\n"); + fprintf(stderr, " call-null cause a crash by calling through a nullptr\n"); fprintf(stderr, " leak leak memory until we get OOM-killed\n"); fprintf(stderr, "\n"); fprintf(stderr, " abort call abort()\n"); @@ -239,6 +245,8 @@ noinline int do_action(const char* arg) { crashnostack(); } else if (!strcasecmp(arg, "exit")) { exit(1); + } else if (!strcasecmp(arg, "call-null")) { + return crash_null(); } else if (!strcasecmp(arg, "crash") || !strcmp(arg, "SIGSEGV")) { return crash(42); } else if (!strcasecmp(arg, "abort")) { |