summaryrefslogtreecommitdiffstats
path: root/llvm/lib/XRay
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2018-11-01 22:57:50 +0000
committerDean Michael Berris <dberris@google.com>2018-11-01 22:57:50 +0000
commite8c650ab126bc67cc4dffa0b8671c635079fc786 (patch)
tree003cd2f7983c9061f0f1d64de7301025a69eee99 /llvm/lib/XRay
parent0857df38bd3cbff4c30cb1bc4366afacd3cc973d (diff)
downloadbcm5719-llvm-e8c650ab126bc67cc4dffa0b8671c635079fc786.tar.gz
bcm5719-llvm-e8c650ab126bc67cc4dffa0b8671c635079fc786.zip
[XRay] Fix TSC and atomic custom/typed event accounting
Summary: This is a follow-on change to D53858 which turns out to have had a TSC accounting bug when writing out function exit records in FDR mode. This change adds a number of tests to ensure that: - We are handling the delta between the exit TSC and the last TSC we've seen. - We are writing the custom event and typed event records as a single update to the buffer extents. - We are able to catch boundary conditions when loading FDR logs. We introduce a TSC matcher to the test helpers, which we use in the testing/verification of the TSC accounting change. Reviewers: mboerger Subscribers: mgorny, hiraditya, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D53967 llvm-svn: 345905
Diffstat (limited to 'llvm/lib/XRay')
-rw-r--r--llvm/lib/XRay/FDRRecordProducer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/XRay/FDRRecordProducer.cpp b/llvm/lib/XRay/FDRRecordProducer.cpp
index 4b010f1fa62..59b5697cd64 100644
--- a/llvm/lib/XRay/FDRRecordProducer.cpp
+++ b/llvm/lib/XRay/FDRRecordProducer.cpp
@@ -84,6 +84,12 @@ Expected<std::unique_ptr<Record>> FileBasedRecordProducer::produce() {
// the rest of the bytes.
auto PreReadOffset = OffsetPtr;
uint8_t FirstByte = E.getU8(&OffsetPtr);
+ if (OffsetPtr == PreReadOffset)
+ return createStringError(
+ std::make_error_code(std::errc::executable_format_error),
+ "Failed reading one byte from offset %d.", OffsetPtr);
+
+ // Set up our result record.
std::unique_ptr<Record> R;
// For metadata records, handle especially here.
OpenPOWER on IntegriCloud