History log of /bionic/libc/bionic/libc_logging.cpp
Revision Date Author Comments
1506fc178e9dcd873eaf95535ac7625ebb59388f 18-Aug-2014 Dan Albert <danalbert@google.com> Expose android_set_abort_message().

Removes the leading underscores from __android_set_abort_message() and
moves its declaration into a public header file.

Bug: 17059126
Change-Id: I470c79db47ec783ea7a54b800f8b78ecbe7479ab
(cherry picked from commit ce6b1abbb1da797e716d8ec03da4e3b6304fd11d)
(cherry picked from commit 3a25ab952befbe908f6df45805683ebe3bf65863)
1dd1b88bdee77b32d316de2a9a2ed52856f75483 20-Jul-2014 Dan Albert <danalbert@google.com> __libc_fatal should print a newline to stderr.

Change-Id: I088dc880d7488a65beac8cda95f530f3db41f112
(cherry picked from commit 97e31dedf056b07bcfcd46c49b60bf0798c60843)
b1b60c30bf321c0fc02264b953b5c16c49d34457 26-Jul-2014 Elliott Hughes <enh@google.com> Use vsnprintf(3) in syslog(3).

It seemed like a clever trick to use the internal log message formatting
code in syslog(3), but on reflection that means you can't (for example)
format floating point numbers. This patch switches us over to using good
old vsnprintf(3), even though that requires us to jump through a few hoops.

There's no obvious way to unit test this, so I wrote a little program and
ran that.

Bug: 14292866
Change-Id: I9c83500ba9cbb209b6f496067a91bf69434eeef5
4514aa630c8cace57a71268eabff687fcdf13ca0 23-Jul-2014 Colin Cross <ccross@android.com> HACK: remove %m support from printf.

The change that added this support causes a cpu hard lock on one
device. This code clearly isn't at fault, but disabling it to
unblock until we can find a real fix.

Bug: 16484311
Change-Id: I33834dc49d959ae403b10d2c7cad12ae2950f772
0caf70e98e8cf109d0116c774147c568b369fd27 23-Jul-2014 Elliott Hughes <enh@google.com> Fix belated review comments on syslog change.

Bug: 14292866

(cherry picked from commit afe6360627ef3f0e9bc8f45535fbfae3354f3ae0)

Change-Id: I8e3cc6b37b2539e51a27261ffb5d6e58266ce11d
49fbec6d9aee62462a4acf3ba47788ca1e35be37 23-Jul-2014 Colin Cross <ccross@android.com> HACK: remove %m support from printf.

The change that added this support causes a cpu hard lock on one
device. This code clearly isn't at fault, but disabling it to
unblock until we can find a real fix.

Bug: 16484311
Change-Id: I33834dc49d959ae403b10d2c7cad12ae2950f772
4126c129613e27717c110626070c44ea7e3f29ce 23-Jul-2014 Elliott Hughes <enh@google.com> Fix belated review comments on syslog change.

Bug: 14292866

(cherry picked from commit afe6360627ef3f0e9bc8f45535fbfae3354f3ae0)

Change-Id: I8e3cc6b37b2539e51a27261ffb5d6e58266ce11d
b76613627d045acd3bdb7294f424f14c21584872 22-Jul-2014 Elliott Hughes <enh@google.com> Rewrite syslog(3) to use Android logging.

Since we don't have syslogd on Android and you can't run one on a non-rooted
device, it's more useful if syslog output just goes to the regular Android
logging system.

Bug: 14292866

(cherry picked from commit 3ad8ecb64e9dd5614169232b84a93eb3b8aa32d7)

Change-Id: I3038855ca4f22532bf6d2c45d3f8028b866975f9
bae5b1dbd8dfe7318e208be917f4c9b9e8abced6 03-Jul-2014 Nick Kralevich <nnk@google.com> libc_logging: Set SOCK_CLOEXEC on socket

Socket file descriptors remain open across exec unless
SOCK_CLOEXEC is set. Enable this option, to avoid leaking
file descriptors.

In practice, this isn't a big deal, since the socket only remains
open for a very short period to write a message. However, this
socket might leak for for multithreaded programs if an exec occurs
between the open and close.

Change-Id: Ica2e71fe28657c32d56de1431c8f7f1f5c7b7c58
12bf3bcdeeaa0dcdc7a4f4e4d11bc2fc3bf6bd7a 01-Jul-2014 Dmitriy Ivanov <dimitry@google.com> Write message to stderr on __libc_fatal()

Change-Id: Ia8d6e256768fa51786d0139d3f3b6e9e4bebe027
1728b2396591853345507a063ed6075dfd251706 14-May-2014 Elliott Hughes <enh@google.com> Switch to g_ for globals.

That's what the Google style guide recommends, and we're starting
to get a mix.

Change-Id: Ib0c53a890bb5deed5c679e887541a715faea91fc
011101905d91b770893e8a2fb6c09552d1c63652 08-May-2014 Elliott Hughes <enh@google.com> Send bionic's fatal logging to the crash log.

Bug: 14159417
Change-Id: I7aa986fb8e11660035221f9bb4fe0bc40ac36c58
c78368f04faa4ee17f546985809e7550f3f88636 07-May-2014 Elliott Hughes <enh@google.com> Change the interface for fatal logging.

This more general interface lets liblog give us any fatal log message,
regardless of source. This means we can remove the special case for
LOG_ALWAYS_FATAL with a simpler scheme that automatically works for
the VM too.

Change-Id: Ia6dbf7c3dbabf223081bd5159294835d954bb067
2e3b7108b5b3d3f3a4a0fb369016e854bcf92212 23-Apr-2014 Elliott Hughes <enh@google.com> Allow liblog to pass failure reasons to debuggerd.

assert(3) already does this, but LOG_ALWAYS_FATAL and LOG_ALWAYS_FATAL_IF
have been missing out.

Change-Id: I1d6214c4f792fa0d4ba3c14eded3fc9c332bd3c5
8664be583a4556e5ca132288e989d307d2df92ce 21-Mar-2014 Mark Salyzyn <salyzyn@google.com> libc: Thread IDs missing from logcat -v thread

- stuff caller's thread id into the packet.

Bug: 13568206
Change-Id: If8b318ef75c7dcdddb05da8ac3038860f0fda5ec
9fc76027f3e1e02193f3dd98063c55918e1b4066 05-Mar-2014 Mark Salyzyn <salyzyn@google.com> libc: libc_logging 64bit compile issue

- user space logger wire format for time

Change-Id: I4840653e3a6ae151a02584311d1227d2fe536d0f
0336e35368aa161f1fed04ccde39553db4740b97 08-Nov-2013 Mark Salyzyn <salyzyn@google.com> libc: Make calls to new user-space logger

* libc (fatal) logging now makes socket connection to the
user-space logging service.
* Add a TARGET_USES_LOGD make flag for BoardConfig.mk to manage
whether logd is enabled for use or not.

Change-Id: I96ab598c76d6eec86f9d0bc81094c1fb3fb0d9b4
d1eda33f012e46083b91e087fb79d14a5ce70f0e 16-Oct-2013 Elliott Hughes <enh@google.com> Avoid confusing "read prevented write" log messages.

Moving to a "function: message" style avoids ambiguity.

Change-Id: If9d590e50265c61725d3673bd03796e65edd2d5e
eb847bc8666842a3cfc9c06e8458ad1abebebaf0 10-Oct-2013 Elliott Hughes <enh@google.com> Fix x86_64 build, clean up intermediate libraries.

The x86_64 build was failing because clone.S had a call to __thread_entry which
was being added to a different intermediate .a on the way to making libc.so,
and the linker couldn't guarantee statically that such a relocation would be
possible.

ld: error: out/target/product/generic_x86_64/obj/STATIC_LIBRARIES/libc_common_intermediates/libc_common.a(clone.o): requires dynamic R_X86_64_PC32 reloc against '__thread_entry' which may overflow at runtime; recompile with -fPIC

This patch addresses that by ensuring that the caller and callee end up in the
same intermediate .a. While I'm here, I've tried to clean up some of the mess
that led to this situation too. In particular, this removes libc/private/ from
the default include path (except for the DNS code), and splits out the DNS
code into its own library (since it's a weird special case of upstream NetBSD
code that's diverged so heavily it's unlikely ever to get back in sync).

There's more cleanup of the DNS situation possible, but this is definitely a
step in the right direction, and it's more than enough to get x86_64 building
cleanly.

Change-Id: I00425a7245b7a2573df16cc38798187d0729e7c4
0f395b7ba056ccec3915737cfece81ca2161e980 08-Oct-2013 Elliott Hughes <enh@google.com> Make logging fall back to /dev/stderr if we're on the host.

Otherwise you get no logging, which sucks.

Change-Id: Iea1e8f996461afbb217a55711b7967005c39cfcb
17fc25d20f4d61f7fc3dfb3de095719ada89e38b 21-Jun-2013 Nick Kralevich <nnk@google.com> libc_logging: don't keep file descriptors open forever

Avoid keeping unnecessary file descriptors around when they're not
needed. Libc doesn't log so much that opening / closing overhead
matters.

Change-Id: I590ec5c27562db9bac025f781c48ec9a7724ce77
61e699a133a4807fe878a6cb0d7190d7c96e21f8 12-Jun-2013 Elliott Hughes <enh@google.com> Clean up abort.

* A dlmalloc usage error shouldn't call abort(3) because we want to
cause a SIGSEGV by writing the address dlmalloc didn't like to an
address the kernel won't like, so that debuggerd will dump the
memory around the address that upset dlmalloc.

* Switch to the simpler FreeBSD/NetBSD style of registering stdio
cleanup. Hopefully this will let us simplify more of the stdio
implementation.

* Clear the stdio cleanup handler before we abort because of a dlmalloc
corruption error. This fixes the reported bug, where we'd hang inside
dlmalloc because the stdio cleanup reentered dlmalloc.

Bug: 9301265
Change-Id: Ief31b389455d6876e5a68f0f5429567d37277dbc
885f3b9cad01b8158aadc55c159c17dbf34f622c 22-May-2013 Christopher Ferris <cferris@google.com> Implement malloc_usable_size for debug impls.

- Implemented chk_memalign.
- Fixed a few bugs in leak_memalign.
- Implemented {leak,fill,check,qemu}_malloc_usable_size.
- Make malloc_usable_size update at run time.
- Add malloc_test.cpp as a small set of tests for the
malloc debug routines.
- Fix the qemu routines since it's been broken since it moved to C++.
- Add support for the %u format to the out_vformat in libc_logging.cpp.
This is used by the emulator code.

Tested using the bionic-unit-tests with setprop libc.debug.malloc
set to 1, 5, and 10.

I tested as much as possible on the emulator, but tracing doesn't appear
to be working properly.

Bug: 6143477

Merge change from internal master.

(cherry-picked from commit 3d594c258045783fc9e1956ce7a4d91e302f011e)

Change-Id: I4ae00fffba82315a8c283f35893fd554460722fb
3d594c258045783fc9e1956ce7a4d91e302f011e 22-May-2013 Christopher Ferris <cferris@google.com> Implement malloc_usable_size for debug impls.

- Implemented chk_memalign.
- Fixed a few bugs in leak_memalign.
- Implemented {leak,fill,check,qemu}_malloc_usable_size.
- Make malloc_usable_size update at run time.
- Add malloc_test.cpp as a small set of tests for the
malloc debug routines.
- Fix the qemu routines since it's been broken since it moved to C++.
- Add support for the %u format to the out_vformat in libc_logging.cpp.
This is used by the emulator code.

Tested using the bionic-unit-tests with setprop libc.debug.malloc
set to 1, 5, and 10.

I tested as much as possible on the emulator, but tracing doesn't appear
to be working properly.

Bug: 6143477

Change-Id: Ieba99b58c2228c88d80afd264501004a4dadd212
7b4d77e400d321ccc7cdadd1cd225ebb1a69d358 04-Apr-2013 Elliott Hughes <enh@google.com> 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

(cherry picked from commit 0d787c1fa18c6a1f29ef9840e28a68cf077be1de)

Change-Id: I5daeeaa36c1fc23f7f437d73a19808d9d558dd4d
0d787c1fa18c6a1f29ef9840e28a68cf077be1de 04-Apr-2013 Elliott Hughes <enh@google.com> 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
8f2a5a0b40fc82126c691d5c30131d908772aab7 15-Mar-2013 Elliott Hughes <enh@google.com> Clean up internal libc logging.

We only need one logging API, and I prefer the one that does no
allocation and is thus safe to use in any context.

Also use O_CLOEXEC when opening the /dev/log files.

Move everything logging-related into one header file.

Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58