Report errors to the log, not just stderr.

In particular this affects assert(3) and __cxa_pure_virtual, both of
which have managed to confuse people this week by apparently aborting
without reason. (Because stderr goes nowhere, normally.)

Bug: 6852995
Bug: 6840813
Change-Id: I7f5d17d5ddda439e217b7932096702dc013b9142
This commit is contained in:
Elliott Hughes
2012-07-27 17:40:29 -07:00
parent a7916509a3
commit 52d6233296
7 changed files with 80 additions and 88 deletions

View File

@@ -1,10 +1,8 @@
#undef NDEBUG
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
extern "C" void __cxa_pure_virtual()
{
fprintf(stderr, "Pure virtual function called. Are you calling virtual methods from a destructor?\n");
abort();
extern "C" void __cxa_pure_virtual() {
// We can't call __libc_android_log_write from libstdc++ because it's private, so cheat.
assert(!"Pure virtual function called. Are you calling virtual methods from a destructor?");
/* NOTREACHED */
}