[PATCH] D47170: [fuchsia] Add line buffering in RawWrite
Jake Ehrlich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 21 17:36:19 PDT 2018
jakehehrlich created this revision.
jakehehrlich added reviewers: mcgrathr, kcc, alekseyshl, vitalybuka.
Herald added subscribers: Sanitizers, kubamracek.
This change causes RawWrite to buffer upto 128 bytes or until a line is reached. This helps group calls into more readable lines.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D47170
Files:
compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
Index: compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
+++ compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cc
@@ -407,7 +407,18 @@
}
void RawWrite(const char *buffer) {
- __sanitizer_log_write(buffer, internal_strlen(buffer));
+ static _Thread_local char line[128];
+ static _Thread_local unsigned long cur = 0;
+
+ while (*buffer) {
+ if (cur >= sizeof(line) || *buffer == '\n') {
+ __sanitizer_log_write(line, cur);
+ cur = 0;
+ if (*buffer == '\n') ++buffer;
+ } else {
+ line[cur++] = *buffer++;
+ }
+ }
}
void CatastrophicErrorWrite(const char *buffer, uptr length) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47170.147920.patch
Type: text/x-patch
Size: 750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/bef0ba13/attachment.bin>
More information about the llvm-commits
mailing list