From 83380725911f52d9724f684b3768eb7d9b948b3b Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 2 Jan 2019 18:29:28 -0800 Subject: [PATCH] CallStack: include prefix/tag when unlinked Bug: N/A Test: manual Change-Id: I8f7a19744af938a02d876ab81c1dafee04744f96 --- libutils/include/utils/CallStack.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libutils/include/utils/CallStack.h b/libutils/include/utils/CallStack.h index 56004fe49..7a4a345d0 100644 --- a/libutils/include/utils/CallStack.h +++ b/libutils/include/utils/CallStack.h @@ -123,13 +123,14 @@ public: if (reinterpret_cast(logStackInternal) != 0 && stack != nullptr) { logStackInternal(logtag, stack, priority); } else { - ALOGW("CallStack::logStackInternal not linked"); + ALOG(LOG_WARN, logtag, "CallStack::logStackInternal not linked"); } } #else - static void ALWAYS_INLINE logStack(const char*, CallStack* = getCurrent().get(), + static void ALWAYS_INLINE logStack(const char* logtag, CallStack* = getCurrent().get(), android_LogPriority = ANDROID_LOG_DEBUG) { + ALOG(LOG_WARN, logtag, "CallStack::logStackInternal not linked"); } #endif // !WEAKS_AVAILABLE @@ -139,13 +140,13 @@ public: if (reinterpret_cast(stackToStringInternal) != 0 && stack != nullptr) { return stackToStringInternal(prefix, stack); } else { - return String8(""); + return String8::format("%s", (prefix ? prefix : "")); } } #else // !WEAKS_AVAILABLE - static String8 ALWAYS_INLINE stackToString(const char* = nullptr, + static String8 ALWAYS_INLINE stackToString(const char* prefix = nullptr, const CallStack* = getCurrent().get()) { - return String8(""); + return String8::format("%s", (prefix ? prefix : "")); } #endif // !WEAKS_AVAILABLE