Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lldb/source/API/SBCommandInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
SBDebugger debugger_sb(m_interpreter.GetDebugger().shared_from_this());
m_backend->DoExecute(debugger_sb, command.GetArgumentVector(), sb_return);
}
std::shared_ptr<lldb::SBCommandPluginInterface> m_backend;
lldb::SBCommandPluginInterface *m_backend;
std::optional<std::string> m_auto_repeat_command;
};
} // namespace lldb_private
Expand Down
18 changes: 11 additions & 7 deletions lldb/unittests/API/SBCommandInterpreterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,28 @@
//
//===----------------------------------------------------------------------===/

#include "gtest/gtest.h"

// Use the umbrella header for -Wdocumentation.
#include "lldb/API/LLDB.h"

#include "TestingSupport/SubsystemRAII.h"
#include "lldb/API/SBDebugger.h"
#include "gtest/gtest.h"
#include <cstring>
#include <string>

using namespace lldb;
using namespace lldb_private;

class SBCommandInterpreterTest : public testing::Test {
protected:
void SetUp() override {
SBDebugger::Initialize();
m_dbg = SBDebugger::Create(/*source_init_files=*/false);
debugger = SBDebugger::Create(/*source_init_files=*/false);
}

SBDebugger m_dbg;
void TearDown() override { SBDebugger::Destroy(debugger); }

SubsystemRAII<lldb::SBDebugger> subsystems;
SBDebugger debugger;
};

class DummyCommand : public SBCommandPluginInterface {
Expand All @@ -44,7 +48,7 @@ class DummyCommand : public SBCommandPluginInterface {
TEST_F(SBCommandInterpreterTest, SingleWordCommand) {
// We first test a command without autorepeat
DummyCommand dummy("It worked");
SBCommandInterpreter interp = m_dbg.GetCommandInterpreter();
SBCommandInterpreter interp = debugger.GetCommandInterpreter();
interp.AddCommand("dummy", &dummy, /*help=*/nullptr);
{
SBCommandReturnObject result;
Expand Down Expand Up @@ -78,7 +82,7 @@ TEST_F(SBCommandInterpreterTest, SingleWordCommand) {
}

TEST_F(SBCommandInterpreterTest, MultiWordCommand) {
SBCommandInterpreter interp = m_dbg.GetCommandInterpreter();
SBCommandInterpreter interp = debugger.GetCommandInterpreter();
auto command = interp.AddMultiwordCommand("multicommand", /*help=*/nullptr);
// We first test a subcommand without autorepeat
DummyCommand subcommand("It worked again");
Expand Down