2010-06-09 00:52:24 +08:00
|
|
|
//===-- 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
|
|
|
|
(
|
2010-09-18 09:14:36 +08:00
|
|
|
CommandInterpreter &interpreter,
|
2010-06-09 00:52:24 +08:00
|
|
|
const char *name,
|
|
|
|
const char *help,
|
|
|
|
const char *syntax
|
|
|
|
) :
|
2010-09-18 09:14:36 +08:00
|
|
|
CommandObject (interpreter, name, help, syntax),
|
2010-06-09 00:52:24 +08:00
|
|
|
m_crossref_object_types()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CommandObjectCrossref::~CommandObjectCrossref ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CommandObjectCrossref::Execute
|
|
|
|
(
|
|
|
|
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:");
|
|
|
|
|
2010-07-10 04:39:50 +08:00
|
|
|
const size_t count = m_crossref_object_types.GetArgumentCount();
|
|
|
|
for (size_t i = 0; i < count; ++i)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|