LLDB mainline
ScriptedCommandInterface.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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_INTERPRETER_INTERFACES_SCRIPTEDCOMMANDINTERFACE_H
10#define LLDB_INTERPRETER_INTERFACES_SCRIPTEDCOMMANDINTERFACE_H
11
12#include "ScriptedInterface.h"
13#include "lldb/lldb-private.h"
14
15namespace lldb_private {
17public:
18 bool UserCanRunDirectly() const override { return true; }
19
20 virtual llvm::Expected<StructuredData::GenericSP>
21 CreatePluginObject(llvm::StringRef class_name,
22 lldb::DebuggerSP debugger_sp) = 0;
23
24 virtual bool RunRawCommand(llvm::StringRef args,
25 ScriptedCommandSynchronicity synchronicity,
26 CommandReturnObject &cmd_retobj, Status &error,
27 const ExecutionContext &exe_ctx) {
28 return false;
29 }
30
31 virtual bool RunParsedCommand(Args &args,
32 ScriptedCommandSynchronicity synchronicity,
33 CommandReturnObject &cmd_retobj, Status &error,
34 const ExecutionContext &exe_ctx) {
35 return false;
36 }
37
38 virtual std::optional<std::string> GetRepeatCommand(Args &args) {
39 return std::nullopt;
40 }
41
43 HandleArgumentCompletion(std::vector<std::string> &args, size_t args_pos,
44 size_t char_in_arg) {
45 return {};
46 }
47
49 HandleOptionArgumentCompletion(llvm::StringRef &long_option,
50 size_t char_in_arg) {
51 return {};
52 }
53
54 virtual bool GetShortHelp(std::string &dest) {
55 dest.clear();
56 return false;
57 }
58
59 virtual bool GetLongHelp(std::string &dest) {
60 dest.clear();
61 return false;
62 }
63
64 virtual uint32_t GetFlags() { return 0; }
65
67
69
70 virtual void OptionParsingStarted() {}
71
72 virtual bool SetOptionValue(ExecutionContext *exe_ctx,
73 llvm::StringRef long_option,
74 llvm::StringRef value) {
75 return false;
76 }
77};
78} // namespace lldb_private
79
80#endif // LLDB_INTERPRETER_INTERFACES_SCRIPTEDCOMMANDINTERFACE_H
static llvm::raw_ostream & error(Stream &strm)
A command line argument class.
Definition Args.h:33
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
virtual bool SetOptionValue(ExecutionContext *exe_ctx, llvm::StringRef long_option, llvm::StringRef value)
virtual StructuredData::DictionarySP HandleArgumentCompletion(std::vector< std::string > &args, size_t args_pos, size_t char_in_arg)
bool UserCanRunDirectly() const override
Whether the user can invoke this extension directly, the way a scripted command can.
virtual bool RunParsedCommand(Args &args, ScriptedCommandSynchronicity synchronicity, CommandReturnObject &cmd_retobj, Status &error, const ExecutionContext &exe_ctx)
virtual StructuredData::ObjectSP GetArgumentsDefinition()
virtual bool GetShortHelp(std::string &dest)
virtual std::optional< std::string > GetRepeatCommand(Args &args)
virtual StructuredData::ObjectSP GetOptionsDefinition()
virtual StructuredData::DictionarySP HandleOptionArgumentCompletion(llvm::StringRef &long_option, size_t char_in_arg)
virtual bool RunRawCommand(llvm::StringRef args, ScriptedCommandSynchronicity synchronicity, CommandReturnObject &cmd_retobj, Status &error, const ExecutionContext &exe_ctx)
virtual llvm::Expected< StructuredData::GenericSP > CreatePluginObject(llvm::StringRef class_name, lldb::DebuggerSP debugger_sp)=0
virtual bool GetLongHelp(std::string &dest)
An error handling class.
Definition Status.h:118
std::shared_ptr< Dictionary > DictionarySP
std::shared_ptr< Object > ObjectSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Debugger > DebuggerSP