llvm-project/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTOptions.td
Walter Erquinigo fb19f11ef4 [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
2020-11-18 18:24:36 -08:00

17 lines
743 B
TableGen

include "../../../../source/Commands/OptionsBase.td"
let Command = "thread trace start intel pt" in {
def thread_trace_start_intel_pt_size: Option<"size", "s">,
Group<1>,
Arg<"Value">,
Desc<"The size of the trace in KB. The kernel rounds it down to the nearest"
" multiple of 4. Defaults to 4.">;
def thread_trace_start_intel_pt_custom_config: Option<"custom-config", "c">,
Group<1>,
Arg<"Value">,
Desc<"Low level bitmask configuration for the kernel based on the values "
"in `grep -H /sys/bus/event_source/devices/intel_pt/format/*`. "
"See https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/perf-intel-pt.txt"
" for more information. Defaults to 0.">;
}