From 41571781c01723a64a0d2fa3e82b1b7f3f2c28dc Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Sat, 6 Feb 2016 01:36:07 +0000 Subject: Per Jim's suggestion, move checks that we're not mixing and matching Debuggers and Commands deeper in the bowels of LLDB NFC llvm-svn: 259972 --- lldb/source/Interpreter/CommandInterpreter.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp') 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; } -- cgit v1.2.3