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