Occasionally the assertion that enforces increasing TSC values in DecodedThread::NotifyTsc
would get tripped during large multi CPU trace decoding.
The root cause of this issue was an assumption that all the data of a
PSB will fit within the start,end TSC of the "owning"
ThreadContinuousExecution. After investigating, this is not the case
because PSBs can have multiple TSCs.
This diff works around this issue by introducing a TSC upper bound for
each PSBBlockDecoder. This fixes the assertion failure by simply
"dropping" the remaining data of PSB whenever the TSC upper bound is
exceeded during decoding.
Future work will do a larger refactor of the multi CPU decoding to
remove the dependencies on this incorrect assumption so that PSB blocks
that span multiple ThreadContinuousExecutions are correctly handled.
correctly
Test Plan:
Run thread dump instructions 3 on a problematic trace and observe the assertion is no longer hit. The new error can be observed in the dump of events:
{ "id": 5346, "error": "decoding truncated: TSC 64197386832965432 exceeds maximum TSC value 64197386633174537, will skip decoding the remaining data of the PSB (skipping 375 of 1336 bytes)" },
Run relevant unittests
tools/lldb/unittests/Process/Linux/ProcessLinuxTests tools/lldb/unittests/Utility/UtilityTests --gtest_filter=TraceGDBRemotePacketsTest.* tools/lldb/unittests/Disassembler/x86/GetControlFlowKindx86Tests ./bin/lldb-dotest -p TestTrace
use * instead of value(). value() is rarely used in LLVM code. Also use >= instead of >