History log of /bionic/libc/bionic/debug_stacktrace.cpp
Revision Date Author Comments
6e54c3e519892ca13f15bdcea0d431befbadac25 05-Feb-2015 Elliott Hughes <enh@google.com> Use the libcxxabi __cxa_demangle.

Bug: 18930951
Change-Id: If2ea3633ac6dfd4ec975c0f16bdf3dd58e05c614
05fc1d7050d5451aea08dc5f504d2670287b2d43 29-Jan-2015 Elliott Hughes <enh@google.com> Add missing includes.

Change-Id: Ibf549266a19a67eb9158d341a69dddfb654be669
30e59c4c691d493fda7da35307db69ced61e7cf4 07-Jan-2015 Elliott Hughes <enh@google.com> _Unwind_Context is a struct.

Change-Id: Iff2c52dc630eb83b931a78fdebc4494d69462db7
c701e5b3357b6484572d46f29c5d1e51063dfcbb 25-Jul-2014 Christopher Ferris <cferris@google.com> Use libunwindbacktrace for debug malloc code.

Create a method of disabling the debug allocation code paths so that
it's possible to use the libunwindbacktrace library without any
modifications.

Use this path to create and destroy the maps for the process. It's not
stricly necessary in the init code since the symbols are not modified
until after the initialize calls.

Also, remove the debug_XXX source files that doesn't need to be in libc.so.

Fix the maps reading code since it was completely broken for 64 bit.

Bug: 16408686

(cherry picked from commit 861c0ef37bcfcae56d88572cb01c18bcfe1faded)

Change-Id: I04445f0cf9a1e85172b64d57df92eb7939ce2332
861c0ef37bcfcae56d88572cb01c18bcfe1faded 25-Jul-2014 Christopher Ferris <cferris@google.com> Use libunwindbacktrace for debug malloc code.

Create a method of disabling the debug allocation code paths so that
it's possible to use the libunwindbacktrace library without any
modifications.

Use this path to create and destroy the maps for the process. It's not
stricly necessary in the init code since the symbols are not modified
until after the initialize calls.

Also, remove the debug_XXX source files that doesn't need to be in libc.so.

Fix the maps reading code since it was completely broken for 64 bit.

Bug: 16408686

Change-Id: I6b02ef6ce26fdb7a59ad1029e7cbba9accceb704
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
d3679c815e010c2e67bf07420b6ab3a74f27a2ed 21-Apr-2014 Elliott Hughes <enh@google.com> clang is >= 3.4 now; remove a hack.

Change-Id: I8d976ee0fd88eca9779c87b5d7e27f46b4b1b489
ba76572789740ec1a04da30dd89121ef5cb0bf44 26-Feb-2014 Elliott Hughes <enh@google.com> Fix log_backtrace assertion failure caused by LP64 fix.

When libc.debug.malloc is enabled, stack backtraces fail with:

bionic/libc/bionic/libc_logging.cpp:378: assertion "conversion
specifier unsupported" failed

The cause was a change to the format specifier from "%08x" to
"%0*x" to pass the field width as an additional parameter.
Unfortunately this modifier isn't supported by out_vformat() in
libc_logging.cpp.

Changed to use "%016x" if __LP64__ is defined; "%08x" otherwise.

Bug: 13177507
Change-Id: Ibf07263acf14da086d3c3788872f4b5477bd5708
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
c7c5f85ead6a58eadd511c728a9020a493bc128f 09-Oct-2013 Elliott Hughes <enh@google.com> Fix bionic's built-in stack trace dumping for LP64.

Change-Id: I967c5789d7bb2d3d248d94d81a40d5ec4e1bf26d
5f6cfce4f6608f2e450266814543e70b1ed2e02c 02-Oct-2013 Stephen Hines <srhines@google.com> Add simple implementation _Unwind_GetIP() for clang compiles.

Clang (prior to 3.4) does not actually provide a declaration (or definition)
of _Unwind_GetIP() for ARM. We can work around this by writing our own
basic implementation using the available primitive operations.

Change-Id: If6c66846952d8545849ad32d2b55daa4599cfe2c
262b7384e4e691d42070a57472ecc64cf668c480 07-May-2013 Ben Cheng <bccheng@google.com> Adjust PC value in ARM stack trace.

-2 for Thumb BLX(2) or -4 for the rest.

Change-Id: Ie59351a0012c2267309f63f0462fdba4698846fe
63dd03ccedc316724c40e140067e612932e4420e 08-May-2013 Ben Cheng <bccheng@google.com> Remove a spurious FIXME and unnecessary type cast.

Change-Id: I05dcefdec7f047bef7eef5c5ceb7453992d56c24
52171b9bdcb2aa1efe9c4deab37c029699fe763d 07-May-2013 Ben Cheng <bccheng@google.com> Adjust PC value in ARM stack trace.

-2 for Thumb BLX(2) or -4 for the rest.

Change-Id: I804fdabfa1db4709bede222d4b432e8d42d53167
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
35b621c5f4c79959cd36fec0153c2c9c43ebe5f0 29-Jan-2013 Elliott Hughes <enh@google.com> Don't collect useless stack frames; do demangle C++ symbols.

Previously, we'd collect every stack frame and then throw some away
when we came to log them. This meant that stack traces were effectively
shorter than the buffers that had been allocated for them. This patch
only stores frames we'll actually output.

Also dynamically call the C++ demangler so we don't have to try to
read mangled names. Because no one knows the mangling of operator new[]
for int arrays off the top of their head.

Bug: 7291287
Change-Id: I42b022fd7cd61675d05171de4c3b2704d058ef2a
239e7a0756fddf3698bf72cab10d7f382421090b 26-Jan-2013 Elliott Hughes <enh@google.com> More debug malloc fixes.

Include the leaky executable's name in the log output. Fix the "sh" test.
Use uintptr_t instead of intptr_t.

Also fix debug formatting of NULL with %s.

Bug: 7291287
Change-Id: I015bf341cd48d43a247173612e6ccb1bf1243d53
1e980b6bc8315d00a07312b25486531247abd98c 18-Jan-2013 Elliott Hughes <enh@google.com> Fix the duplication in the debugging code.

We had two copies of the backtrace code, and two copies of the
libcorkscrew /proc/pid/maps code. This patch gets us down to one.

We also had hacks so we could log in the malloc debugging code.
This patch pulls the non-allocating "printf" code out of the
dynamic linker so everyone can share.

This patch also makes the leak diagnostics easier to read, and
makes it possible to paste them directly into the 'stack' tool (by
using relative PCs).

This patch also fixes the stdio standard stream leak that was
causing a leak warning every time tf_daemon ran.

Bug: 7291287
Change-Id: I66e4083ac2c5606c8d2737cb45c8ac8a32c7cfe8