[Lldb-commits] [lldb] r259964 - 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

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 5 16:57:42 PST 2016


> On Feb 5, 2016, at 4:43 PM, Enrico Granata via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> Modified: lldb/trunk/source/Target/LanguageRuntime.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=259964&r1=259963&r2=259964&view=diff
> ==============================================================================
> --- lldb/trunk/source/Target/LanguageRuntime.cpp (original)
> +++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Feb  5 18:43:07 2016
> @@ -336,6 +336,10 @@ LanguageRuntime::InitializeCommands (Com
>             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");

Should CommandObject::LoadSubCommand do this check?

>                 parent->LoadSubCommand(command->GetCommandName(), command);
>             }
>         }

Jim



More information about the lldb-commits mailing list