[Lldb-commits] [lldb] r105885 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Commands/CommandCompletions.cpp source/Commands/CommandObjectCrossref.cpp source/Commands/CommandObjectMultiword.cpp source/Commands/CommandObjectScript.cpp source/Commands/CommandObjectScript.h source/Interpreter/CommandCompletions.cpp source/Interpreter/CommandObjectCrossref.cpp source/Interpreter/CommandObjectMultiword.cpp source/Interpreter/CommandObjectScript.cpp source/Interpreter/CommandObjectScript.h
Greg Clayton
gclayton at apple.com
Sat Jun 12 08:43:36 PDT 2010
Author: gclayton
Date: Sat Jun 12 10:43:35 2010
New Revision: 105885
URL: http://llvm.org/viewvc/llvm-project?rev=105885&view=rev
Log:
Moved files around for linux build. Fixed up Xcode project to
refer to the new locations.
Added:
lldb/trunk/source/Commands/CommandCompletions.cpp
- copied unchanged from r105882, lldb/trunk/source/Interpreter/CommandCompletions.cpp
lldb/trunk/source/Commands/CommandObjectCrossref.cpp
- copied unchanged from r105882, lldb/trunk/source/Interpreter/CommandObjectCrossref.cpp
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
- copied unchanged from r105882, lldb/trunk/source/Interpreter/CommandObjectMultiword.cpp
lldb/trunk/source/Interpreter/CommandObjectScript.cpp
- copied unchanged from r105882, lldb/trunk/source/Commands/CommandObjectScript.cpp
lldb/trunk/source/Interpreter/CommandObjectScript.h
- copied unchanged from r105882, lldb/trunk/source/Commands/CommandObjectScript.h
Removed:
lldb/trunk/source/Commands/CommandObjectScript.cpp
lldb/trunk/source/Commands/CommandObjectScript.h
lldb/trunk/source/Interpreter/CommandCompletions.cpp
lldb/trunk/source/Interpreter/CommandObjectCrossref.cpp
lldb/trunk/source/Interpreter/CommandObjectMultiword.cpp
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=105885&r1=105884&r2=105885&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sat Jun 12 10:43:35 2010
@@ -604,7 +604,7 @@
26BC7D2010F1B76300F91463 /* CommandObjectQuit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectQuit.h; path = source/Commands/CommandObjectQuit.h; sourceTree = "<group>"; };
26BC7D2210F1B76300F91463 /* CommandObjectRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectRegister.h; path = source/Commands/CommandObjectRegister.h; sourceTree = "<group>"; };
26BC7D2310F1B76300F91463 /* CommandObjectRemove.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectRemove.h; path = source/Commands/CommandObjectRemove.h; sourceTree = "<group>"; };
- 26BC7D2410F1B76300F91463 /* CommandObjectScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectScript.h; path = source/Commands/CommandObjectScript.h; sourceTree = "<group>"; };
+ 26BC7D2410F1B76300F91463 /* CommandObjectScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectScript.h; path = source/Interpreter/CommandObjectScript.h; sourceTree = "<group>"; };
26BC7D2510F1B76300F91463 /* CommandObjectSelect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSelect.h; path = source/Commands/CommandObjectSelect.h; sourceTree = "<group>"; };
26BC7D2610F1B76300F91463 /* CommandObjectSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSet.h; path = source/Commands/CommandObjectSet.h; sourceTree = "<group>"; };
26BC7D2710F1B76300F91463 /* CommandObjectSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSettings.h; path = source/Commands/CommandObjectSettings.h; sourceTree = "<group>"; };
@@ -728,7 +728,7 @@
26BC7E3910F1B84700F91463 /* CommandObjectQuit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectQuit.cpp; path = source/Commands/CommandObjectQuit.cpp; sourceTree = "<group>"; };
26BC7E3B10F1B84700F91463 /* CommandObjectRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectRegister.cpp; path = source/Commands/CommandObjectRegister.cpp; sourceTree = "<group>"; };
26BC7E3C10F1B84700F91463 /* CommandObjectRemove.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectRemove.cpp; path = source/Commands/CommandObjectRemove.cpp; sourceTree = "<group>"; };
- 26BC7E3D10F1B84700F91463 /* CommandObjectScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectScript.cpp; path = source/Commands/CommandObjectScript.cpp; sourceTree = "<group>"; };
+ 26BC7E3D10F1B84700F91463 /* CommandObjectScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectScript.cpp; path = source/Interpreter/CommandObjectScript.cpp; sourceTree = "<group>"; };
26BC7E3E10F1B84700F91463 /* CommandObjectSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSelect.cpp; path = source/Commands/CommandObjectSelect.cpp; sourceTree = "<group>"; };
26BC7E3F10F1B84700F91463 /* CommandObjectSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSet.cpp; path = source/Commands/CommandObjectSet.cpp; sourceTree = "<group>"; };
26BC7E4010F1B84700F91463 /* CommandObjectSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSettings.cpp; path = source/Commands/CommandObjectSettings.cpp; sourceTree = "<group>"; };
@@ -872,8 +872,8 @@
26DFBC50113B48D600DD817F /* CommandObjectCrossref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectCrossref.h; path = include/lldb/Interpreter/CommandObjectCrossref.h; sourceTree = "<group>"; };
26DFBC51113B48D600DD817F /* CommandObjectMultiword.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectMultiword.h; path = include/lldb/Interpreter/CommandObjectMultiword.h; sourceTree = "<group>"; };
26DFBC52113B48D600DD817F /* CommandObjectRegexCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectRegexCommand.h; path = include/lldb/Interpreter/CommandObjectRegexCommand.h; sourceTree = "<group>"; };
- 26DFBC57113B48F300DD817F /* CommandObjectCrossref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectCrossref.cpp; path = source/Interpreter/CommandObjectCrossref.cpp; sourceTree = "<group>"; };
- 26DFBC58113B48F300DD817F /* CommandObjectMultiword.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectMultiword.cpp; path = source/Interpreter/CommandObjectMultiword.cpp; sourceTree = "<group>"; };
+ 26DFBC57113B48F300DD817F /* CommandObjectCrossref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectCrossref.cpp; path = source/Commands/CommandObjectCrossref.cpp; sourceTree = "<group>"; };
+ 26DFBC58113B48F300DD817F /* CommandObjectMultiword.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectMultiword.cpp; path = source/Commands/CommandObjectMultiword.cpp; sourceTree = "<group>"; };
26DFBC59113B48F300DD817F /* CommandObjectRegexCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectRegexCommand.cpp; path = source/Interpreter/CommandObjectRegexCommand.cpp; sourceTree = "<group>"; };
26E3EEBD11A9870400FBADB6 /* Unwind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Unwind.h; path = include/lldb/Target/Unwind.h; sourceTree = "<group>"; };
26E3EEBE11A98A1900FBADB6 /* UnwindLibUnwind.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnwindLibUnwind.cpp; path = Utility/UnwindLibUnwind.cpp; sourceTree = "<group>"; };
@@ -918,7 +918,7 @@
4C00986F11500B4300F316B0 /* UnixSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnixSignals.h; path = include/lldb/Target/UnixSignals.h; sourceTree = "<group>"; };
4C00987011500B4300F316B0 /* UnixSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnixSignals.cpp; path = source/Target/UnixSignals.cpp; sourceTree = "<group>"; };
4C09CB73116BD98B00C7A725 /* CommandCompletions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandCompletions.h; path = include/lldb/Interpreter/CommandCompletions.h; sourceTree = "<group>"; };
- 4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandCompletions.cpp; path = source/Interpreter/CommandCompletions.cpp; sourceTree = "<group>"; };
+ 4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandCompletions.cpp; path = source/Commands/CommandCompletions.cpp; sourceTree = "<group>"; };
4C43DEF9110641F300E55CBF /* ThreadPlanShouldStopHere.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanShouldStopHere.h; path = include/lldb/Target/ThreadPlanShouldStopHere.h; sourceTree = "<group>"; };
4C43DEFA110641F300E55CBF /* ThreadPlanShouldStopHere.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanShouldStopHere.cpp; path = source/Target/ThreadPlanShouldStopHere.cpp; sourceTree = "<group>"; };
4C43DF8511069BFD00E55CBF /* ThreadPlanStepInRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepInRange.h; path = include/lldb/Target/ThreadPlanStepInRange.h; sourceTree = "<group>"; };
Removed: lldb/trunk/source/Commands/CommandObjectScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectScript.cpp?rev=105884&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectScript.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectScript.cpp (removed)
@@ -1,149 +0,0 @@
-//===-- CommandObjectScript.cpp ---------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectScript.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Args.h"
-
-#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/ScriptInterpreterPython.h"
-#include "lldb/Interpreter/ScriptInterpreterNone.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//-------------------------------------------------------------------------
-// CommandObjectScript
-//-------------------------------------------------------------------------
-
-CommandObjectScript::CommandObjectScript (ScriptLanguage script_lang) :
- CommandObject ("script",
- "Passes an expression to the script interpreter for evaluation and returns the results. Drops user into the interactive interpreter if no expressions are given.",
- "script [<script-expressions-for-evaluation>]"),
- m_script_lang (script_lang),
- m_interpreter_ap ()
-{
-}
-
-CommandObjectScript::~CommandObjectScript ()
-{
-}
-
-bool
-CommandObjectScript::ExecuteRawCommandString
-(
- const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- std::string arg_str (command);
-
- ScriptInterpreter *script_interpreter = GetInterpreter ();
-
- if (script_interpreter == NULL)
- {
- result.AppendError("no script interpeter");
- result.SetStatus (eReturnStatusFailed);
- }
-
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- FILE *err_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- if (out_fh && err_fh)
- {
- if (arg_str.empty())
- script_interpreter->ExecuteInterpreterLoop (out_fh, err_fh);
- else
- script_interpreter->ExecuteOneLine (arg_str, out_fh, err_fh);
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else
- {
- if (out_fh == NULL)
- result.AppendError("invalid output file handle");
- else
- result.AppendError("invalid error file handle");
- }
- return result.Succeeded();
-}
-
-bool
-CommandObjectScript::WantsRawCommandString()
-{
- return true;
-}
-
-bool
-CommandObjectScript::Execute
-(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- std::string arg_str;
- ScriptInterpreter *script_interpreter = GetInterpreter ();
-
- if (script_interpreter == NULL)
- {
- result.AppendError("no script interpeter");
- result.SetStatus (eReturnStatusFailed);
- }
-
- const int argc = command.GetArgumentCount();
- for (int i = 0; i < argc; ++i)
- arg_str.append(command.GetArgumentAtIndex(i));
-
-
- FILE *out_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- FILE *err_fh = Debugger::GetSharedInstance().GetOutputFileHandle();
- if (out_fh && err_fh)
- {
- if (arg_str.empty())
- script_interpreter->ExecuteInterpreterLoop (out_fh, err_fh);
- else
- script_interpreter->ExecuteOneLine (arg_str, out_fh, err_fh);
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
- }
- else
- {
- if (out_fh == NULL)
- result.AppendError("invalid output file handle");
- else
- result.AppendError("invalid error file handle");
- }
- return result.Succeeded();
-}
-
-
-ScriptInterpreter *
-CommandObjectScript::GetInterpreter ()
-{
- if (m_interpreter_ap.get() == NULL)
- {
- switch (m_script_lang)
- {
- case eScriptLanguagePython:
- m_interpreter_ap.reset (new ScriptInterpreterPython ());
- break;
-
- case eScriptLanguageNone:
- m_interpreter_ap.reset (new ScriptInterpreterNone ());
- break;
- }
- }
- return m_interpreter_ap.get();
-}
Removed: lldb/trunk/source/Commands/CommandObjectScript.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectScript.h?rev=105884&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectScript.h (original)
+++ lldb/trunk/source/Commands/CommandObjectScript.h (removed)
@@ -1,58 +0,0 @@
-//===-- CommandObjectScript.h -----------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_CommandObjectScript_h_
-#define liblldb_CommandObjectScript_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandObject.h"
-
-namespace lldb_private {
-
-//-------------------------------------------------------------------------
-// CommandObjectScript
-//-------------------------------------------------------------------------
-
-class CommandObjectScript : public CommandObject
-{
-public:
-
- CommandObjectScript (lldb::ScriptLanguage script_lang);
-
- virtual
- ~CommandObjectScript ();
-
- bool WantsRawCommandString();
-
- virtual bool
- ExecuteRawCommandString (const char *command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-
- virtual bool
- Execute (Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result);
-
- ScriptInterpreter *
- GetInterpreter ();
-
-private:
- lldb::ScriptLanguage m_script_lang;
- std::auto_ptr<ScriptInterpreter> m_interpreter_ap;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectScript_h_
Removed: lldb/trunk/source/Interpreter/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandCompletions.cpp?rev=105884&view=auto
==============================================================================
--- lldb/trunk/source/Interpreter/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandCompletions.cpp (removed)
@@ -1,414 +0,0 @@
-//===-- CommandCompletions.cpp ----------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Args.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Core/FileSpecList.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Interpreter/CommandCompletions.h"
-
-
-using namespace lldb_private;
-
-CommandCompletions::CommonCompletionElement
-CommandCompletions::g_common_completions[] =
-{
- {eCustomCompletion, NULL},
- {eSourceFileCompletion, CommandCompletions::SourceFiles},
- {eDiskFileCompletion, NULL},
- {eSymbolCompletion, CommandCompletions::Symbols},
- {eModuleCompletion, CommandCompletions::Modules},
- {eNoCompletion, NULL} // This one has to be last in the list.
-};
-
-bool
-CommandCompletions::InvokeCommonCompletionCallbacks (uint32_t completion_mask,
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
-{
- bool handled = false;
-
- if (completion_mask & eCustomCompletion)
- return false;
-
- for (int i = 0; ; i++)
- {
- if (g_common_completions[i].type == eNoCompletion)
- break;
- else if ((g_common_completions[i].type & completion_mask) == g_common_completions[i].type
- && g_common_completions[i].callback != NULL)
- {
- handled = true;
- g_common_completions[i].callback (completion_str,
- match_start_point,
- max_return_elements,
- interpreter,
- searcher,
- matches);
- }
- }
- return handled;
-}
-
-int
-CommandCompletions::SourceFiles (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
-{
- // Find some way to switch "include support files..."
- SourceFileCompleter completer (false, partial_file_name, match_start_point, max_return_elements, interpreter,
- matches);
-
- if (searcher == NULL)
- {
- lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP();
- SearchFilter null_searcher (target_sp);
- completer.DoCompletion (&null_searcher);
- }
- else
- {
- completer.DoCompletion (searcher);
- }
- return matches.GetSize();
-}
-
-int
-CommandCompletions::Modules (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
-{
- ModuleCompleter completer(partial_file_name, match_start_point, max_return_elements, interpreter, matches);
-
- if (searcher == NULL)
- {
- lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP();
- SearchFilter null_searcher (target_sp);
- completer.DoCompletion (&null_searcher);
- }
- else
- {
- completer.DoCompletion (searcher);
- }
- return matches.GetSize();
-}
-
-int
-CommandCompletions::Symbols (const char *partial_file_name,
- int match_start_point,
- int max_return_elements,
- lldb_private::CommandInterpreter *interpreter,
- SearchFilter *searcher,
- lldb_private::StringList &matches)
-{
- SymbolCompleter completer(partial_file_name, match_start_point, max_return_elements, interpreter, matches);
-
- if (searcher == NULL)
- {
- lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP();
- SearchFilter null_searcher (target_sp);
- completer.DoCompletion (&null_searcher);
- }
- else
- {
- completer.DoCompletion (searcher);
- }
- return matches.GetSize();
-}
-
-CommandCompletions::Completer::Completer (
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches
-) :
- m_completion_str (completion_str),
- m_match_start_point (match_start_point),
- m_max_return_elements (max_return_elements),
- m_interpreter (interpreter),
- m_matches (matches)
-{
-}
-
-CommandCompletions::Completer::~Completer ()
-{
-
-}
-
-//----------------------------------------------------------------------
-// SourceFileCompleter
-//----------------------------------------------------------------------
-
-CommandCompletions::SourceFileCompleter::SourceFileCompleter (
- bool include_support_files,
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches
-) :
- CommandCompletions::Completer (completion_str, match_start_point, max_return_elements, interpreter, matches),
- m_include_support_files (include_support_files),
- m_matching_files()
-{
- FileSpec partial_spec (m_completion_str.c_str());
- m_file_name = partial_spec.GetFilename().GetCString();
- m_dir_name = partial_spec.GetDirectory().GetCString();
-}
-
-Searcher::Depth
-CommandCompletions::SourceFileCompleter::GetDepth()
-{
- return eDepthCompUnit;
-}
-
-Searcher::CallbackReturn
-CommandCompletions::SourceFileCompleter::SearchCallback (
- SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete
-)
-{
- if (context.comp_unit != NULL)
- {
- if (m_include_support_files)
- {
- FileSpecList supporting_files = context.comp_unit->GetSupportFiles();
- for (size_t sfiles = 0; sfiles < supporting_files.GetSize(); sfiles++)
- {
- const FileSpec &sfile_spec = supporting_files.GetFileSpecAtIndex(sfiles);
- const char *sfile_file_name = sfile_spec.GetFilename().GetCString();
- const char *sfile_dir_name = sfile_spec.GetFilename().GetCString();
- bool match = false;
- if (m_file_name && sfile_file_name
- && strstr (sfile_file_name, m_file_name) == sfile_file_name)
- match = true;
- if (match && m_dir_name && sfile_dir_name
- && strstr (sfile_dir_name, m_dir_name) != sfile_dir_name)
- match = false;
-
- if (match)
- {
- m_matching_files.AppendIfUnique(sfile_spec);
- }
- }
-
- }
- else
- {
- const char *cur_file_name = context.comp_unit->GetFilename().GetCString();
- const char *cur_dir_name = context.comp_unit->GetDirectory().GetCString();
-
- bool match = false;
- if (m_file_name && cur_file_name
- && strstr (cur_file_name, m_file_name) == cur_file_name)
- match = true;
-
- if (match && m_dir_name && cur_dir_name
- && strstr (cur_dir_name, m_dir_name) != cur_dir_name)
- match = false;
-
- if (match)
- {
- m_matching_files.AppendIfUnique(context.comp_unit);
- }
- }
- }
- return Searcher::eCallbackReturnContinue;
-}
-
-size_t
-CommandCompletions::SourceFileCompleter::DoCompletion (SearchFilter *filter)
-{
- filter->Search (*this);
- // Now convert the filelist to completions:
- for (size_t i = 0; i < m_matching_files.GetSize(); i++)
- {
- m_matches.AppendString (m_matching_files.GetFileSpecAtIndex(i).GetFilename().GetCString());
- }
- return m_matches.GetSize();
-
-}
-
-//----------------------------------------------------------------------
-// SymbolCompleter
-//----------------------------------------------------------------------
-
-static bool
-regex_chars (const char comp)
-{
- if (comp == '[' || comp == ']' || comp == '(' || comp == ')')
- return true;
- else
- return false;
-}
-CommandCompletions::SymbolCompleter::SymbolCompleter (
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches
-) :
- CommandCompletions::Completer (completion_str, match_start_point, max_return_elements, interpreter, matches)
-{
- std::string regex_str ("^");
- regex_str.append(completion_str);
- regex_str.append(".*");
- std::string::iterator pos;
-
- pos = find_if(regex_str.begin(), regex_str.end(), regex_chars);
- while (pos < regex_str.end()) {
- pos = regex_str.insert(pos, '\\');
- pos += 2;
- pos = find_if(pos, regex_str.end(), regex_chars);
- }
- m_regex.Compile(regex_str.c_str());
-}
-
-Searcher::Depth
-CommandCompletions::SymbolCompleter::GetDepth()
-{
- return eDepthModule;
-}
-
-Searcher::CallbackReturn
-CommandCompletions::SymbolCompleter::SearchCallback (
- SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete
-)
-{
- SymbolContextList func_list;
- SymbolContextList sym_list;
-
- if (context.module_sp != NULL)
- {
- if (context.module_sp)
- {
- context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, lldb::eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_regex, true, func_list);
- }
-
- SymbolContext sc;
- // Now add the functions & symbols to the list - only add if unique:
- for (int i = 0; i < func_list.GetSize(); i++)
- {
- if (func_list.GetContextAtIndex(i, sc))
- {
- if (sc.function)
- {
- m_match_set.insert (sc.function->GetMangled().GetDemangledName());
- }
- }
- }
-
- for (int i = 0; i < sym_list.GetSize(); i++)
- {
- if (sym_list.GetContextAtIndex(i, sc))
- {
- if (sc.symbol && sc.symbol->GetAddressRangePtr())
- {
- m_match_set.insert (sc.symbol->GetMangled().GetDemangledName());
- }
- }
- }
- }
- return Searcher::eCallbackReturnContinue;
-}
-
-size_t
-CommandCompletions::SymbolCompleter::DoCompletion (SearchFilter *filter)
-{
- filter->Search (*this);
- collection::iterator pos = m_match_set.begin(), end = m_match_set.end();
- for (pos = m_match_set.begin(); pos != end; pos++)
- m_matches.AppendString((*pos).GetCString());
-
- return m_matches.GetSize();
-}
-
-//----------------------------------------------------------------------
-// ModuleCompleter
-//----------------------------------------------------------------------
-CommandCompletions::ModuleCompleter::ModuleCompleter (
- const char *completion_str,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches
-) :
- CommandCompletions::Completer (completion_str, match_start_point, max_return_elements, interpreter, matches)
-{
- FileSpec partial_spec (m_completion_str.c_str());
- m_file_name = partial_spec.GetFilename().GetCString();
- m_dir_name = partial_spec.GetDirectory().GetCString();
-}
-
-Searcher::Depth
-CommandCompletions::ModuleCompleter::GetDepth()
-{
- return eDepthModule;
-}
-
-Searcher::CallbackReturn
-CommandCompletions::ModuleCompleter::SearchCallback (
- SearchFilter &filter,
- SymbolContext &context,
- Address *addr,
- bool complete
-)
-{
- if (context.module_sp != NULL)
- {
- const char *cur_file_name = context.module_sp->GetFileSpec().GetFilename().GetCString();
- const char *cur_dir_name = context.module_sp->GetFileSpec().GetDirectory().GetCString();
-
- bool match = false;
- if (m_file_name && cur_file_name
- && strstr (cur_file_name, m_file_name) == cur_file_name)
- match = true;
-
- if (match && m_dir_name && cur_dir_name
- && strstr (cur_dir_name, m_dir_name) != cur_dir_name)
- match = false;
-
- if (match)
- {
- m_matches.AppendString (cur_file_name);
- }
- }
- return Searcher::eCallbackReturnContinue;
-}
-
-size_t
-CommandCompletions::ModuleCompleter::DoCompletion (SearchFilter *filter)
-{
- filter->Search (*this);
- return m_matches.GetSize();
-}
-
-
-
Removed: lldb/trunk/source/Interpreter/CommandObjectCrossref.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectCrossref.cpp?rev=105884&view=auto
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectCrossref.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectCrossref.cpp (removed)
@@ -1,92 +0,0 @@
-//===-- CommandObjectCrossref.cpp -------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Interpreter/CommandObjectCrossref.h"
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandReturnObject.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//-------------------------------------------------------------------------
-// CommandObjectCrossref
-//-------------------------------------------------------------------------
-
-CommandObjectCrossref::CommandObjectCrossref
-(
- const char *name,
- const char *help,
- const char *syntax
-) :
- CommandObject (name, help, syntax),
- m_crossref_object_types()
-{
-}
-
-CommandObjectCrossref::~CommandObjectCrossref ()
-{
-}
-
-bool
-CommandObjectCrossref::Execute
-(
- Args& command,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- if (m_crossref_object_types.GetArgumentCount() == 0)
- {
- result.AppendErrorWithFormat ("There are no objects for which you can call '%s'.\n", GetCommandName());
- result.SetStatus (eReturnStatusFailed);
- }
- else
- {
- GenerateHelpText (result);
- }
- return result.Succeeded();
-}
-
-void
-CommandObjectCrossref::AddObject (const char *obj_name)
-{
- m_crossref_object_types.AppendArgument (obj_name);
-}
-
-const char **
-CommandObjectCrossref::GetObjectTypes () const
-{
- return m_crossref_object_types.GetConstArgumentVector();
-}
-
-void
-CommandObjectCrossref::GenerateHelpText (CommandReturnObject &result)
-{
- result.AppendMessage ("This command can be called on the following types of objects:");
-
- for (int i = 0; i < m_crossref_object_types.GetArgumentCount(); ++i)
- {
- const char *obj_name = m_crossref_object_types.GetArgumentAtIndex(i);
- result.AppendMessageWithFormat (" %s (e.g. '%s %s')\n", obj_name,
- obj_name, GetCommandName());
- }
-
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
-}
-
-bool
-CommandObjectCrossref::IsCrossRefObject ()
-{
- return true;
-}
Removed: lldb/trunk/source/Interpreter/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectMultiword.cpp?rev=105884&view=auto
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectMultiword.cpp (removed)
@@ -1,263 +0,0 @@
-//===-- CommandObjectMultiword.cpp ------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Interpreter/CommandObjectMultiword.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandContext.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Core/Options.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-//-------------------------------------------------------------------------
-// CommandObjectMultiword
-//-------------------------------------------------------------------------
-
-CommandObjectMultiword::CommandObjectMultiword
-(
- const char *name,
- const char *help,
- const char *syntax,
- uint32_t flags
-) :
- CommandObject (name, help, syntax, flags)
-{
-}
-
-CommandObjectMultiword::~CommandObjectMultiword ()
-{
-}
-
-CommandObjectSP
-CommandObjectMultiword::GetSubcommandSP (const char *sub_cmd, StringList *matches)
-{
- CommandObjectSP return_cmd_sp;
- CommandObject::CommandMap::iterator pos;
-
- if (!m_subcommand_dict.empty())
- {
- pos = m_subcommand_dict.find (sub_cmd);
- if (pos != m_subcommand_dict.end())
- return_cmd_sp = pos->second;
- else
- {
-
- StringList local_matches;
- if (matches == NULL)
- matches = &local_matches;
- int num_matches = CommandObject::AddNamesMatchingPartialString (m_subcommand_dict, sub_cmd, *matches);
-
- if (num_matches == 1)
- {
- // Cleaner, but slightly less efficient would be to call back into this function, since I now
- // know I have an exact match...
-
- sub_cmd = matches->GetStringAtIndex(0);
- pos = m_subcommand_dict.find(sub_cmd);
- if (pos != m_subcommand_dict.end())
- return_cmd_sp = pos->second;
- }
- }
- }
- return return_cmd_sp;
-}
-
-CommandObject *
-CommandObjectMultiword::GetSubcommandObject (const char *sub_cmd, StringList *matches)
-{
- return GetSubcommandSP(sub_cmd, matches).get();
-}
-
-bool
-CommandObjectMultiword::LoadSubCommand (CommandObjectSP cmd_obj, const char *name,
- CommandInterpreter *interpreter)
-{
- CommandMap::iterator pos;
- bool success = true;
-
- pos = m_subcommand_dict.find(name);
- if (pos == m_subcommand_dict.end())
- {
- m_subcommand_dict[name] = cmd_obj;
- interpreter->CrossRegisterCommand (name, GetCommandName());
- }
- else
- success = false;
-
- return success;
-}
-
-bool
-CommandObjectMultiword::Execute
-(
- Args& args,
- CommandContext *context,
- CommandInterpreter *interpreter,
- CommandReturnObject &result
-)
-{
- const size_t argc = args.GetArgumentCount();
- if (argc == 0)
- {
- GenerateHelpText (result, interpreter);
- }
- else
- {
- const char *sub_command = args.GetArgumentAtIndex (0);
-
- if (sub_command)
- {
- if (::strcasecmp (sub_command, "help") == 0)
- {
- GenerateHelpText (result, interpreter);
- }
- else if (!m_subcommand_dict.empty())
- {
- StringList matches;
- CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches);
- if (sub_cmd_obj != NULL)
- {
- // Now call CommandObject::Execute to process and options in 'rest_of_line'. From there
- // the command-specific version of Execute will be called, with the processed arguments.
-
- args.Shift();
-
- sub_cmd_obj->ExecuteWithOptions (args, context, interpreter, result);
- }
- else
- {
- std::string error_msg;
- int num_subcmd_matches = matches.GetSize();
- if (num_subcmd_matches > 0)
- error_msg.assign ("ambiguous command ");
- else
- error_msg.assign ("invalid command ");
-
- error_msg.append ("'");
- error_msg.append (GetCommandName());
- error_msg.append (" ");
- error_msg.append (sub_command);
- error_msg.append ("'");
-
- if (num_subcmd_matches > 0)
- {
- error_msg.append (" Possible completions:");
- for (int i = 0; i < num_subcmd_matches; i++)
- {
- error_msg.append ("\n\t");
- error_msg.append (matches.GetStringAtIndex (i));
- }
- }
- error_msg.append ("\n");
- result.AppendRawError (error_msg.c_str(), error_msg.size());
- result.SetStatus (eReturnStatusFailed);
- }
- }
- else
- {
- result.AppendErrorWithFormat ("'%s' does not have any subcommands.\n", GetCommandName());
- result.SetStatus (eReturnStatusFailed);
- }
- }
- }
-
- return result.Succeeded();
-}
-
-void
-CommandObjectMultiword::GenerateHelpText (CommandReturnObject &result, CommandInterpreter *interpreter)
-{
- // First time through here, generate the help text for the object and
- // push it to the return result object as well
-
- StreamString &output_stream = result.GetOutputStream();
- output_stream.PutCString ("The following subcommands are supported:\n\n");
-
- CommandMap::iterator pos;
- std::string longest_word = interpreter->FindLongestCommandWord (m_subcommand_dict);
- uint32_t max_len = 0;
-
- if (! longest_word.empty())
- max_len = strlen (longest_word.c_str()) + 4; // Indent the output by 4 spaces.
-
- for (pos = m_subcommand_dict.begin(); pos != m_subcommand_dict.end(); ++pos)
- {
- std::string indented_command (" ");
- indented_command.append (pos->first);
- interpreter->OutputFormattedHelpText (result.GetOutputStream(), indented_command.c_str(), "--",
- pos->second->GetHelp(), max_len);
- }
-
- output_stream.PutCString ("\nFor more help on any particular subcommand, type 'help <command> <subcommand>'.\n");
-
- result.SetStatus (eReturnStatusSuccessFinishNoResult);
-}
-
-int
-CommandObjectMultiword::HandleCompletion
-(
- Args &input,
- int &cursor_index,
- int &cursor_char_position,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter *interpreter,
- StringList &matches
-)
-{
- if (cursor_index == 0)
- {
- CommandObject::AddNamesMatchingPartialString (m_subcommand_dict, input.GetArgumentAtIndex(0), matches);
-
- if (matches.GetSize() == 1
- && matches.GetStringAtIndex(0) != NULL
- && strcmp (input.GetArgumentAtIndex(0), matches.GetStringAtIndex(0)) == 0)
- {
- StringList temp_matches;
- CommandObject *cmd_obj = GetSubcommandObject (input.GetArgumentAtIndex(0), &temp_matches);
- if (cmd_obj != NULL)
- {
- matches.DeleteStringAtIndex (0);
- input.Shift();
- cursor_char_position = 0;
- input.AppendArgument ("");
- return cmd_obj->HandleCompletion (input, cursor_index, cursor_char_position, match_start_point,
- max_return_elements, interpreter, matches);
- }
- else
- return matches.GetSize();
- }
- else
- return matches.GetSize();
- }
- else
- {
- CommandObject *sub_command_object = GetSubcommandObject (input.GetArgumentAtIndex(0), &matches);
- if (sub_command_object == NULL)
- {
- return matches.GetSize();
- }
- else
- {
- // Remove the one match that we got from calling GetSubcommandObject.
- matches.DeleteStringAtIndex(0);
- input.Shift();
- cursor_index--;
- return sub_command_object->HandleCompletion (input, cursor_index, cursor_char_position, match_start_point,
- max_return_elements, interpreter, matches);
- }
-
- }
-}
-
More information about the lldb-commits
mailing list