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/CommandObjectApropos.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'lldb/source/Commands/CommandObjectApropos.cpp') diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp index bdb70df1a32..0f10b3ec780 100644 --- a/lldb/source/Commands/CommandObjectApropos.cpp +++ b/lldb/source/Commands/CommandObjectApropos.cpp @@ -40,14 +40,18 @@ CommandObjectApropos::~CommandObjectApropos() bool -CommandObjectApropos::Execute (Args &command, CommandContext *context, CommandInterpreter *interpreter, - CommandReturnObject &result) +CommandObjectApropos::Execute +( + CommandInterpreter &interpreter, + Args& args, + CommandReturnObject &result +) { - const int argc = command.GetArgumentCount (); + const int argc = args.GetArgumentCount (); if (argc == 1) { - const char *search_word = command.GetArgumentAtIndex(0); + const char *search_word = args.GetArgumentAtIndex(0); if ((search_word != NULL) && (strlen (search_word) > 0)) { @@ -55,7 +59,7 @@ CommandObjectApropos::Execute (Args &command, CommandContext *context, CommandIn // is private. StringList commands_found; StringList commands_help; - interpreter->FindCommandsForApropos (search_word, commands_found, commands_help); + interpreter.FindCommandsForApropos (search_word, commands_found, commands_help); if (commands_found.GetSize() == 0) { result.AppendMessageWithFormat ("No commands found pertaining to '%s'.", search_word); @@ -74,8 +78,11 @@ CommandObjectApropos::Execute (Args &command, CommandContext *context, CommandIn } for (int i = 0; i < commands_found.GetSize(); ++i) - interpreter->OutputFormattedHelpText (result.GetOutputStream(), commands_found.GetStringAtIndex(i), - "--", commands_help.GetStringAtIndex(i), max_len); + interpreter.OutputFormattedHelpText (result.GetOutputStream(), + commands_found.GetStringAtIndex(i), + "--", commands_help. + GetStringAtIndex(i), + max_len); } result.SetStatus (eReturnStatusSuccessFinishNoResult); -- cgit v1.2.3