[trace][intel pt] Implement the Intel PT cursor
authorWalter Erquinigo <wallace@fb.com>
Tue, 29 Jun 2021 21:03:30 +0000 (14:03 -0700)
committerWalter Erquinigo <wallace@fb.com>
Fri, 16 Jul 2021 23:47:43 +0000 (16:47 -0700)
commitb0aa70761b8324d0c9ebc57da58a44c9e266ce0e
tree82a92b8a3856f81a421db658ac18c423ca6d92d2
parent77aec978a911254299640f9b10bdf1933986b96e
[trace][intel pt] Implement the Intel PT cursor

D104422 added the interface for TraceCursor, which is the main way to traverse instructions in a trace. This diff implements the corresponding cursor class for Intel PT and deletes the now obsolete code.

Besides that, the logic for the "thread trace dump instructions" was adapted to use this cursor (pretty much I ended up moving code from Trace.cpp to TraceCursor.cpp). The command by default traverses the instructions backwards, and if the user passes --forwards, then it's not forwards. More information about that is in the Options.td file.

Regarding the Intel PT cursor. All Intel PT cursors for the same thread share the same DecodedThread instance. I'm not yet implementing lazy decoding because we don't need it. That'll be for later. For the time being, the entire thread trace is decoded when the first cursor for that thread is requested.

Differential Revision: https://reviews.llvm.org/D105531
21 files changed:
lldb/include/lldb/Target/Trace.h
lldb/include/lldb/Target/TraceCursor.h
lldb/include/lldb/Target/TraceInstructionDumper.h [new file with mode: 0644]
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/Options.td
lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
lldb/source/Plugins/Trace/intel-pt/DecodedThread.cpp
lldb/source/Plugins/Trace/intel-pt/DecodedThread.h
lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.cpp
lldb/source/Plugins/Trace/intel-pt/IntelPTDecoder.h
lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.cpp [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
lldb/source/Target/CMakeLists.txt
lldb/source/Target/Trace.cpp
lldb/source/Target/TraceCursor.cpp
lldb/source/Target/TraceInstructionDumper.cpp [new file with mode: 0644]
lldb/test/API/commands/trace/TestTraceDumpInstructions.py
lldb/test/API/commands/trace/TestTraceStartStop.py
lldb/test/API/commands/trace/multiple-threads/TestTraceStartStopMultipleThreads.py