Files
clang-p2996/lldb/source/Commands/CommandObjectSettings.h
Caroline Tice 3df9a8dfd7 This is a very large commit that completely re-does the way lldb
handles user settable internal variables (the equivalent of set/show
variables in gdb).  In addition to the basic infrastructure (most of
which is defined in UserSettingsController.{h,cpp}, there are examples
of two classes that have been set up to contain user settable
variables (the Debugger and Process classes).  The 'settings' command
has been modified to be a command-subcommand structure, and the 'set',
'show' and 'append' commands have been moved into this sub-commabnd
structure.  The old StateVariable class has been completely replaced
by this, and the state variable dictionary has been removed from the
Command Interpreter.  Places that formerly accessed the state variable
mechanism have been modified to access the variables in this new
structure instead (checking the term-width; getting/checking the
prompt; etc.)

Variables are attached to classes; there are two basic "flavors" of
variables that can be set: "global" variables (static/class-wide), and
"instance" variables (one per instance of the class).  The whole thing
has been set up so that any global or instance variable can be set at
any time (e.g. on start up, in your .lldbinit file), whether or not
any instances actually exist (there's a whole pending and default
values mechanism to help deal with that).

llvm-svn: 113041
2010-09-04 00:03:46 +00:00

344 lines
10 KiB
C++

//===-- CommandObjectSettings.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_CommandObjectSettings_h_
#define liblldb_CommandObjectSettings_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Interpreter/Options.h"
namespace lldb_private {
//-------------------------------------------------------------------------
// CommandObjectMultiwordSettings
//-------------------------------------------------------------------------
class CommandObjectMultiwordSettings : public CommandObjectMultiword
{
public:
CommandObjectMultiwordSettings (CommandInterpreter &interpreter);
virtual
~CommandObjectMultiwordSettings ();
};
//-------------------------------------------------------------------------
// CommandObjectSettingsSet
//-------------------------------------------------------------------------
class CommandObjectSettingsSet : public CommandObject
{
public:
CommandObjectSettingsSet ();
virtual
~CommandObjectSettingsSet ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual Options *
GetOptions ();
class CommandOptions : public Options
{
public:
CommandOptions ();
virtual
~CommandOptions ();
virtual Error
SetOptionValue (int option_idx, const char *option_arg);
void
ResetOptionValues ();
const lldb::OptionDefinition*
GetDefinitions ();
// Options table: Required for subclasses of Options.
static lldb::OptionDefinition g_option_table[];
// Instance variables to hold the values for command options.
bool m_override;
bool m_reset;
};
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
CommandOptions m_options;
};
//-------------------------------------------------------------------------
// CommandObjectSettingsShow -- Show current values
//-------------------------------------------------------------------------
class CommandObjectSettingsShow : public CommandObject
{
public:
CommandObjectSettingsShow ();
virtual
~CommandObjectSettingsShow ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsList -- List settable variables
//-------------------------------------------------------------------------
class CommandObjectSettingsList : public CommandObject
{
public:
CommandObjectSettingsList ();
virtual
~CommandObjectSettingsList ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsRemove
//-------------------------------------------------------------------------
class CommandObjectSettingsRemove : public CommandObject
{
public:
CommandObjectSettingsRemove ();
virtual
~CommandObjectSettingsRemove ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsReplace
//-------------------------------------------------------------------------
class CommandObjectSettingsReplace : public CommandObject
{
public:
CommandObjectSettingsReplace ();
virtual
~CommandObjectSettingsReplace ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsInsertBefore
//-------------------------------------------------------------------------
class CommandObjectSettingsInsertBefore : public CommandObject
{
public:
CommandObjectSettingsInsertBefore ();
virtual
~CommandObjectSettingsInsertBefore ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingInsertAfter
//-------------------------------------------------------------------------
class CommandObjectSettingsInsertAfter : public CommandObject
{
public:
CommandObjectSettingsInsertAfter ();
virtual
~CommandObjectSettingsInsertAfter ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsAppend
//-------------------------------------------------------------------------
class CommandObjectSettingsAppend : public CommandObject
{
public:
CommandObjectSettingsAppend ();
virtual
~CommandObjectSettingsAppend ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
};
//-------------------------------------------------------------------------
// CommandObjectSettingsClear
//-------------------------------------------------------------------------
class CommandObjectSettingsClear : public CommandObject
{
public:
CommandObjectSettingsClear ();
virtual
~CommandObjectSettingsClear ();
virtual bool
Execute (CommandInterpreter &interpreter,
Args& command,
CommandReturnObject &result);
virtual int
HandleArgumentCompletion (CommandInterpreter &interpreter,
Args &input,
int &cursor_index,
int &cursor_char_position,
OptionElementVector &opt_element_vector,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
private:
};
} // namespace lldb_private
#endif // liblldb_CommandObjectSettings_h_