summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Commands/CommandObjectMultiword.cpp3
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp10
-rw-r--r--lldb/source/Target/LanguageRuntime.cpp1
3 files changed, 12 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index 206f3b6fb7d..ed70551ef37 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -92,6 +92,9 @@ CommandObjectMultiword::LoadSubCommand
const CommandObjectSP& cmd_obj
)
{
+ if (cmd_obj.get())
+ assert((&GetCommandInterpreter() == &cmd_obj->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter");
+
CommandMap::iterator pos;
bool success = true;
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index fd88f0d6b4b..bab12462489 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -874,6 +874,9 @@ CommandInterpreter::GetCommandSP (const char *cmd_cstr, bool include_aliases, bo
bool
CommandInterpreter::AddCommand (const char *name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
{
+ if (cmd_sp.get())
+ assert((this == &cmd_sp->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter");
+
if (name && name[0])
{
std::string name_sstr(name);
@@ -893,9 +896,11 @@ CommandInterpreter::AddUserCommand (std::string name,
const lldb::CommandObjectSP &cmd_sp,
bool can_replace)
{
+ if (cmd_sp.get())
+ assert((this == &cmd_sp->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter");
+
if (!name.empty())
{
-
const char* name_cstr = name.c_str();
// do not allow replacement of internal commands
@@ -1110,6 +1115,9 @@ CommandInterpreter::UserCommandExists (const char *cmd)
void
CommandInterpreter::AddAlias (const char *alias_name, CommandObjectSP& command_obj_sp)
{
+ if (command_obj_sp.get())
+ assert((this == &command_obj_sp->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter");
+
command_obj_sp->SetIsAlias (true);
m_alias_dict[alias_name] = command_obj_sp;
}
diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp
index 7f386162d16..d247994621f 100644
--- a/lldb/source/Target/LanguageRuntime.cpp
+++ b/lldb/source/Target/LanguageRuntime.cpp
@@ -339,7 +339,6 @@ LanguageRuntime::InitializeCommands (CommandObject* parent)
// the CommandObject vended by a Language plugin cannot be created once and cached because
// we may create multiple debuggers and need one instance of the command each - the implementing function
// is meant to create a new instance of the command each time it is invoked
- assert(&command->GetCommandInterpreter() == &parent->GetCommandInterpreter() && "language plugin returned command for a mismatched CommandInterpreter");
parent->LoadSubCommand(command->GetCommandName(), command);
}
}
OpenPOWER on IntegriCloud