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