summaryrefslogtreecommitdiff
path: root/debuggerd/libdebuggerd/utility.cpp
diff options
context:
space:
mode:
authorMitch Phillips <mitchp@google.com>2019-11-18 15:17:18 -0800
committerMitch Phillips <mitchp@google.com>2019-11-19 09:49:05 -0800
commitaadebd89827aacbd6ca458077bef5986c3fb691a (patch)
tree869da0e4fbfe5737b689fed51b03fcc1ca8fda1f /debuggerd/libdebuggerd/utility.cpp
parentbace5995f1c1c6e006e94f6f235828a13ecda753 (diff)
Add variadic logging to libdebuggerd internal.
GWP-ASan's crash information retrieval services requires a Printf() function (declared by the system/implementing allocator). In this instance, because _LOG is called with additional arguments (the log_t), this function must be wrapped to conform to printf_t defined by GWP-ASan. We can easily wrap the variadic version. Bug: 135634846 Test: atest debuggerd_test Change-Id: I17209cd2b7455ce889e2f8194969f606cac329eb
Diffstat (limited to 'debuggerd/libdebuggerd/utility.cpp')
-rw-r--r--debuggerd/libdebuggerd/utility.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/debuggerd/libdebuggerd/utility.cpp b/debuggerd/libdebuggerd/utility.cpp
index 9b2779a9e..5ce26fcde 100644
--- a/debuggerd/libdebuggerd/utility.cpp
+++ b/debuggerd/libdebuggerd/utility.cpp
@@ -67,6 +67,14 @@ static bool should_write_to_kmsg() {
__attribute__((__weak__, visibility("default")))
void _LOG(log_t* log, enum logtype ltype, const char* fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ _VLOG(log, ltype, fmt, ap);
+ va_end(ap);
+}
+
+__attribute__((__weak__, visibility("default")))
+void _VLOG(log_t* log, enum logtype ltype, const char* fmt, va_list ap) {
bool write_to_tombstone = (log->tfd != -1);
bool write_to_logcat = is_allowed_in_logcat(ltype)
&& log->crashed_tid != -1
@@ -75,10 +83,7 @@ void _LOG(log_t* log, enum logtype ltype, const char* fmt, ...) {
static bool write_to_kmsg = should_write_to_kmsg();
std::string msg;
- va_list ap;
- va_start(ap, fmt);
android::base::StringAppendV(&msg, fmt, ap);
- va_end(ap);
if (msg.empty()) return;