summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/LanguageRuntime.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2016-02-06 00:43:07 +0000
committerEnrico Granata <egranata@apple.com>2016-02-06 00:43:07 +0000
commit0a66e2f13505f9cf9e8a37dc35cb68effedeb13d (patch)
treea7abb280a21486f8989846b770745f7611d86ab8 /lldb/source/Target/LanguageRuntime.cpp
parent304ccee5285534369a79960152a767e7a18398e8 (diff)
downloadbcm5719-llvm-0a66e2f13505f9cf9e8a37dc35cb68effedeb13d.tar.gz
bcm5719-llvm-0a66e2f13505f9cf9e8a37dc35cb68effedeb13d.zip
Fix an issue where certain CommandObjects (or Options thereof) were being created once, bound to a specific CommandInterpreter (and hence a specific Debugger), and then cached for reuse across different Debugger instances
Obviously, if the original Debugger goes away, those commands are holding on to now stale memory, which has the potential to cause crashes Fixes rdar://24460882 llvm-svn: 259964
Diffstat (limited to 'lldb/source/Target/LanguageRuntime.cpp')
-rw-r--r--lldb/source/Target/LanguageRuntime.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp
index b1e2b3eb04f..7f386162d16 100644
--- a/lldb/source/Target/LanguageRuntime.cpp
+++ b/lldb/source/Target/LanguageRuntime.cpp
@@ -336,6 +336,10 @@ LanguageRuntime::InitializeCommands (CommandObject* parent)
CommandObjectSP command = command_callback(parent->GetCommandInterpreter());
if (command)
{
+ // 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