From 6611103cfe7a8c08554816fc08abef2e2960e799 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 23 Jun 2010 01:19:29 +0000 Subject: Very large changes that were needed in order to allow multiple connections to the debugger from GUI windows. Previously there was one global debugger instance that could be accessed that had its own command interpreter and current state (current target/process/thread/frame). When a GUI debugger was attached, if it opened more than one window that each had a console window, there were issues where the last one to setup the global debugger object won and got control of the debugger. To avoid this we now create instances of the lldb_private::Debugger that each has its own state: - target list for targets the debugger instance owns - current process/thread/frame - its own command interpreter - its own input, output and error file handles to avoid conflicts - its own input reader stack So now clients should call: SBDebugger::Initialize(); // (static function) SBDebugger debugger (SBDebugger::Create()); // Use which ever file handles you wish debugger.SetErrorFileHandle (stderr, false); debugger.SetOutputFileHandle (stdout, false); debugger.SetInputFileHandle (stdin, true); // main loop SBDebugger::Terminate(); // (static function) SBDebugger::Initialize() and SBDebugger::Terminate() are ref counted to ensure nothing gets destroyed too early when multiple clients might be attached. Cleaned up the command interpreter and the CommandObject and all subclasses to take more appropriate arguments. llvm-svn: 106615 --- lldb/source/Commands/CommandObjectSet.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lldb/source/Commands/CommandObjectSet.cpp') diff --git a/lldb/source/Commands/CommandObjectSet.cpp b/lldb/source/Commands/CommandObjectSet.cpp index 46ad049fd1b..89f154a083e 100644 --- a/lldb/source/Commands/CommandObjectSet.cpp +++ b/lldb/source/Commands/CommandObjectSet.cpp @@ -38,9 +38,8 @@ CommandObjectSet::~CommandObjectSet() bool CommandObjectSet::Execute ( + CommandInterpreter &interpreter, Args& command, - CommandContext *context, - CommandInterpreter *interpreter, CommandReturnObject &result ) { @@ -66,7 +65,7 @@ CommandObjectSet::Execute else if (var_value == NULL || var_value[0] == '\0') { // No value given: Check to see if we're trying to clear an array. - StateVariable *var = interpreter->GetStateVariable (var_name); + StateVariable *var = interpreter.GetStateVariable (var_name); if (var != NULL && var->GetType() == StateVariable::eTypeStringArray) { @@ -81,7 +80,7 @@ CommandObjectSet::Execute } else { - StateVariable *var = interpreter->GetStateVariable(var_name); + StateVariable *var = interpreter.GetStateVariable(var_name); if (var == NULL) { result.AppendErrorWithFormat ("'%s' is not a settable internal variable.\n", var_name); @@ -98,7 +97,7 @@ CommandObjectSet::Execute if (success) { result.SetStatus(eReturnStatusSuccessFinishResult); - if (!var->HasVerifyFunction() || var->VerifyValue (interpreter, (void *) &new_value, result)) + if (!var->HasVerifyFunction() || var->VerifyValue (&interpreter, (void *) &new_value, result)) var->SetBoolValue (new_value); } else @@ -115,7 +114,7 @@ CommandObjectSet::Execute if (success) { result.SetStatus(eReturnStatusSuccessFinishResult); - if (!var->HasVerifyFunction() || var->VerifyValue (interpreter, (void *) &new_value, result)) + if (!var->HasVerifyFunction() || var->VerifyValue (&interpreter, (void *) &new_value, result)) var->SetIntValue (new_value); } else @@ -126,7 +125,7 @@ CommandObjectSet::Execute } else if (var->GetType() == StateVariable::eTypeString) { - if (!var->HasVerifyFunction() || var->VerifyValue (interpreter, (void *) var_value, result)) + if (!var->HasVerifyFunction() || var->VerifyValue (&interpreter, (void *) var_value, result)) var->SetStringValue (var_value); } else if (var->GetType() == StateVariable::eTypeStringArray) -- cgit v1.2.3