forked from OSchip/llvm-project
<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 llvm-svn: 175831
This commit is contained in:
parent
fe03e40d83
commit
d2f16e2c2d
|
@ -334,10 +334,6 @@ public:
|
|||
void
|
||||
Initialize ();
|
||||
|
||||
void
|
||||
CrossRegisterCommand (const char *dest_cmd,
|
||||
const char *object_type);
|
||||
|
||||
void
|
||||
SetScriptLanguage (lldb::ScriptLanguage lang);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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_
|
|
@ -115,12 +115,6 @@ public:
|
|||
virtual const char *
|
||||
GetHelpLong ();
|
||||
|
||||
virtual void
|
||||
AddObject (const char *obj_name);
|
||||
|
||||
virtual bool
|
||||
IsCrossRefObject ();
|
||||
|
||||
virtual bool
|
||||
IsRemovable() const;
|
||||
|
||||
|
|
|
@ -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 */,
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -355,34 +355,15 @@ CommandInterpreter::LoadCommandDictionary ()
|
|||
{
|
||||
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 *message, bool default_answer)
|
|||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue