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 virtual llvm::Expected<StructuredData::GenericSP>
19 CreatePluginObject(llvm::StringRef class_name,
20 lldb::DebuggerSP debugger_sp) = 0;
21
22 virtual bool RunRawCommand(llvm::StringRef args,
23 ScriptedCommandSynchronicity synchronicity,
24 CommandReturnObject &cmd_retobj, Status &error,
25 const ExecutionContext &exe_ctx) {
26 return false;
27 }
28
29 virtual bool RunParsedCommand(Args &args,
30 ScriptedCommandSynchronicity synchronicity,
31 CommandReturnObject &cmd_retobj, Status &error,
32 const ExecutionContext &exe_ctx) {
33 return false;
34 }
35
36 virtual std::optional<std::string> GetRepeatCommand(Args &args) {
37 return std::nullopt;
38 }
39
41 HandleArgumentCompletion(std::vector<std::string> &args, size_t args_pos,
42 size_t char_in_arg) {
43 return {};
44 }
45
47 HandleOptionArgumentCompletion(llvm::StringRef &long_option,
48 size_t char_in_arg) {
49 return {};
50 }
51
52 virtual bool GetShortHelp(std::string &dest) {
53 dest.clear();
54 return false;
55 }
56
57 virtual bool GetLongHelp(std::string &dest) {
58 dest.clear();
59 return false;
60 }
61
62 virtual uint32_t GetFlags() { return 0; }
63
65
67
68 virtual void OptionParsingStarted() {}
69
70 virtual bool SetOptionValue(ExecutionContext *exe_ctx,
71 llvm::StringRef long_option,
72 llvm::StringRef value) {
73 return false;
74 }
75};
76} // namespace lldb_private
77
78#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)
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