1 | //===-- CommandObjectTrace.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_COMMANDS_COMMANDOBJECTTRACE_H |
10 | #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTTRACE_H |
11 | |
12 | #include "CommandObjectThreadUtil.h" |
13 | |
14 | namespace lldb_private { |
15 | |
16 | class CommandObjectTrace : public CommandObjectMultiword { |
17 | public: |
18 | CommandObjectTrace(CommandInterpreter &interpreter); |
19 | |
20 | ~CommandObjectTrace() override; |
21 | }; |
22 | |
23 | /// This class works by delegating the logic to the actual trace plug-in that |
24 | /// can support the current process. |
25 | class CommandObjectTraceProxy : public CommandObjectProxy { |
26 | public: |
27 | CommandObjectTraceProxy(bool live_debug_session_only, |
28 | CommandInterpreter &interpreter, const char *name, |
29 | const char *help = nullptr, |
30 | const char *syntax = nullptr, uint32_t flags = 0) |
31 | : CommandObjectProxy(interpreter, name, help, syntax, flags), |
32 | m_live_debug_session_only(live_debug_session_only) {} |
33 | |
34 | protected: |
35 | virtual lldb::CommandObjectSP GetDelegateCommand(Trace &trace) = 0; |
36 | |
37 | llvm::Expected<lldb::CommandObjectSP> DoGetProxyCommandObject(); |
38 | |
39 | CommandObject *GetProxyCommandObject() override; |
40 | |
41 | private: |
42 | llvm::StringRef GetUnsupportedError() override { return m_delegate_error; } |
43 | |
44 | bool m_live_debug_session_only; |
45 | lldb::CommandObjectSP m_delegate_sp; |
46 | std::string m_delegate_error; |
47 | }; |
48 | |
49 | } // namespace lldb_private |
50 | |
51 | #endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTTRACE_H |
52 | |