[Lldb-commits] [lldb] r175831 - <rdar://problem/13265017>
Enrico Granata
egranata at apple.com
Thu Feb 21 15:57:25 PST 2013
Author: enrico
Date: Thu Feb 21 17:57:25 2013
New Revision: 175831
URL: http://llvm.org/viewvc/llvm-project?rev=175831&view=rev
Log:
<rdar://problem/13265017>
The notion of Crossref command has long been forgotten, and there is nothing using CommandObjectCrossref in the current LLDB codebase
However, this was causing a conflict with process plugins and command aliases ending up in an infinite loop under situations such as:
(lldb) command alias monitor process plugin packet monitor
(lldb) process att -n Calendar
Process 28709 stopped
Executable module set to "/Applications/Calendar.app/Contents/MacOS/Calendar".
Architecture set to: x86_64-apple-macosx.
(lldb) command alias monitor process plugin packet monitor
This fixes the loop (and consequent crash) by disposing of Crossref commands and related code
Removed:
lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h
lldb/trunk/source/Commands/CommandObjectCrossref.cpp
Modified:
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=175831&r1=175830&r2=175831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Thu Feb 21 17:57:25 2013
@@ -335,10 +335,6 @@ public:
Initialize ();
void
- CrossRegisterCommand (const char *dest_cmd,
- const char *object_type);
-
- void
SetScriptLanguage (lldb::ScriptLanguage lang);
Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=175831&r1=175830&r2=175831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Thu Feb 21 17:57:25 2013
@@ -124,12 +124,6 @@ public:
void
SetSyntax (const char *str);
-
- virtual void
- AddObject (const char *obj_name) {}
-
- virtual bool
- IsCrossRefObject () { return false; }
// override this to return true if you want to enable the user to delete
// the Command object from the Command dictionary (aliases have their own
Removed: lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h?rev=175830&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h (removed)
@@ -1,60 +0,0 @@
-//===-- CommandObjectCrossref.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_CommandObjectCrossref_h_
-#define liblldb_CommandObjectCrossref_h_
-
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Interpreter/CommandObject.h"
-#include "lldb/Interpreter/Args.h"
-
-namespace lldb_private {
-
-//-------------------------------------------------------------------------
-// CommandObjectCrossref
-//-------------------------------------------------------------------------
-
-class CommandObjectCrossref : public CommandObjectParsed
-{
-public:
- CommandObjectCrossref (CommandInterpreter &interpreter,
- const char *name,
- const char *help = NULL,
- const char *syntax = NULL);
-
- virtual
- ~CommandObjectCrossref ();
-
- virtual void
- GenerateHelpText (CommandReturnObject &result);
-
- virtual bool
- IsCrossRefObject ();
-
- virtual void
- AddObject (const char *obj_name);
-
- const char **
- GetObjectTypes () const;
-
-protected:
- virtual bool
- DoExecute (Args& command,
- CommandReturnObject &result);
-
-private:
- Args m_crossref_object_types;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CommandObjectCrossref_h_
Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h?rev=175831&r1=175830&r2=175831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h Thu Feb 21 17:57:25 2013
@@ -115,12 +115,6 @@ public:
virtual const char *
GetHelpLong ();
- virtual void
- AddObject (const char *obj_name);
-
- virtual bool
- IsCrossRefObject ();
-
virtual bool
IsRemovable() const;
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=175831&r1=175830&r2=175831&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Feb 21 17:57:25 2013
@@ -275,7 +275,6 @@
2689007F13353E2200698AC0 /* CommandCompletions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */; };
2689008013353E2200698AC0 /* CommandInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F0810F1B8DD00F91463 /* CommandInterpreter.cpp */; };
2689008113353E2200698AC0 /* CommandObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F0910F1B8DD00F91463 /* CommandObject.cpp */; };
- 2689008213353E2200698AC0 /* CommandObjectCrossref.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DFBC57113B48F300DD817F /* CommandObjectCrossref.cpp */; };
2689008313353E2200698AC0 /* CommandObjectMultiword.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DFBC58113B48F300DD817F /* CommandObjectMultiword.cpp */; };
2689008413353E2200698AC0 /* CommandObjectRegexCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DFBC59113B48F300DD817F /* CommandObjectRegexCommand.cpp */; };
2689008513353E2200698AC0 /* CommandReturnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F0A10F1B8DD00F91463 /* CommandReturnObject.cpp */; };
@@ -1375,10 +1374,8 @@
26DE20601161902600A093E2 /* SBBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBBlock.cpp; path = source/API/SBBlock.cpp; sourceTree = "<group>"; };
26DE20621161904200A093E2 /* SBLineEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBLineEntry.cpp; path = source/API/SBLineEntry.cpp; sourceTree = "<group>"; };
26DE20641161904E00A093E2 /* SBSymbol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBSymbol.cpp; path = source/API/SBSymbol.cpp; sourceTree = "<group>"; };
- 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/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>"; };
26E152231419CACA007967D0 /* ObjectFilePECOFF.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFilePECOFF.cpp; sourceTree = "<group>"; };
@@ -2920,8 +2917,6 @@
26BC7F0810F1B8DD00F91463 /* CommandInterpreter.cpp */,
26BC7DE310F1B7F900F91463 /* CommandObject.h */,
26BC7F0910F1B8DD00F91463 /* CommandObject.cpp */,
- 26DFBC50113B48D600DD817F /* CommandObjectCrossref.h */,
- 26DFBC57113B48F300DD817F /* CommandObjectCrossref.cpp */,
26DFBC51113B48D600DD817F /* CommandObjectMultiword.h */,
26DFBC58113B48F300DD817F /* CommandObjectMultiword.cpp */,
26DFBC52113B48D600DD817F /* CommandObjectRegexCommand.h */,
@@ -4005,7 +4000,6 @@
2689007F13353E2200698AC0 /* CommandCompletions.cpp in Sources */,
2689008013353E2200698AC0 /* CommandInterpreter.cpp in Sources */,
2689008113353E2200698AC0 /* CommandObject.cpp in Sources */,
- 2689008213353E2200698AC0 /* CommandObjectCrossref.cpp in Sources */,
2689008313353E2200698AC0 /* CommandObjectMultiword.cpp in Sources */,
2689008413353E2200698AC0 /* CommandObjectRegexCommand.cpp in Sources */,
2689008513353E2200698AC0 /* CommandReturnObject.cpp in Sources */,
Removed: lldb/trunk/source/Commands/CommandObjectCrossref.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCrossref.cpp?rev=175830&view=auto
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCrossref.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCrossref.cpp (removed)
@@ -1,88 +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
-(
- CommandInterpreter &interpreter,
- const char *name,
- const char *help,
- const char *syntax
-) :
- CommandObjectParsed (interpreter, name, help, syntax),
- m_crossref_object_types()
-{
-}
-
-CommandObjectCrossref::~CommandObjectCrossref ()
-{
-}
-
-bool
-CommandObjectCrossref::DoExecute (Args& command, 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:");
-
- const size_t count = m_crossref_object_types.GetArgumentCount();
- for (size_t i = 0; i < count; ++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;
-}
Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=175831&r1=175830&r2=175831&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Thu Feb 21 17:57:25 2013
@@ -101,7 +101,6 @@ CommandObjectMultiword::LoadSubCommand
if (pos == m_subcommand_dict.end())
{
m_subcommand_dict[name] = cmd_obj;
- m_interpreter.CrossRegisterCommand (name, GetCommandName());
}
else
success = false;
@@ -365,23 +364,6 @@ CommandObjectProxy::GetHelpLong ()
return NULL;
}
-void
-CommandObjectProxy::AddObject (const char *obj_name)
-{
- CommandObject *proxy_command = GetProxyCommandObject();
- if (proxy_command)
- return proxy_command->AddObject (obj_name);
-}
-
-bool
-CommandObjectProxy::IsCrossRefObject ()
-{
- CommandObject *proxy_command = GetProxyCommandObject();
- if (proxy_command)
- return proxy_command->IsCrossRefObject();
- return false;
-}
-
bool
CommandObjectProxy::IsRemovable() const
{
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=175831&r1=175830&r2=175831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Feb 21 17:57:25 2013
@@ -355,34 +355,15 @@ CommandInterpreter::LoadCommandDictionar
{
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
- // **** IMPORTANT **** IMPORTANT *** IMPORTANT *** **** IMPORTANT **** IMPORTANT *** IMPORTANT ***
- //
- // Command objects that are used as cross reference objects (i.e. they inherit from CommandObjectCrossref)
- // *MUST* be created and put into the command dictionary *BEFORE* any multi-word commands (which may use
- // the cross-referencing stuff) are created!!!
- //
- // **** IMPORTANT **** IMPORTANT *** IMPORTANT *** **** IMPORTANT **** IMPORTANT *** IMPORTANT ***
-
-
- // Command objects that inherit from CommandObjectCrossref must be created before other command objects
- // are created. This is so that when another command is created that needs to go into a crossref object,
- // the crossref object exists and is ready to take the cross reference. Put the cross referencing command
- // objects into the CommandDictionary now, so they are ready for use when the other commands get created.
-
- // Non-CommandObjectCrossref commands can now be created.
-
lldb::ScriptLanguage script_language = m_debugger.GetScriptLanguage();
m_command_dict["apropos"] = CommandObjectSP (new CommandObjectApropos (*this));
m_command_dict["breakpoint"]= CommandObjectSP (new CommandObjectMultiwordBreakpoint (*this));
- //m_command_dict["call"] = CommandObjectSP (new CommandObjectCall (*this));
m_command_dict["command"] = CommandObjectSP (new CommandObjectMultiwordCommands (*this));
m_command_dict["disassemble"] = CommandObjectSP (new CommandObjectDisassemble (*this));
m_command_dict["expression"]= CommandObjectSP (new CommandObjectExpression (*this));
-// m_command_dict["file"] = CommandObjectSP (new CommandObjectFile (*this));
m_command_dict["frame"] = CommandObjectSP (new CommandObjectMultiwordFrame (*this));
m_command_dict["help"] = CommandObjectSP (new CommandObjectHelp (*this));
- /// m_command_dict["image"] = CommandObjectSP (new CommandObjectImage (*this));
m_command_dict["log"] = CommandObjectSP (new CommandObjectLog (*this));
m_command_dict["memory"] = CommandObjectSP (new CommandObjectMemory (*this));
m_command_dict["platform"] = CommandObjectSP (new CommandObjectPlatform (*this));
@@ -2139,20 +2120,6 @@ CommandInterpreter::Confirm (const char
return response;
}
-
-void
-CommandInterpreter::CrossRegisterCommand (const char * dest_cmd, const char * object_type)
-{
- CommandObjectSP cmd_obj_sp = GetCommandSPExact (dest_cmd, true);
-
- if (cmd_obj_sp)
- {
- CommandObject *cmd_obj = cmd_obj_sp.get();
- if (cmd_obj->IsCrossRefObject ())
- cmd_obj->AddObject (object_type);
- }
-}
-
OptionArgVectorSP
CommandInterpreter::GetAliasOptions (const char *alias_name)
{
More information about the lldb-commits
mailing list