xref: /freebsd-src/contrib/llvm-project/lldb/source/Commands/CommandObjectTrace.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1e8d8bef9SDimitry Andric //===-- CommandObjectTrace.h ------------------------------------*- C++ -*-===//
2e8d8bef9SDimitry Andric //
3e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e8d8bef9SDimitry Andric //
7e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
8e8d8bef9SDimitry Andric 
9e8d8bef9SDimitry Andric #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTTRACE_H
10e8d8bef9SDimitry Andric #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTTRACE_H
11e8d8bef9SDimitry Andric 
12*fe6060f1SDimitry Andric #include "CommandObjectThreadUtil.h"
13e8d8bef9SDimitry Andric 
14e8d8bef9SDimitry Andric namespace lldb_private {
15e8d8bef9SDimitry Andric 
16e8d8bef9SDimitry Andric class CommandObjectTrace : public CommandObjectMultiword {
17e8d8bef9SDimitry Andric public:
18e8d8bef9SDimitry Andric   CommandObjectTrace(CommandInterpreter &interpreter);
19e8d8bef9SDimitry Andric 
20e8d8bef9SDimitry Andric   ~CommandObjectTrace() override;
21e8d8bef9SDimitry Andric };
22e8d8bef9SDimitry Andric 
23*fe6060f1SDimitry Andric /// This class works by delegating the logic to the actual trace plug-in that
24*fe6060f1SDimitry Andric /// can support the current process.
25*fe6060f1SDimitry Andric class CommandObjectTraceProxy : public CommandObjectProxy {
26*fe6060f1SDimitry Andric public:
27*fe6060f1SDimitry Andric   CommandObjectTraceProxy(bool live_debug_session_only,
28*fe6060f1SDimitry Andric                           CommandInterpreter &interpreter, const char *name,
29*fe6060f1SDimitry Andric                           const char *help = nullptr,
30*fe6060f1SDimitry Andric                           const char *syntax = nullptr, uint32_t flags = 0)
CommandObjectProxy(interpreter,name,help,syntax,flags)31*fe6060f1SDimitry Andric       : CommandObjectProxy(interpreter, name, help, syntax, flags),
32*fe6060f1SDimitry Andric         m_live_debug_session_only(live_debug_session_only) {}
33*fe6060f1SDimitry Andric 
34*fe6060f1SDimitry Andric protected:
35*fe6060f1SDimitry Andric   virtual lldb::CommandObjectSP GetDelegateCommand(Trace &trace) = 0;
36*fe6060f1SDimitry Andric 
37*fe6060f1SDimitry Andric   llvm::Expected<lldb::CommandObjectSP> DoGetProxyCommandObject();
38*fe6060f1SDimitry Andric 
39*fe6060f1SDimitry Andric   CommandObject *GetProxyCommandObject() override;
40*fe6060f1SDimitry Andric 
41*fe6060f1SDimitry Andric private:
GetUnsupportedError()42*fe6060f1SDimitry Andric   llvm::StringRef GetUnsupportedError() override { return m_delegate_error; }
43*fe6060f1SDimitry Andric 
44*fe6060f1SDimitry Andric   bool m_live_debug_session_only;
45*fe6060f1SDimitry Andric   lldb::CommandObjectSP m_delegate_sp;
46*fe6060f1SDimitry Andric   std::string m_delegate_error;
47*fe6060f1SDimitry Andric };
48*fe6060f1SDimitry Andric 
49e8d8bef9SDimitry Andric } // namespace lldb_private
50e8d8bef9SDimitry Andric 
51e8d8bef9SDimitry Andric #endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTTRACE_H
52