summaryrefslogtreecommitdiffstats
path: root/libc/private
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-04-04 13:46:46 -0700
committerElliott Hughes <enh@google.com>2013-04-05 11:24:19 -0700
commit0d787c1fa18c6a1f29ef9840e28a68cf077be1de (patch)
tree3f8efc05d80658c9be48513238104a5de01a9951 /libc/private
parent014c75c78bdcad8acde8d0abb2450aa1f78e1a1f (diff)
downloadbionic-0d787c1fa18c6a1f29ef9840e28a68cf077be1de.zip
bionic-0d787c1fa18c6a1f29ef9840e28a68cf077be1de.tar.gz
bionic-0d787c1fa18c6a1f29ef9840e28a68cf077be1de.tar.bz2
Make abort messages available to debuggerd.
This adds __libc_fatal, cleans up the internal logging code a bit more, and switches suitable callers over to __libc_fatal. In addition to logging, __libc_fatal stashes the message somewhere that the debuggerd signal handler can find it before calling abort. In the debuggerd signal handler, we pass this address to debuggerd so that it can come back with ptrace to read the message and present it to the user. Bug: 8531731 Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
Diffstat (limited to 'libc/private')
-rw-r--r--libc/private/KernelArgumentBlock.h4
-rw-r--r--libc/private/libc_logging.h14
2 files changed, 18 insertions, 0 deletions
diff --git a/libc/private/KernelArgumentBlock.h b/libc/private/KernelArgumentBlock.h
index d777267..14eca06 100644
--- a/libc/private/KernelArgumentBlock.h
+++ b/libc/private/KernelArgumentBlock.h
@@ -21,6 +21,8 @@
#include <stdint.h>
#include <sys/auxv.h>
+struct abort_msg_t;
+
// When the kernel starts the dynamic linker, it passes a pointer to a block
// of memory containing argc, the argv array, the environment variable array,
// and the array of ELF aux vectors. This class breaks that block up into its
@@ -67,6 +69,8 @@ class KernelArgumentBlock {
char** envp;
Elf32_auxv_t* auxv;
+ abort_msg_t** abort_message_ptr;
+
private:
// Disallow copy and assignment.
KernelArgumentBlock(const KernelArgumentBlock&);
diff --git a/libc/private/libc_logging.h b/libc/private/libc_logging.h
index 4c9dc21..281bad3 100644
--- a/libc/private/libc_logging.h
+++ b/libc/private/libc_logging.h
@@ -67,6 +67,20 @@ enum {
ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
};
+struct abort_msg_t {
+ size_t size;
+ char msg[0];
+};
+
+__LIBC_HIDDEN__ void __libc_set_abort_message(const char* msg);
+
+//
+// Formats a message to the log (priority 'fatal'), then aborts.
+//
+
+__LIBC_HIDDEN__ __noreturn void __libc_fatal(const char* format, ...)
+ __attribute__((__format__(printf, 1, 2)));
+
//
// Formatting routines for the C library's internal debugging.
// Unlike the usual alternatives, these don't allocate.