OSDN Git Service

llvm-xray: Broken chrome trace event format output
authorDean Michael Berris <dberris@google.com>
Tue, 24 Jul 2018 01:45:34 +0000 (01:45 +0000)
committerDean Michael Berris <dberris@google.com>
Tue, 24 Jul 2018 01:45:34 +0000 (01:45 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337795 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-xray/xray-converter.cpp

index 1563ef1..90e14d0 100644 (file)
@@ -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");