[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.

llvm-svn: 341239
This commit is contained in:
Dean Michael Berris 2018-08-31 19:11:19 +00:00
parent b1c9813042
commit 250c56d127
1 changed files with 3 additions and 3 deletions

View File

@ -208,7 +208,7 @@ Error loadNaiveFormatLog(StringRef Data, bool IsLittleEndian,
/// 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 &State, DataExtractor &RecordExtractor,
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 &State, DataExtractor &RecordExtractor,
// 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();
}