summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-07-16 17:19:57 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-07-16 17:19:58 +0000
commit596ee9ea8ae37b17fbdff91508f55250d528f1d2 (patch)
tree371f9101062c1a2b642c716de305520acd90e56b
parentfb1c9cf6fa4efafb3e0c6b0bc93c7f087d926a48 (diff)
parentb1be27e29b01009d66ac66c20e275506673e962c (diff)
downloadsystem_core-596ee9ea8ae37b17fbdff91508f55250d528f1d2.zip
system_core-596ee9ea8ae37b17fbdff91508f55250d528f1d2.tar.gz
system_core-596ee9ea8ae37b17fbdff91508f55250d528f1d2.tar.bz2
Merge "Improve the crasher stack-overflow command."
-rw-r--r--debuggerd/crasher.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/debuggerd/crasher.c b/debuggerd/crasher.c
index 8c225cb..5ecb1a5 100644
--- a/debuggerd/crasher.c
+++ b/debuggerd/crasher.c
@@ -47,17 +47,19 @@ static int smash_stack(int i) {
// Unless there's a "big enough" buffer on the stack, gcc
// doesn't bother inserting checks.
char buf[8];
- // If we don't write something relatively unpredicatable
+ // If we don't write something relatively unpredictable
// into the buffer and then do something with it, gcc
// optimizes everything away and just returns a constant.
*(int*)(&buf[7]) = (uintptr_t) &buf[0];
return *(int*)(&buf[0]);
}
+static void* global = 0; // So GCC doesn't optimize the tail recursion out of overflow_stack.
+
__attribute__((noinline)) static void overflow_stack(void* p) {
- fprintf(stderr, "p = %p\n", p);
void* buf[1];
buf[0] = p;
+ global = buf;
overflow_stack(&buf);
}