[PATCH] D60589: [sanitizer_common] Expose a variadic version of the sanitizer Printf function.
Mitch Phillips via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 14:55:42 PDT 2019
hctim created this revision.
hctim added reviewers: pcc, eugenis.
Herald added subscribers: Sanitizers, kubamracek.
Herald added projects: Sanitizers, LLVM.
Allows users of sanitizer printf() to create wrappers around the sanitizer Printf function. Used in GWP-ASan to allow us to default-provide a function pointer to Printf(), as the signature taken by GWP-ASan arguments has an 'int' return type.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60589
Files:
compiler-rt/lib/sanitizer_common/sanitizer_common.h
compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
Index: compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
@@ -322,6 +322,10 @@
va_end(args);
}
+void VariadicPrintf(const char *format, va_list ap) {
+ SharedPrintfCode(false, format, ap);
+}
+
// Like Printf, but prints the current PID before the output string.
FORMAT(1, 2)
void Report(const char *format, ...) {
Index: compiler-rt/lib/sanitizer_common/sanitizer_common.h
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_common.h
+++ compiler-rt/lib/sanitizer_common/sanitizer_common.h
@@ -22,6 +22,8 @@
#include "sanitizer_list.h"
#include "sanitizer_mutex.h"
+#include <stdarg.h>
+
#if defined(_MSC_VER) && !defined(__clang__)
extern "C" void _ReadWriteBarrier();
#pragma intrinsic(_ReadWriteBarrier)
@@ -186,6 +188,7 @@
bool ColorizeReports();
void RemoveANSIEscapeSequencesFromString(char *buffer);
void Printf(const char *format, ...);
+void VariadicPrintf(const char *format, va_list ap);
void Report(const char *format, ...);
void SetPrintfAndReportCallback(void (*callback)(const char *));
#define VReport(level, ...) \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60589.194769.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190411/9e0fb610/attachment.bin>
More information about the llvm-commits
mailing list