diff options
author | Hans Boehm <hboehm@google.com> | 2018-08-07 23:45:25 +0000 |
---|---|---|
committer | Hans Boehm <hboehm@google.com> | 2018-08-08 16:30:12 -0700 |
commit | 2a019ecf4f4326b45e14d62f9fe2ca994e21742f (patch) | |
tree | 596ab95d03d41a25a48ed1680fc4982fc50dca9c /libutils/CallStack.cpp | |
parent | 7d4e7d3156997da003b3e60e5b9fe024ae244940 (diff) |
Revert^2 "Prepare to fail in RefBase destructor if count is untouched"
This reverts commit b9d0753d2ba88cc60947823e68bb3bed60268361.
Reason for revert: Re-land with MacOS workaround.
Test: Build (on Linux) and boot AOSP, with weak symbols enabled and disabled.
Change-Id: I5150cd90367178f3b039761dca3bccc9c2987df1
Diffstat (limited to 'libutils/CallStack.cpp')
-rw-r--r-- | libutils/CallStack.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/libutils/CallStack.cpp b/libutils/CallStack.cpp index bd6015e79..fe6f33d74 100644 --- a/libutils/CallStack.cpp +++ b/libutils/CallStack.cpp @@ -16,16 +16,15 @@ #define LOG_TAG "CallStack" -#include <utils/CallStack.h> - -#include <memory> - #include <utils/Printer.h> #include <utils/Errors.h> #include <utils/Log.h> #include <backtrace/Backtrace.h> +#define CALLSTACK_WEAK // Don't generate weak definitions. +#include <utils/CallStack.h> + namespace android { CallStack::CallStack() { @@ -76,4 +75,30 @@ void CallStack::print(Printer& printer) const { } } +// The following four functions may be used via weak symbol references from libutils. +// Clients assume that if any of these symbols are available, then deleteStack() is. + +#ifdef WEAKS_AVAILABLE + +CallStack::CallStackUPtr CallStack::getCurrentInternal(int ignoreDepth) { + CallStack::CallStackUPtr stack(new CallStack()); + stack->update(ignoreDepth + 1); + return stack; +} + +void CallStack::logStackInternal(const char* logtag, const CallStack* stack, + android_LogPriority priority) { + stack->log(logtag, priority); +} + +String8 CallStack::stackToStringInternal(const char* prefix, const CallStack* stack) { + return stack->toString(prefix); +} + +void CallStack::deleteStack(CallStack* stack) { + delete stack; +} + +#endif // WEAKS_AVAILABLE + }; // namespace android |