[intel pt] Refactor parsing
authorWalter Erquinigo <wallace@fb.com>
Sat, 3 Oct 2020 19:23:12 +0000 (12:23 -0700)
committerWalter Erquinigo <wallace@fb.com>
Sat, 10 Oct 2020 00:32:04 +0000 (17:32 -0700)
commitea1f49741ec4c0a37796b88f6bb8d09d7ab1e8c3
tree6a3dca6d1fb55eb4dd93cce31a12655763917ea2
parent3c366740ca24bab0494a7f7319acfc8f851d21a9
[intel pt] Refactor parsing

With the feedback I was getting in different diffs, I realized that splitting the parsing logic into two classes was not easy to deal with. I do see value in doing that, but I'd rather leave that as a refactor after most of the intel-pt logic is in place. Thus, I'm merging the common parser into the intel pt one, having thus only one that is fully aware of Intel PT during parsing and object creation.

Besides, based on the feedback in https://reviews.llvm.org/D88769, I'm creating a ThreadIntelPT class that will be able to orchestrate decoding of its own trace and can handle the stop events correctly.

This leaves the TraceIntelPT class as an initialization class that glues together different components. Right now it can initialize a trace session from a json file, and in the future will be able to initialize a trace session from a live process.

Besides, I'm renaming SettingsParser to SessionParser, which I think is a better name, as the json object represents a trace session of possibly many processes.

With the current set of targets, we have the following

- Trace: main interface for dealing with trace sessions
- TraceIntelPT: plugin Trace for dealing with intel pt sessions
- TraceIntelPTSessionParser: a parser of a json trace session file that can create a corresponding TraceIntelPT instance along with Targets, ProcessTraces (to be created in https://reviews.llvm.org/D88769), and ThreadIntelPT threads.
- ProcessTrace: (to be created in https://reviews.llvm.org/D88769) can handle the correct state of the traces as the user traverses the trace. I don't think there'll be a need an intel-pt specific implementation of this class.
- ThreadIntelPT: a thread implementation that can handle the decoding of its own trace file, along with keeping track of the current position the user is looking at when doing reverse debugging.

Differential Revision: https://reviews.llvm.org/D88841
23 files changed:
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/Target/Trace.h
lldb/include/lldb/Target/TraceSessionFileParser.h [new file with mode: 0644]
lldb/include/lldb/Target/TraceSettingsParser.h [deleted file]
lldb/include/lldb/lldb-forward.h
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/Commands/CommandObjectTrace.cpp
lldb/source/Core/PluginManager.cpp
lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
lldb/source/Plugins/Trace/intel-pt/ThreadIntelPT.cpp [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/ThreadIntelPT.h [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.cpp [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSessionFileParser.h [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSettingsParser.cpp [deleted file]
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSettingsParser.h [deleted file]
lldb/source/Target/CMakeLists.txt
lldb/source/Target/Trace.cpp
lldb/source/Target/TraceSessionFileParser.cpp [new file with mode: 0644]
lldb/source/Target/TraceSettingsParser.cpp [deleted file]
lldb/test/API/commands/trace/TestTraceLoad.py
lldb/test/API/commands/trace/TestTraceSchema.py