[llvm] r341239 - [XRay] Use correct type for thread ID parsing
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 31 12:11:20 PDT 2018
Author: dberris
Date: Fri Aug 31 12:11:19 2018
New Revision: 341239
URL: http://llvm.org/viewvc/llvm-project?rev=341239&view=rev
Log:
[XRay] Use correct type for thread ID parsing
Previously we were reading only a uint16_t when we really needed to read
an int32_t from the log.
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=341239&r1=341238&r2=341239&view=diff
==============================================================================
--- llvm/trunk/lib/XRay/Trace.cpp (original)
+++ llvm/trunk/lib/XRay/Trace.cpp Fri Aug 31 12:11:19 2018
@@ -208,7 +208,7 @@ Error loadNaiveFormatLog(StringRef Data,
/// encoded TSC values into absolute encodings on each record.
struct FDRState {
uint16_t CPUId;
- uint16_t ThreadId;
+ int32_t ThreadId;
int32_t ProcessId;
uint64_t BaseTSC;
@@ -268,7 +268,7 @@ Error processFDRNewBufferRecord(FDRState
fdrStateToTwine(State.Expects), OffsetPtr);
auto PreReadOffset = OffsetPtr;
- State.ThreadId = RecordExtractor.getU16(&OffsetPtr);
+ State.ThreadId = RecordExtractor.getSigned(&OffsetPtr, 4);
if (OffsetPtr == PreReadOffset)
return createStringError(
std::make_error_code(std::errc::executable_format_error),
@@ -277,7 +277,7 @@ Error processFDRNewBufferRecord(FDRState
// Advance the offset pointer by enough bytes representing the remaining
// padding in a metadata record.
- OffsetPtr += kFDRMetadataBodySize - 2;
+ OffsetPtr += kFDRMetadataBodySize - 4;
assert(OffsetPtr - PreReadOffset == kFDRMetadataBodySize);
return Error::success();
}
More information about the llvm-commits
mailing list