OSDN Git Service

[XRay] clarify error messages when parsing broken traces
authorMartin Pelikan <martin.pelikan@gmail.com>
Tue, 30 Jan 2018 13:41:34 +0000 (13:41 +0000)
committerMartin Pelikan <martin.pelikan@gmail.com>
Tue, 30 Jan 2018 13:41:34 +0000 (13:41 +0000)
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

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

lib/XRay/Trace.cpp

index d1fcf1c..d8c54dd 100644 (file)
@@ -120,9 +120,10 @@ Error loadNaiveFormatLog(StringRef Data, XRayFileHeader &FileHeader,
       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;