summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ferris2017-09-25 14:16:59 -0500
committerGerrit Code Review2017-09-25 14:16:59 -0500
commit9b91324cb032c5aa4ace8deecdaa4163189925a3 (patch)
treeb10afcbaa6ec33bdd807a5d29ad9ce4374a90781 /debuggerd
parentbaea76dba79712cac7395c571b9bcd5a266622be (diff)
parentb9de87f7edefd7a2473134b267716c5fd750e89f (diff)
downloadplatform-system-core-9b91324cb032c5aa4ace8deecdaa4163189925a3.tar.gz
platform-system-core-9b91324cb032c5aa4ace8deecdaa4163189925a3.tar.xz
platform-system-core-9b91324cb032c5aa4ace8deecdaa4163189925a3.zip
Merge "Add a new unwind method on error."
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/crasher/crasher.cpp8
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) {
114 return reinterpret_cast<uintptr_t>(result); 114 return reinterpret_cast<uintptr_t>(result);
115} 115}
116 116
117noinline int crash_null() {
118 int (*null_func)() = nullptr;
119 return null_func();
120}
121
117noinline int crash3(int a) { 122noinline int crash3(int a) {
118 *reinterpret_cast<int*>(0xdead) = a; 123 *reinterpret_cast<int*>(0xdead) = a;
119 return a*4; 124 return a*4;
@@ -169,6 +174,7 @@ static int usage() {
169 fprintf(stderr, " nostack crash with a NULL stack pointer\n"); 174 fprintf(stderr, " nostack crash with a NULL stack pointer\n");
170 fprintf(stderr, "\n"); 175 fprintf(stderr, "\n");
171 fprintf(stderr, " heap-usage cause a libc abort by abusing a heap function\n"); 176 fprintf(stderr, " heap-usage cause a libc abort by abusing a heap function\n");
177 fprintf(stderr, " call-null cause a crash by calling through a nullptr\n");
172 fprintf(stderr, " leak leak memory until we get OOM-killed\n"); 178 fprintf(stderr, " leak leak memory until we get OOM-killed\n");
173 fprintf(stderr, "\n"); 179 fprintf(stderr, "\n");
174 fprintf(stderr, " abort call abort()\n"); 180 fprintf(stderr, " abort call abort()\n");
@@ -239,6 +245,8 @@ noinline int do_action(const char* arg) {
239 crashnostack(); 245 crashnostack();
240 } else if (!strcasecmp(arg, "exit")) { 246 } else if (!strcasecmp(arg, "exit")) {
241 exit(1); 247 exit(1);
248 } else if (!strcasecmp(arg, "call-null")) {
249 return crash_null();
242 } else if (!strcasecmp(arg, "crash") || !strcmp(arg, "SIGSEGV")) { 250 } else if (!strcasecmp(arg, "crash") || !strcmp(arg, "SIGSEGV")) {
243 return crash(42); 251 return crash(42);
244 } else if (!strcasecmp(arg, "abort")) { 252 } else if (!strcasecmp(arg, "abort")) {