[XRay] Bug fixes for FDR custom event and arg-logging

Summary:
This change has a number of fixes for FDR mode in compiler-rt along with
changes to the tooling handling the traces in llvm.

In the runtime, we do the following:

- Advance the "last record" pointer appropriately when writing the
  custom event data in the log.

- Add XRAY_NEVER_INSTRUMENT in the rewinding routine.

- When collecting the argument of functions appropriately marked, we
  should not attempt to rewind them (and reset the counts of functions
  that can be re-wound).

In the tooling, we do the following:

- Remove the state logic in BlockIndexer and instead rely on the
  presence/absence of records to indicate blocks.

- Move the verifier into a loop associated with each block.

Reviewers: mboerger, eizan

Subscribers: llvm-commits, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342122 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dean Michael Berris
2018-09-13 09:25:42 +00:00
parent 6785a334c3
commit 1468b7dcde
3 changed files with 7 additions and 24 deletions
+6 -19
View File
@@ -16,22 +16,7 @@
namespace llvm {
namespace xray {
Error BlockIndexer::visit(BufferExtents &) {
if (CurrentState == State::ThreadIDFound) {
Index::iterator It;
std::tie(It, std::ignore) =
Indices.insert({{CurrentBlock.ProcessID, CurrentBlock.ThreadID}, {}});
It->second.push_back({CurrentBlock.ProcessID, CurrentBlock.ThreadID,
CurrentBlock.WallclockTime,
std::move(CurrentBlock.Records)});
CurrentBlock.ProcessID = 0;
CurrentBlock.ThreadID = 0;
CurrentBlock.WallclockTime = nullptr;
CurrentBlock.Records = {};
}
CurrentState = State::ExtentsFound;
return Error::success();
}
Error BlockIndexer::visit(BufferExtents &) { return Error::success(); }
Error BlockIndexer::visit(WallclockRecord &R) {
CurrentBlock.Records.push_back(&R);
@@ -66,14 +51,16 @@ Error BlockIndexer::visit(PIDRecord &R) {
}
Error BlockIndexer::visit(NewBufferRecord &R) {
CurrentState = State::ThreadIDFound;
if (!CurrentBlock.Records.empty())
if (auto E = flush())
return E;
CurrentBlock.ThreadID = R.tid();
CurrentBlock.Records.push_back(&R);
return Error::success();
}
Error BlockIndexer::visit(EndBufferRecord &R) {
CurrentState = State::SeekExtents;
CurrentBlock.Records.push_back(&R);
return Error::success();
}
@@ -84,7 +71,6 @@ Error BlockIndexer::visit(FunctionRecord &R) {
}
Error BlockIndexer::flush() {
CurrentState = State::SeekExtents;
Index::iterator It;
std::tie(It, std::ignore) =
Indices.insert({{CurrentBlock.ProcessID, CurrentBlock.ThreadID}, {}});
@@ -94,6 +80,7 @@ Error BlockIndexer::flush() {
CurrentBlock.ProcessID = 0;
CurrentBlock.ThreadID = 0;
CurrentBlock.Records = {};
CurrentBlock.WallclockTime = nullptr;
return Error::success();
}