[llvm] r323758 - [XRay] clarify error messages when parsing broken traces

Martin Pelikan via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 05:41:34 PST 2018


Author: pelikan
Date: Tue Jan 30 05:41:34 2018
New Revision: 323758

URL: http://llvm.org/viewvc/llvm-project?rev=323758&view=rev
Log:
[XRay] clarify error messages when parsing broken traces

Summary:
When there's a mismatch of a function argument being right after the
wrong function, print an offset into the file where that happened, to
ease further debugging.

Reviewers: dberris, eizan, kpw

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D42492

Modified:
    llvm/trunk/lib/XRay/Trace.cpp

Modified: llvm/trunk/lib/XRay/Trace.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/Trace.cpp?rev=323758&r1=323757&r2=323758&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/Trace.cpp (original)
+++ llvm/trunk/lib/XRay/Trace.cpp Tue Jan 30 05:41:34 2018
@@ -120,9 +120,10 @@ Error loadNaiveFormatLog(StringRef Data,
       auto TId = RecordExtractor.getU32(&OffsetPtr);
       if (Record.FuncId != FuncId || Record.TId != TId)
         return make_error<StringError>(
-            Twine("Corrupted log, found payload following non-matching "
-                  "function + thread record. Record for ") +
-                Twine(Record.FuncId) + " != " + Twine(FuncId),
+            Twine("Corrupted log, found arg payload following non-matching "
+                  "function + thread record. Record for function ") +
+                Twine(Record.FuncId) + " != " + Twine(FuncId) + "; offset: " +
+                Twine(S.data() - Data.data()),
             std::make_error_code(std::errc::executable_format_error));
       // Advance another four bytes to avoid padding.
       OffsetPtr += 4;




More information about the llvm-commits mailing list