1 | //===-- CommandObjectThreadTraceExportCTF.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_COMMANDOBJECTTHREADTRACEEXPORTCTF_H |
10 | #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTHREADTRACEEXPORTCTF_H |
11 | |
12 | #include "TraceExporterCTF.h" |
13 | #include "lldb/Interpreter/CommandInterpreter.h" |
14 | #include "lldb/Interpreter/CommandReturnObject.h" |
15 | #include <optional> |
16 | |
17 | namespace lldb_private { |
18 | namespace ctf { |
19 | |
20 | class CommandObjectThreadTraceExportCTF : public CommandObjectParsed { |
21 | public: |
22 | class CommandOptions : public Options { |
23 | public: |
24 | CommandOptions() : Options() { OptionParsingStarting(execution_context: nullptr); } |
25 | |
26 | Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, |
27 | ExecutionContext *execution_context) override; |
28 | |
29 | void OptionParsingStarting(ExecutionContext *execution_context) override; |
30 | |
31 | llvm::ArrayRef<OptionDefinition> GetDefinitions() override; |
32 | |
33 | std::optional<size_t> m_thread_index; |
34 | std::string m_file; |
35 | }; |
36 | |
37 | CommandObjectThreadTraceExportCTF(CommandInterpreter &interpreter) |
38 | : CommandObjectParsed( |
39 | interpreter, "thread trace export ctf", |
40 | "Export a given thread's trace to Chrome Trace Format", |
41 | "thread trace export ctf [<ctf-options>]", |
42 | lldb::eCommandRequiresProcess | lldb::eCommandTryTargetAPILock | |
43 | lldb::eCommandProcessMustBeLaunched | |
44 | lldb::eCommandProcessMustBePaused | |
45 | lldb::eCommandProcessMustBeTraced), |
46 | m_options() {} |
47 | |
48 | Options *GetOptions() override { return &m_options; } |
49 | |
50 | protected: |
51 | void DoExecute(Args &command, CommandReturnObject &result) override; |
52 | |
53 | CommandOptions m_options; |
54 | }; |
55 | |
56 | } // namespace ctf |
57 | } // namespace lldb_private |
58 | |
59 | #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTHREADTRACEEXPORTCTF_H |
60 |