13#include "lldb/Host/Config.h"
26#define LLDB_OPTIONS_scripting_run
27#include "CommandOptions.inc"
33 interpreter,
"scripting run",
34 "Invoke the script interpreter with provided code and display any "
35 "results. Start the interactive interpreter if no code is "
37 "scripting run [--language <scripting-language> --] "
53 switch (short_option) {
60 "unrecognized value for language '%s'", option_arg.str().c_str());
63 llvm_unreachable(
"Unimplemented option");
74 return llvm::ArrayRef(g_scripting_run_options);
99 "the script-lang setting is set to none - scripting not available");
106 if (script_interpreter ==
nullptr) {
115 if (command.empty()) {
132#define LLDB_OPTIONS_scripting_extension_list
133#include "CommandOptions.inc"
139 interpreter,
"scripting extension list",
140 "List all the available scripting extension templates. ",
141 "scripting template list [--language <scripting-language> --]") {}
156 switch (short_option) {
161 if (!
error.Success())
163 "unrecognized value for language '{0}'", option_arg);
166 llvm_unreachable(
"Unimplemented option");
177 return llvm::ArrayRef(g_scripting_extension_list_options);
186 s.
Printf(
"Available scripted extension templates:");
188 auto print_field = [&s](llvm::StringRef key, llvm::StringRef value) {
189 if (!value.empty()) {
192 s << key <<
": " << value <<
'\n';
197 size_t num_listed_interface = 0;
199 for (
size_t i = 0; i < num_extensions; i++) {
200 llvm::StringRef plugin_name =
202 if (plugin_name.empty())
210 if (!num_listed_interface)
213 num_listed_interface++;
215 llvm::StringRef desc =
220 print_field(
"Name", plugin_name);
222 print_field(
"Description", desc);
223 usages.
Dump(s, ScriptedInterfaceUsages::UsageKind::API);
224 usages.
Dump(s, ScriptedInterfaceUsages::UsageKind::CommandInterpreter);
226 if (i != num_extensions - 1)
230 if (!num_listed_interface)
242 interpreter,
"scripting extension",
243 "Commands for operating on the scripting extensions.",
244 "scripting extension [<subcommand-options>]") {
256 interpreter,
"scripting",
257 "Commands for operating on the scripting functionalities.",
258 "scripting <subcommand> [<subcommand-options>]") {
static llvm::raw_ostream & error(Stream &strm)
CommandObjectMultiwordScriptingExtension(CommandInterpreter &interpreter)
~CommandObjectMultiwordScriptingExtension() override=default
lldb::ScriptLanguage m_language
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void OptionParsingStarting(ExecutionContext *execution_context) override
~CommandOptions() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
Options * GetOptions() override
void DoExecute(Args &command, CommandReturnObject &result) override
~CommandObjectScriptingExtensionList() override=default
CommandObjectScriptingExtensionList(CommandInterpreter &interpreter)
void OptionParsingStarting(ExecutionContext *execution_context) override
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandOptions() override=default
lldb::ScriptLanguage language
Options * GetOptions() override
CommandObjectScriptingRun(CommandInterpreter &interpreter)
void DoExecute(llvm::StringRef command, CommandReturnObject &result) override
~CommandObjectScriptingRun() override=default
A command line argument class.
~CommandObjectMultiwordScripting() override
CommandObjectMultiwordScripting(CommandInterpreter &interpreter)
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
CommandInterpreter & m_interpreter
bool ParseOptions(Args &args, CommandReturnObject &result)
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
Stream & GetOutputStream()
static void ForceUpdate()
lldb::ScriptLanguage GetScriptLanguage() const
ScriptInterpreter * GetScriptInterpreter(bool can_create=true, std::optional< lldb::ScriptLanguage > language={})
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A pair of an option list with a 'raw' string as a suffix.
bool HasArgs() const
Returns true if there are any arguments before the raw suffix.
Args & GetArgs()
Returns the list of arguments.
const std::string & GetRawPart() const
Returns the raw suffix part of the parsed string.
A command line option parsing protocol class.
std::vector< Option > m_getopt_table
static lldb::ScriptLanguage GetScriptedInterfaceLanguageAtIndex(uint32_t idx)
static uint32_t GetNumScriptedInterfaces()
static llvm::StringRef GetScriptedInterfaceDescriptionAtIndex(uint32_t idx)
static llvm::StringRef GetScriptedInterfaceNameAtIndex(uint32_t idx)
static ScriptedInterfaceUsages GetScriptedInterfaceUsagesAtIndex(uint32_t idx)
virtual void ExecuteInterpreterLoop()=0
virtual bool ExecuteOneLine(llvm::StringRef command, CommandReturnObject *result, const ExecuteScriptOptions &options=ExecuteScriptOptions())=0
static std::string LanguageToString(lldb::ScriptLanguage language)
void Dump(Stream &s, UsageKind kind) const
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
A stream class that can stream formatted output to a file.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
A class that represents a running process on the host machine.
ScriptLanguage
Script interpreter types.
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
@ eReturnStatusSuccessFinishNoResult
static int64_t ToOptionEnum(llvm::StringRef s, const OptionEnumValues &enum_values, int32_t fail_value, Status &error)