summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_printf.cc
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2017-07-20 17:31:08 +0000
committerVitaly Buka <vitalybuka@google.com>2017-07-20 17:31:08 +0000
commit971e3334155801f5b7727d1888acfdcab1d2aecd (patch)
treef6c9cd5dde9feb1fec0dd7bd76a0573070e3ae92 /lib/sanitizer_common/sanitizer_printf.cc
parent6a1564dd475f3cd3a5cec309b3ec45312da2ec37 (diff)
[compiler-rt] Include thread ID into sanitizers logs
Reviewers: kcc, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D35654 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308637 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_printf.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_printf.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_printf.cc b/lib/sanitizer_common/sanitizer_printf.cc
index 99b7ff1b5..b14675a06 100644
--- a/lib/sanitizer_common/sanitizer_printf.cc
+++ b/lib/sanitizer_common/sanitizer_printf.cc
@@ -260,16 +260,15 @@ static void SharedPrintfCode(bool append_pid, const char *format,
"Buffer in Report is too short!\n"); \
}
if (append_pid) {
- int pid = internal_getpid();
const char *exe_name = GetProcessName();
if (common_flags()->log_exe_name && exe_name) {
needed_length += internal_snprintf(buffer, buffer_size,
"==%s", exe_name);
CHECK_NEEDED_LENGTH
}
- needed_length += internal_snprintf(buffer + needed_length,
- buffer_size - needed_length,
- "==%d==", pid);
+ needed_length +=
+ internal_snprintf(buffer + needed_length, buffer_size - needed_length,
+ "==%d:%d==", internal_getpid(), GetTid());
CHECK_NEEDED_LENGTH
}
needed_length += VSNPrintf(buffer + needed_length,
@@ -300,7 +299,7 @@ void Printf(const char *format, ...) {
va_end(args);
}
-// Like Printf, but prints the current PID before the output string.
+// Like Printf, but prints the current PID:TID before the output string.
FORMAT(1, 2)
void Report(const char *format, ...) {
va_list args;