[flang][MLIR] Support delayed privatization for `wsloop` (PFT -> MLIR) (#118271)
[llvm-project.git] / lldb / source / Commands / CommandObjectPlugin.cpp
blobf3108b8a768d2a7a0031c7eced9ba66b43ec01da
1 //===-- CommandObjectPlugin.cpp -------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "CommandObjectPlugin.h"
10 #include "lldb/Interpreter/CommandInterpreter.h"
11 #include "lldb/Interpreter/CommandReturnObject.h"
13 using namespace lldb;
14 using namespace lldb_private;
16 class CommandObjectPluginLoad : public CommandObjectParsed {
17 public:
18 CommandObjectPluginLoad(CommandInterpreter &interpreter)
19 : CommandObjectParsed(interpreter, "plugin load",
20 "Import a dylib that implements an LLDB plugin.",
21 nullptr) {
22 AddSimpleArgumentList(eArgTypeFilename);
25 ~CommandObjectPluginLoad() override = default;
27 protected:
28 void DoExecute(Args &command, CommandReturnObject &result) override {
29 size_t argc = command.GetArgumentCount();
31 if (argc != 1) {
32 result.AppendError("'plugin load' requires one argument");
33 return;
36 Status error;
38 FileSpec dylib_fspec(command[0].ref());
39 FileSystem::Instance().Resolve(dylib_fspec);
41 if (GetDebugger().LoadPlugin(dylib_fspec, error))
42 result.SetStatus(eReturnStatusSuccessFinishResult);
43 else {
44 result.AppendError(error.AsCString());
49 CommandObjectPlugin::CommandObjectPlugin(CommandInterpreter &interpreter)
50 : CommandObjectMultiword(interpreter, "plugin",
51 "Commands for managing LLDB plugins.",
52 "plugin <subcommand> [<subcommand-options>]") {
53 LoadSubCommand("load",
54 CommandObjectSP(new CommandObjectPluginLoad(interpreter)));
57 CommandObjectPlugin::~CommandObjectPlugin() = default;