summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-11-14 09:41:24 +0000
committerAlexey Samsonov <samsonov@google.com>2013-11-14 09:41:24 +0000
commit4d369187ec89acb5780c0041174ff12524ef210f (patch)
tree4ba910d1597009c2171fdbcaa46c6c6e346a8696 /compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
parent498e5906ad8e0e9959a1ec146cac01850829690e (diff)
downloadbcm5719-llvm-4d369187ec89acb5780c0041174ff12524ef210f.tar.gz
bcm5719-llvm-4d369187ec89acb5780c0041174ff12524ef210f.zip
[Sanitizer] Print symbolized stack frame using a single Printf() call.
This reduces the number of "write" syscalls performed to print a single stack frame description, and makes sanitizer output less intermixed with program output. Also, add a number of unit tests. llvm-svn: 194686
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_printf.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_printf.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
index 4f3968ad258..bbdb24b685d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc
@@ -294,4 +294,13 @@ int internal_snprintf(char *buffer, uptr length, const char *format, ...) {
return needed_length;
}
+void InternalScopedString::append(const char *format, ...) {
+ CHECK_LT(length_, size());
+ va_list args;
+ va_start(args, format);
+ VSNPrintf(data() + length_, size() - length_, format, args);
+ va_end(args);
+ length_ += internal_strlen(data() + length_);
+}
+
} // namespace __sanitizer
OpenPOWER on IntegriCloud