1*e8d8bef9SDimitry Andric //===-- CommandObjectTraceStartIntelPT.h ----------------------*- C++ //-*-===// 2*e8d8bef9SDimitry Andric // 3*e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*e8d8bef9SDimitry Andric // 7*e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===// 8*e8d8bef9SDimitry Andric 9*e8d8bef9SDimitry Andric #ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTRACESTARTINTELPT_H 10*e8d8bef9SDimitry Andric #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTRACESTARTINTELPT_H 11*e8d8bef9SDimitry Andric 12*e8d8bef9SDimitry Andric #include "../../../../source/Commands/CommandObjectThreadUtil.h" 13*e8d8bef9SDimitry Andric #include "lldb/Interpreter/CommandInterpreter.h" 14*e8d8bef9SDimitry Andric #include "lldb/Interpreter/CommandReturnObject.h" 15*e8d8bef9SDimitry Andric 16*e8d8bef9SDimitry Andric namespace lldb_private { 17*e8d8bef9SDimitry Andric namespace trace_intel_pt { 18*e8d8bef9SDimitry Andric 19*e8d8bef9SDimitry Andric class CommandObjectTraceStartIntelPT : public CommandObjectIterateOverThreads { 20*e8d8bef9SDimitry Andric public: 21*e8d8bef9SDimitry Andric class CommandOptions : public Options { 22*e8d8bef9SDimitry Andric public: 23*e8d8bef9SDimitry Andric CommandOptions() : Options() { OptionParsingStarting(nullptr); } 24*e8d8bef9SDimitry Andric 25*e8d8bef9SDimitry Andric ~CommandOptions() override = default; 26*e8d8bef9SDimitry Andric 27*e8d8bef9SDimitry Andric Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, 28*e8d8bef9SDimitry Andric ExecutionContext *execution_context) override; 29*e8d8bef9SDimitry Andric 30*e8d8bef9SDimitry Andric void OptionParsingStarting(ExecutionContext *execution_context) override; 31*e8d8bef9SDimitry Andric 32*e8d8bef9SDimitry Andric llvm::ArrayRef<OptionDefinition> GetDefinitions() override; 33*e8d8bef9SDimitry Andric 34*e8d8bef9SDimitry Andric size_t m_size_in_kb; 35*e8d8bef9SDimitry Andric uint32_t m_custom_config; 36*e8d8bef9SDimitry Andric }; 37*e8d8bef9SDimitry Andric 38*e8d8bef9SDimitry Andric CommandObjectTraceStartIntelPT(CommandInterpreter &interpreter) 39*e8d8bef9SDimitry Andric : CommandObjectIterateOverThreads( 40*e8d8bef9SDimitry Andric interpreter, "thread trace start", 41*e8d8bef9SDimitry Andric "Start tracing one or more threads with intel-pt. " 42*e8d8bef9SDimitry Andric "Defaults to the current thread. Thread indices can be " 43*e8d8bef9SDimitry Andric "specified as arguments.\n Use the thread-index \"all\" to trace " 44*e8d8bef9SDimitry Andric "all threads.", 45*e8d8bef9SDimitry Andric "thread trace start [<thread-index> <thread-index> ...] " 46*e8d8bef9SDimitry Andric "[<intel-pt-options>]", 47*e8d8bef9SDimitry Andric lldb::eCommandRequiresProcess | lldb::eCommandTryTargetAPILock | 48*e8d8bef9SDimitry Andric lldb::eCommandProcessMustBeLaunched | 49*e8d8bef9SDimitry Andric lldb::eCommandProcessMustBePaused), 50*e8d8bef9SDimitry Andric m_options() {} 51*e8d8bef9SDimitry Andric 52*e8d8bef9SDimitry Andric ~CommandObjectTraceStartIntelPT() override = default; 53*e8d8bef9SDimitry Andric 54*e8d8bef9SDimitry Andric Options *GetOptions() override { return &m_options; } 55*e8d8bef9SDimitry Andric 56*e8d8bef9SDimitry Andric protected: 57*e8d8bef9SDimitry Andric bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override; 58*e8d8bef9SDimitry Andric 59*e8d8bef9SDimitry Andric CommandOptions m_options; 60*e8d8bef9SDimitry Andric }; 61*e8d8bef9SDimitry Andric 62*e8d8bef9SDimitry Andric } // namespace trace_intel_pt 63*e8d8bef9SDimitry Andric } // namespace lldb_private 64*e8d8bef9SDimitry Andric 65*e8d8bef9SDimitry Andric #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTRACESTARTINTELPT_H 66