[trace][intel-pt] Scaffold the 'thread trace start | stop' commands
authorWalter Erquinigo <a20012251@gmail.com>
Tue, 27 Oct 2020 04:22:06 +0000 (21:22 -0700)
committerWalter Erquinigo <a20012251@gmail.com>
Thu, 19 Nov 2020 02:24:36 +0000 (18:24 -0800)
commitfb19f11ef47bc479d42c11450817c5e855a9830b
tree54a34a6be75b39928683e89ad76ee4d9e8395968
parent25f5406f087579d43ca9a82dee7f3e76f0691bad
[trace][intel-pt] Scaffold the 'thread trace start | stop' commands

Depends on D90490.

The stop command is simple and invokes the new method Trace::StopTracingThread(thread).

On the other hand, the start command works by delegating its implementation to a CommandObject provided by the Trace plugin. This is necessary because each trace plugin needs different options for this command. There's even the chance that a Trace plugin can't support live tracing, but instead supports offline decoding and analysis, which means that "thread trace dump instructions" works but "thread trace start" doest. Because of this and a few other reasons, it's better to have each plugin provide this implementation.

Besides, I'm using the GetSupportedTraceType method introduced in D90490 to quickly infer what's the trace plug-in that works for the current process.

As an implementation note, I moved CommandObjectIterateOverThreads to its header so that I can use it from the IntelPT plugin. Besides, the actual start and stop logic for intel-pt is not part of this diff.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D90729
30 files changed:
lldb/include/lldb/Core/PluginManager.h
lldb/include/lldb/Interpreter/CommandObjectMultiword.h
lldb/include/lldb/Target/PostMortemProcess.h [new file with mode: 0644]
lldb/include/lldb/Target/Process.h
lldb/include/lldb/Target/ProcessTrace.h
lldb/include/lldb/Target/Trace.h
lldb/include/lldb/lldb-enumerations.h
lldb/include/lldb/lldb-private-interfaces.h
lldb/source/Commands/CMakeLists.txt
lldb/source/Commands/CommandObjectMultiword.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/CommandObjectThreadUtil.cpp [new file with mode: 0644]
lldb/source/Commands/CommandObjectThreadUtil.h [new file with mode: 0644]
lldb/source/Core/PluginManager.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
lldb/source/Plugins/Process/mach-core/ProcessMachCore.h
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/source/Plugins/Process/minidump/ProcessMinidump.h
lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.h [new file with mode: 0644]
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td [new file with mode: 0644]
lldb/source/Target/Process.cpp
lldb/source/Target/ProcessTrace.cpp
lldb/test/API/commands/trace/TestTraceDumpInstructions.py
lldb/test/API/commands/trace/TestTraceStartStop.py [new file with mode: 0644]