From 640435f6cad21fe4dc2cc63a8e7306904380a3cd Mon Sep 17 00:00:00 2001 From: Samuel Thayer Date: Sun, 27 Jan 2019 12:59:11 -0700 Subject: [PATCH 1/2] Print compressed protobuf data --- rtl/deduplicate_report.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rtl/deduplicate_report.cpp b/rtl/deduplicate_report.cpp index 8da41c3..4502461 100644 --- a/rtl/deduplicate_report.cpp +++ b/rtl/deduplicate_report.cpp @@ -342,10 +342,16 @@ namespace __tsan { bool OnReport(const ReportDesc *report, bool suppressed) { PBReportDesc* pb_report = tsToPbReportDesc(*report); + size_t size = pb_report->ByteSizeLong(); + void *bytes = malloc(size); + pb_report->SerializeToArray(bytes, size); - Printf("\\/ \\/ \\/\n"); - Printf("%s\n", pb_report->DebugString().c_str()); - Printf("/\\ /\\ /\\\n\n\n\n"); + Printf("==================\n"); + Printf("%s\n", (char*)bytes); + Printf("==================\n"); + + delete pb_report; + free(bytes); return true; } From fb6d14e696a9b0ecf3cccbf5c37acfa6abe0bb07 Mon Sep 17 00:00:00 2001 From: Samuel Thayer Date: Sun, 3 Feb 2019 18:38:56 -0700 Subject: [PATCH 2/2] Print whole protobuf message --- rtl/deduplicate_report.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rtl/deduplicate_report.cpp b/rtl/deduplicate_report.cpp index 4502461..b354e5c 100644 --- a/rtl/deduplicate_report.cpp +++ b/rtl/deduplicate_report.cpp @@ -342,13 +342,14 @@ namespace __tsan { bool OnReport(const ReportDesc *report, bool suppressed) { PBReportDesc* pb_report = tsToPbReportDesc(*report); + size_t size = pb_report->ByteSizeLong(); void *bytes = malloc(size); pb_report->SerializeToArray(bytes, size); Printf("==================\n"); - Printf("%s\n", (char*)bytes); - Printf("==================\n"); + write(2, (char*)bytes, size); + Printf("\n==================\n"); delete pb_report; free(bytes);