diff options
| author | Enrico Granata <egranata@apple.com> | 2016-02-06 01:36:07 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2016-02-06 01:36:07 +0000 |
| commit | 41571781c01723a64a0d2fa3e82b1b7f3f2c28dc (patch) | |
| tree | 77748f328d2f3aa97ff5dac3d46cab10769f59b2 /lldb/source/Interpreter/CommandInterpreter.cpp | |
| parent | 23919372d1db1dba80e8c4697e0a0922e830fc3a (diff) | |
| download | llvm-41571781c01723a64a0d2fa3e82b1b7f3f2c28dc.zip llvm-41571781c01723a64a0d2fa3e82b1b7f3f2c28dc.tar.gz llvm-41571781c01723a64a0d2fa3e82b1b7f3f2c28dc.tar.bz2 | |
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
Diffstat (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp')
| -rw-r--r-- | lldb/source/Interpreter/CommandInterpreter.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index fd88f0d..bab1246 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; } |
