From 833bb6fbdc98f7021a90153a3aac92505c32c9e7 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Tue, 24 Jul 2018 01:45:34 +0000 Subject: [PATCH] llvm-xray: Broken chrome trace event format output Summary: Missing comma separator for EXIT and TAIL_EXIT RecordTypes emit invalid JSON output for Chrome Trace Event Format. Reviewers: dberris Reviewed By: dberris Subscribers: sammccall, kpw, llvm-commits Differential Revision: https://reviews.llvm.org/D49687 llvm-svn: 337795 --- llvm/tools/llvm-xray/xray-converter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/tools/llvm-xray/xray-converter.cpp b/llvm/tools/llvm-xray/xray-converter.cpp index 1563ef1..90e14d0 100644 --- a/llvm/tools/llvm-xray/xray-converter.cpp +++ b/llvm/tools/llvm-xray/xray-converter.cpp @@ -313,6 +313,9 @@ void TraceConverter::exportAsChromeTraceEventFormat(const Trace &Records, // (And/Or in loop termination below) StackTrieNode *PreviousCursor = nullptr; do { + if (PreviousCursor != nullptr) { + OS << ",\n"; + } writeTraceViewerRecord(Version, OS, StackCursor->FuncId, R.TId, R.PId, Symbolize, FuncIdHelper, EventTimestampUs, *StackCursor, "E"); -- 2.7.4