Reimplemented the code that backed the "settings" in lldb. There were many issues with the previous implementation:

- no setting auto completion
- very manual and error prone way of getting/setting variables
- tons of code duplication
- useless instance names for processes, threads

Now settings can easily be defined like option values. The new settings makes use of the "OptionValue" classes so we can re-use the option value code that we use to set settings in command options. No more instances, just "does the right thing".

llvm-svn: 162366
This commit is contained in:
Greg Clayton 2012-08-22 17:17:09 +00:00
parent 40dd4d9bf3
commit 67cc06366c
104 changed files with 11538 additions and 7903 deletions

View File

@ -60,6 +60,8 @@ public:
{
}
explicit ConstString (const llvm::StringRef &s);
//------------------------------------------------------------------
/// Construct with C String value
///
@ -375,6 +377,9 @@ public:
void
SetCString (const char *cstr);
void
SetString (const llvm::StringRef &s);
//------------------------------------------------------------------
/// Set the C string value and its mangled counterpart.
///

View File

@ -27,6 +27,7 @@
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/TargetList.h"
@ -39,267 +40,18 @@ namespace lldb_private {
///
/// Provides a global root objects for the debugger core.
//----------------------------------------------------------------------
class DebuggerInstanceSettings : public InstanceSettings
{
public:
enum StopDisassemblyType
{
eStopDisassemblyTypeNever = 0,
eStopDisassemblyTypeNoSource,
eStopDisassemblyTypeAlways
};
DebuggerInstanceSettings (const lldb::UserSettingsControllerSP &m_owner_sp, bool live_instance = true, const char *name = NULL);
DebuggerInstanceSettings (const DebuggerInstanceSettings &rhs);
virtual
~DebuggerInstanceSettings ();
DebuggerInstanceSettings&
operator= (const DebuggerInstanceSettings &rhs);
void
UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const ConstString &instance_name,
const SettingEntry &entry,
VarSetOperationType op,
Error &err,
bool pending);
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error *err);
uint32_t
GetTerminalWidth () const
{
return m_term_width;
}
void
SetTerminalWidth (uint32_t term_width)
{
Error err;
if (ValidTermWidthValue(term_width, err))
m_term_width = term_width;
}
uint32_t
GetStopSourceLineCount (bool before) const
{
if (before)
return m_stop_source_before_count;
else
return m_stop_source_after_count;
}
void
SetStopSourceLineCount (bool before, uint32_t n)
{
if (before)
m_stop_source_before_count = n;
else
m_stop_source_after_count = n;
}
StopDisassemblyType
GetStopDisassemblyDisplay () const
{
return m_stop_disassembly_display;
}
uint32_t
GetDisassemblyLineCount () const
{
return m_stop_disassembly_count;
}
void
SetDisassemblyLineCount (uint32_t n)
{
m_stop_disassembly_count = n;
}
const char *
GetPrompt() const
{
return m_prompt.c_str();
}
void
SetPrompt(const char *p)
{
if (p)
m_prompt.assign (p);
else
m_prompt.assign ("(lldb) ");
BroadcastPromptChange (m_instance_name, m_prompt.c_str());
}
bool
GetNotifyVoid() const
{
return m_notify_void;
}
const char *
GetFrameFormat() const
{
return m_frame_format.c_str();
}
bool
SetFrameFormat(const char *frame_format)
{
if (frame_format && frame_format[0])
{
m_frame_format.assign (frame_format);
return true;
}
return false;
}
const char *
GetThreadFormat() const
{
return m_thread_format.c_str();
}
bool
SetThreadFormat(const char *thread_format)
{
if (thread_format && thread_format[0])
{
m_thread_format.assign (thread_format);
return true;
}
return false;
}
lldb::ScriptLanguage
GetScriptLanguage() const
{
return m_script_lang;
}
void
SetScriptLanguage (lldb::ScriptLanguage script_lang)
{
m_script_lang = script_lang;
}
bool
GetUseExternalEditor () const
{
return m_use_external_editor;
}
bool
SetUseExternalEditor (bool use_external_editor_p)
{
bool old_value = m_use_external_editor;
m_use_external_editor = use_external_editor_p;
return old_value;
}
bool
GetAutoConfirm () const
{
return m_auto_confirm_on;
}
void
SetAutoConfirm (bool auto_confirm_on)
{
m_auto_confirm_on = auto_confirm_on;
}
protected:
void
CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending);
bool
BroadcastPromptChange (const ConstString &instance_name, const char *new_prompt);
bool
ValidTermWidthValue (const char *value, Error err);
bool
ValidTermWidthValue (uint32_t value, Error err);
const ConstString
CreateInstanceName ();
static OptionEnumValueElement g_show_disassembly_enum_values[];
private:
uint32_t m_term_width;
uint32_t m_stop_source_before_count;
uint32_t m_stop_source_after_count;
uint32_t m_stop_disassembly_count;
StopDisassemblyType m_stop_disassembly_display;
std::string m_prompt;
bool m_notify_void;
std::string m_frame_format;
std::string m_thread_format;
lldb::ScriptLanguage m_script_lang;
bool m_use_external_editor;
bool m_auto_confirm_on;
};
class Debugger :
public STD_ENABLE_SHARED_FROM_THIS(Debugger),
public UserID,
public DebuggerInstanceSettings,
public Properties,
public BroadcasterManager
{
friend class SourceManager; // For GetSourceFileCache.
public:
class SettingsController : public UserSettingsController
{
public:
SettingsController ();
virtual
~SettingsController ();
static SettingEntry global_settings_table[];
static SettingEntry instance_settings_table[];
protected:
lldb::InstanceSettingsSP
CreateInstanceSettings (const char *instance_name);
private:
// Class-wide settings.
DISALLOW_COPY_AND_ASSIGN (SettingsController);
};
static lldb::UserSettingsControllerSP &
GetSettingsController ();
static lldb::DebuggerSP
CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL);
@ -499,6 +251,69 @@ public:
void
SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
//----------------------------------------------------------------------
// Properties Functions
//----------------------------------------------------------------------
enum StopDisassemblyType
{
eStopDisassemblyTypeNever = 0,
eStopDisassemblyTypeNoSource,
eStopDisassemblyTypeAlways
};
bool
GetAutoConfirm () const;
const char *
GetFrameFormat() const;
const char *
GetThreadFormat() const;
lldb::ScriptLanguage
GetScriptLanguage() const;
bool
SetScriptLanguage (lldb::ScriptLanguage script_lang);
uint32_t
GetTerminalWidth () const;
bool
SetTerminalWidth (uint32_t term_width);
const char *
GetPrompt() const;
void
SetPrompt(const char *p);
bool
GetUseExternalEditor () const;
bool
SetUseExternalEditor (bool use_external_editor_p);
uint32_t
GetStopSourceLineCount (bool before) const;
StopDisassemblyType
GetStopDisassemblyDisplay () const;
uint32_t
GetDisassemblyLineCount () const;
bool
GetNotifyVoid () const;
const ConstString &
GetInstanceName()
{
return m_instance_name;
}
protected:
static void
@ -518,7 +333,6 @@ protected:
{
return m_source_file_cache;
}
Communication m_input_comm;
StreamFile m_input_file;
StreamFile m_output_file;
@ -536,6 +350,7 @@ protected:
typedef std::map<std::string, lldb::StreamSP> LogStreamMap;
LogStreamMap m_log_streams;
lldb::StreamSP m_log_callback_stream_sp;
ConstString m_instance_name;
private:

View File

@ -22,7 +22,7 @@
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Opcode.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {

View File

@ -18,7 +18,6 @@
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/Opcode.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Interpreter/NamedOptionValue.h"
//----------------------------------------------------------------------
/// @class EmulateInstruction EmulateInstruction.h "lldb/Core/EmulateInstruction.h"

View File

@ -185,6 +185,44 @@ public:
uint32_t
GetSize () const;
bool
Insert (uint32_t idx, const FileSpec &file)
{
if (idx < m_files.size())
{
m_files.insert(m_files.begin() + idx, file);
return true;
}
else if (idx == m_files.size())
{
m_files.push_back(file);
return true;
}
return false;
}
bool
Replace (uint32_t idx, const FileSpec &file)
{
if (idx < m_files.size())
{
m_files[idx] = file;
return true;
}
return false;
}
bool
Remove (uint32_t idx)
{
if (idx < m_files.size())
{
m_files.erase(m_files.begin() + idx);
return true;
}
return false;
}
static size_t GetFilesMatchingPartialPath (const char *path, bool dir_okay, FileSpecList &matches);
protected:

View File

@ -168,6 +168,21 @@ public:
bool
IsValid () const;
void
Clear ()
{
Free();
m_re.clear();
m_compile_flags = 0;
m_comp_err = 1;
}
int
GetErrorCode() const
{
return m_comp_err;
}
bool
operator < (const RegularExpression& rhs) const;

View File

@ -30,6 +30,9 @@ public:
virtual
~StringList ();
void
AppendString (const std::string &s);
void
AppendString (const char *str);
@ -81,7 +84,19 @@ public:
StringList&
operator << (StringList strings);
// This string list contains a list of valid auto completion
// strings, and the "s" is passed in. "matches" is filled in
// with zero or more string values that start with "s", and
// the first string to exactly match one of the string
// values in this collection, will have "exact_matches_idx"
// filled in to match the index, or "exact_matches_idx" will
// have SIZE_MAX
size_t
AutoComplete (const char *s,
StringList &matches,
size_t &exact_matches_idx) const;
private:
STLStringArray m_strings;

View File

@ -145,6 +145,27 @@ public:
return NULL;
}
//------------------------------------------------------------------
// Find the value for the unique string in the map.
//
// Return the value for \a unique_cstr if one is found, return
// \a fail_value otherwise. This method works well for simple type
// T values and only if there is a sensible failure value that can
// be returned and that won't match any existing values.
//------------------------------------------------------------------
T
Find (const char *unique_cstr, T fail_value) const
{
Entry search_entry (unique_cstr);
const_iterator end = m_map.end();
const_iterator pos = std::lower_bound (m_map.begin(), end, search_entry);
if (pos != end)
{
if (pos->cstring == unique_cstr)
return pos->value;
}
return fail_value;
}
//------------------------------------------------------------------
// Get a pointer to the first entry that matches "name". NULL will
// be returned if there is no entry that matches "name".

View File

@ -25,436 +25,487 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
typedef struct
{
const char *var_name;
SettableVariableType var_type;
const char *default_value;
OptionEnumValueElement *enum_values;
bool initialized;
bool hidden;
const char *description; //help text
} SettingEntry;
//typedef struct
//{
// lldb::UserSettingsControllerSP parent;
// ConstString level_name;
// std::vector<SettingEntry> global_settings;
// std::vector<SettingEntry> instance_settings;
//} UserSettingDefinition;
//
typedef struct
{
lldb::UserSettingsControllerSP parent;
ConstString level_name;
std::vector<SettingEntry> global_settings;
std::vector<SettingEntry> instance_settings;
} UserSettingDefinition;
class UserSettingsController :
public STD_ENABLE_SHARED_FROM_THIS(UserSettingsController)
class Properties
{
public:
Properties () :
m_collection_sp ()
{
}
UserSettingsController (const char *level_name,
const lldb::UserSettingsControllerSP &parent);
Properties (const lldb::OptionValuePropertiesSP &collection_sp) :
m_collection_sp (collection_sp)
{
}
virtual
~UserSettingsController ();
// Pure virtual functions, which all sub-classes must implement.
virtual lldb::InstanceSettingsSP
CreateInstanceSettings (const char *instance_name) = 0;
// Virtual functions that you can override if you have global settings
// (not instance specific).
virtual bool
SetGlobalVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const SettingEntry &entry,
const VarSetOperationType op,
Error &err);
virtual bool
GetGlobalVariable (const ConstString &var_name,
StringList &value,
Error &err);
// End of pure virtual functions.
StringList
GetVariable (const char *full_dot_name,
SettableVariableType &var_type,
const char *debugger_instance_name,
Error &err);
Error
SetVariable (const char *full_dot_name,
const char *value,
const VarSetOperationType op,
const bool override,
const char *debugger_instance_name,
const char *index_value = NULL);
const lldb::UserSettingsControllerSP &
GetParent ();
const ConstString &
GetLevelName ();
void
RegisterChild (const lldb::UserSettingsControllerSP &child);
void
RemoveChild (const lldb::UserSettingsControllerSP &child);
void
CreateSettingsVector (const SettingEntry *table,
const bool global);
void
CreateDefaultInstanceSettings ();
void
InitializeGlobalVariables ();
const lldb::InstanceSettingsSP &
FindPendingSettings (const ConstString &instance_name);
void
RemovePendingSettings (const ConstString &instance_name);
void
RegisterInstanceSettings (InstanceSettings *instance_settings);
void
UnregisterInstanceSettings (InstanceSettings *instance_settings);
void
RenameInstanceSettings (const char *old_name, const char *new_name);
void
SetDefaultInstanceSettings (const lldb::InstanceSettingsSP &instance_settings_sp)
~Properties()
{
m_default_settings = instance_settings_sp;
}
// -------------------------------------------------------------------------
// Public static methods
// -------------------------------------------------------------------------
static void
FindAllSettingsDescriptions (CommandInterpreter &interpreter,
const lldb::UserSettingsControllerSP& usc_sp,
const char *current_prefix,
Stream &result_stream,
Error &err);
static void
FindSettingsDescriptions (CommandInterpreter &interpreter,
const lldb::UserSettingsControllerSP& usc_sp,
const char *current_prefix,
const char *search_name,
Stream &result_stream,
Error &err);
static void
SearchAllSettingsDescriptions (CommandInterpreter &interpreter,
const lldb::UserSettingsControllerSP& usc_sp,
const char *current_prefix,
const char *search_word,
Stream &result_stream);
static void
GetAllVariableValues (CommandInterpreter &interpreter,
const lldb::UserSettingsControllerSP& usc_sp,
const char *current_prefix,
Stream &result_stream,
Error &err);
static bool
DumpValue (CommandInterpreter &interpreter,
const lldb::UserSettingsControllerSP& usc_sp,
const char *variable_dot_name,
Stream &strm);
static bool
DumpValue (const char *variable_dot_name,
SettableVariableType var_type,
const StringList &variable_value,
Stream &strm);
static int
CompleteSettingsNames (const lldb::UserSettingsControllerSP& usc_sp,
Args &partial_setting_name_pieces,
bool &word_complete,
StringList &matches);
static int
CompleteSettingsValue (const lldb::UserSettingsControllerSP& usc_sp,
const char *full_dot_name,
const char *partial_value,
bool &word_complete,
StringList &matches);
static Args
BreakNameIntoPieces (const char *full_dot_name);
static const char *
GetTypeString (SettableVariableType var_type);
static const char *
EnumToString (const OptionEnumValueElement *enum_values, int value);
static void
UpdateStringVariable (VarSetOperationType op,
std::string &string_var,
const char *new_value,
Error &err);
static void
UpdateBooleanVariable (VarSetOperationType op,
bool &bool_var,
const char *new_value,
bool clear_value, // Used for op == eVarSetOperationClear
Error &err);
static void
UpdateStringArrayVariable (VarSetOperationType op,
const char *index_value,
Args &array_var,
const char *new_value,
Error &err);
static void
UpdateDictionaryVariable (VarSetOperationType op,
const char *index_value,
std::map<std::string, std::string> &dictionary,
const char *new_value,
Error &err);
static void
UpdateEnumVariable (OptionEnumValueElement *enum_values,
int *enum_var,
const char *new_value,
Error &err);
static Error
UpdateStringOptionValue (const char *new_value_cstr,
VarSetOperationType op,
OptionValueString &option_value);
static Error
UpdateBooleanOptionValue (const char *new_value_cstr,
VarSetOperationType op,
OptionValueBoolean &option_value);
static Error
UpdateFileSpecOptionValue (const char *new_value_cstr,
VarSetOperationType op,
OptionValueFileSpec &option_value);
static bool
InitializeSettingsController (lldb::UserSettingsControllerSP &controller_sp,
SettingEntry *global_settings,
SettingEntry *instance_settings);
static void
FinalizeSettingsController (lldb::UserSettingsControllerSP &controller_sp);
lldb::InstanceSettingsSP
GetDefaultInstanceSettings ()
virtual lldb::OptionValuePropertiesSP
GetValueProperties () const
{
return m_default_settings;
// This function is virtual in case subclasses want to lazily
// implement creating the properties.
return m_collection_sp;
}
protected:
virtual lldb::OptionValueSP
GetPropertyValue (const ExecutionContext *exe_ctx,
const char *property_path,
bool will_modify,
Error &error) const;
// -------------------------------------------------------------------------
// Protected methods are declared below here.
// -------------------------------------------------------------------------
bool
IsLiveInstance (const std::string &instance_name);
int
GlobalVariableMatches (const char *partial_name,
const std::string &complete_prefix,
StringList &matches);
int
InstanceVariableMatches (const char *partial_name,
const std::string &complete_prefix,
const char *instance_name,
StringList &matches);
int
LiveInstanceMatches (const char *partial_name,
const std::string &complete_prefix,
bool &word_complete,
StringList &matches);
int
ChildMatches (const char *partial_name,
const std::string &complete_prefix,
bool &word_complete,
StringList &matches);
virtual Error
SetPropertyValue (const ExecutionContext *exe_ctx,
VarSetOperationType op,
const char *property_path,
const char *value);
virtual Error
DumpPropertyValue (const ExecutionContext *exe_ctx,
Stream &strm,
const char *property_path,
uint32_t dump_mask);
virtual void
DumpAllPropertyValues (const ExecutionContext *exe_ctx,
Stream &strm,
uint32_t dump_mask);
virtual void
DumpAllDescriptions (CommandInterpreter &interpreter,
Stream &strm) const;
size_t
GetNumChildren ();
const lldb::UserSettingsControllerSP
GetChildAtIndex (size_t index);
const SettingEntry *
GetGlobalEntry (const ConstString &var_name);
const SettingEntry *
GetInstanceEntry (const ConstString &var_name);
void
BuildParentPrefix (std::string &parent_prefix);
void
CopyDefaultSettings (const lldb::InstanceSettingsSP &new_settings,
const ConstString &instance_name,
bool pending);
lldb::InstanceSettingsSP
PendingSettingsForInstance (const ConstString &instance_name);
InstanceSettings *
FindSettingsForInstance (const ConstString &instance_name);
void
GetAllPendingSettingValues (Stream &result_stream);
void
GetAllDefaultSettingValues (Stream &result_stream);
void
GetAllInstanceVariableValues (CommandInterpreter &interpreter,
Stream &result_stream);
void
OverrideAllInstances (const ConstString &var_name,
const char *value,
VarSetOperationType op,
const char *index_value,
Error &err);
UserSettingDefinition &
GetControllerSettings () { return m_settings; }
// -------------------------------------------------------------------------
// Static protected methods are declared below here.
// -------------------------------------------------------------------------
static void
PrintEnumValues (const OptionEnumValueElement *enum_values,
Stream &str);
static int
BooleanMatches (const char *partial_value,
bool &word_complete,
StringList &matches);
static int
EnumMatches (const char *partial_value,
OptionEnumValueElement *enum_values,
bool &word_complete,
StringList &matches);
static void
VerifyOperationForType (SettableVariableType var_type,
VarSetOperationType op,
const ConstString &var_name,
Error &err);
// This is protected rather than private so that classes that inherit from UserSettingsController can access it.
lldb::InstanceSettingsSP m_default_settings;
private:
UserSettingDefinition m_settings;
typedef std::map<std::string,InstanceSettings*> InstanceSettingsMap;
std::vector<lldb::UserSettingsControllerSP> m_children;
std::map <std::string, lldb::InstanceSettingsSP> m_pending_settings;
InstanceSettingsMap m_live_settings; // live settings should never be NULL (hence 'live')
mutable Mutex m_children_mutex;
mutable Mutex m_pending_settings_mutex;
mutable Mutex m_live_settings_mutex;
DISALLOW_COPY_AND_ASSIGN (UserSettingsController);
};
class InstanceSettings
{
public:
InstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, const char *instance_name, bool live_instance = true);
InstanceSettings (const InstanceSettings &rhs);
virtual
~InstanceSettings ();
InstanceSettings&
operator= (const InstanceSettings &rhs);
// Begin Pure Virtual Functions
virtual void
UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const ConstString &instance_name,
const SettingEntry &entry,
VarSetOperationType op,
Error &err,
bool pending) = 0;
virtual bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error *err) = 0;
virtual void
CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending) = 0;
virtual const ConstString
CreateInstanceName () = 0;
// End Pure Virtual Functions
const ConstString &
GetInstanceName () { return m_instance_name; }
void
ChangeInstanceName (const std::string &new_instance_name);
static const ConstString &
GetDefaultName ();
static const ConstString &
InvalidName ();
Apropos (const char *keyword,
std::vector<const Property *> &matching_properties) const;
protected:
lldb::UserSettingsControllerWP m_owner_wp;
ConstString m_instance_name;
lldb::OptionValuePropertiesSP m_collection_sp;
};
//class UserSettingsController :
// public STD_ENABLE_SHARED_FROM_THIS(UserSettingsController)
//{
//public:
//
// UserSettingsController (const char *level_name,
// const lldb::UserSettingsControllerSP &parent);
//
// virtual
// ~UserSettingsController ();
//
// // Pure virtual functions, which all sub-classes must implement.
// virtual lldb::InstanceSettingsSP
// CreateInstanceSettings (const char *instance_name) = 0;
//
// // Virtual functions that you can override if you have global settings
// // (not instance specific).
// virtual bool
// SetGlobalVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const SettingEntry &entry,
// const VarSetOperationType op,
// Error &err);
//
// virtual bool
// GetGlobalVariable (const ConstString &var_name,
// StringList &value,
// Error &err);
//
// // End of pure virtual functions.
// StringList
// GetVariable (const char *full_dot_name,
// SettableVariableType &var_type,
// const char *debugger_instance_name,
// Error &err);
//
// Error
// SetVariable (const char *full_dot_name,
// const char *value,
// const VarSetOperationType op,
// const bool override,
// const char *debugger_instance_name,
// const char *index_value = NULL);
//
// const lldb::UserSettingsControllerSP &
// GetParent ();
//
// const ConstString &
// GetLevelName ();
//
// void
// RegisterChild (const lldb::UserSettingsControllerSP &child);
//
// void
// RemoveChild (const lldb::UserSettingsControllerSP &child);
//
// void
// CreateSettingsVector (const SettingEntry *table,
// const bool global);
//
// void
// CreateDefaultInstanceSettings ();
//
// void
// InitializeGlobalVariables ();
//
// const lldb::InstanceSettingsSP &
// FindPendingSettings (const ConstString &instance_name);
//
// void
// RemovePendingSettings (const ConstString &instance_name);
//
// void
// RegisterInstanceSettings (InstanceSettings *instance_settings);
//
// void
// UnregisterInstanceSettings (InstanceSettings *instance_settings);
//
// void
// RenameInstanceSettings (const char *old_name, const char *new_name);
//
// void
// SetDefaultInstanceSettings (const lldb::InstanceSettingsSP &instance_settings_sp)
// {
// m_default_settings = instance_settings_sp;
// }
// // -------------------------------------------------------------------------
// // Public static methods
// // -------------------------------------------------------------------------
//
// static void
// FindAllSettingsDescriptions (CommandInterpreter &interpreter,
// const lldb::UserSettingsControllerSP& usc_sp,
// const char *current_prefix,
// Stream &result_stream,
// Error &err);
//
// static void
// FindSettingsDescriptions (CommandInterpreter &interpreter,
// const lldb::UserSettingsControllerSP& usc_sp,
// const char *current_prefix,
// const char *search_name,
// Stream &result_stream,
// Error &err);
//
// static void
// SearchAllSettingsDescriptions (CommandInterpreter &interpreter,
// const lldb::UserSettingsControllerSP& usc_sp,
// const char *current_prefix,
// const char *search_word,
// Stream &result_stream);
//
// static void
// GetAllVariableValues (CommandInterpreter &interpreter,
// const lldb::UserSettingsControllerSP& usc_sp,
// const char *current_prefix,
// Stream &result_stream,
// Error &err);
//
// static bool
// DumpValue (CommandInterpreter &interpreter,
// const lldb::UserSettingsControllerSP& usc_sp,
// const char *variable_dot_name,
// Stream &strm);
//
// static bool
// DumpValue (const char *variable_dot_name,
// SettableVariableType var_type,
// const StringList &variable_value,
// Stream &strm);
//
// static int
// CompleteSettingsNames (const lldb::UserSettingsControllerSP& usc_sp,
// Args &partial_setting_name_pieces,
// bool &word_complete,
// StringList &matches);
//
// static int
// CompleteSettingsValue (const lldb::UserSettingsControllerSP& usc_sp,
// const char *full_dot_name,
// const char *partial_value,
// bool &word_complete,
// StringList &matches);
//
// static Args
// BreakNameIntoPieces (const char *full_dot_name);
//
// static const char *
// GetTypeString (SettableVariableType var_type);
//
//
// static const char *
// EnumToString (const OptionEnumValueElement *enum_values, int value);
//
// static void
// UpdateStringVariable (VarSetOperationType op,
// std::string &string_var,
// const char *new_value,
// Error &err);
//
//
// static void
// UpdateBooleanVariable (VarSetOperationType op,
// bool &bool_var,
// const char *new_value,
// bool clear_value, // Used for op == eVarSetOperationClear
// Error &err);
//
// static void
// UpdateStringArrayVariable (VarSetOperationType op,
// const char *index_value,
// Args &array_var,
// const char *new_value,
// Error &err);
//
// static void
// UpdateDictionaryVariable (VarSetOperationType op,
// const char *index_value,
// std::map<std::string, std::string> &dictionary,
// const char *new_value,
// Error &err);
//
// static void
// UpdateEnumVariable (OptionEnumValueElement *enum_values,
// int *enum_var,
// const char *new_value,
// Error &err);
//
// static Error
// UpdateStringOptionValue (const char *new_value_cstr,
// VarSetOperationType op,
// OptionValueString &option_value);
//
// static Error
// UpdateBooleanOptionValue (const char *new_value_cstr,
// VarSetOperationType op,
// OptionValueBoolean &option_value);
//
// static Error
// UpdateFileSpecOptionValue (const char *new_value_cstr,
// VarSetOperationType op,
// OptionValueFileSpec &option_value);
//
// static bool
// InitializeSettingsController (lldb::UserSettingsControllerSP &controller_sp,
// SettingEntry *global_settings,
// SettingEntry *instance_settings);
//
// static void
// FinalizeSettingsController (lldb::UserSettingsControllerSP &controller_sp);
//
//
// lldb::InstanceSettingsSP
// GetDefaultInstanceSettings ()
// {
// return m_default_settings;
// }
//
//protected:
//
// // -------------------------------------------------------------------------
// // Protected methods are declared below here.
// // -------------------------------------------------------------------------
//
// bool
// IsLiveInstance (const std::string &instance_name);
//
// int
// GlobalVariableMatches (const char *partial_name,
// const std::string &complete_prefix,
// StringList &matches);
//
// int
// InstanceVariableMatches (const char *partial_name,
// const std::string &complete_prefix,
// const char *instance_name,
// StringList &matches);
//
// int
// LiveInstanceMatches (const char *partial_name,
// const std::string &complete_prefix,
// bool &word_complete,
// StringList &matches);
//
// int
// ChildMatches (const char *partial_name,
// const std::string &complete_prefix,
// bool &word_complete,
// StringList &matches);
//
//
// size_t
// GetNumChildren ();
//
// const lldb::UserSettingsControllerSP
// GetChildAtIndex (size_t index);
//
//
// const SettingEntry *
// GetGlobalEntry (const ConstString &var_name);
//
// const SettingEntry *
// GetInstanceEntry (const ConstString &var_name);
//
// void
// BuildParentPrefix (std::string &parent_prefix);
//
//
// void
// CopyDefaultSettings (const lldb::InstanceSettingsSP &new_settings,
// const ConstString &instance_name,
// bool pending);
//
// lldb::InstanceSettingsSP
// PendingSettingsForInstance (const ConstString &instance_name);
//
// InstanceSettings *
// FindSettingsForInstance (const ConstString &instance_name);
//
// void
// GetAllPendingSettingValues (Stream &result_stream);
//
// void
// GetAllDefaultSettingValues (Stream &result_stream);
//
// void
// GetAllInstanceVariableValues (CommandInterpreter &interpreter,
// Stream &result_stream);
//
// void
// OverrideAllInstances (const ConstString &var_name,
// const char *value,
// VarSetOperationType op,
// const char *index_value,
// Error &err);
//
// UserSettingDefinition &
// GetControllerSettings () { return m_settings; }
//
// // -------------------------------------------------------------------------
// // Static protected methods are declared below here.
// // -------------------------------------------------------------------------
//
// static void
// PrintEnumValues (const OptionEnumValueElement *enum_values,
// Stream &str);
//
//
// static int
// BooleanMatches (const char *partial_value,
// bool &word_complete,
// StringList &matches);
//
// static int
// EnumMatches (const char *partial_value,
// OptionEnumValueElement *enum_values,
// bool &word_complete,
// StringList &matches);
//
// static void
// VerifyOperationForType (SettableVariableType var_type,
// VarSetOperationType op,
// const ConstString &var_name,
// Error &err);
//
// // This is protected rather than private so that classes that inherit from UserSettingsController can access it.
//
// lldb::InstanceSettingsSP m_default_settings;
//
//private:
//
// UserSettingDefinition m_settings;
//
// typedef std::map<std::string,InstanceSettings*> InstanceSettingsMap;
//
// std::vector<lldb::UserSettingsControllerSP> m_children;
// std::map <std::string, lldb::InstanceSettingsSP> m_pending_settings;
// InstanceSettingsMap m_live_settings; // live settings should never be NULL (hence 'live')
// mutable Mutex m_children_mutex;
// mutable Mutex m_pending_settings_mutex;
// mutable Mutex m_live_settings_mutex;
//
// DISALLOW_COPY_AND_ASSIGN (UserSettingsController);
//};
//
//class InstanceSettings
//{
//public:
//
// InstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, const char *instance_name, bool live_instance = true);
//
// InstanceSettings (const InstanceSettings &rhs);
//
// virtual
// ~InstanceSettings ();
//
// InstanceSettings&
// operator= (const InstanceSettings &rhs);
//
// // Begin Pure Virtual Functions
//
// virtual void
// UpdateInstanceSettingsVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const ConstString &instance_name,
// const SettingEntry &entry,
// VarSetOperationType op,
// Error &err,
// bool pending) = 0;
//
// virtual bool
// GetInstanceSettingsValue (const SettingEntry &entry,
// const ConstString &var_name,
// StringList &value,
// Error *err) = 0;
//
// virtual void
// CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
// bool pending) = 0;
//
// virtual const ConstString
// CreateInstanceName () = 0;
//
// // End Pure Virtual Functions
//
// const ConstString &
// GetInstanceName () { return m_instance_name; }
//
//
// void
// ChangeInstanceName (const std::string &new_instance_name);
//
// static const ConstString &
// GetDefaultName ();
//
// static const ConstString &
// InvalidName ();
//
//protected:
//
// lldb::UserSettingsControllerWP m_owner_wp;
// ConstString m_instance_name;
//};
//
} // namespace lldb_private

View File

@ -74,20 +74,20 @@ public:
//----------------------------------------------------------------------
static int
DiskFiles (CommandInterpreter &interpreter,
const char *partial_file_name,
int match_start_point,
int max_return_elements,
SearchFilter *searcher,
bool &word_complete,
StringList &matches);
const char *partial_file_name,
int match_start_point,
int max_return_elements,
SearchFilter *searcher,
bool &word_complete,
StringList &matches);
static int
DiskDirectories (CommandInterpreter &interpreter,
const char *partial_file_name,
int match_start_point,
int max_return_elements,
SearchFilter *searcher,
bool &word_complete,
StringList &matches);
const char *partial_file_name,
int match_start_point,
int max_return_elements,
SearchFilter *searcher,
bool &word_complete,
StringList &matches);
static int
SourceFiles (CommandInterpreter &interpreter,

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
namespace lldb_private {
//-------------------------------------------------------------------------

View File

@ -15,7 +15,8 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
namespace lldb_private {

View File

@ -15,7 +15,9 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueFormat.h"
#include "lldb/Interpreter/OptionValueSInt64.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
namespace lldb_private {

View File

@ -15,7 +15,8 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
namespace lldb_private {
//-------------------------------------------------------------------------

View File

@ -15,7 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
namespace lldb_private {
//-------------------------------------------------------------------------

View File

@ -15,7 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueUUID.h"
namespace lldb_private {
//-------------------------------------------------------------------------

View File

@ -14,7 +14,7 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/Options.h"
namespace lldb_private {

View File

@ -0,0 +1,384 @@
//===-- OptionValue.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_OptionValue_h_
#define liblldb_OptionValue_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-defines.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Error.h"
namespace lldb_private {
//---------------------------------------------------------------------
// OptionValue
//---------------------------------------------------------------------
class OptionValue
{
public:
typedef enum {
eTypeInvalid = 0,
eTypeArch,
eTypeArgs,
eTypeArray,
eTypeBoolean,
eTypeDictionary,
eTypeEnum,
eTypeFileSpec,
eTypeFileSpecList,
eTypeFormat,
eTypePathMap,
eTypeProperties,
eTypeRegex,
eTypeSInt64,
eTypeString,
eTypeUInt64,
eTypeUUID
} Type;
enum {
eDumpOptionName = (1u << 0),
eDumpOptionType = (1u << 1),
eDumpOptionValue = (1u << 2),
eDumpOptionDescription = (1u << 3),
eDumpOptionRaw = (1u << 4),
eDumpGroupValue = (eDumpOptionName | eDumpOptionType | eDumpOptionValue),
eDumpGroupHelp = (eDumpOptionName | eDumpOptionType | eDumpOptionDescription)
};
OptionValue () :
m_value_was_set (false)
{
}
OptionValue (const OptionValue &rhs) :
m_value_was_set (rhs.m_value_was_set)
{
}
virtual ~OptionValue ()
{
}
//-----------------------------------------------------------------
// Subclasses should override these functions
//-----------------------------------------------------------------
virtual Type
GetType () const = 0;
// If this value is always hidden, the avoid showing any info on this
// value, just show the info for the child values.
virtual bool
ValueIsTransparent () const
{
return GetType() == eTypeProperties;
}
virtual const char *
GetTypeAsCString () const
{
return GetBuiltinTypeAsCString(GetType());
}
static const char *
GetBuiltinTypeAsCString (Type t);
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0;
virtual Error
SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear () = 0;
virtual lldb::OptionValueSP
DeepCopy () const = 0;
virtual size_t
AutoComplete (CommandInterpreter &interpreter,
const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
//-----------------------------------------------------------------
// Subclasses can override these functions
//-----------------------------------------------------------------
virtual lldb::OptionValueSP
GetSubValue (const ExecutionContext *exe_ctx,
const char *name,
bool will_modify,
Error &error) const
{
error.SetErrorStringWithFormat("'%s' is not a value subvalue", name);
return lldb::OptionValueSP();
}
virtual Error
SetSubValue (const ExecutionContext *exe_ctx,
VarSetOperationType op,
const char *name,
const char *value);
virtual bool
IsAggregateValue () const
{
return false;
}
virtual ConstString
GetName() const
{
return ConstString();
}
virtual bool
DumpQualifiedName (Stream &strm) const;
//-----------------------------------------------------------------
// Subclasses should NOT override these functions as they use the
// above functions to implement functionality
//-----------------------------------------------------------------
uint32_t
GetTypeAsMask ()
{
return 1u << GetType();
}
static uint32_t
ConvertTypeToMask (OptionValue::Type type)
{
return 1u << type;
}
static OptionValue::Type
ConvertTypeMaskToType (uint32_t type_mask)
{
// If only one bit is set, then return an appropriate enumeration
switch (type_mask)
{
case 1u << eTypeArch: return eTypeArch;
case 1u << eTypeArgs: return eTypeArgs;
case 1u << eTypeArray: return eTypeArray;
case 1u << eTypeBoolean: return eTypeBoolean;
case 1u << eTypeDictionary: return eTypeDictionary;
case 1u << eTypeEnum: return eTypeEnum;
case 1u << eTypeFileSpec: return eTypeFileSpec;
case 1u << eTypeFileSpecList: return eTypeFileSpecList;
case 1u << eTypeFormat: return eTypeFormat;
case 1u << eTypePathMap: return eTypePathMap;
case 1u << eTypeProperties: return eTypeProperties;
case 1u << eTypeRegex: return eTypeRegex;
case 1u << eTypeSInt64: return eTypeSInt64;
case 1u << eTypeString: return eTypeString;
case 1u << eTypeUInt64: return eTypeUInt64;
case 1u << eTypeUUID: return eTypeUUID;
}
// Else return invalid
return eTypeInvalid;
}
static lldb::OptionValueSP
CreateValueFromCStringForTypeMask (const char *value_cstr,
uint32_t type_mask,
Error &error);
// Get this value as a uint64_t value if it is encoded as a boolean,
// uint64_t or int64_t. Other types will cause "fail_value" to be
// returned
uint64_t
GetUInt64Value (uint64_t fail_value, bool *success_ptr);
OptionValueArch *
GetAsArch ();
const OptionValueArch *
GetAsArch () const;
OptionValueArray *
GetAsArray ();
const OptionValueArray *
GetAsArray () const;
OptionValueArgs *
GetAsArgs ();
const OptionValueArgs *
GetAsArgs () const;
OptionValueBoolean *
GetAsBoolean ();
const OptionValueBoolean *
GetAsBoolean () const;
OptionValueDictionary *
GetAsDictionary ();
const OptionValueDictionary *
GetAsDictionary () const;
OptionValueEnumeration *
GetAsEnumeration ();
const OptionValueEnumeration *
GetAsEnumeration () const;
OptionValueFileSpec *
GetAsFileSpec ();
const OptionValueFileSpec *
GetAsFileSpec () const;
OptionValueFileSpecList *
GetAsFileSpecList ();
const OptionValueFileSpecList *
GetAsFileSpecList () const;
OptionValueFormat *
GetAsFormat ();
const OptionValueFormat *
GetAsFormat () const;
OptionValuePathMappings *
GetAsPathMappings ();
const OptionValuePathMappings *
GetAsPathMappings () const;
OptionValueProperties *
GetAsProperties ();
const OptionValueProperties *
GetAsProperties () const;
OptionValueRegex *
GetAsRegex ();
const OptionValueRegex *
GetAsRegex () const;
OptionValueSInt64 *
GetAsSInt64 ();
const OptionValueSInt64 *
GetAsSInt64 () const;
OptionValueString *
GetAsString ();
const OptionValueString *
GetAsString () const;
OptionValueUInt64 *
GetAsUInt64 ();
const OptionValueUInt64 *
GetAsUInt64 () const;
OptionValueUUID *
GetAsUUID ();
const OptionValueUUID *
GetAsUUID () const;
bool
GetBooleanValue (bool fail_value = false) const;
bool
SetBooleanValue (bool new_value);
int64_t
GetEnumerationValue (int64_t fail_value = -1) const;
bool
SetEnumerationValue (int64_t value);
FileSpec
GetFileSpecValue () const;
bool
SetFileSpecValue (const FileSpec &file_spec);
FileSpecList
GetFileSpecListValue () const;
lldb::Format
GetFormatValue (lldb::Format fail_value = lldb::eFormatDefault) const;
bool
SetFormatValue (lldb::Format new_value);
const RegularExpression *
GetRegexValue () const;
int64_t
GetSInt64Value (int64_t fail_value = 0) const;
bool
SetSInt64Value (int64_t new_value);
const char *
GetStringValue (const char *fail_value = NULL) const;
bool
SetStringValue (const char *new_value);
uint64_t
GetUInt64Value (uint64_t fail_value = 0) const;
bool
SetUInt64Value (uint64_t new_value);
UUID
GetUUIDValue () const;
bool
SetUUIDValue (const UUID &uuid);
bool
OptionWasSet () const
{
return m_value_was_set;
}
void
SetOptionWasSet ()
{
m_value_was_set = true;
}
void
SetParent (const lldb::OptionValueSP &parent_sp)
{
m_parent_wp = parent_sp;
}
protected:
lldb::OptionValueWP m_parent_wp;
bool m_value_was_set; // This can be used to see if a value has been set
// by a call to SetValueFromCString(). It is often
// handy to know if an option value was set from
// the command line or as a setting, versus if we
// just have the default value that was already
// populated in the option value.
};
} // namespace lldb_private
#endif // liblldb_OptionValue_h_

View File

@ -0,0 +1,139 @@
//===-- OptionValueArch.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_OptionValueArch_h_
#define liblldb_OptionValueArch_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueArch : public OptionValue
{
public:
OptionValueArch () :
OptionValue(),
m_current_value (),
m_default_value ()
{
}
OptionValueArch (const char *triple) :
OptionValue(),
m_current_value (triple),
m_default_value ()
{
m_default_value = m_current_value;
}
OptionValueArch (const ArchSpec &value) :
OptionValue(),
m_current_value (value),
m_default_value (value)
{
}
OptionValueArch (const ArchSpec &current_value,
const ArchSpec &default_value) :
OptionValue(),
m_current_value (current_value),
m_default_value (default_value)
{
}
virtual
~OptionValueArch()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeArch;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
virtual size_t
AutoComplete (CommandInterpreter &interpreter,
const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
ArchSpec &
GetCurrentValue()
{
return m_current_value;
}
const ArchSpec &
GetCurrentValue() const
{
return m_current_value;
}
const ArchSpec &
GetDefaultValue() const
{
return m_default_value;
}
void
SetCurrentValue (const ArchSpec &value, bool set_value_was_set)
{
m_current_value = value;
if (set_value_was_set)
m_value_was_set = true;
}
void
SetDefaultValue (const ArchSpec &value)
{
m_default_value = value;
}
protected:
ArchSpec m_current_value;
ArchSpec m_default_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueArch_h_

View File

@ -0,0 +1,46 @@
//===-- OptionValueArgs.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_OptionValueArgs_h_
#define liblldb_OptionValueArgs_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValueArray.h"
namespace lldb_private {
class OptionValueArgs : public OptionValueArray
{
public:
OptionValueArgs () :
OptionValueArray (OptionValue::ConvertTypeToMask (OptionValue::eTypeString))
{
}
virtual
~OptionValueArgs()
{
}
size_t
GetArgs (Args &args);
virtual Type
GetType() const
{
return eTypeArgs;
}
};
} // namespace lldb_private
#endif // liblldb_OptionValueArgs_h_

View File

@ -0,0 +1,178 @@
//===-- OptionValueArray.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_OptionValueArray_h_
#define liblldb_OptionValueArray_h_
// C Includes
// C++ Includes
#include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueArray : public OptionValue
{
public:
OptionValueArray (uint32_t type_mask = UINT32_MAX, bool raw_value_dump = false) :
m_type_mask (type_mask),
m_values (),
m_raw_value_dump(raw_value_dump)
{
}
virtual
~OptionValueArray()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeArray;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_values.clear();
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
virtual bool
IsAggregateValue () const
{
return true;
}
virtual lldb::OptionValueSP
GetSubValue (const ExecutionContext *exe_ctx,
const char *name,
bool will_modify,
Error &error) const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
uint32_t
GetSize () const
{
return m_values.size();
}
lldb::OptionValueSP
operator[](uint32_t idx) const
{
lldb::OptionValueSP value_sp;
if (idx < m_values.size())
value_sp = m_values[idx];
return value_sp;
}
lldb::OptionValueSP
GetValueAtIndex (uint32_t idx) const
{
lldb::OptionValueSP value_sp;
if (idx < m_values.size())
value_sp = m_values[idx];
return value_sp;
}
bool
AppendValue (const lldb::OptionValueSP &value_sp)
{
// Make sure the value_sp object is allowed to contain
// values of the type passed in...
if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
{
m_values.push_back(value_sp);
return true;
}
return false;
}
bool
InsertValue (uint32_t idx, const lldb::OptionValueSP &value_sp)
{
// Make sure the value_sp object is allowed to contain
// values of the type passed in...
if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
{
if (idx < m_values.size())
m_values.insert(m_values.begin() + idx, value_sp);
else
m_values.push_back(value_sp);
return true;
}
return false;
}
bool
ReplaceValue (uint32_t idx, const lldb::OptionValueSP &value_sp)
{
// Make sure the value_sp object is allowed to contain
// values of the type passed in...
if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
{
if (idx < m_values.size())
{
m_values[idx] = value_sp;
return true;
}
}
return false;
}
bool
DeleteValue (uint32_t idx)
{
if (idx < m_values.size())
{
m_values.erase (m_values.begin() + idx);
return true;
}
return false;
}
size_t
GetArgs (Args &args) const;
Error
SetArgs (const Args &args, VarSetOperationType op);
protected:
typedef std::vector<lldb::OptionValueSP> collection;
uint32_t m_type_mask;
collection m_values;
bool m_raw_value_dump;
};
} // namespace lldb_private
#endif // liblldb_OptionValueArray_h_

View File

@ -0,0 +1,133 @@
//===-- OptionValueBoolean.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_OptionValueBoolean_h_
#define liblldb_OptionValueBoolean_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueBoolean : public OptionValue
{
public:
OptionValueBoolean (bool value) :
OptionValue(),
m_current_value (value),
m_default_value (value)
{
}
OptionValueBoolean (bool current_value,
bool default_value) :
OptionValue(),
m_current_value (current_value),
m_default_value (default_value)
{
}
virtual
~OptionValueBoolean()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeBoolean;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
//------------------------------------------------------------------
/// Convert to bool operator.
///
/// This allows code to check a OptionValueBoolean in conditions.
///
/// @code
/// OptionValueBoolean bool_value(...);
/// if (bool_value)
/// { ...
/// @endcode
///
/// @return
/// /b True this object contains a valid namespace decl, \b
/// false otherwise.
//------------------------------------------------------------------
operator bool() const
{
return m_current_value;
}
const bool &
operator = (bool b)
{
m_current_value = b;
return m_current_value;
}
bool
GetCurrentValue() const
{
return m_current_value;
}
bool
GetDefaultValue() const
{
return m_default_value;
}
void
SetCurrentValue (bool value)
{
m_current_value = value;
}
void
SetDefaultValue (bool value)
{
m_default_value = value;
}
virtual lldb::OptionValueSP
DeepCopy () const;
protected:
bool m_current_value;
bool m_default_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueBoolean_h_

View File

@ -0,0 +1,139 @@
//===-- OptionValueDictionary.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_OptionValueDictionary_h_
#define liblldb_OptionValueDictionary_h_
// C Includes
// C++ Includes
#include <map>
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueDictionary : public OptionValue
{
public:
OptionValueDictionary (uint32_t type_mask = UINT32_MAX, bool raw_value_dump = true) :
OptionValue(),
m_type_mask (type_mask),
m_values (),
m_raw_value_dump (raw_value_dump)
{
}
virtual
~OptionValueDictionary()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeDictionary;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_values.clear();
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
virtual bool
IsAggregateValue () const
{
return true;
}
bool
IsHomogenous() const
{
return ConvertTypeMaskToType (m_type_mask) != eTypeInvalid;
}
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
uint32_t
GetNumValues() const
{
return m_values.size();
}
lldb::OptionValueSP
GetValueForKey (const ConstString &key) const;
virtual lldb::OptionValueSP
GetSubValue (const ExecutionContext *exe_ctx,
const char *name,
bool will_modify,
Error &error) const;
virtual Error
SetSubValue (const ExecutionContext *exe_ctx,
VarSetOperationType op,
const char *name,
const char *value);
//---------------------------------------------------------------------
// String value getters and setters
//---------------------------------------------------------------------
const char *
GetStringValueForKey (const ConstString &key);
bool
SetStringValueForKey (const ConstString &key,
const char *value,
bool can_replace = true);
bool
SetValueForKey (const ConstString &key,
const lldb::OptionValueSP &value_sp,
bool can_replace = true);
bool
DeleteValueForKey (const ConstString &key);
size_t
GetArgs (Args &args) const;
Error
SetArgs (const Args &args, VarSetOperationType op);
protected:
typedef std::map<ConstString, lldb::OptionValueSP> collection;
uint32_t m_type_mask;
collection m_values;
bool m_raw_value_dump;
};
} // namespace lldb_private
#endif // liblldb_OptionValueDictionary_h_

View File

@ -0,0 +1,118 @@
//===-- OptionValueEnumeration.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_OptionValueEnumeration_h_
#define liblldb_OptionValueEnumeration_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueEnumeration : public OptionValue
{
public:
typedef int64_t enum_type;
struct EnumeratorInfo
{
enum_type value;
const char *description;
};
typedef UniqueCStringMap<EnumeratorInfo> EnumerationMap;
typedef typename EnumerationMap::Entry EnumerationMapEntry;
OptionValueEnumeration (const OptionEnumValueElement *enumerators, enum_type value);
virtual
~OptionValueEnumeration();
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeEnum;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
enum_type
operator = (enum_type value)
{
m_current_value = value;
return m_current_value;
}
enum_type
GetCurrentValue() const
{
return m_current_value;
}
enum_type
GetDefaultValue() const
{
return m_default_value;
}
void
SetCurrentValue (enum_type value)
{
m_current_value = value;
}
void
SetDefaultValue (enum_type value)
{
m_default_value = value;
}
protected:
void
SetEnumerations (const OptionEnumValueElement *enumerators);
enum_type m_current_value;
enum_type m_default_value;
EnumerationMap m_enumerations;
};
} // namespace lldb_private
#endif // liblldb_OptionValueEnumeration_h_

View File

@ -0,0 +1,129 @@
//===-- OptionValueFileSpec.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_OptionValueFileSpec_h_
#define liblldb_OptionValueFileSpec_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Host/FileSpec.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueFileSpec : public OptionValue
{
public:
OptionValueFileSpec () :
OptionValue(),
m_current_value (),
m_default_value ()
{
}
OptionValueFileSpec (const FileSpec &value) :
OptionValue(),
m_current_value (value),
m_default_value (value)
{
}
OptionValueFileSpec (const FileSpec &current_value,
const FileSpec &default_value) :
OptionValue(),
m_current_value (current_value),
m_default_value (default_value)
{
}
virtual
~OptionValueFileSpec()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeFileSpec;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
virtual size_t
AutoComplete (CommandInterpreter &interpreter,
const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
FileSpec &
GetCurrentValue()
{
return m_current_value;
}
const FileSpec &
GetCurrentValue() const
{
return m_current_value;
}
const FileSpec &
GetDefaultValue() const
{
return m_default_value;
}
void
SetCurrentValue (const FileSpec &value)
{
m_current_value = value;
}
void
SetDefaultValue (const FileSpec &value)
{
m_default_value = value;
}
protected:
FileSpec m_current_value;
FileSpec m_default_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueFileSpec_h_

View File

@ -0,0 +1,105 @@
//===-- OptionValueFileSpecList.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_OptionValueFileSpecList_h_
#define liblldb_OptionValueFileSpecList_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/FileSpecList.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueFileSpecList : public OptionValue
{
public:
OptionValueFileSpecList () :
OptionValue(),
m_current_value ()
{
}
OptionValueFileSpecList (const FileSpecList &current_value) :
OptionValue(),
m_current_value (current_value)
{
}
virtual
~OptionValueFileSpecList()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeFileSpecList;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value.Clear();
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
virtual bool
IsAggregateValue () const
{
return true;
}
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
FileSpecList &
GetCurrentValue()
{
return m_current_value;
}
const FileSpecList &
GetCurrentValue() const
{
return m_current_value;
}
void
SetCurrentValue (const FileSpecList &value)
{
m_current_value = value;
}
protected:
FileSpecList m_current_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueFileSpecList_h_

View File

@ -0,0 +1,107 @@
//===-- OptionValueFormat.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_OptionValueFormat_h_
#define liblldb_OptionValueFormat_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueFormat : public OptionValue
{
public:
OptionValueFormat (lldb::Format value) :
OptionValue(),
m_current_value (value),
m_default_value (value)
{
}
OptionValueFormat (lldb::Format current_value,
lldb::Format default_value) :
OptionValue(),
m_current_value (current_value),
m_default_value (default_value)
{
}
virtual
~OptionValueFormat()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeFormat;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
lldb::Format
GetCurrentValue() const
{
return m_current_value;
}
lldb::Format
GetDefaultValue() const
{
return m_default_value;
}
void
SetCurrentValue (lldb::Format value)
{
m_current_value = value;
}
void
SetDefaultValue (lldb::Format value)
{
m_default_value = value;
}
protected:
lldb::Format m_current_value;
lldb::Format m_default_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueFormat_h_

View File

@ -0,0 +1,94 @@
//===-- OptionValuePathMappings.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_OptionValuePathMappings_h_
#define liblldb_OptionValuePathMappings_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Target/PathMappingList.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValuePathMappings : public OptionValue
{
public:
OptionValuePathMappings (bool notify_changes) :
OptionValue(),
m_path_mappings (),
m_notify_changes (notify_changes)
{
}
virtual
~OptionValuePathMappings()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypePathMap;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_path_mappings.Clear(m_notify_changes);
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
virtual bool
IsAggregateValue () const
{
return true;
}
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
PathMappingList &
GetCurrentValue()
{
return m_path_mappings;
}
const PathMappingList &
GetCurrentValue() const
{
return m_path_mappings;
}
protected:
PathMappingList m_path_mappings;
bool m_notify_changes;
};
} // namespace lldb_private
#endif // liblldb_OptionValuePathMappings_h_

View File

@ -0,0 +1,252 @@
//===-- OptionValueProperties.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_OptionValueProperties_h_
#define liblldb_OptionValueProperties_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/Property.h"
namespace lldb_private {
class OptionValueProperties : public OptionValue, public STD_ENABLE_SHARED_FROM_THIS(OptionValueProperties)
{
public:
//---------------------------------------------------------------------
// OptionValueProperties
//---------------------------------------------------------------------
OptionValueProperties () :
OptionValue(),
m_name ()
{
}
OptionValueProperties (const ConstString &name);
OptionValueProperties (const OptionValueProperties &global_properties);
virtual
~OptionValueProperties()
{
}
virtual Type
GetType () const
{
return eTypeProperties;
}
virtual bool
Clear ();
virtual lldb::OptionValueSP
DeepCopy () const;
virtual Error
SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
virtual void
DumpValue (const ExecutionContext *exe_ctx,
Stream &strm,
uint32_t dump_mask);
virtual ConstString
GetName () const
{
return m_name;
}
virtual Error
DumpPropertyValue (const ExecutionContext *exe_ctx,
Stream &strm,
const char *property_path,
uint32_t dump_mask);
virtual void
DumpAllDescriptions (CommandInterpreter &interpreter,
Stream &strm) const;
void
Apropos (const char *keyword,
std::vector<const Property *> &matching_properties) const;
void
Initialize (const PropertyDefinition *setting_definitions);
// bool
// GetQualifiedName (Stream &strm);
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
virtual size_t
GetNumProperties() const;
virtual ConstString
GetPropertyNameAtIndex (uint32_t idx) const;
virtual const char *
GetPropertyDescriptionAtIndex (uint32_t idx) const;
//---------------------------------------------------------------------
// Get the index of a property given its exact name in this property
// collection, "name" can't be a path to a property path that refers
// to a property within a property
//---------------------------------------------------------------------
virtual uint32_t
GetPropertyIndex (const ConstString &name) const;
//---------------------------------------------------------------------
// Get a property by exact name exists in this property collection, name
// can not be a path to a property path that refers to a property within
// a property
//---------------------------------------------------------------------
virtual const Property *
GetProperty (const ExecutionContext *exe_ctx,
bool will_modify,
const ConstString &name) const;
virtual const Property *
GetPropertyAtIndex (const ExecutionContext *exe_ctx,
bool will_modify,
uint32_t idx) const;
//---------------------------------------------------------------------
// Property can be be a property path like "target.process.extra-startup-command"
//---------------------------------------------------------------------
virtual const Property *
GetPropertyAtPath (const ExecutionContext *exe_ctx,
bool will_modify,
const char *property_path) const;
virtual lldb::OptionValueSP
GetPropertyValueAtIndex (const ExecutionContext *exe_ctx,
bool will_modify,
uint32_t idx) const;
virtual lldb::OptionValueSP
GetValueForKey (const ExecutionContext *exe_ctx,
const ConstString &key,
bool value_will_be_modified) const;
lldb::OptionValueSP
GetSubValue (const ExecutionContext *exe_ctx,
const char *name,
bool value_will_be_modified,
Error &error) const;
virtual Error
SetSubValue (const ExecutionContext *exe_ctx,
VarSetOperationType op,
const char *path,
const char *value);
virtual bool
PredicateMatches (const ExecutionContext *exe_ctx,
const char *predicate) const
{
return false;
}
OptionValueArch *
GetPropertyAtIndexAsOptionValueArch (const ExecutionContext *exe_ctx, uint32_t idx) const;
bool
GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const;
bool
SetPropertyAtIndexFromArgs (const ExecutionContext *exe_ctx, uint32_t idx, const Args &args);
bool
GetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool fail_value) const;
bool
SetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool new_value);
OptionValueDictionary *
GetPropertyAtIndexAsOptionValueDictionary (const ExecutionContext *exe_ctx, uint32_t idx) const;
int64_t
GetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const;
bool
SetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value);
const RegularExpression *
GetPropertyAtIndexAsOptionValueRegex (const ExecutionContext *exe_ctx, uint32_t idx) const;
OptionValueSInt64 *
GetPropertyAtIndexAsOptionValueSInt64 (const ExecutionContext *exe_ctx, uint32_t idx) const;
int64_t
GetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const;
bool
SetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value);
uint64_t
GetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t fail_value) const;
bool
SetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t new_value);
const char *
GetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *fail_value) const;
bool
SetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *new_value);
FileSpec
GetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx) const;
bool
SetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx, const FileSpec &file_spec);
OptionValuePathMappings *
GetPropertyAtIndexAsOptionValuePathMappings (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
OptionValueFileSpecList *
GetPropertyAtIndexAsOptionValueFileSpecList (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
void
AppendProperty(const ConstString &name,
const ConstString &desc,
bool is_global,
const lldb::OptionValueSP &value_sp);
protected:
const Property *
ProtectedGetPropertyAtIndex (uint32_t idx) const
{
if (idx < m_properties.size())
return &m_properties[idx];
return NULL;
}
typedef UniqueCStringMap<size_t> NameToIndex;
ConstString m_name;
std::vector<Property> m_properties;
NameToIndex m_name_to_index;
};
} // namespace lldb_private
#endif // liblldb_OptionValueProperties_h_

View File

@ -0,0 +1,98 @@
//===-- OptionValueRegex.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_OptionValueRegex_h_
#define liblldb_OptionValueRegex_h_
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/Core/RegularExpression.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueRegex : public OptionValue
{
public:
OptionValueRegex (const char *value = NULL, uint32_t regex_flags = 0) :
OptionValue(),
m_regex (value, regex_flags)
{
}
virtual
~OptionValueRegex()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeRegex;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_regex.Clear();
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
const RegularExpression *
GetCurrentValue() const
{
if (m_regex.IsValid())
return &m_regex;
return NULL;
}
void
SetCurrentValue (const char *value, uint32_t regex_flags)
{
if (value && value[0])
m_regex.Compile (value, regex_flags);
else
m_regex.Clear();
}
bool
IsValid () const
{
return m_regex.IsValid();
}
protected:
RegularExpression m_regex;
};
} // namespace lldb_private
#endif // liblldb_OptionValueRegex_h_

View File

@ -0,0 +1,172 @@
//===-- OptionValueSInt64.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_OptionValueSInt64_h_
#define liblldb_OptionValueSInt64_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueSInt64 : public OptionValue
{
public:
OptionValueSInt64 () :
OptionValue(),
m_current_value (0),
m_default_value (0),
m_min_value (INT64_MIN),
m_max_value (INT64_MAX)
{
}
OptionValueSInt64 (int64_t value) :
OptionValue(),
m_current_value (value),
m_default_value (value),
m_min_value (INT64_MIN),
m_max_value (INT64_MAX)
{
}
OptionValueSInt64 (int64_t current_value,
int64_t default_value) :
OptionValue(),
m_current_value (current_value),
m_default_value (default_value),
m_min_value (INT64_MIN),
m_max_value (INT64_MAX)
{
}
OptionValueSInt64 (const OptionValueSInt64 &rhs) :
OptionValue(rhs),
m_current_value (rhs.m_current_value),
m_default_value (rhs.m_default_value),
m_min_value (rhs.m_min_value),
m_max_value (rhs.m_max_value)
{
}
virtual
~OptionValueSInt64()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeSInt64;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
const int64_t &
operator = (int64_t value)
{
m_current_value = value;
return m_current_value;
}
int64_t
GetCurrentValue() const
{
return m_current_value;
}
int64_t
GetDefaultValue() const
{
return m_default_value;
}
bool
SetCurrentValue (int64_t value)
{
if (value >= m_min_value && value <= m_max_value)
{
m_current_value = value;
return true;
}
return false;
}
bool
SetDefaultValue (int64_t value)
{
if (value >= m_min_value && value <= m_max_value)
{
m_default_value = value;
return true;
}
return false;
}
void
SetMinimumValue (int64_t v)
{
m_min_value = v;
}
int64_t
GetMinimumValue () const
{
return m_min_value;
}
void
SetMaximumValue (int64_t v)
{
m_max_value = v;
}
int64_t
GetMaximumValue () const
{
return m_max_value;
}
protected:
int64_t m_current_value;
int64_t m_default_value;
int64_t m_min_value;
int64_t m_max_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueSInt64_h_

View File

@ -0,0 +1,161 @@
//===-- OptionValueString.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_OptionValueString_h_
#define liblldb_OptionValueString_h_
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueString : public OptionValue
{
public:
OptionValueString () :
OptionValue(),
m_current_value (),
m_default_value ()
{
}
OptionValueString (const char *value) :
OptionValue(),
m_current_value (),
m_default_value ()
{
if (value && value[0])
{
m_current_value.assign (value);
m_default_value.assign (value);
}
}
OptionValueString (const char *current_value,
const char *default_value) :
OptionValue(),
m_current_value (),
m_default_value ()
{
if (current_value && current_value[0])
m_current_value.assign (current_value);
if (default_value && default_value[0])
m_default_value.assign (default_value);
}
virtual
~OptionValueString()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeString;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
const char *
operator = (const char *value)
{
if (value && value[0])
m_current_value.assign (value);
else
m_current_value.clear();
return m_current_value.c_str();
}
const char *
GetCurrentValue() const
{
return m_current_value.c_str();
}
const char *
GetDefaultValue() const
{
return m_default_value.c_str();
}
void
SetCurrentValue (const char *value)
{
if (value && value[0])
m_current_value.assign (value);
else
m_current_value.clear();
}
void
AppendToCurrentValue (const char *value)
{
if (value && value[0])
m_current_value.append (value);
}
void
SetDefaultValue (const char *value)
{
if (value && value[0])
m_default_value.assign (value);
else
m_default_value.clear();
}
bool
IsCurrentValueEmpty () const
{
return m_current_value.empty();
}
bool
IsDefaultValueEmpty () const
{
return m_default_value.empty();
}
protected:
std::string m_current_value;
std::string m_default_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueString_h_

View File

@ -0,0 +1,134 @@
//===-- OptionValueUInt64.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_OptionValueUInt64_h_
#define liblldb_OptionValueUInt64_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueUInt64 : public OptionValue
{
public:
OptionValueUInt64 () :
OptionValue(),
m_current_value (0),
m_default_value (0)
{
}
OptionValueUInt64 (uint64_t value) :
OptionValue(),
m_current_value (value),
m_default_value (value)
{
}
OptionValueUInt64 (uint64_t current_value,
uint64_t default_value) :
OptionValue(),
m_current_value (current_value),
m_default_value (default_value)
{
}
virtual
~OptionValueUInt64()
{
}
//---------------------------------------------------------------------
// Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
// inside of a lldb::OptionValueSP object if all goes well. If the
// string isn't a uint64_t value or any other error occurs, return an
// empty lldb::OptionValueSP and fill error in with the correct stuff.
//---------------------------------------------------------------------
static lldb::OptionValueSP
Create (const char *value_cstr, Error &error);
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeUInt64;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_current_value = m_default_value;
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
const uint64_t &
operator = (uint64_t value)
{
m_current_value = value;
return m_current_value;
}
operator uint64_t () const
{
return m_current_value;
}
uint64_t
GetCurrentValue() const
{
return m_current_value;
}
uint64_t
GetDefaultValue() const
{
return m_default_value;
}
void
SetCurrentValue (uint64_t value)
{
m_current_value = value;
}
void
SetDefaultValue (uint64_t value)
{
m_default_value = value;
}
protected:
uint64_t m_current_value;
uint64_t m_default_value;
};
} // namespace lldb_private
#endif // liblldb_OptionValueUInt64_h_

View File

@ -0,0 +1,98 @@
//===-- OptionValueUUID.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_OptionValueUUID_h_
#define liblldb_OptionValueUUID_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/UUID.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueUUID : public OptionValue
{
public:
OptionValueUUID () :
OptionValue(),
m_uuid ()
{
}
OptionValueUUID (const UUID &uuid) :
OptionValue(),
m_uuid (uuid)
{
}
virtual
~OptionValueUUID()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
virtual OptionValue::Type
GetType () const
{
return eTypeUUID;
}
virtual void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
virtual Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign);
virtual bool
Clear ()
{
m_uuid.Clear();
m_value_was_set = false;
return true;
}
virtual lldb::OptionValueSP
DeepCopy () const;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
UUID &
GetCurrentValue()
{
return m_uuid;
}
const UUID &
GetCurrentValue() const
{
return m_uuid;
}
void
SetCurrentValue (const UUID &value)
{
m_uuid = value;
}
protected:
UUID m_uuid;
};
} // namespace lldb_private
#endif // liblldb_OptionValueUUID_h_

View File

@ -0,0 +1,31 @@
//===-- OptionValues.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_OptionValues_h_
#define liblldb_OptionValues_h_
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/OptionValueArch.h"
#include "lldb/Interpreter/OptionValueArgs.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueDictionary.h"
#include "lldb/Interpreter/OptionValueEnumeration.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueFormat.h"
#include "lldb/Interpreter/OptionValuePathMappings.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/OptionValueRegex.h"
#include "lldb/Interpreter/OptionValueSInt64.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Interpreter/OptionValueUUID.h"
#endif // liblldb_OptionValues_h_

View File

@ -0,0 +1,109 @@
//===-- Property.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_Property_h_
#define liblldb_Property_h_
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-defines.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Flags.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
// A structure that can be used to create a global table for all properties.
// Property class instances can be constructed using one of these.
struct PropertyDefinition
{
const char *name;
OptionValue::Type type;
bool global;
uintptr_t default_uint_value;
const char *default_cstr_value;
OptionEnumValueElement *enum_values;
const char *description;
};
class Property
{
public:
Property (const PropertyDefinition &definition);
Property (const ConstString &name,
const ConstString &desc,
bool is_global,
const lldb::OptionValueSP &value_sp);
const ConstString &
GetName() const
{
return m_name;
}
const char *
GetDescription () const
{
return m_description.GetCString();
}
const lldb::OptionValueSP &
GetValue() const
{
return m_value_sp;
}
void
SetOptionValue (const lldb::OptionValueSP &value_sp)
{
m_value_sp = value_sp;
}
bool
IsValid() const
{
return (bool)m_value_sp;
}
bool
IsGlobal () const
{
return m_is_global;
}
void
Dump (const ExecutionContext *exe_ctx,
Stream &strm,
uint32_t dump_mask) const;
bool
DumpQualifiedName(Stream &strm) const;
void
DumpDescription (CommandInterpreter &interpreter,
Stream &strm,
uint32_t output_width,
bool display_qualified_name) const;
protected:
ConstString m_name;
ConstString m_description;
lldb::OptionValueSP m_value_sp;
bool m_is_global;
};
} // namespace lldb_private
#endif // liblldb_Property_h_

View File

@ -86,9 +86,14 @@ public:
bool
Replace (const ConstString &path,
const ConstString &new_path,
const ConstString &replacement,
bool notify);
bool
Replace (const ConstString &path,
const ConstString &replacement,
uint32_t index,
bool notify);
bool
RemapPath (const ConstString &path, ConstString &new_path) const;

View File

@ -459,7 +459,10 @@ namespace lldb_private {
{
return false;
}
virtual size_t
GetEnvironment (StringList &environment);
protected:
bool m_is_host;
// Set to true when we are able to actually set the OS version while

View File

@ -48,74 +48,92 @@
namespace lldb_private {
//----------------------------------------------------------------------
// ProcessInstanceSettings
//----------------------------------------------------------------------
class ProcessInstanceSettings : public InstanceSettings
{
public:
ProcessInstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, bool live_instance = true, const char *name = NULL);
ProcessInstanceSettings (const ProcessInstanceSettings &rhs);
virtual
~ProcessInstanceSettings ();
ProcessInstanceSettings&
operator= (const ProcessInstanceSettings &rhs);
void
UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const ConstString &instance_name,
const SettingEntry &entry,
VarSetOperationType op,
Error &err,
bool pending);
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error *err);
bool GetDisableMemoryCache() const
class ProcessProperties : public Properties
{
return m_disable_memory_cache;
}
const Args &
GetExtraStartupCommands () const
{
return m_extra_startup_commands;
}
void
SetExtraStartupCommands (const Args &args)
{
m_extra_startup_commands = args;
}
protected:
const ConstString &
GetDisableMemoryCacheVarName () const;
const ConstString &
GetExtraStartupCommandVarName () const;
public:
ProcessProperties(bool is_global);
void
CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending);
virtual
~ProcessProperties();
bool GetDisableMemoryCache() const;
const ConstString
CreateInstanceName ();
Args //&
GetExtraStartupCommands () const;
void
SetExtraStartupCommands (const Args &args);
};
bool m_disable_memory_cache;
Args m_extra_startup_commands;
};
typedef STD_SHARED_PTR(ProcessProperties) ProcessPropertiesSP;
////----------------------------------------------------------------------
//// ProcessInstanceSettings
////----------------------------------------------------------------------
//class ProcessInstanceSettings : public InstanceSettings
//{
//public:
//
// ProcessInstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, bool live_instance = true, const char *name = NULL);
//
// ProcessInstanceSettings (const ProcessInstanceSettings &rhs);
//
// virtual
// ~ProcessInstanceSettings ();
//
// ProcessInstanceSettings&
// operator= (const ProcessInstanceSettings &rhs);
//
//
// void
// UpdateInstanceSettingsVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const ConstString &instance_name,
// const SettingEntry &entry,
// VarSetOperationType op,
// Error &err,
// bool pending);
//
// bool
// GetInstanceSettingsValue (const SettingEntry &entry,
// const ConstString &var_name,
// StringList &value,
// Error *err);
//
// bool GetDisableMemoryCache() const
// {
// return m_disable_memory_cache;
// }
//
// const Args &
// GetExtraStartupCommands () const
// {
// return m_extra_startup_commands;
// }
//
// void
// SetExtraStartupCommands (const Args &args)
// {
// m_extra_startup_commands = args;
// }
//
//protected:
// const ConstString &
// GetDisableMemoryCacheVarName () const;
//
// const ConstString &
// GetExtraStartupCommandVarName () const;
//
// void
// CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
// bool pending);
//
// const ConstString
// CreateInstanceName ();
//
// bool m_disable_memory_cache;
// Args m_extra_startup_commands;
//};
//----------------------------------------------------------------------
// ProcessInfo
@ -1344,11 +1362,11 @@ protected:
//----------------------------------------------------------------------
class Process :
public STD_ENABLE_SHARED_FROM_THIS(Process),
public ProcessProperties,
public UserID,
public Broadcaster,
public ExecutionContextScope,
public PluginInterface,
public ProcessInstanceSettings
public PluginInterface
{
friend class ThreadList;
friend class ClangFunction; // For WaitForStateChangeEventsPrivate
@ -1507,29 +1525,29 @@ public:
};
class SettingsController : public UserSettingsController
{
public:
SettingsController ();
virtual
~SettingsController ();
static SettingEntry global_settings_table[];
static SettingEntry instance_settings_table[];
protected:
lldb::InstanceSettingsSP
CreateInstanceSettings (const char *instance_name);
private:
// Class-wide settings.
DISALLOW_COPY_AND_ASSIGN (SettingsController);
};
// class SettingsController : public UserSettingsController
// {
// public:
//
// SettingsController ();
//
// virtual
// ~SettingsController ();
//
// static SettingEntry global_settings_table[];
// static SettingEntry instance_settings_table[];
//
// protected:
//
// lldb::InstanceSettingsSP
// CreateInstanceSettings (const char *instance_name);
//
// private:
//
// // Class-wide settings.
//
// DISALLOW_COPY_AND_ASSIGN (SettingsController);
// };
#endif
@ -1539,14 +1557,30 @@ public:
static void
SettingsTerminate ();
static lldb::UserSettingsControllerSP &
GetSettingsController ();
void
UpdateInstanceName ();
static const ProcessPropertiesSP &
GetGlobalProperties();
const Args //&
GetExtraStartupCommands () const
{
// TODO: SETTINGS
return Args();
}
void
SetExtraStartupCommands (const Args &args)
{
// TODO: SETTINGS
}
bool
GetDisableMemoryCache() const
{
// TODO: SETTINGS
return false;
}
//------------------------------------------------------------------
/// Construct with a shared pointer to a target, and the Process listener.
//------------------------------------------------------------------

View File

@ -26,7 +26,9 @@
#include "lldb/Core/SourceManager.h"
#include "lldb/Expression/ClangPersistentVariables.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueEnumeration.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContextScope.h"
@ -38,244 +40,331 @@ namespace lldb_private {
//----------------------------------------------------------------------
// TargetInstanceSettings
//----------------------------------------------------------------------
class TargetInstanceSettings : public InstanceSettings
{
public:
static OptionEnumValueElement g_dynamic_value_types[];
extern OptionEnumValueElement g_dynamic_value_types[];
//class TargetInstanceSettings : public InstanceSettings
//{
//public:
// static OptionEnumValueElement g_dynamic_value_types[];
//
// TargetInstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, bool live_instance = true, const char *name = NULL);
//
// TargetInstanceSettings (const TargetInstanceSettings &rhs);
//
// virtual
// ~TargetInstanceSettings ();
//
// TargetInstanceSettings&
// operator= (const TargetInstanceSettings &rhs);
//
// void
// UpdateInstanceSettingsVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const ConstString &instance_name,
// const SettingEntry &entry,
// VarSetOperationType op,
// Error &err,
// bool pending);
//
// bool
// GetInstanceSettingsValue (const SettingEntry &entry,
// const ConstString &var_name,
// StringList &value,
// Error *err);
//
// lldb::DynamicValueType
// GetPreferDynamicValue()
// {
// return (lldb::DynamicValueType) g_dynamic_value_types[m_prefer_dynamic_value].value;
// }
//
// bool
// GetEnableSyntheticValue ()
// {
// return m_enable_synthetic_value;
// }
//
// void
// SetEnableSyntheticValue (bool b)
// {
// m_enable_synthetic_value = b;
// }
//
// bool
// GetSkipPrologue()
// {
// return m_skip_prologue;
// }
//
// PathMappingList &
// GetSourcePathMap ()
// {
// return m_source_map;
// }
//
// FileSpecList &
// GetExecutableSearchPaths ()
// {
// return m_exe_search_paths;
// }
//
// const FileSpecList &
// GetExecutableSearchPaths () const
// {
// return m_exe_search_paths;
// }
//
//
// uint32_t
// GetMaximumNumberOfChildrenToDisplay()
// {
// return m_max_children_display;
// }
// uint32_t
// GetMaximumSizeOfStringSummary()
// {
// return m_max_strlen_length;
// }
//
// bool
// GetBreakpointsConsultPlatformAvoidList ()
// {
// return m_breakpoints_use_platform_avoid;
// }
//
// const Args &
// GetRunArguments () const
// {
// return m_run_args;
// }
//
// void
// SetRunArguments (const Args &args)
// {
// m_run_args = args;
// }
//
// void
// GetHostEnvironmentIfNeeded ();
//
// size_t
// GetEnvironmentAsArgs (Args &env);
//
// const char *
// GetStandardInputPath () const
// {
// if (m_input_path.empty())
// return NULL;
// return m_input_path.c_str();
// }
//
// void
// SetStandardInputPath (const char *path)
// {
// if (path && path[0])
// m_input_path.assign (path);
// else
// {
// // Make sure we deallocate memory in string...
// std::string tmp;
// tmp.swap (m_input_path);
// }
// }
//
// const char *
// GetStandardOutputPath () const
// {
// if (m_output_path.empty())
// return NULL;
// return m_output_path.c_str();
// }
//
// void
// SetStandardOutputPath (const char *path)
// {
// if (path && path[0])
// m_output_path.assign (path);
// else
// {
// // Make sure we deallocate memory in string...
// std::string tmp;
// tmp.swap (m_output_path);
// }
// }
//
// const char *
// GetStandardErrorPath () const
// {
// if (m_error_path.empty())
// return NULL;
// return m_error_path.c_str();
// }
//
// void
// SetStandardErrorPath (const char *path)
// {
// if (path && path[0])
// m_error_path.assign (path);
// else
// {
// // Make sure we deallocate memory in string...
// std::string tmp;
// tmp.swap (m_error_path);
// }
// }
//
// bool
// GetDisableASLR () const
// {
// return m_disable_aslr;
// }
//
// void
// SetDisableASLR (bool b)
// {
// m_disable_aslr = b;
// }
//
// bool
// GetDisableSTDIO () const
// {
// return m_disable_stdio;
// }
//
// void
// SetDisableSTDIO (bool b)
// {
// m_disable_stdio = b;
// }
//
//
//protected:
//
// void
// CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
// bool pending);
//
// const ConstString
// CreateInstanceName ();
//
// OptionValueFileSpec m_expr_prefix_file;
// std::string m_expr_prefix_contents;
// int m_prefer_dynamic_value;
// OptionValueBoolean m_enable_synthetic_value;
// OptionValueBoolean m_skip_prologue;
// PathMappingList m_source_map;
// FileSpecList m_exe_search_paths;
// uint32_t m_max_children_display;
// uint32_t m_max_strlen_length;
// OptionValueBoolean m_breakpoints_use_platform_avoid;
// typedef std::map<std::string, std::string> dictionary;
// Args m_run_args;
// dictionary m_env_vars;
// std::string m_input_path;
// std::string m_output_path;
// std::string m_error_path;
// bool m_disable_aslr;
// bool m_disable_stdio;
// bool m_inherit_host_env;
// bool m_got_host_env;
//
//
//};
class TargetProperties;
typedef STD_SHARED_PTR(TargetProperties) TargetPropertiesSP;
TargetInstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, bool live_instance = true, const char *name = NULL);
TargetInstanceSettings (const TargetInstanceSettings &rhs);
virtual
~TargetInstanceSettings ();
TargetInstanceSettings&
operator= (const TargetInstanceSettings &rhs);
void
UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const ConstString &instance_name,
const SettingEntry &entry,
VarSetOperationType op,
Error &err,
bool pending);
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error *err);
lldb::DynamicValueType
GetPreferDynamicValue()
class TargetProperties : public Properties
{
return (lldb::DynamicValueType) g_dynamic_value_types[m_prefer_dynamic_value].value;
}
bool
GetEnableSyntheticValue ()
{
return m_enable_synthetic_value;
}
public:
TargetProperties(Target *target);
void
SetEnableSyntheticValue (bool b)
{
m_enable_synthetic_value = b;
}
bool
GetSkipPrologue()
{
return m_skip_prologue;
}
PathMappingList &
GetSourcePathMap ()
{
return m_source_map;
}
FileSpecList &
GetExecutableSearchPaths ()
{
return m_exe_search_paths;
}
const FileSpecList &
GetExecutableSearchPaths () const
{
return m_exe_search_paths;
}
uint32_t
GetMaximumNumberOfChildrenToDisplay()
{
return m_max_children_display;
}
uint32_t
GetMaximumSizeOfStringSummary()
{
return m_max_strlen_length;
}
bool
GetBreakpointsConsultPlatformAvoidList ()
{
return m_breakpoints_use_platform_avoid;
}
virtual
~TargetProperties();
const Args &
GetRunArguments () const
{
return m_run_args;
}
void
SetRunArguments (const Args &args)
{
m_run_args = args;
}
void
GetHostEnvironmentIfNeeded ();
size_t
GetEnvironmentAsArgs (Args &env);
const char *
GetStandardInputPath () const
{
if (m_input_path.empty())
return NULL;
return m_input_path.c_str();
}
void
SetStandardInputPath (const char *path)
{
if (path && path[0])
m_input_path.assign (path);
else
virtual lldb::OptionValuePropertiesSP
GetValueProperties () const
{
// Make sure we deallocate memory in string...
std::string tmp;
tmp.swap (m_input_path);
return m_collection_sp;
}
}
const char *
GetStandardOutputPath () const
{
if (m_output_path.empty())
return NULL;
return m_output_path.c_str();
}
void
SetStandardOutputPath (const char *path)
{
if (path && path[0])
m_output_path.assign (path);
else
{
// Make sure we deallocate memory in string...
std::string tmp;
tmp.swap (m_output_path);
}
}
const char *
GetStandardErrorPath () const
{
if (m_error_path.empty())
return NULL;
return m_error_path.c_str();
}
void
SetStandardErrorPath (const char *path)
{
if (path && path[0])
m_error_path.assign (path);
else
{
// Make sure we deallocate memory in string...
std::string tmp;
tmp.swap (m_error_path);
}
}
bool
GetDisableASLR () const
{
return m_disable_aslr;
}
void
SetDisableASLR (bool b)
{
m_disable_aslr = b;
}
bool
GetDisableSTDIO () const
{
return m_disable_stdio;
}
void
SetDisableSTDIO (bool b)
{
m_disable_stdio = b;
}
ArchSpec
GetDefaultArchitecture () const;
void
SetDefaultArchitecture (const ArchSpec& arch);
protected:
void
CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending);
const ConstString
CreateInstanceName ();
OptionValueFileSpec m_expr_prefix_file;
std::string m_expr_prefix_contents;
int m_prefer_dynamic_value;
OptionValueBoolean m_enable_synthetic_value;
OptionValueBoolean m_skip_prologue;
PathMappingList m_source_map;
FileSpecList m_exe_search_paths;
uint32_t m_max_children_display;
uint32_t m_max_strlen_length;
OptionValueBoolean m_breakpoints_use_platform_avoid;
typedef std::map<std::string, std::string> dictionary;
Args m_run_args;
dictionary m_env_vars;
std::string m_input_path;
std::string m_output_path;
std::string m_error_path;
bool m_disable_aslr;
bool m_disable_stdio;
bool m_inherit_host_env;
bool m_got_host_env;
};
lldb::DynamicValueType
GetPreferDynamicValue() const;
bool
GetDisableASLR () const;
void
SetDisableASLR (bool b);
bool
GetDisableSTDIO () const;
void
SetDisableSTDIO (bool b);
bool
GetRunArguments (Args &args) const;
void
SetRunArguments (const Args &args);
size_t
GetEnvironmentAsArgs (Args &env) const;
bool
GetSkipPrologue() const;
PathMappingList &
GetSourcePathMap () const;
FileSpecList &
GetExecutableSearchPaths () const;
bool
GetEnableSyntheticValue () const;
uint32_t
GetMaximumNumberOfChildrenToDisplay() const;
uint32_t
GetMaximumSizeOfStringSummary() const;
FileSpec
GetStandardInputPath () const;
void
SetStandardInputPath (const char *path);
FileSpec
GetStandardOutputPath () const;
void
SetStandardOutputPath (const char *path);
FileSpec
GetStandardErrorPath () const;
void
SetStandardErrorPath (const char *path);
bool
GetBreakpointsConsultPlatformAvoidList ();
};
//----------------------------------------------------------------------
// Target
//----------------------------------------------------------------------
class Target :
public STD_ENABLE_SHARED_FROM_THIS(Target),
public TargetProperties,
public Broadcaster,
public ExecutionContextScope,
public TargetInstanceSettings
public ExecutionContextScope
{
public:
friend class TargetList;
@ -342,8 +431,8 @@ public:
static void
SettingsTerminate ();
static lldb::UserSettingsControllerSP &
GetSettingsController ();
// static lldb::UserSettingsControllerSP &
// GetSettingsController ();
static FileSpecList
GetDefaultExecutableSearchPaths ();
@ -354,12 +443,21 @@ public:
static void
SetDefaultArchitecture (const ArchSpec &arch);
void
UpdateInstanceName ();
// void
// UpdateInstanceName ();
lldb::ModuleSP
GetSharedModule (const ModuleSpec &module_spec,
Error *error_ptr = NULL);
//----------------------------------------------------------------------
// Settings accessors
//----------------------------------------------------------------------
static const TargetPropertiesSP &
GetGlobalProperties();
private:
//------------------------------------------------------------------
/// Construct with optional file and arch.
@ -1091,47 +1189,47 @@ public:
//------------------------------------------------------------------
// Target::SettingsController
//------------------------------------------------------------------
class SettingsController : public UserSettingsController
{
public:
SettingsController ();
virtual
~SettingsController ();
bool
SetGlobalVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const SettingEntry &entry,
const VarSetOperationType op,
Error&err);
bool
GetGlobalVariable (const ConstString &var_name,
StringList &value,
Error &err);
static SettingEntry global_settings_table[];
static SettingEntry instance_settings_table[];
ArchSpec &
GetArchitecture ()
{
return m_default_architecture;
}
protected:
lldb::InstanceSettingsSP
CreateInstanceSettings (const char *instance_name);
private:
// Class-wide settings.
ArchSpec m_default_architecture;
DISALLOW_COPY_AND_ASSIGN (SettingsController);
};
// class SettingsController : public UserSettingsController
// {
// public:
// SettingsController ();
//
// virtual
// ~SettingsController ();
//
// bool
// SetGlobalVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const SettingEntry &entry,
// const VarSetOperationType op,
// Error&err);
//
// bool
// GetGlobalVariable (const ConstString &var_name,
// StringList &value,
// Error &err);
//
// static SettingEntry global_settings_table[];
// static SettingEntry instance_settings_table[];
//
// ArchSpec &
// GetArchitecture ()
// {
// return m_default_architecture;
// }
// protected:
//
// lldb::InstanceSettingsSP
// CreateInstanceSettings (const char *instance_name);
//
// private:
//
// // Class-wide settings.
// ArchSpec m_default_architecture;
//
// DISALLOW_COPY_AND_ASSIGN (SettingsController);
// };
//------------------------------------------------------------------
// Methods.
@ -1145,7 +1243,7 @@ public:
lldb::SearchFilterSP
GetSearchFilterForModuleAndCUList (const FileSpecList *containingModules, const FileSpecList *containingSourceFiles);
protected:
protected:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------

View File

@ -21,100 +21,127 @@
namespace lldb_private {
class ThreadInstanceSettings : public InstanceSettings
{
public:
ThreadInstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, bool live_instance = true, const char *name = NULL);
ThreadInstanceSettings (const ThreadInstanceSettings &rhs);
virtual
~ThreadInstanceSettings ();
ThreadInstanceSettings&
operator= (const ThreadInstanceSettings &rhs);
void
UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const ConstString &instance_name,
const SettingEntry &entry,
VarSetOperationType op,
Error &err,
bool pending);
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error *err);
RegularExpression *
GetSymbolsToAvoidRegexp()
class ThreadProperties : public Properties
{
return m_avoid_regexp_ap.get();
}
static const ConstString &
StepAvoidRegexpVarName ();
public:
ThreadProperties(bool is_global);
virtual
~ThreadProperties();
//------------------------------------------------------------------
/// The regular expression returned determines symbols that this
/// thread won't stop in during "step-in" operations.
///
/// @return
/// A pointer to a regular expression to compare against symbols,
/// or NULL if all symbols are allowed.
///
//------------------------------------------------------------------
const RegularExpression *
GetSymbolsToAvoidRegexp();
bool
GetTraceEnabledState() const;
};
bool
GetTraceEnabledState()
{
return m_trace_enabled;
}
static const ConstString &
GetTraceThreadVarName ();
typedef STD_SHARED_PTR(ThreadProperties) ThreadPropertiesSP;
protected:
void
CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending);
const ConstString
CreateInstanceName ();
private:
std::auto_ptr<RegularExpression> m_avoid_regexp_ap;
bool m_trace_enabled;
};
//class ThreadInstanceSettings : public InstanceSettings
//{
//public:
//
// ThreadInstanceSettings (const lldb::UserSettingsControllerSP &owner_sp, bool live_instance = true, const char *name = NULL);
//
// ThreadInstanceSettings (const ThreadInstanceSettings &rhs);
//
// virtual
// ~ThreadInstanceSettings ();
//
// ThreadInstanceSettings&
// operator= (const ThreadInstanceSettings &rhs);
//
//
// void
// UpdateInstanceSettingsVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const ConstString &instance_name,
// const SettingEntry &entry,
// VarSetOperationType op,
// Error &err,
// bool pending);
//
// bool
// GetInstanceSettingsValue (const SettingEntry &entry,
// const ConstString &var_name,
// StringList &value,
// Error *err);
//
// RegularExpression *
// GetSymbolsToAvoidRegexp()
// {
// return m_avoid_regexp_ap.get();
// }
//
// static const ConstString &
// StepAvoidRegexpVarName ();
//
// bool
// GetTraceEnabledState()
// {
// return m_trace_enabled;
// }
// static const ConstString &
// GetTraceThreadVarName ();
//
//protected:
//
// void
// CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
// bool pending);
//
// const ConstString
// CreateInstanceName ();
//
//private:
//
// std::auto_ptr<RegularExpression> m_avoid_regexp_ap;
// bool m_trace_enabled;
//};
class Thread :
public STD_ENABLE_SHARED_FROM_THIS(Thread),
public ThreadProperties,
public UserID,
public ExecutionContextScope,
public ThreadInstanceSettings
public ExecutionContextScope//,
//public ThreadInstanceSettings
{
public:
class SettingsController : public UserSettingsController
{
public:
SettingsController ();
virtual
~SettingsController ();
static SettingEntry global_settings_table[];
static SettingEntry instance_settings_table[];
protected:
lldb::InstanceSettingsSP
CreateInstanceSettings (const char *instance_name);
private:
// Class-wide settings.
DISALLOW_COPY_AND_ASSIGN (SettingsController);
};
// class SettingsController : public UserSettingsController
// {
// public:
//
// SettingsController ();
//
// virtual
// ~SettingsController ();
//
// static SettingEntry global_settings_table[];
// static SettingEntry instance_settings_table[];
//
// protected:
//
// lldb::InstanceSettingsSP
// CreateInstanceSettings (const char *instance_name);
//
// private:
//
// // Class-wide settings.
//
// DISALLOW_COPY_AND_ASSIGN (SettingsController);
// };
// TODO: You shouldn't just checkpoint the register state alone, so this should get
// moved to protected. To do that ThreadStateCheckpoint needs to be returned as a token...
@ -191,17 +218,14 @@ public:
RegisterCheckpoint register_backup; // You need to restore the registers, of course...
};
void
UpdateInstanceName ();
static void
SettingsInitialize ();
static void
SettingsTerminate ();
static lldb::UserSettingsControllerSP &
GetSettingsController ();
static const ThreadPropertiesSP &
GetGlobalProperties();
Thread (const lldb::ProcessSP &process_sp, lldb::tid_t tid);
virtual ~Thread();
@ -708,21 +732,6 @@ public:
void
SetTracer (lldb::ThreadPlanTracerSP &tracer_sp);
//------------------------------------------------------------------
/// The regular expression returned determines symbols that this
/// thread won't stop in during "step-in" operations.
///
/// @return
/// A pointer to a regular expression to compare against symbols,
/// or NULL if all symbols are allowed.
///
//------------------------------------------------------------------
RegularExpression *
GetSymbolsToAvoidRegexp()
{
return ThreadInstanceSettings::GetSymbolsToAvoidRegexp();
}
// Get the thread index ID. The index ID that is guaranteed to not be
// re-used by a process. They start at 1 and increase with each new thread.
// This allows easy command line access by a unique ID that is easier to

View File

@ -134,6 +134,22 @@ class ObjectFile;
class OperatingSystem;
class Options;
class OptionValue;
class OptionValueArch;
class OptionValueArgs;
class OptionValueArray;
class OptionValueBoolean;
class OptionValueDictionary;
class OptionValueEnumeration;
class OptionValueFileSpec;
class OptionValueFileSpecList;
class OptionValueFormat;
class OptionValuePathMappings;
class OptionValueProperties;
class OptionValueRegex;
class OptionValueSInt64;
class OptionValueString;
class OptionValueUInt64;
class OptionValueUUID;
class NamedOption;
class PathMappingList;
class Platform;
@ -145,6 +161,8 @@ class ProcessInstanceInfo;
class ProcessInstanceInfoList;
class ProcessInstanceInfoMatch;
class ProcessLaunchInfo;
class Property;
struct PropertyDefinition;
class RegisterContext;
class RegisterLocation;
class RegisterLocationList;
@ -161,6 +179,7 @@ class SearchFilter;
class Section;
class SectionImpl;
class SectionList;
class Settings;
class SourceManager;
class SourceManagerImpl;
class StackFrame;
@ -249,11 +268,11 @@ namespace lldb {
typedef STD_SHARED_PTR(lldb_private::Baton) BatonSP;
typedef STD_SHARED_PTR(lldb_private::Block) BlockSP;
typedef STD_SHARED_PTR(lldb_private::Breakpoint) BreakpointSP;
typedef STD_WEAK_PTR(lldb_private::Breakpoint) BreakpointWP;
typedef STD_WEAK_PTR( lldb_private::Breakpoint) BreakpointWP;
typedef STD_SHARED_PTR(lldb_private::BreakpointSite) BreakpointSiteSP;
typedef STD_WEAK_PTR(lldb_private::BreakpointSite) BreakpointSiteWP;
typedef STD_WEAK_PTR( lldb_private::BreakpointSite) BreakpointSiteWP;
typedef STD_SHARED_PTR(lldb_private::BreakpointLocation) BreakpointLocationSP;
typedef STD_WEAK_PTR(lldb_private::BreakpointLocation) BreakpointLocationWP;
typedef STD_WEAK_PTR( lldb_private::BreakpointLocation) BreakpointLocationWP;
typedef STD_SHARED_PTR(lldb_private::BreakpointResolver) BreakpointResolverSP;
typedef STD_SHARED_PTR(lldb_private::Broadcaster) BroadcasterSP;
typedef STD_SHARED_PTR(lldb_private::ClangExpressionVariable) ClangExpressionVariableSP;
@ -264,13 +283,13 @@ namespace lldb {
typedef STD_SHARED_PTR(lldb_private::DataBuffer) DataBufferSP;
typedef STD_SHARED_PTR(lldb_private::DataExtractor) DataExtractorSP;
typedef STD_SHARED_PTR(lldb_private::Debugger) DebuggerSP;
typedef STD_WEAK_PTR(lldb_private::Debugger) DebuggerWP;
typedef STD_WEAK_PTR( lldb_private::Debugger) DebuggerWP;
typedef STD_SHARED_PTR(lldb_private::Disassembler) DisassemblerSP;
typedef STD_SHARED_PTR(lldb_private::DynamicLoader) DynamicLoaderSP;
typedef STD_SHARED_PTR(lldb_private::Event) EventSP;
typedef STD_SHARED_PTR(lldb_private::ExecutionContextRef) ExecutionContextRefSP;
typedef STD_SHARED_PTR(lldb_private::TypeCategoryImpl) TypeCategoryImplSP;
typedef STD_SHARED_PTR(lldb_private::Function) FunctionSP;
typedef STD_SHARED_PTR(lldb_private::FuncUnwinders) FuncUnwindersSP;
typedef STD_SHARED_PTR(lldb_private::InlineFunctionInfo) InlineFunctionInfoSP;
typedef STD_SHARED_PTR(lldb_private::InputReader) InputReaderSP;
typedef STD_SHARED_PTR(lldb_private::InstanceSettings) InstanceSettingsSP;
@ -281,59 +300,78 @@ namespace lldb {
typedef STD_SHARED_PTR(lldb_private::Log) LogSP;
typedef STD_SHARED_PTR(lldb_private::LogChannel) LogChannelSP;
typedef STD_SHARED_PTR(lldb_private::Module) ModuleSP;
typedef STD_WEAK_PTR(lldb_private::Module) ModuleWP;
typedef STD_WEAK_PTR( lldb_private::Module) ModuleWP;
typedef STD_SHARED_PTR(lldb_private::ObjectFile) ObjectFileSP;
typedef STD_WEAK_PTR(lldb_private::ObjectFile) ObjectFileWP;
typedef STD_WEAK_PTR( lldb_private::ObjectFile) ObjectFileWP;
typedef STD_SHARED_PTR(lldb_private::OptionValue) OptionValueSP;
typedef STD_WEAK_PTR( lldb_private::OptionValue) OptionValueWP;
typedef STD_SHARED_PTR(lldb_private::OptionValueArch) OptionValueArchSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueArgs) OptionValueArgsSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueArray) OptionValueArraySP;
typedef STD_SHARED_PTR(lldb_private::OptionValueBoolean) OptionValueBooleanSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueDictionary) OptionValueDictionarySP;
typedef STD_SHARED_PTR(lldb_private::OptionValueFileSpec) OptionValueFileSpecSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueFileSpecList) OptionValueFileSpecListSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueFormat) OptionValueFormatSP;
typedef STD_SHARED_PTR(lldb_private::OptionValuePathMappings) OptionValuePathMappingsSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueProperties) OptionValuePropertiesSP;
// typedef STD_WEAK_PTR( lldb_private::OptionValueProperties) OptionValuePropertiesWP;
typedef STD_SHARED_PTR(lldb_private::OptionValueRegex) OptionValueRegexSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueSInt64) OptionValueSInt64SP;
typedef STD_SHARED_PTR(lldb_private::OptionValueString) OptionValueStringSP;
typedef STD_SHARED_PTR(lldb_private::OptionValueUInt64) OptionValueUInt64SP;
typedef STD_SHARED_PTR(lldb_private::OptionValueUUID) OptionValueUUIDSP;
typedef STD_SHARED_PTR(lldb_private::Platform) PlatformSP;
typedef STD_SHARED_PTR(lldb_private::Process) ProcessSP;
typedef STD_SHARED_PTR(lldb_private::ProcessAttachInfo) ProcessAttachInfoSP;
typedef STD_SHARED_PTR(lldb_private::ProcessLaunchInfo) ProcessLaunchInfoSP;
typedef STD_WEAK_PTR(lldb_private::Process) ProcessWP;
typedef STD_WEAK_PTR( lldb_private::Process) ProcessWP;
typedef STD_SHARED_PTR(lldb_private::Property) PropertySP;
typedef STD_SHARED_PTR(lldb_private::RegisterContext) RegisterContextSP;
typedef STD_SHARED_PTR(lldb_private::RegularExpression) RegularExpressionSP;
typedef STD_SHARED_PTR(lldb_private::Section) SectionSP;
typedef STD_WEAK_PTR(lldb_private::Section) SectionWP;
typedef STD_SHARED_PTR(lldb_private::SearchFilter) SearchFilterSP;
typedef STD_SHARED_PTR(lldb_private::ScriptInterpreterObject) ScriptInterpreterObjectSP;
#ifndef LLDB_DISABLE_PYTHON
typedef STD_SHARED_PTR(lldb_private::ScriptSummaryFormat) ScriptSummaryFormatSP;
#endif // #ifndef LLDB_DISABLE_PYTHON
typedef STD_SHARED_PTR(lldb_private::Section) SectionSP;
typedef STD_WEAK_PTR( lldb_private::Section) SectionWP;
typedef STD_SHARED_PTR(lldb_private::SearchFilter) SearchFilterSP;
typedef STD_SHARED_PTR(lldb_private::Settings) SettingsSP;
typedef STD_SHARED_PTR(lldb_private::StackFrame) StackFrameSP;
typedef STD_WEAK_PTR(lldb_private::StackFrame) StackFrameWP;
typedef STD_WEAK_PTR( lldb_private::StackFrame) StackFrameWP;
typedef STD_SHARED_PTR(lldb_private::StackFrameList) StackFrameListSP;
typedef STD_SHARED_PTR(lldb_private::StopInfo) StopInfoSP;
typedef STD_SHARED_PTR(lldb_private::StoppointLocation) StoppointLocationSP;
typedef STD_SHARED_PTR(lldb_private::Stream) StreamSP;
typedef STD_SHARED_PTR(lldb_private::StringSummaryFormat) StringTypeSummaryImplSP;
typedef STD_SHARED_PTR(lldb_private::TypeSummaryImpl) TypeSummaryImplSP;
typedef STD_SHARED_PTR(lldb_private::TypeNameSpecifierImpl) TypeNameSpecifierImplSP;
typedef STD_SHARED_PTR(lldb_private::SymbolFile) SymbolFileSP;
typedef STD_SHARED_PTR(lldb_private::SymbolFileType) SymbolFileTypeSP;
typedef STD_WEAK_PTR(lldb_private::SymbolFileType) SymbolFileTypeWP;
typedef STD_WEAK_PTR( lldb_private::SymbolFileType) SymbolFileTypeWP;
typedef STD_SHARED_PTR(lldb_private::SymbolContextSpecifier) SymbolContextSpecifierSP;
typedef STD_SHARED_PTR(lldb_private::SyntheticChildren) SyntheticChildrenSP;
typedef STD_SHARED_PTR(lldb_private::SyntheticChildrenFrontEnd) SyntheticChildrenFrontEndSP;
typedef STD_SHARED_PTR(lldb_private::TypeFilterImpl) TypeFilterImplSP;
#ifndef LLDB_DISABLE_PYTHON
typedef STD_SHARED_PTR(lldb_private::TypeSyntheticImpl) TypeSyntheticImplSP;
#endif
typedef STD_SHARED_PTR(lldb_private::Target) TargetSP;
typedef STD_WEAK_PTR(lldb_private::Target) TargetWP;
typedef STD_WEAK_PTR( lldb_private::Target) TargetWP;
typedef STD_SHARED_PTR(lldb_private::Thread) ThreadSP;
typedef STD_WEAK_PTR(lldb_private::Thread) ThreadWP;
typedef STD_WEAK_PTR( lldb_private::Thread) ThreadWP;
typedef STD_SHARED_PTR(lldb_private::ThreadPlan) ThreadPlanSP;
typedef STD_SHARED_PTR(lldb_private::ThreadPlanTracer) ThreadPlanTracerSP;
typedef STD_SHARED_PTR(lldb_private::Type) TypeSP;
typedef STD_WEAK_PTR(lldb_private::Type) TypeWP;
typedef STD_WEAK_PTR( lldb_private::Type) TypeWP;
typedef STD_SHARED_PTR(lldb_private::TypeCategoryImpl) TypeCategoryImplSP;
typedef STD_SHARED_PTR(lldb_private::TypeImpl) TypeImplSP;
typedef STD_SHARED_PTR(lldb_private::FuncUnwinders) FuncUnwindersSP;
typedef STD_SHARED_PTR(lldb_private::TypeFilterImpl) TypeFilterImplSP;
typedef STD_SHARED_PTR(lldb_private::TypeFormatImpl) TypeFormatImplSP;
typedef STD_SHARED_PTR(lldb_private::TypeNameSpecifierImpl) TypeNameSpecifierImplSP;
typedef STD_SHARED_PTR(lldb_private::TypeSummaryImpl) TypeSummaryImplSP;
#ifndef LLDB_DISABLE_PYTHON
typedef STD_SHARED_PTR(lldb_private::TypeSyntheticImpl) TypeSyntheticImplSP;
#endif
typedef STD_SHARED_PTR(lldb_private::UserSettingsController) UserSettingsControllerSP;
typedef STD_WEAK_PTR(lldb_private::UserSettingsController) UserSettingsControllerWP;
typedef STD_WEAK_PTR( lldb_private::UserSettingsController) UserSettingsControllerWP;
typedef STD_SHARED_PTR(lldb_private::UnwindPlan) UnwindPlanSP;
typedef lldb_private::SharingPtr<lldb_private::ValueObject> ValueObjectSP;
typedef STD_SHARED_PTR(lldb_private::Value) ValueSP;
typedef STD_SHARED_PTR(lldb_private::TypeFormatImpl) TypeFormatImplSP;
typedef STD_SHARED_PTR(lldb_private::ValueList) ValueListSP;
typedef STD_SHARED_PTR(lldb_private::Variable) VariableSP;
typedef STD_SHARED_PTR(lldb_private::VariableList) VariableListSP;

View File

@ -59,16 +59,16 @@ typedef enum ArchitectureType
///
//----------------------------------------------------------------------
typedef enum SettableVariableType
{
eSetVarTypeInt,
eSetVarTypeBoolean,
eSetVarTypeString,
eSetVarTypeArray,
eSetVarTypeDictionary,
eSetVarTypeEnum,
eSetVarTypeNone
} SettableVariableType;
//typedef enum SettableVariableType
//{
// eSetVarTypeInt,
// eSetVarTypeBoolean,
// eSetVarTypeString,
// eSetVarTypeArray,
// eSetVarTypeDictionary,
// eSetVarTypeEnum,
// eSetVarTypeNone
//} SettableVariableType;
typedef enum VarSetOperationType
{

View File

@ -39,17 +39,17 @@ namespace lldb_private
//----------------------------------------------------------------------
typedef struct
{
const char * name; // Name of this register set
const char * short_name; // A short name for this register set
const char *name; // Name of this register set
const char *short_name; // A short name for this register set
size_t num_registers; // The number of registers in REGISTERS array below
const uint32_t *registers; // An array of register numbers in this set
} RegisterSet;
typedef struct
{
int value;
const char * string_value;
const char * usage;
int64_t value;
const char *string_value;
const char *usage;
} OptionEnumValueElement;
typedef struct
@ -57,13 +57,13 @@ namespace lldb_private
uint32_t usage_mask; // Used to mark options that can be used together. If (1 << n & usage_mask) != 0
// then this option belongs to option set n.
bool required; // This option is required (in the current usage level)
const char * long_option; // Full name for this option.
const char *long_option; // Full name for this option.
char short_option; // Single character for this option.
int option_has_arg; // no_argument, required_argument or optional_argument
OptionEnumValueElement *enum_values; // If non-NULL an array of enum values.
uint32_t completion_type; // Cookie the option class can use to do define the argument completion.
lldb::CommandArgumentType argument_type; // Type of argument this option takes
const char * usage_text; // Full text explaining what this options does and what (if any) argument to
const char *usage_text; // Full text explaining what this options does and what (if any) argument to
// pass it.
} OptionDefinition;

View File

@ -49,6 +49,33 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
260A248E15D06C50009981B0 /* OptionValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 260A248D15D06C4F009981B0 /* OptionValues.h */; };
260CC62E15D04377002BF2E0 /* OptionValueArgs.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62115D04377002BF2E0 /* OptionValueArgs.h */; };
260CC62F15D04377002BF2E0 /* OptionValueArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62215D04377002BF2E0 /* OptionValueArray.h */; };
260CC63015D04377002BF2E0 /* OptionValueBoolean.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62315D04377002BF2E0 /* OptionValueBoolean.h */; };
260CC63115D04377002BF2E0 /* OptionValueProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62415D04377002BF2E0 /* OptionValueProperties.h */; };
260CC63215D04377002BF2E0 /* OptionValueDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62515D04377002BF2E0 /* OptionValueDictionary.h */; };
260CC63315D04377002BF2E0 /* OptionValueEnumeration.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62615D04377002BF2E0 /* OptionValueEnumeration.h */; };
260CC63415D04377002BF2E0 /* OptionValueFileSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62715D04377002BF2E0 /* OptionValueFileSpec.h */; };
260CC63515D04377002BF2E0 /* OptionValueFileSpecList.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62815D04377002BF2E0 /* OptionValueFileSpecList.h */; };
260CC63615D04377002BF2E0 /* OptionValueFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62915D04377002BF2E0 /* OptionValueFormat.h */; };
260CC63715D04377002BF2E0 /* OptionValueSInt64.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62A15D04377002BF2E0 /* OptionValueSInt64.h */; };
260CC63815D04377002BF2E0 /* OptionValueString.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62B15D04377002BF2E0 /* OptionValueString.h */; };
260CC63915D04377002BF2E0 /* OptionValueUInt64.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62C15D04377002BF2E0 /* OptionValueUInt64.h */; };
260CC63A15D04377002BF2E0 /* OptionValueUUID.h in Headers */ = {isa = PBXBuildFile; fileRef = 260CC62D15D04377002BF2E0 /* OptionValueUUID.h */; };
260CC64815D0440D002BF2E0 /* OptionValueArgs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC63B15D0440D002BF2E0 /* OptionValueArgs.cpp */; };
260CC64915D0440D002BF2E0 /* OptionValueArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC63C15D0440D002BF2E0 /* OptionValueArray.cpp */; };
260CC64A15D0440D002BF2E0 /* OptionValueBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC63D15D0440D002BF2E0 /* OptionValueBoolean.cpp */; };
260CC64B15D0440D002BF2E0 /* OptionValueProperties.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC63E15D0440D002BF2E0 /* OptionValueProperties.cpp */; };
260CC64C15D0440D002BF2E0 /* OptionValueDictionary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC63F15D0440D002BF2E0 /* OptionValueDictionary.cpp */; };
260CC64D15D0440D002BF2E0 /* OptionValueEnumeration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64015D0440D002BF2E0 /* OptionValueEnumeration.cpp */; };
260CC64E15D0440D002BF2E0 /* OptionValueFileSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64115D0440D002BF2E0 /* OptionValueFileSpec.cpp */; };
260CC64F15D0440D002BF2E0 /* OptionValueFileSpecLIst.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64215D0440D002BF2E0 /* OptionValueFileSpecLIst.cpp */; };
260CC65015D0440D002BF2E0 /* OptionValueFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64315D0440D002BF2E0 /* OptionValueFormat.cpp */; };
260CC65115D0440D002BF2E0 /* OptionValueSInt64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64415D0440D002BF2E0 /* OptionValueSInt64.cpp */; };
260CC65215D0440D002BF2E0 /* OptionValueString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64515D0440D002BF2E0 /* OptionValueString.cpp */; };
260CC65315D0440D002BF2E0 /* OptionValueUInt64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64615D0440D002BF2E0 /* OptionValueUInt64.cpp */; };
260CC65415D0440D002BF2E0 /* OptionValueUUID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260CC64715D0440D002BF2E0 /* OptionValueUUID.cpp */; };
260E07C6136FA69E00CF21D3 /* OptionGroupUUID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E07C5136FA69E00CF21D3 /* OptionGroupUUID.cpp */; };
260E07C8136FAB9200CF21D3 /* OptionGroupFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260E07C7136FAB9200CF21D3 /* OptionGroupFile.cpp */; };
261744781168585B005ADD65 /* SBType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 261744771168585B005ADD65 /* SBType.cpp */; };
@ -61,9 +88,12 @@
26368A3C126B697600E8659F /* darwin-debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26368A3B126B697600E8659F /* darwin-debug.cpp */; };
26368AF7126B960500E8659F /* darwin-debug in Resources */ = {isa = PBXBuildFile; fileRef = 26579F68126A25920007C5CB /* darwin-debug */; };
263E949F13661AEA00E7D1CE /* UnwindAssembly-x86.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263E949D13661AE400E7D1CE /* UnwindAssembly-x86.cpp */; };
2640E19F15DC78FD00F23B50 /* Property.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2640E19E15DC78FD00F23B50 /* Property.cpp */; };
2642FBAE13D003B400ED6808 /* CommunicationKDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2642FBA813D003B400ED6808 /* CommunicationKDP.cpp */; };
2642FBB013D003B400ED6808 /* ProcessKDP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2642FBAA13D003B400ED6808 /* ProcessKDP.cpp */; };
2642FBB213D003B400ED6808 /* ProcessKDPLog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2642FBAC13D003B400ED6808 /* ProcessKDPLog.cpp */; };
26491E3B15E1DB8600CBFFC2 /* OptionValueRegex.h in Headers */ = {isa = PBXBuildFile; fileRef = 26491E3A15E1DB8600CBFFC2 /* OptionValueRegex.h */; };
26491E3E15E1DB9F00CBFFC2 /* OptionValueRegex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26491E3D15E1DB9F00CBFFC2 /* OptionValueRegex.cpp */; };
264A97BF133918BC0017F0BE /* PlatformRemoteGDBServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 264A97BD133918BC0017F0BE /* PlatformRemoteGDBServer.cpp */; };
264D8D5013661BD7003A368F /* UnwindAssembly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 264D8D4F13661BD7003A368F /* UnwindAssembly.cpp */; };
265205A813D3E3F700132FE2 /* RegisterContextKDP_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 265205A213D3E3F700132FE2 /* RegisterContextKDP_arm.cpp */; };
@ -378,13 +408,16 @@
26957D9813D381C900670048 /* RegisterContextDarwin_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26957D9213D381C900670048 /* RegisterContextDarwin_arm.cpp */; };
26957D9A13D381C900670048 /* RegisterContextDarwin_i386.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26957D9413D381C900670048 /* RegisterContextDarwin_i386.cpp */; };
26957D9C13D381C900670048 /* RegisterContextDarwin_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26957D9613D381C900670048 /* RegisterContextDarwin_x86_64.cpp */; };
2697A39315E404B1003E682C /* OptionValueArch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2697A39215E404B1003E682C /* OptionValueArch.cpp */; };
2697A39515E404BA003E682C /* OptionValueArch.h in Headers */ = {isa = PBXBuildFile; fileRef = 2697A39415E404BA003E682C /* OptionValueArch.h */; };
2697A54D133A6305004E4240 /* PlatformDarwin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2697A54B133A6305004E4240 /* PlatformDarwin.cpp */; };
26A527C114E24F5F00F3A14A /* ProcessMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BD14E24F5F00F3A14A /* ProcessMachCore.cpp */; };
26A527C214E24F5F00F3A14A /* ProcessMachCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 26A527BE14E24F5F00F3A14A /* ProcessMachCore.h */; };
26A527C314E24F5F00F3A14A /* ThreadMachCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A527BF14E24F5F00F3A14A /* ThreadMachCore.cpp */; };
26A527C414E24F5F00F3A14A /* ThreadMachCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 26A527C014E24F5F00F3A14A /* ThreadMachCore.h */; };
26A69C5F137A17A500262477 /* RegisterValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C6886E137880C400407EDF /* RegisterValue.cpp */; };
26A7A035135E6E4200FB369E /* NamedOptionValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A7A034135E6E4200FB369E /* NamedOptionValue.cpp */; };
26A7A035135E6E4200FB369E /* OptionValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26A7A034135E6E4200FB369E /* OptionValue.cpp */; };
26ACEC2815E077AE00E94760 /* Property.h in Headers */ = {isa = PBXBuildFile; fileRef = 26ACEC2715E077AE00E94760 /* Property.h */; };
26B1EFAE154638AF00E2DAC7 /* DWARFDeclContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26B1EFAC154638AF00E2DAC7 /* DWARFDeclContext.cpp */; };
26B1EFAF154638AF00E2DAC7 /* DWARFDeclContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 26B1EFAD154638AF00E2DAC7 /* DWARFDeclContext.h */; };
26B1FCB813381071002886E2 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* CoreFoundation.framework */; };
@ -405,6 +438,8 @@
26D5E15F135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */; };
26D5E163135BB054006EA0A7 /* OptionGroupPlatform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D5E162135BB054006EA0A7 /* OptionGroupPlatform.cpp */; };
26D7E45D13D5E30A007FD12B /* SocketAddress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D7E45C13D5E30A007FD12B /* SocketAddress.cpp */; };
26DAED6015D327A200E15819 /* OptionValuePathMappings.h in Headers */ = {isa = PBXBuildFile; fileRef = 26DAED5F15D327A200E15819 /* OptionValuePathMappings.h */; };
26DAED6315D327C200E15819 /* OptionValuePathMappings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DAED6215D327C200E15819 /* OptionValuePathMappings.cpp */; };
26DB3E161379E7AD0080DC73 /* ABIMacOSX_arm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DB3E071379E7AD0080DC73 /* ABIMacOSX_arm.cpp */; };
26DB3E1C1379E7AD0080DC73 /* ABIMacOSX_i386.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DB3E0F1379E7AD0080DC73 /* ABIMacOSX_i386.cpp */; };
26DB3E1F1379E7AD0080DC73 /* ABISysV_x86_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DB3E131379E7AD0080DC73 /* ABISysV_x86_64.cpp */; };
@ -661,6 +696,7 @@
260223E8115F06E500A601A2 /* SBCommunication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBCommunication.cpp; path = source/API/SBCommunication.cpp; sourceTree = "<group>"; };
26022531115F27FA00A601A2 /* SBFileSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBFileSpec.h; path = include/lldb/API/SBFileSpec.h; sourceTree = "<group>"; };
26022532115F281400A601A2 /* SBFileSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFileSpec.cpp; path = source/API/SBFileSpec.cpp; sourceTree = "<group>"; };
260A248D15D06C4F009981B0 /* OptionValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValues.h; path = include/lldb/Interpreter/OptionValues.h; sourceTree = "<group>"; };
260C6EA013011578005E16B0 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = File.h; path = include/lldb/Host/File.h; sourceTree = "<group>"; };
260C6EA213011581005E16B0 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = File.cpp; sourceTree = "<group>"; };
260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanBase.cpp; path = source/Target/ThreadPlanBase.cpp; sourceTree = "<group>"; };
@ -731,6 +767,32 @@
260C89DF10F57C5600BB2B04 /* SymbolFileSymtab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolFileSymtab.h; sourceTree = "<group>"; };
260C89E210F57C5600BB2B04 /* SymbolVendorMacOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolVendorMacOSX.cpp; sourceTree = "<group>"; };
260C89E310F57C5600BB2B04 /* SymbolVendorMacOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolVendorMacOSX.h; sourceTree = "<group>"; };
260CC62115D04377002BF2E0 /* OptionValueArgs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueArgs.h; path = include/lldb/Interpreter/OptionValueArgs.h; sourceTree = "<group>"; };
260CC62215D04377002BF2E0 /* OptionValueArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueArray.h; path = include/lldb/Interpreter/OptionValueArray.h; sourceTree = "<group>"; };
260CC62315D04377002BF2E0 /* OptionValueBoolean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueBoolean.h; path = include/lldb/Interpreter/OptionValueBoolean.h; sourceTree = "<group>"; };
260CC62415D04377002BF2E0 /* OptionValueProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueProperties.h; path = include/lldb/Interpreter/OptionValueProperties.h; sourceTree = "<group>"; };
260CC62515D04377002BF2E0 /* OptionValueDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueDictionary.h; path = include/lldb/Interpreter/OptionValueDictionary.h; sourceTree = "<group>"; };
260CC62615D04377002BF2E0 /* OptionValueEnumeration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueEnumeration.h; path = include/lldb/Interpreter/OptionValueEnumeration.h; sourceTree = "<group>"; };
260CC62715D04377002BF2E0 /* OptionValueFileSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueFileSpec.h; path = include/lldb/Interpreter/OptionValueFileSpec.h; sourceTree = "<group>"; };
260CC62815D04377002BF2E0 /* OptionValueFileSpecList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueFileSpecList.h; path = include/lldb/Interpreter/OptionValueFileSpecList.h; sourceTree = "<group>"; };
260CC62915D04377002BF2E0 /* OptionValueFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueFormat.h; path = include/lldb/Interpreter/OptionValueFormat.h; sourceTree = "<group>"; };
260CC62A15D04377002BF2E0 /* OptionValueSInt64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueSInt64.h; path = include/lldb/Interpreter/OptionValueSInt64.h; sourceTree = "<group>"; };
260CC62B15D04377002BF2E0 /* OptionValueString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueString.h; path = include/lldb/Interpreter/OptionValueString.h; sourceTree = "<group>"; };
260CC62C15D04377002BF2E0 /* OptionValueUInt64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueUInt64.h; path = include/lldb/Interpreter/OptionValueUInt64.h; sourceTree = "<group>"; };
260CC62D15D04377002BF2E0 /* OptionValueUUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueUUID.h; path = include/lldb/Interpreter/OptionValueUUID.h; sourceTree = "<group>"; };
260CC63B15D0440D002BF2E0 /* OptionValueArgs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueArgs.cpp; path = source/Interpreter/OptionValueArgs.cpp; sourceTree = "<group>"; };
260CC63C15D0440D002BF2E0 /* OptionValueArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueArray.cpp; path = source/Interpreter/OptionValueArray.cpp; sourceTree = "<group>"; };
260CC63D15D0440D002BF2E0 /* OptionValueBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueBoolean.cpp; path = source/Interpreter/OptionValueBoolean.cpp; sourceTree = "<group>"; };
260CC63E15D0440D002BF2E0 /* OptionValueProperties.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueProperties.cpp; path = source/Interpreter/OptionValueProperties.cpp; sourceTree = "<group>"; };
260CC63F15D0440D002BF2E0 /* OptionValueDictionary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueDictionary.cpp; path = source/Interpreter/OptionValueDictionary.cpp; sourceTree = "<group>"; };
260CC64015D0440D002BF2E0 /* OptionValueEnumeration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueEnumeration.cpp; path = source/Interpreter/OptionValueEnumeration.cpp; sourceTree = "<group>"; };
260CC64115D0440D002BF2E0 /* OptionValueFileSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueFileSpec.cpp; path = source/Interpreter/OptionValueFileSpec.cpp; sourceTree = "<group>"; };
260CC64215D0440D002BF2E0 /* OptionValueFileSpecLIst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueFileSpecLIst.cpp; path = source/Interpreter/OptionValueFileSpecLIst.cpp; sourceTree = "<group>"; };
260CC64315D0440D002BF2E0 /* OptionValueFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueFormat.cpp; path = source/Interpreter/OptionValueFormat.cpp; sourceTree = "<group>"; };
260CC64415D0440D002BF2E0 /* OptionValueSInt64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueSInt64.cpp; path = source/Interpreter/OptionValueSInt64.cpp; sourceTree = "<group>"; };
260CC64515D0440D002BF2E0 /* OptionValueString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueString.cpp; path = source/Interpreter/OptionValueString.cpp; sourceTree = "<group>"; };
260CC64615D0440D002BF2E0 /* OptionValueUInt64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueUInt64.cpp; path = source/Interpreter/OptionValueUInt64.cpp; sourceTree = "<group>"; };
260CC64715D0440D002BF2E0 /* OptionValueUUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueUUID.cpp; path = source/Interpreter/OptionValueUUID.cpp; sourceTree = "<group>"; };
260E07C3136FA68900CF21D3 /* OptionGroupUUID.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupUUID.h; path = include/lldb/Interpreter/OptionGroupUUID.h; sourceTree = "<group>"; };
260E07C5136FA69E00CF21D3 /* OptionGroupUUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupUUID.cpp; path = source/Interpreter/OptionGroupUUID.cpp; sourceTree = "<group>"; };
260E07C7136FAB9200CF21D3 /* OptionGroupFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupFile.cpp; path = source/Interpreter/OptionGroupFile.cpp; sourceTree = "<group>"; };
@ -814,6 +876,7 @@
263E949D13661AE400E7D1CE /* UnwindAssembly-x86.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = "UnwindAssembly-x86.cpp"; sourceTree = "<group>"; };
263E949E13661AE400E7D1CE /* UnwindAssembly-x86.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UnwindAssembly-x86.h"; sourceTree = "<group>"; };
263FEDA5112CC1DA00E4C208 /* ThreadSafeSTLMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafeSTLMap.h; path = include/lldb/Core/ThreadSafeSTLMap.h; sourceTree = "<group>"; };
2640E19E15DC78FD00F23B50 /* Property.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Property.cpp; path = source/Interpreter/Property.cpp; sourceTree = "<group>"; };
26424E3C125986CB0016D82C /* ValueObjectConstResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectConstResult.cpp; path = source/Core/ValueObjectConstResult.cpp; sourceTree = "<group>"; };
26424E3E125986D30016D82C /* ValueObjectConstResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueObjectConstResult.h; path = include/lldb/Core/ValueObjectConstResult.h; sourceTree = "<group>"; };
2642FBA813D003B400ED6808 /* CommunicationKDP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommunicationKDP.cpp; sourceTree = "<group>"; };
@ -825,6 +888,8 @@
264334381110F63100CDB6C6 /* ValueObjectRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueObjectRegister.cpp; path = source/Core/ValueObjectRegister.cpp; sourceTree = "<group>"; };
2643343A1110F63C00CDB6C6 /* ValueObjectRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueObjectRegister.h; path = include/lldb/Core/ValueObjectRegister.h; sourceTree = "<group>"; };
264723A511FA076E00DE380C /* CleanUp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CleanUp.h; path = include/lldb/Utility/CleanUp.h; sourceTree = "<group>"; };
26491E3A15E1DB8600CBFFC2 /* OptionValueRegex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueRegex.h; path = include/lldb/Interpreter/OptionValueRegex.h; sourceTree = "<group>"; };
26491E3D15E1DB9F00CBFFC2 /* OptionValueRegex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueRegex.cpp; path = source/Interpreter/OptionValueRegex.cpp; sourceTree = "<group>"; };
264A43BB1320B3B4005B4096 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Platform.h; path = include/lldb/Target/Platform.h; sourceTree = "<group>"; };
264A43BD1320BCEB005B4096 /* Platform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Platform.cpp; path = source/Target/Platform.cpp; sourceTree = "<group>"; };
264A97BD133918BC0017F0BE /* PlatformRemoteGDBServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformRemoteGDBServer.cpp; path = "gdb-server/PlatformRemoteGDBServer.cpp"; sourceTree = "<group>"; };
@ -922,6 +987,8 @@
26957D9513D381C900670048 /* RegisterContextDarwin_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextDarwin_i386.h; path = Utility/RegisterContextDarwin_i386.h; sourceTree = "<group>"; };
26957D9613D381C900670048 /* RegisterContextDarwin_x86_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterContextDarwin_x86_64.cpp; path = Utility/RegisterContextDarwin_x86_64.cpp; sourceTree = "<group>"; };
26957D9713D381C900670048 /* RegisterContextDarwin_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterContextDarwin_x86_64.h; path = Utility/RegisterContextDarwin_x86_64.h; sourceTree = "<group>"; };
2697A39215E404B1003E682C /* OptionValueArch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValueArch.cpp; path = source/Interpreter/OptionValueArch.cpp; sourceTree = "<group>"; };
2697A39415E404BA003E682C /* OptionValueArch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValueArch.h; path = include/lldb/Interpreter/OptionValueArch.h; sourceTree = "<group>"; };
2697A54B133A6305004E4240 /* PlatformDarwin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformDarwin.cpp; sourceTree = "<group>"; };
2697A54C133A6305004E4240 /* PlatformDarwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformDarwin.h; sourceTree = "<group>"; };
269FF07D12494F7D00225026 /* FuncUnwinders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FuncUnwinders.h; path = include/lldb/Symbol/FuncUnwinders.h; sourceTree = "<group>"; };
@ -937,8 +1004,9 @@
26A527BE14E24F5F00F3A14A /* ProcessMachCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessMachCore.h; sourceTree = "<group>"; };
26A527BF14E24F5F00F3A14A /* ThreadMachCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadMachCore.cpp; sourceTree = "<group>"; };
26A527C014E24F5F00F3A14A /* ThreadMachCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadMachCore.h; sourceTree = "<group>"; };
26A7A034135E6E4200FB369E /* NamedOptionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NamedOptionValue.cpp; path = source/Interpreter/NamedOptionValue.cpp; sourceTree = "<group>"; };
26A7A036135E6E5300FB369E /* NamedOptionValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NamedOptionValue.h; path = include/lldb/Interpreter/NamedOptionValue.h; sourceTree = "<group>"; };
26A7A034135E6E4200FB369E /* OptionValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValue.cpp; path = source/Interpreter/OptionValue.cpp; sourceTree = "<group>"; };
26A7A036135E6E5300FB369E /* OptionValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionValue.h; path = include/lldb/Interpreter/OptionValue.h; sourceTree = "<group>"; };
26ACEC2715E077AE00E94760 /* Property.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Property.h; path = include/lldb/Interpreter/Property.h; sourceTree = "<group>"; };
26B167A41123BF5500DC7B4F /* ThreadSafeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSafeValue.h; path = include/lldb/Core/ThreadSafeValue.h; sourceTree = "<group>"; };
26B1EFAC154638AF00E2DAC7 /* DWARFDeclContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFDeclContext.cpp; sourceTree = "<group>"; };
26B1EFAD154638AF00E2DAC7 /* DWARFDeclContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFDeclContext.h; sourceTree = "<group>"; };
@ -1232,6 +1300,8 @@
26D7E45C13D5E30A007FD12B /* SocketAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocketAddress.cpp; path = source/Host/common/SocketAddress.cpp; sourceTree = "<group>"; };
26D9FDC612F784E60003F2EE /* EmulateInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EmulateInstruction.h; path = include/lldb/Core/EmulateInstruction.h; sourceTree = "<group>"; };
26D9FDC812F784FD0003F2EE /* EmulateInstruction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EmulateInstruction.cpp; path = source/Core/EmulateInstruction.cpp; sourceTree = "<group>"; };
26DAED5F15D327A200E15819 /* OptionValuePathMappings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValuePathMappings.h; path = include/lldb/Interpreter/OptionValuePathMappings.h; sourceTree = "<group>"; };
26DAED6215D327C200E15819 /* OptionValuePathMappings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionValuePathMappings.cpp; path = source/Interpreter/OptionValuePathMappings.cpp; sourceTree = "<group>"; };
26DAFD9711529BC7005A394E /* ExecutionContextScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExecutionContextScope.h; path = include/lldb/Target/ExecutionContextScope.h; sourceTree = "<group>"; };
26DB3E071379E7AD0080DC73 /* ABIMacOSX_arm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ABIMacOSX_arm.cpp; sourceTree = "<group>"; };
26DB3E081379E7AD0080DC73 /* ABIMacOSX_arm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABIMacOSX_arm.h; sourceTree = "<group>"; };
@ -2756,8 +2826,41 @@
26BC7DE410F1B7F900F91463 /* CommandReturnObject.h */,
26BC7F0A10F1B8DD00F91463 /* CommandReturnObject.cpp */,
94005E0513F45A1B001EF42D /* embedded_interpreter.py */,
26A7A036135E6E5300FB369E /* NamedOptionValue.h */,
26A7A034135E6E4200FB369E /* NamedOptionValue.cpp */,
26A7A036135E6E5300FB369E /* OptionValue.h */,
26A7A034135E6E4200FB369E /* OptionValue.cpp */,
260A248D15D06C4F009981B0 /* OptionValues.h */,
2697A39415E404BA003E682C /* OptionValueArch.h */,
2697A39215E404B1003E682C /* OptionValueArch.cpp */,
260CC62115D04377002BF2E0 /* OptionValueArgs.h */,
260CC63B15D0440D002BF2E0 /* OptionValueArgs.cpp */,
260CC62215D04377002BF2E0 /* OptionValueArray.h */,
260CC63C15D0440D002BF2E0 /* OptionValueArray.cpp */,
260CC62315D04377002BF2E0 /* OptionValueBoolean.h */,
260CC63D15D0440D002BF2E0 /* OptionValueBoolean.cpp */,
260CC62515D04377002BF2E0 /* OptionValueDictionary.h */,
260CC63F15D0440D002BF2E0 /* OptionValueDictionary.cpp */,
260CC62615D04377002BF2E0 /* OptionValueEnumeration.h */,
260CC64015D0440D002BF2E0 /* OptionValueEnumeration.cpp */,
260CC62715D04377002BF2E0 /* OptionValueFileSpec.h */,
260CC64115D0440D002BF2E0 /* OptionValueFileSpec.cpp */,
260CC62815D04377002BF2E0 /* OptionValueFileSpecList.h */,
260CC64215D0440D002BF2E0 /* OptionValueFileSpecLIst.cpp */,
260CC62915D04377002BF2E0 /* OptionValueFormat.h */,
260CC64315D0440D002BF2E0 /* OptionValueFormat.cpp */,
26DAED5F15D327A200E15819 /* OptionValuePathMappings.h */,
26DAED6215D327C200E15819 /* OptionValuePathMappings.cpp */,
260CC62415D04377002BF2E0 /* OptionValueProperties.h */,
260CC63E15D0440D002BF2E0 /* OptionValueProperties.cpp */,
26491E3A15E1DB8600CBFFC2 /* OptionValueRegex.h */,
26491E3D15E1DB9F00CBFFC2 /* OptionValueRegex.cpp */,
260CC62A15D04377002BF2E0 /* OptionValueSInt64.h */,
260CC64415D0440D002BF2E0 /* OptionValueSInt64.cpp */,
260CC62B15D04377002BF2E0 /* OptionValueString.h */,
260CC64515D0440D002BF2E0 /* OptionValueString.cpp */,
260CC62C15D04377002BF2E0 /* OptionValueUInt64.h */,
260CC64615D0440D002BF2E0 /* OptionValueUInt64.cpp */,
260CC62D15D04377002BF2E0 /* OptionValueUUID.h */,
260CC64715D0440D002BF2E0 /* OptionValueUUID.cpp */,
26BC7D6D10F1B77400F91463 /* Options.h */,
26BC7E8610F1B85900F91463 /* Options.cpp */,
26D5E160135BAEB0006EA0A7 /* OptionGroupArchitecture.h */,
@ -2779,9 +2882,11 @@
267C0128136880C7006E963E /* OptionGroupValueObjectDisplay.h */,
267C012A136880DF006E963E /* OptionGroupValueObjectDisplay.cpp */,
26ED3D6F13C5638A0017D45E /* OptionGroupVariable.h */,
B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */,
26ED3D6C13C563810017D45E /* OptionGroupVariable.cpp */,
B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */,
B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */,
26ACEC2715E077AE00E94760 /* Property.h */,
2640E19E15DC78FD00F23B50 /* Property.cpp */,
26BC7DE510F1B7F900F91463 /* ScriptInterpreter.h */,
9A82010B10FFB49800182560 /* ScriptInterpreter.cpp */,
9A2771FB1135A35C00E6ADB6 /* ScriptInterpreterNone.h */,
@ -3239,6 +3344,24 @@
2694E9A514FC0BBD0076DE67 /* PlatformLinux.h in Headers */,
2663E379152BD1890091EC22 /* ReadWriteLock.h in Headers */,
26B1EFAF154638AF00E2DAC7 /* DWARFDeclContext.h in Headers */,
260CC62E15D04377002BF2E0 /* OptionValueArgs.h in Headers */,
260CC62F15D04377002BF2E0 /* OptionValueArray.h in Headers */,
260CC63015D04377002BF2E0 /* OptionValueBoolean.h in Headers */,
260CC63115D04377002BF2E0 /* OptionValueProperties.h in Headers */,
260CC63215D04377002BF2E0 /* OptionValueDictionary.h in Headers */,
260CC63315D04377002BF2E0 /* OptionValueEnumeration.h in Headers */,
260CC63415D04377002BF2E0 /* OptionValueFileSpec.h in Headers */,
260CC63515D04377002BF2E0 /* OptionValueFileSpecList.h in Headers */,
260CC63615D04377002BF2E0 /* OptionValueFormat.h in Headers */,
260CC63715D04377002BF2E0 /* OptionValueSInt64.h in Headers */,
260CC63815D04377002BF2E0 /* OptionValueString.h in Headers */,
260CC63915D04377002BF2E0 /* OptionValueUInt64.h in Headers */,
260CC63A15D04377002BF2E0 /* OptionValueUUID.h in Headers */,
260A248E15D06C50009981B0 /* OptionValues.h in Headers */,
26DAED6015D327A200E15819 /* OptionValuePathMappings.h in Headers */,
26ACEC2815E077AE00E94760 /* Property.h in Headers */,
26491E3B15E1DB8600CBFFC2 /* OptionValueRegex.h in Headers */,
2697A39515E404BA003E682C /* OptionValueArch.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3858,7 +3981,7 @@
26D5E15F135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp in Sources */,
26D5E163135BB054006EA0A7 /* OptionGroupPlatform.cpp in Sources */,
26BD407F135D2AE000237D80 /* FileLineResolver.cpp in Sources */,
26A7A035135E6E4200FB369E /* NamedOptionValue.cpp in Sources */,
26A7A035135E6E4200FB369E /* OptionValue.cpp in Sources */,
9A22A161135E30370024DDC3 /* EmulateInstructionARM.cpp in Sources */,
9A22A163135E30370024DDC3 /* EmulationStateARM.cpp in Sources */,
9A4F35101368A51A00823F52 /* StreamAsynchronousIO.cpp in Sources */,
@ -3938,8 +4061,25 @@
2694E9A414FC0BBD0076DE67 /* PlatformLinux.cpp in Sources */,
26B1EFAE154638AF00E2DAC7 /* DWARFDeclContext.cpp in Sources */,
B21EB71515CC99F100E60059 /* cxa_demangle.cpp in Sources */,
260CC64815D0440D002BF2E0 /* OptionValueArgs.cpp in Sources */,
260CC64915D0440D002BF2E0 /* OptionValueArray.cpp in Sources */,
260CC64A15D0440D002BF2E0 /* OptionValueBoolean.cpp in Sources */,
260CC64B15D0440D002BF2E0 /* OptionValueProperties.cpp in Sources */,
260CC64C15D0440D002BF2E0 /* OptionValueDictionary.cpp in Sources */,
260CC64D15D0440D002BF2E0 /* OptionValueEnumeration.cpp in Sources */,
260CC64E15D0440D002BF2E0 /* OptionValueFileSpec.cpp in Sources */,
260CC64F15D0440D002BF2E0 /* OptionValueFileSpecLIst.cpp in Sources */,
260CC65015D0440D002BF2E0 /* OptionValueFormat.cpp in Sources */,
260CC65115D0440D002BF2E0 /* OptionValueSInt64.cpp in Sources */,
260CC65215D0440D002BF2E0 /* OptionValueString.cpp in Sources */,
260CC65315D0440D002BF2E0 /* OptionValueUInt64.cpp in Sources */,
260CC65415D0440D002BF2E0 /* OptionValueUUID.cpp in Sources */,
26DAED6315D327C200E15819 /* OptionValuePathMappings.cpp in Sources */,
B2B7CCEB15D1BD6700EEFB57 /* CommandObjectWatchpointCommand.cpp in Sources */,
B2B7CCF015D1C20F00EEFB57 /* WatchpointOptions.cpp in Sources */,
2640E19F15DC78FD00F23B50 /* Property.cpp in Sources */,
26491E3E15E1DB9F00CBFFC2 /* OptionValueRegex.cpp in Sources */,
2697A39315E404B1003E682C /* OptionValueArch.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4252,13 +4392,11 @@
Foundation,
"-v",
"-t",
"-Wl,-v",
);
"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
"-lllvmclang",
"-v",
"-t",
"-Wl,-v",
"-framework",
Foundation,
);
@ -4313,13 +4451,11 @@
AppKit,
"-v",
"-t",
"-Wl,-v",
);
"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
"-lllvmclang",
"-v",
"-t",
"-Wl,-v",
"-framework",
Foundation,
);

View File

@ -908,50 +908,54 @@ SBDebugger::FindDebuggerWithID (int id)
const char *
SBDebugger::GetInstanceName()
{
if (m_opaque_sp)
return m_opaque_sp->GetInstanceName().AsCString();
else
// TODO: SETTINGS -- fill this in
// if (m_opaque_sp)
// return m_opaque_sp->GetInstanceName().AsCString();
// else
return NULL;
}
SBError
SBDebugger::SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name)
{
UserSettingsControllerSP root_settings_controller = Debugger::GetSettingsController();
Error err = root_settings_controller->SetVariable (var_name,
value,
eVarSetOperationAssign,
true,
debugger_instance_name);
SBError sb_error;
sb_error.SetError (err);
return sb_error;
// TODO: SETTINGS -- fill this in
// UserSettingsControllerSP root_settings_controller = Debugger::GetSettingsController();
//
// Error err = root_settings_controller->SetVariable (var_name,
// value,
// eVarSetOperationAssign,
// true,
// debugger_instance_name);
// SBError sb_error;
// sb_error.SetError (err);
//
// return sb_error;
return SBError();
}
SBStringList
SBDebugger::GetInternalVariableValue (const char *var_name, const char *debugger_instance_name)
{
SBStringList ret_value;
SettableVariableType var_type;
Error err;
UserSettingsControllerSP root_settings_controller = Debugger::GetSettingsController();
StringList value = root_settings_controller->GetVariable (var_name, var_type, debugger_instance_name, err);
if (err.Success())
{
for (unsigned i = 0; i != value.GetSize(); ++i)
ret_value.AppendString (value.GetStringAtIndex(i));
}
else
{
ret_value.AppendString (err.AsCString());
}
// TODO: SETTINGS -- fill this in
// SettableVariableType var_type;
// Error err;
//
// UserSettingsControllerSP root_settings_controller = Debugger::GetSettingsController();
//
// StringList value = root_settings_controller->GetVariable (var_name, var_type, debugger_instance_name, err);
//
// if (err.Success())
// {
// for (unsigned i = 0; i != value.GetSize(); ++i)
// ret_value.AppendString (value.GetStringAtIndex(i));
// }
// else
// {
// ret_value.AppendString (err.AsCString());
// }
//
//
return ret_value;
}

View File

@ -405,15 +405,30 @@ CommandCompletions::SettingsNames (CommandInterpreter &interpreter,
bool &word_complete,
StringList &matches)
{
lldb::UserSettingsControllerSP root_settings = Debugger::GetSettingsController();
Args partial_setting_name_pieces = UserSettingsController::BreakNameIntoPieces (partial_setting_name);
return UserSettingsController::CompleteSettingsNames (root_settings,
partial_setting_name_pieces,
word_complete,
matches);
//return matches.GetSize();
// Cache the full setting name list
static StringList g_property_names;
if (g_property_names.GetSize() == 0)
{
// Generate the full setting name list on demand
lldb::OptionValuePropertiesSP properties_sp (interpreter.GetDebugger().GetValueProperties());
if (properties_sp)
{
StreamString strm;
properties_sp->DumpValue(NULL, strm, OptionValue::eDumpOptionName);
const std::string &str = strm.GetString();
g_property_names.SplitIntoLines(str.c_str(), str.size());
}
}
size_t exact_matches_idx = SIZE_MAX;
const size_t num_matches = g_property_names.AutoComplete (partial_setting_name, matches, exact_matches_idx);
// return UserSettingsController::CompleteSettingsNames (root_settings,
// partial_setting_name_pieces,
// word_complete,
// matches);
//
word_complete = exact_matches_idx != SIZE_MAX;
return num_matches;
}

View File

@ -86,27 +86,22 @@ CommandObjectApropos::DoExecute (Args& args, CommandReturnObject &result)
for (size_t i = 0; i < commands_found.GetSize(); ++i)
m_interpreter.OutputFormattedHelpText (result.GetOutputStream(),
commands_found.GetStringAtIndex(i),
"--", commands_help.
GetStringAtIndex(i),
"--",
commands_help.GetStringAtIndex(i),
max_len);
}
StreamString settings_search_results;
lldb::UserSettingsControllerSP root = Debugger::GetSettingsController ();
const char *settings_prefix = root->GetLevelName().GetCString();
UserSettingsController::SearchAllSettingsDescriptions (m_interpreter,
root,
settings_prefix,
search_word,
settings_search_results);
if (settings_search_results.GetSize() > 0)
std::vector<const Property *> properties;
const size_t num_properties = m_interpreter.GetDebugger().Apropos(search_word, properties);
if (num_properties)
{
const bool dump_qualified_name = true;
result.AppendMessageWithFormat ("\nThe following settings variables may relate to '%s': \n\n", search_word);
result.AppendMessageWithFormat ("%s", settings_search_results.GetData());
for (size_t i=0; i<num_properties; ++i)
properties[i]->DumpDescription (m_interpreter, result.GetOutputStream(), 0, dump_qualified_name);
}
result.SetStatus (eReturnStatusSuccessFinishNoResult);

View File

@ -25,6 +25,7 @@
#include "lldb/Interpreter/OptionGroupFormat.h"
#include "lldb/Interpreter/OptionGroupOutputFile.h"
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"

View File

@ -426,11 +426,7 @@ protected:
Debugger &debugger = m_interpreter.GetDebugger();
if (argc == 0)
{
const Args &target_settings_args = target->GetRunArguments();
if (target_settings_args.GetArgumentCount())
m_options.launch_info.GetArguments() = target_settings_args;
}
target->GetRunArguments(m_options.launch_info.GetArguments());
ProcessSP process_sp (platform_sp->DebugProcess (m_options.launch_info,
debugger,

View File

@ -168,9 +168,9 @@ protected:
if (launch_args.GetArgumentCount() == 0)
{
const Args &process_args = target->GetRunArguments();
if (process_args.GetArgumentCount() > 0)
m_options.launch_info.GetArguments().AppendArguments (process_args);
Args target_setting_args;
if (target->GetRunArguments(target_setting_args) > 0)
m_options.launch_info.GetArguments().AppendArguments (target_setting_args);
}
else
{

View File

@ -20,9 +20,10 @@
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionGroupFormat.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"

View File

@ -21,12 +21,14 @@ using namespace lldb;
using namespace lldb_private;
#include "llvm/ADT/StringRef.h"
static inline void StripLeadingSpaces(llvm::StringRef &Str)
static inline void StripLeadingSpaces(llvm::StringRef &s)
{
while (!Str.empty() && isspace(Str[0]))
Str = Str.substr(1);
const size_t non_space = s.find_first_not_of(' ');
if (non_space > 0)
s = s.substr(non_space);
}
//-------------------------------------------------------------------------
// CommandObjectSettingsSet
//-------------------------------------------------------------------------
@ -68,8 +70,8 @@ public:
"When setting a dictionary or array variable, you can set multiple entries \n\
at once by giving the values to the set command. For example: \n\
\n\
(lldb) settings set target.run-args value1 value2 value3 \n\
(lldb) settings set target.env-vars [\"MYPATH\"]=~/.:/usr/bin [\"SOME_ENV_VAR\"]=12345 \n\
(lldb) settings set target.run-args value1 value2 value3 \n\
(lldb) settings set target.env-vars MYPATH=~/.:/usr/bin SOME_ENV_VAR=12345 \n\
\n\
(lldb) settings show target.run-args \n\
[0]: 'value1' \n\
@ -79,8 +81,6 @@ at once by giving the values to the set command. For example: \n\
'MYPATH=~/.:/usr/bin'\n\
'SOME_ENV_VAR=12345' \n\
\n\
Note the special syntax for setting a dictionary element: [\"<key>\"]=<value> \n\
\n\
Warning: The 'set' command re-sets the entire array or dictionary. If you \n\
just want to add, remove or update individual values (or add something to \n\
the end), use one of the other settings sub-commands: append, replace, \n\
@ -108,8 +108,7 @@ insert-before or insert-after.\n");
CommandOptions (CommandInterpreter &interpreter) :
Options (interpreter),
m_override (true),
m_reset (false)
m_global (false)
{
}
@ -124,11 +123,8 @@ insert-before or insert-after.\n");
switch (short_option)
{
case 'n':
m_override = false;
break;
case 'r':
m_reset = true;
case 'g':
m_global = true;
break;
default:
error.SetErrorStringWithFormat ("unrecognized options '%c'", short_option);
@ -141,8 +137,7 @@ insert-before or insert-after.\n");
void
OptionParsingStarting ()
{
m_override = true;
m_reset = false;
m_global = false;
}
const OptionDefinition*
@ -157,9 +152,7 @@ insert-before or insert-after.\n");
// Instance variables to hold the values for command options.
bool m_override;
bool m_reset;
bool m_global;
};
virtual int
@ -172,15 +165,20 @@ insert-before or insert-after.\n");
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
// Attempting to complete variable name
llvm::StringRef prev_str(cursor_index == 2 ? input.GetArgumentAtIndex(1) : "");
if (cursor_index == 1 ||
(cursor_index == 2 && prev_str.startswith("-")) // "settings set -r th", followed by Tab.
)
const size_t argc = input.GetArgumentCount();
const char *arg = NULL;
int setting_var_idx;
for (setting_var_idx = 1; setting_var_idx < argc; ++setting_var_idx)
{
arg = input.GetArgumentAtIndex(setting_var_idx);
if (arg && arg[0] != '-')
break; // We found our setting variable name index
}
if (cursor_index == setting_var_idx)
{
// Attempting to complete setting variable name
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eSettingsNameCompletion,
completion_str.c_str(),
@ -189,39 +187,37 @@ insert-before or insert-after.\n");
NULL,
word_complete,
matches);
// If there is only 1 match which fulfills the completion request, do an early return.
if (matches.GetSize() == 1 && completion_str.compare(matches.GetStringAtIndex(0)) != 0)
return 1;
}
// Attempting to complete value
if ((cursor_index == 2) // Partly into the variable's value
|| (cursor_index == 1 // Or at the end of a completed valid variable name
&& matches.GetSize() == 1
&& completion_str.compare (matches.GetStringAtIndex(0)) == 0))
else
{
matches.Clear();
UserSettingsControllerSP usc_sp = Debugger::GetSettingsController();
if (cursor_index == 1)
arg = input.GetArgumentAtIndex(cursor_index);
if (arg)
{
// The user is at the end of the variable name, which is complete and valid.
UserSettingsController::CompleteSettingsValue (usc_sp,
input.GetArgumentAtIndex (1), // variable name
NULL, // empty value string
word_complete,
matches);
}
else
{
// The user is partly into the variable value.
UserSettingsController::CompleteSettingsValue (usc_sp,
input.GetArgumentAtIndex (1), // variable name
completion_str.c_str(), // partial value string
word_complete,
matches);
if (arg[0] == '-')
{
// Complete option name
}
else
{
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
// Complete setting value
const char *setting_var_name = input.GetArgumentAtIndex(setting_var_idx);
Error error;
lldb::OptionValueSP value_sp (m_interpreter.GetDebugger().GetPropertyValue(&exe_ctx, setting_var_name, false, error));
if (value_sp)
{
value_sp->AutoComplete (m_interpreter,
completion_str.c_str(),
match_start_point,
max_return_elements,
word_complete,
matches);
}
}
}
}
return matches.GetSize();
}
@ -229,16 +225,14 @@ protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
Args cmd_args(command);
// Process possible options.
if (!ParseOptions (cmd_args, result))
return false;
const int argc = cmd_args.GetArgumentCount ();
if ((argc < 2) && (!m_options.m_reset))
const size_t argc = cmd_args.GetArgumentCount ();
if ((argc < 2) && (!m_options.m_global))
{
result.AppendError ("'settings set' takes more arguments");
result.SetStatus (eReturnStatusFailed);
@ -248,7 +242,7 @@ protected:
const char *var_name = cmd_args.GetArgumentAtIndex (0);
if ((var_name == NULL) || (var_name[0] == '\0'))
{
result.AppendError ("'settings set' command requires a valid variable name; No value supplied");
result.AppendError ("'settings set' command requires a valid variable name");
result.SetStatus (eReturnStatusFailed);
return false;
}
@ -260,27 +254,33 @@ protected:
StripLeadingSpaces(var_value_str);
std::string var_value_string = var_value_str.str();
if (!m_options.m_reset
&& var_value_string.empty())
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Error error;
if (m_options.m_global)
{
result.AppendError ("'settings set' command requires a valid variable value unless using '--reset' option;"
" No value supplied");
error = m_interpreter.GetDebugger().SetPropertyValue (NULL,
eVarSetOperationAssign,
var_name,
var_value_string.c_str());
}
if (error.Success())
{
error = m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
eVarSetOperationAssign,
var_name,
var_value_string.c_str());
}
if (error.Fail())
{
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
var_value_string.c_str(),
eVarSetOperationAssign,
m_options.m_override,
m_interpreter.GetDebugger().GetInstanceName().AsCString());
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
result.SetStatus (eReturnStatusSuccessFinishNoResult);
result.SetStatus (eReturnStatusSuccessFinishResult);
}
return result.Succeeded();
@ -292,8 +292,7 @@ private:
OptionDefinition
CommandObjectSettingsSet::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "no-override", 'n', no_argument, NULL, NULL, eArgTypeNone, "Prevents already existing instances and pending settings from being assigned this new value. Using this option means that only the default or specified instance setting values will be updated." },
{ LLDB_OPT_SET_2, false, "reset", 'r', no_argument, NULL, NULL, eArgTypeNone, "Causes value to be reset to the original default for this variable. No value needs to be specified when this option is used." },
{ LLDB_OPT_SET_2, false, "global", 'g', no_argument, NULL, NULL, eArgTypeNone, "Apply the new value to the global default value." },
{ 0, false, NULL, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
@ -339,8 +338,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eSettingsNameCompletion,
@ -355,51 +353,33 @@ public:
protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
const char *current_prefix = usc_sp->GetLevelName().GetCString();
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
result.SetStatus (eReturnStatusSuccessFinishResult);
Error err;
if (command.GetArgumentCount())
const size_t argc = args.GetArgumentCount ();
if (argc > 0)
{
// The user requested to see the value of a particular variable.
SettableVariableType var_type;
const char *variable_name = command.GetArgumentAtIndex (0);
StringList value = usc_sp->GetVariable (variable_name,
var_type,
m_interpreter.GetDebugger().GetInstanceName().AsCString(),
err);
if (err.Fail ())
for (size_t i=0; i<argc; ++i)
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
{
UserSettingsController::DumpValue(m_interpreter, usc_sp, variable_name, result.GetOutputStream());
result.SetStatus (eReturnStatusSuccessFinishResult);
const char *property_path = args.GetArgumentAtIndex (i);
Error error(m_interpreter.GetDebugger().DumpPropertyValue (&exe_ctx, result.GetOutputStream(), property_path, OptionValue::eDumpGroupValue));
if (error.Success())
{
result.GetOutputStream().EOL();
}
else
{
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
}
else
{
UserSettingsController::GetAllVariableValues (m_interpreter,
usc_sp,
current_prefix,
result.GetOutputStream(),
err);
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
m_interpreter.GetDebugger().DumpAllPropertyValues (& exe_ctx, result.GetOutputStream(), OptionValue::eDumpGroupValue);
}
return result.Succeeded();
@ -451,8 +431,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
CommandCompletions::InvokeCommonCompletionCallbacks (m_interpreter,
CommandCompletions::eSettingsNameCompletion,
@ -467,46 +446,37 @@ public:
protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
DoExecute (Args& args, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
const char *current_prefix = usc_sp->GetLevelName().GetCString();
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
result.SetStatus (eReturnStatusSuccessFinishResult);
Error err;
const bool will_modify = false;
const size_t argc = args.GetArgumentCount ();
if (argc > 0)
{
const bool dump_qualified_name = true;
if (command.GetArgumentCount() == 0)
{
UserSettingsController::FindAllSettingsDescriptions (m_interpreter,
usc_sp,
current_prefix,
result.GetOutputStream(),
err);
}
else if (command.GetArgumentCount() == 1)
{
const char *search_name = command.GetArgumentAtIndex (0);
UserSettingsController::FindSettingsDescriptions (m_interpreter,
usc_sp,
current_prefix,
search_name,
result.GetOutputStream(),
err);
for (size_t i=0; i<argc; ++i)
{
const char *property_path = args.GetArgumentAtIndex (i);
const Property *property = m_interpreter.GetDebugger().GetValueProperties()->GetPropertyAtPath (&exe_ctx, will_modify, property_path);
if (property)
{
property->DumpDescription (m_interpreter, result.GetOutputStream(), 0, dump_qualified_name);
}
else
{
result.AppendErrorWithFormat ("invalid property path '%s'", property_path);
result.SetStatus (eReturnStatusFailed);
}
}
}
else
{
result.AppendError ("Too many aguments for 'settings list' command.\n");
result.SetStatus (eReturnStatusFailed);
return false;
}
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
m_interpreter.GetDebugger().DumpAllDescriptions (m_interpreter, result.GetOutputStream());
}
return result.Succeeded();
@ -517,14 +487,14 @@ protected:
// CommandObjectSettingsRemove
//-------------------------------------------------------------------------
class CommandObjectSettingsRemove : public CommandObjectParsed
class CommandObjectSettingsRemove : public CommandObjectRaw
{
public:
CommandObjectSettingsRemove (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"settings remove",
"Remove the specified element from an internal debugger settings array or dictionary variable.",
NULL)
CommandObjectRaw (interpreter,
"settings remove",
"Remove the specified element from an array or dictionary settings variable.",
NULL)
{
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
@ -569,8 +539,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
// Attempting to complete variable name
if (cursor_index < 2)
@ -588,56 +557,51 @@ public:
protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
DoExecute (const char *command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
const int argc = command.GetArgumentCount ();
if (argc != 2)
result.SetStatus (eReturnStatusSuccessFinishNoResult);
Args cmd_args(command);
// Process possible options.
if (!ParseOptions (cmd_args, result))
return false;
const size_t argc = cmd_args.GetArgumentCount ();
if (argc == 0)
{
result.AppendError ("'settings remove' takes two arguments");
result.AppendError ("'settings set' takes an array or dictionary item, or an array followed by one or more indexes, or a dictionary followed by one or more key names to remove");
result.SetStatus (eReturnStatusFailed);
return false;
}
const char *var_name = command.GetArgumentAtIndex (0);
std::string var_name_string;
const char *var_name = cmd_args.GetArgumentAtIndex (0);
if ((var_name == NULL) || (var_name[0] == '\0'))
{
result.AppendError ("'settings remove' command requires a valid variable name; No value supplied");
result.AppendError ("'settings set' command requires a valid variable name");
result.SetStatus (eReturnStatusFailed);
return false;
}
var_name_string = var_name;
command.Shift();
const char *index_value = command.GetArgumentAtIndex (0);
std::string index_value_string;
if ((index_value == NULL) || (index_value[0] == '\0'))
// Split the raw command into var_name and value pair.
std::string var_name_string = var_name;
llvm::StringRef raw_str(command);
llvm::StringRef var_value_str = raw_str.split(var_name).second;
StripLeadingSpaces(var_value_str);
std::string var_value_string = var_value_str.str();
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Error error (m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
eVarSetOperationRemove,
var_name,
var_value_string.c_str()));
if (error.Fail())
{
result.AppendError ("'settings remove' command requires an index or key value; no value supplied");
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
index_value_string = index_value;
Error err = usc_sp->SetVariable (var_name_string.c_str(),
NULL,
eVarSetOperationRemove,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString(),
index_value_string.c_str());
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
result.SetStatus (eReturnStatusSuccessFinishNoResult);
return result.Succeeded();
}
};
@ -713,8 +677,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
// Attempting to complete variable name
if (cursor_index < 2)
@ -734,18 +697,9 @@ protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
Args cmd_args(command);
const int argc = cmd_args.GetArgumentCount ();
if (argc < 3)
{
result.AppendError ("'settings replace' takes more arguments");
result.SetStatus (eReturnStatusFailed);
return false;
}
const char *var_name = cmd_args.GetArgumentAtIndex (0);
std::string var_name_string;
if ((var_name == NULL) || (var_name[0] == '\0'))
@ -756,46 +710,28 @@ protected:
}
var_name_string = var_name;
cmd_args.Shift();
const char *index_value = cmd_args.GetArgumentAtIndex (0);
std::string index_value_string;
if ((index_value == NULL) || (index_value[0] == '\0'))
{
result.AppendError ("'settings insert-before' command requires an index value; no value supplied");
result.SetStatus (eReturnStatusFailed);
return false;
}
index_value_string = index_value;
cmd_args.Shift();
// Split the raw command into var_name, index_value, and value triple.
llvm::StringRef raw_str(command);
llvm::StringRef var_value_str = raw_str.split(var_name).second.split(index_value).second;
llvm::StringRef var_value_str = raw_str.split(var_name).second;
StripLeadingSpaces(var_value_str);
std::string var_value_string = var_value_str.str();
if (var_value_string.empty())
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Error error(m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
eVarSetOperationReplace,
var_name,
var_value_string.c_str()));
if (error.Fail())
{
result.AppendError ("'settings replace' command requires a valid variable value; no value supplied");
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
var_value_string.c_str(),
eVarSetOperationReplace,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString(),
index_value_string.c_str());
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
result.SetStatus (eReturnStatusSuccessFinishNoResult);
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
return result.Succeeded();
@ -866,8 +802,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
// Attempting to complete variable name
if (cursor_index < 2)
@ -887,10 +822,10 @@ protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
Args cmd_args(command);
const int argc = cmd_args.GetArgumentCount ();
const size_t argc = cmd_args.GetArgumentCount ();
if (argc < 3)
{
@ -909,47 +844,23 @@ protected:
}
var_name_string = var_name;
cmd_args.Shift();
const char *index_value = cmd_args.GetArgumentAtIndex (0);
std::string index_value_string;
if ((index_value == NULL) || (index_value[0] == '\0'))
{
result.AppendError ("'settings insert-before' command requires an index value; no value supplied");
result.SetStatus (eReturnStatusFailed);
return false;
}
index_value_string = index_value;
cmd_args.Shift();
// Split the raw command into var_name, index_value, and value triple.
llvm::StringRef raw_str(command);
llvm::StringRef var_value_str = raw_str.split(var_name).second.split(index_value).second;
llvm::StringRef var_value_str = raw_str.split(var_name).second;
StripLeadingSpaces(var_value_str);
std::string var_value_string = var_value_str.str();
if (var_value_string.empty())
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Error error(m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
eVarSetOperationInsertBefore,
var_name,
var_value_string.c_str()));
if (error.Fail())
{
result.AppendError ("'settings insert-before' command requires a valid variable value;"
" No value supplied");
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
var_value_string.c_str(),
eVarSetOperationInsertBefore,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString(),
index_value_string.c_str());
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
result.SetStatus (eReturnStatusSuccessFinishNoResult);
return false;
}
return result.Succeeded();
@ -1020,8 +931,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
// Attempting to complete variable name
if (cursor_index < 2)
@ -1041,10 +951,10 @@ protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
Args cmd_args(command);
const int argc = cmd_args.GetArgumentCount ();
const size_t argc = cmd_args.GetArgumentCount ();
if (argc < 3)
{
@ -1063,47 +973,23 @@ protected:
}
var_name_string = var_name;
cmd_args.Shift();
const char *index_value = cmd_args.GetArgumentAtIndex (0);
std::string index_value_string;
if ((index_value == NULL) || (index_value[0] == '\0'))
{
result.AppendError ("'settings insert-after' command requires an index value; no value supplied");
result.SetStatus (eReturnStatusFailed);
return false;
}
index_value_string = index_value;
cmd_args.Shift();
// Split the raw command into var_name, index_value, and value triple.
llvm::StringRef raw_str(command);
llvm::StringRef var_value_str = raw_str.split(var_name).second.split(index_value).second;
llvm::StringRef var_value_str = raw_str.split(var_name).second;
StripLeadingSpaces(var_value_str);
std::string var_value_string = var_value_str.str();
if (var_value_string.empty())
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Error error(m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
eVarSetOperationInsertAfter,
var_name,
var_value_string.c_str()));
if (error.Fail())
{
result.AppendError ("'settings insert-after' command requires a valid variable value;"
" No value supplied");
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
var_value_string.c_str(),
eVarSetOperationInsertAfter,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString(),
index_value_string.c_str());
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
result.SetStatus (eReturnStatusSuccessFinishNoResult);
return false;
}
return result.Succeeded();
@ -1164,8 +1050,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
// Attempting to complete variable name
if (cursor_index < 2)
@ -1185,10 +1070,9 @@ protected:
virtual bool
DoExecute (const char *command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
result.SetStatus (eReturnStatusSuccessFinishNoResult);
Args cmd_args(command);
const int argc = cmd_args.GetArgumentCount ();
const size_t argc = cmd_args.GetArgumentCount ();
if (argc < 2)
{
@ -1216,26 +1100,16 @@ protected:
StripLeadingSpaces(var_value_str);
std::string var_value_string = var_value_str.str();
if (var_value_string.empty())
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Error error(m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
eVarSetOperationAppend,
var_name,
var_value_string.c_str()));
if (error.Fail())
{
result.AppendError ("'settings append' command requires a valid variable value;"
" No value supplied");
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
var_value_string.c_str(),
eVarSetOperationAppend,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString());
if (err.Fail ())
{
result.AppendError (err.AsCString());
result.SetStatus (eReturnStatusFailed);
}
else
result.SetStatus (eReturnStatusSuccessFinishNoResult);
return false;
}
return result.Succeeded();
@ -1282,8 +1156,7 @@ public:
bool &word_complete,
StringList &matches)
{
std::string completion_str (input.GetArgumentAtIndex (cursor_index));
completion_str.erase (cursor_char_position);
std::string completion_str (input.GetArgumentAtIndex (cursor_index), cursor_char_position);
// Attempting to complete variable name
if (cursor_index < 2)
@ -1303,9 +1176,8 @@ protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
const int argc = command.GetArgumentCount ();
result.SetStatus (eReturnStatusSuccessFinishNoResult);
const size_t argc = command.GetArgumentCount ();
if (argc != 1)
{
@ -1321,20 +1193,18 @@ protected:
result.SetStatus (eReturnStatusFailed);
return false;
}
Error err = usc_sp->SetVariable (var_name,
NULL,
eVarSetOperationClear,
false,
m_interpreter.GetDebugger().GetInstanceName().AsCString());
if (err.Fail ())
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
Error error (m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
eVarSetOperationClear,
var_name,
NULL));
if (error.Fail())
{
result.AppendError (err.AsCString());
result.AppendError (error.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
else
result.SetStatus (eReturnStatusSuccessFinishNoResult);
return result.Succeeded();
}

View File

@ -205,6 +205,11 @@ ConstString::ConstString (const char *cstr, size_t cstr_len) :
{
}
ConstString::ConstString (const llvm::StringRef &s) :
m_string (StringPool().GetConstCStringWithLength (s.data(), s.size()))
{
}
bool
ConstString::operator < (const ConstString& rhs) const
{
@ -283,6 +288,12 @@ ConstString::SetCString (const char *cstr)
m_string = StringPool().GetConstCString (cstr);
}
void
ConstString::SetString (const llvm::StringRef &s)
{
m_string = StringPool().GetConstCStringWithLength (s.data(), s.size());
}
void
ConstString::SetCStringWithMangledCounterpart (const char *demangled, const ConstString &mangled)
{

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,11 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Timer.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueDictionary.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/ExecutionContext.h"

View File

@ -94,7 +94,7 @@ FileSpecList::Dump(Stream *s, const char *separator_cstr) const
for (pos = m_files.begin(); pos != end; ++pos)
{
pos->Dump(s);
if (separator_cstr)
if (separator_cstr && ((pos + 1) != end))
s->PutCString(separator_cstr);
}
}

View File

@ -184,6 +184,8 @@ RegularExpression::IsValid () const
const char*
RegularExpression::GetText () const
{
if (m_re.empty())
return NULL;
return m_re.c_str();
}

View File

@ -49,6 +49,12 @@ StringList::AppendString (const char *str)
m_strings.push_back (str);
}
void
StringList::AppendString (const std::string &s)
{
m_strings.push_back (s);
}
void
StringList::AppendString (const char *str, size_t str_len)
{
@ -253,3 +259,27 @@ StringList::operator << (StringList strings)
AppendList(strings);
return *this;
}
size_t
StringList::AutoComplete (const char *s, StringList &matches, size_t &exact_idx) const
{
matches.Clear();
exact_idx = SIZE_MAX;
if (s && s[0])
{
const size_t s_len = strlen (s);
const size_t num_strings = m_strings.size();
for (size_t i=0; i<num_strings; ++i)
{
if (m_strings[i].find(s) == 0)
{
if (exact_idx == SIZE_MAX && m_strings[i].size() == s_len)
exact_idx = matches.GetSize();
matches.AppendString (m_strings[i]);
}
}
}
return matches.GetSize();
}

File diff suppressed because it is too large Load Diff

View File

@ -523,15 +523,9 @@ FileSpec::Equal (const FileSpec& a, const FileSpec& b, bool full)
void
FileSpec::Dump(Stream *s) const
{
if (m_filename)
m_directory.Dump(s, ""); // Provide a default for m_directory when we dump it in case it is invalid
m_directory.Dump(s);
if (m_directory)
{
// If dirname was valid, then we need to print a slash between
// the directory and the filename
s->PutChar('/');
}
m_filename.Dump(s);
}

View File

@ -84,17 +84,10 @@ CommandInterpreter::CommandInterpreter
m_truncation_warning(eNoTruncation),
m_command_source_depth (0)
{
const char *dbg_name = debugger.GetInstanceName().AsCString();
std::string lang_name = ScriptInterpreter::LanguageToString (script_language);
StreamString var_name;
var_name.Printf ("[%s].script-lang", dbg_name);
debugger.GetSettingsController()->SetVariable (var_name.GetData(), lang_name.c_str(),
eVarSetOperationAssign, false,
m_debugger.GetInstanceName().AsCString());
debugger.SetScriptLanguage (script_language);
SetEventName (eBroadcastBitThreadShouldExit, "thread-should-exit");
SetEventName (eBroadcastBitResetPrompt, "reset-prompt");
SetEventName (eBroadcastBitQuitCommandReceived, "quit");
SetEventName (eBroadcastBitQuitCommandReceived, "quit");
CheckInWithManager ();
}
@ -2505,6 +2498,7 @@ CommandInterpreter::OutputFormattedHelpText (Stream &strm,
while (end > start
&& text[end] != ' ' && text[end] != '\t' && text[end] != '\n')
end--;
assert (end > 0);
}
sub_len = end - start;

View File

@ -1,503 +0,0 @@
//===-- NamedOptionValue.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/NamedOptionValue.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
//-------------------------------------------------------------------------
// OptionValue
//-------------------------------------------------------------------------
// Get this value as a uint64_t value if it is encoded as a boolean,
// uint64_t or int64_t. Other types will cause "fail_value" to be
// returned
uint64_t
OptionValue::GetUInt64Value (uint64_t fail_value, bool *success_ptr)
{
if (success_ptr)
*success_ptr = true;
switch (GetType())
{
case OptionValue::eTypeBoolean: return static_cast<OptionValueBoolean *>(this)->GetCurrentValue();
case OptionValue::eTypeSInt64: return static_cast<OptionValueSInt64 *>(this)->GetCurrentValue();
case OptionValue::eTypeUInt64: return static_cast<OptionValueUInt64 *>(this)->GetCurrentValue();
default:
break;
}
if (success_ptr)
*success_ptr = false;
return fail_value;
}
OptionValueBoolean *
OptionValue::GetAsBoolean ()
{
if (GetType () == OptionValue::eTypeBoolean)
return static_cast<OptionValueBoolean *>(this);
return NULL;
}
OptionValueSInt64 *
OptionValue::GetAsSInt64 ()
{
if (GetType () == OptionValue::eTypeSInt64)
return static_cast<OptionValueSInt64 *>(this);
return NULL;
}
OptionValueUInt64 *
OptionValue::GetAsUInt64 ()
{
if (GetType () == OptionValue::eTypeUInt64)
return static_cast<OptionValueUInt64 *>(this);
return NULL;
}
OptionValueString *
OptionValue::GetAsString ()
{
if (GetType () == OptionValue::eTypeString)
return static_cast<OptionValueString *>(this);
return NULL;
}
OptionValueFileSpec *
OptionValue::GetAsFileSpec ()
{
if (GetType () == OptionValue::eTypeFileSpec)
return static_cast<OptionValueFileSpec *>(this);
return NULL;
}
OptionValueFormat *
OptionValue::GetAsFormat ()
{
if (GetType () == OptionValue::eTypeFormat)
return static_cast<OptionValueFormat *>(this);
return NULL;
}
OptionValueUUID *
OptionValue::GetAsUUID ()
{
if (GetType () == OptionValue::eTypeUUID)
return static_cast<OptionValueUUID *>(this);
return NULL;
}
OptionValueArray *
OptionValue::GetAsArray ()
{
if (GetType () == OptionValue::eTypeArray)
return static_cast<OptionValueArray *>(this);
return NULL;
}
OptionValueDictionary *
OptionValue::GetAsDictionary ()
{
if (GetType () == OptionValue::eTypeDictionary)
return static_cast<OptionValueDictionary *>(this);
return NULL;
}
const char *
OptionValue::GetStringValue (const char *fail_value)
{
OptionValueString *option_value = GetAsString ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
uint64_t
OptionValue::GetUInt64Value (uint64_t fail_value)
{
OptionValueUInt64 *option_value = GetAsUInt64 ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
lldb::Format
OptionValue::GetFormatValue (lldb::Format fail_value)
{
OptionValueFormat *option_value = GetAsFormat ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
//-------------------------------------------------------------------------
// OptionValueCollection
//-------------------------------------------------------------------------
void
OptionValueCollection::GetQualifiedName (Stream &strm)
{
if (m_parent)
{
m_parent->GetQualifiedName (strm);
strm.PutChar('.');
}
strm << m_name;
}
//-------------------------------------------------------------------------
// OptionValueBoolean
//-------------------------------------------------------------------------
void
OptionValueBoolean::DumpValue (Stream &strm)
{
strm.PutCString (m_current_value ? "true" : "false");
}
Error
OptionValueBoolean::SetValueFromCString (const char *value_cstr)
{
Error error;
bool success = false;
bool value = Args::StringToBoolean(value_cstr, false, &success);
if (success)
{
m_value_was_set = true;
m_current_value = value;
}
else
{
if (value_cstr == NULL)
error.SetErrorString ("invalid boolean string value: NULL");
else if (value_cstr[0] == '\0')
error.SetErrorString ("invalid boolean string value <empty>");
else
error.SetErrorStringWithFormat ("invalid boolean string value: '%s'", value_cstr);
}
return error;
}
//-------------------------------------------------------------------------
// OptionValueSInt64
//-------------------------------------------------------------------------
void
OptionValueSInt64::DumpValue (Stream &strm)
{
strm.Printf ("%lli", m_current_value);
}
Error
OptionValueSInt64::SetValueFromCString (const char *value_cstr)
{
Error error;
bool success = false;
int64_t value = Args::StringToSInt64 (value_cstr, 0, 0, &success);
if (success)
{
m_value_was_set = true;
m_current_value = value;
}
else
{
error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'", value_cstr);
}
return error;
}
//-------------------------------------------------------------------------
// OptionValueUInt64
//-------------------------------------------------------------------------
lldb::OptionValueSP
OptionValueUInt64::Create (const char *value_cstr, Error &error)
{
lldb::OptionValueSP value_sp (new OptionValueUInt64());
error = value_sp->SetValueFromCString (value_cstr);
if (error.Fail())
value_sp.reset();
return value_sp;
}
void
OptionValueUInt64::DumpValue (Stream &strm)
{
strm.Printf ("0x%llx", m_current_value);
}
Error
OptionValueUInt64::SetValueFromCString (const char *value_cstr)
{
Error error;
bool success = false;
uint64_t value = Args::StringToUInt64 (value_cstr, 0, 0, &success);
if (success)
{
m_value_was_set = true;
m_current_value = value;
}
else
{
error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'", value_cstr);
}
return error;
}
//-------------------------------------------------------------------------
// OptionValueDictionary
//-------------------------------------------------------------------------
void
OptionValueString::DumpValue (Stream &strm)
{
strm.Printf ("\"%s\"", m_current_value.c_str());
}
Error
OptionValueString::SetValueFromCString (const char *value_cstr)
{
m_value_was_set = true;
SetCurrentValue (value_cstr);
return Error ();
}
//-------------------------------------------------------------------------
// OptionValueFileSpec
//-------------------------------------------------------------------------
void
OptionValueFileSpec::DumpValue (Stream &strm)
{
if (m_current_value)
{
if (m_current_value.GetDirectory())
{
strm << '"' << m_current_value.GetDirectory();
if (m_current_value.GetFilename())
strm << '/' << m_current_value.GetFilename();
strm << '"';
}
else
{
strm << '"' << m_current_value.GetFilename() << '"';
}
}
}
Error
OptionValueFileSpec::SetValueFromCString (const char *value_cstr)
{
if (value_cstr && value_cstr[0])
m_current_value.SetFile(value_cstr, false);
else
m_current_value.Clear();
m_value_was_set = true;
return Error();
}
//-------------------------------------------------------------------------
// OptionValueFileSpecList
//-------------------------------------------------------------------------
void
OptionValueFileSpecList::DumpValue (Stream &strm)
{
m_current_value.Dump(&strm, "\n");
}
Error
OptionValueFileSpecList::SetValueFromCString (const char *value_cstr)
{
if (value_cstr && value_cstr[0])
{
FileSpec file (value_cstr, false);
m_current_value.Append(file);
}
m_value_was_set = true;
return Error();
}
//-------------------------------------------------------------------------
// OptionValueUUID
//-------------------------------------------------------------------------
void
OptionValueUUID::DumpValue (Stream &strm)
{
m_uuid.Dump (&strm);
}
Error
OptionValueUUID::SetValueFromCString (const char *value_cstr)
{
Error error;
if (m_uuid.SetfromCString(value_cstr) == 0)
error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr);
return error;
}
//-------------------------------------------------------------------------
// OptionValueFormat
//-------------------------------------------------------------------------
void
OptionValueFormat::DumpValue (Stream &strm)
{
strm.PutCString (FormatManager::GetFormatAsCString (m_current_value));
}
Error
OptionValueFormat::SetValueFromCString (const char *value_cstr)
{
Format new_format;
Error error (Args::StringToFormat (value_cstr, new_format, NULL));
if (error.Success())
{
m_value_was_set = true;
m_current_value = new_format;
}
return error;
}
//-------------------------------------------------------------------------
// OptionValueArray
//-------------------------------------------------------------------------
void
OptionValueArray::DumpValue (Stream &strm)
{
const uint32_t size = m_values.size();
for (uint32_t i = 0; i<size; ++i)
{
strm.Printf("[%u] ", i);
m_values[i]->DumpValue (strm);
}
}
Error
OptionValueArray::SetValueFromCString (const char *value_cstr)
{
Error error;
error.SetErrorStringWithFormat ("array option values don't yet support being set by string: '%s'", value_cstr);
return error;
}
//-------------------------------------------------------------------------
// OptionValueDictionary
//-------------------------------------------------------------------------
void
OptionValueDictionary::DumpValue (Stream &strm)
{
collection::iterator pos, end = m_values.end();
for (pos = m_values.begin(); pos != end; ++pos)
{
strm.Printf("%s=", pos->first.GetCString());
pos->second->DumpValue (strm);
}
}
Error
OptionValueDictionary::SetValueFromCString (const char *value_cstr)
{
Error error;
error.SetErrorStringWithFormat ("dictionary option values don't yet support being set by string: '%s'", value_cstr);
return error;
}
lldb::OptionValueSP
OptionValueDictionary::GetValueForKey (const ConstString &key) const
{
lldb::OptionValueSP value_sp;
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
value_sp = pos->second;
return value_sp;
}
const char *
OptionValueDictionary::GetStringValueForKey (const ConstString &key)
{
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
{
if (pos->second->GetType() == OptionValue::eTypeString)
return static_cast<OptionValueString *>(pos->second.get())->GetCurrentValue();
}
return NULL;
}
bool
OptionValueDictionary::SetStringValueForKey (const ConstString &key,
const char *value,
bool can_replace)
{
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
{
if (!can_replace)
return false;
if (pos->second->GetType() == OptionValue::eTypeString)
{
pos->second->SetValueFromCString(value);
return true;
}
}
m_values[key] = OptionValueSP (new OptionValueString (value));
return true;
}
bool
OptionValueDictionary::SetValueForKey (const ConstString &key,
const lldb::OptionValueSP &value_sp,
bool can_replace)
{
// Make sure the value_sp object is allowed to contain
// values of the type passed in...
if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
{
if (!can_replace)
{
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
return false;
}
m_values[key] = value_sp;
return true;
}
return false;
}
bool
OptionValueDictionary::DeleteValueForKey (const ConstString &key)
{
collection::iterator pos = m_values.find (key);
if (pos != m_values.end())
{
m_values.erase(pos);
return true;
}
return false;
}

View File

@ -31,8 +31,7 @@ OptionGroupValueObjectDisplay::~OptionGroupValueObjectDisplay ()
static OptionDefinition
g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "dynamic-type", 'd', required_argument, TargetInstanceSettings::g_dynamic_value_types,
0, eArgTypeNone, "Show the object as its full dynamic type, not its static type, if available."},
{ LLDB_OPT_SET_1, false, "dynamic-type", 'd', required_argument, g_dynamic_value_types, 0, eArgTypeNone, "Show the object as its full dynamic type, not its static type, if available."},
{ LLDB_OPT_SET_1, false, "synthetic-type", 'S', required_argument, NULL, 0, eArgTypeBoolean, "Show the object obeying its synthetic provider, if available."},
{ LLDB_OPT_SET_1, false, "depth", 'D', required_argument, NULL, 0, eArgTypeCount, "Set the max recurse depth when dumping aggregate types (default is infinity)."},
{ LLDB_OPT_SET_1, false, "flat", 'F', no_argument, NULL, 0, eArgTypeNone, "Display results in a flat format that uses expression paths for each variable or member."},
@ -73,7 +72,7 @@ OptionGroupValueObjectDisplay::SetOptionValue (CommandInterpreter &interpreter,
case 'd':
{
int32_t result;
result = Args::StringToOptionEnum (option_arg, TargetInstanceSettings::g_dynamic_value_types, 2, error);
result = Args::StringToOptionEnum (option_arg, g_dynamic_value_types, 2, error);
if (error.Success())
use_dynamic = (lldb::DynamicValueType) result;
}

View File

@ -0,0 +1,633 @@
//===-- OptionValue.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/OptionValue.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/StringList.h"
#include "lldb/Interpreter/OptionValues.h"
using namespace lldb;
using namespace lldb_private;
//-------------------------------------------------------------------------
// Get this value as a uint64_t value if it is encoded as a boolean,
// uint64_t or int64_t. Other types will cause "fail_value" to be
// returned
//-------------------------------------------------------------------------
uint64_t
OptionValue::GetUInt64Value (uint64_t fail_value, bool *success_ptr)
{
if (success_ptr)
*success_ptr = true;
switch (GetType())
{
case OptionValue::eTypeBoolean: return static_cast<OptionValueBoolean *>(this)->GetCurrentValue();
case OptionValue::eTypeSInt64: return static_cast<OptionValueSInt64 *>(this)->GetCurrentValue();
case OptionValue::eTypeUInt64: return static_cast<OptionValueUInt64 *>(this)->GetCurrentValue();
default:
break;
}
if (success_ptr)
*success_ptr = false;
return fail_value;
}
Error
OptionValue::SetSubValue (const ExecutionContext *exe_ctx,
VarSetOperationType op,
const char *name,
const char *value)
{
Error error;
error.SetErrorStringWithFormat("SetSubValue is not supported");
return error;
}
OptionValueBoolean *
OptionValue::GetAsBoolean ()
{
if (GetType () == OptionValue::eTypeBoolean)
return static_cast<OptionValueBoolean *>(this);
return NULL;
}
const OptionValueBoolean *
OptionValue::GetAsBoolean () const
{
if (GetType () == OptionValue::eTypeBoolean)
return static_cast<const OptionValueBoolean *>(this);
return NULL;
}
OptionValueFileSpec *
OptionValue::GetAsFileSpec ()
{
if (GetType () == OptionValue::eTypeFileSpec)
return static_cast<OptionValueFileSpec *>(this);
return NULL;
}
const OptionValueFileSpec *
OptionValue::GetAsFileSpec () const
{
if (GetType () == OptionValue::eTypeFileSpec)
return static_cast<const OptionValueFileSpec *>(this);
return NULL;
}
OptionValueFileSpecList *
OptionValue::GetAsFileSpecList ()
{
if (GetType () == OptionValue::eTypeFileSpecList)
return static_cast<OptionValueFileSpecList *>(this);
return NULL;
}
const OptionValueFileSpecList *
OptionValue::GetAsFileSpecList () const
{
if (GetType () == OptionValue::eTypeFileSpecList)
return static_cast<const OptionValueFileSpecList *>(this);
return NULL;
}
OptionValueArch *
OptionValue::GetAsArch ()
{
if (GetType () == OptionValue::eTypeArch)
return static_cast<OptionValueArch *>(this);
return NULL;
}
const OptionValueArch *
OptionValue::GetAsArch () const
{
if (GetType () == OptionValue::eTypeArch)
return static_cast<const OptionValueArch *>(this);
return NULL;
}
OptionValueArray *
OptionValue::GetAsArray ()
{
if (GetType () == OptionValue::eTypeArray)
return static_cast<OptionValueArray *>(this);
return NULL;
}
const OptionValueArray *
OptionValue::GetAsArray () const
{
if (GetType () == OptionValue::eTypeArray)
return static_cast<const OptionValueArray *>(this);
return NULL;
}
OptionValueArgs *
OptionValue::GetAsArgs ()
{
if (GetType () == OptionValue::eTypeArgs)
return static_cast<OptionValueArgs *>(this);
return NULL;
}
const OptionValueArgs *
OptionValue::GetAsArgs () const
{
if (GetType () == OptionValue::eTypeArgs)
return static_cast<const OptionValueArgs *>(this);
return NULL;
}
OptionValueDictionary *
OptionValue::GetAsDictionary ()
{
if (GetType () == OptionValue::eTypeDictionary)
return static_cast<OptionValueDictionary *>(this);
return NULL;
}
const OptionValueDictionary *
OptionValue::GetAsDictionary () const
{
if (GetType () == OptionValue::eTypeDictionary)
return static_cast<const OptionValueDictionary *>(this);
return NULL;
}
OptionValueEnumeration *
OptionValue::GetAsEnumeration ()
{
if (GetType () == OptionValue::eTypeEnum)
return static_cast<OptionValueEnumeration *>(this);
return NULL;
}
const OptionValueEnumeration *
OptionValue::GetAsEnumeration () const
{
if (GetType () == OptionValue::eTypeEnum)
return static_cast<const OptionValueEnumeration *>(this);
return NULL;
}
OptionValueFormat *
OptionValue::GetAsFormat ()
{
if (GetType () == OptionValue::eTypeFormat)
return static_cast<OptionValueFormat *>(this);
return NULL;
}
const OptionValueFormat *
OptionValue::GetAsFormat () const
{
if (GetType () == OptionValue::eTypeFormat)
return static_cast<const OptionValueFormat *>(this);
return NULL;
}
OptionValuePathMappings *
OptionValue::GetAsPathMappings ()
{
if (GetType () == OptionValue::eTypePathMap)
return static_cast<OptionValuePathMappings *>(this);
return NULL;
}
const OptionValuePathMappings *
OptionValue::GetAsPathMappings () const
{
if (GetType () == OptionValue::eTypePathMap)
return static_cast<const OptionValuePathMappings *>(this);
return NULL;
}
OptionValueProperties *
OptionValue::GetAsProperties ()
{
if (GetType () == OptionValue::eTypeProperties)
return static_cast<OptionValueProperties *>(this);
return NULL;
}
const OptionValueProperties *
OptionValue::GetAsProperties () const
{
if (GetType () == OptionValue::eTypeProperties)
return static_cast<const OptionValueProperties *>(this);
return NULL;
}
OptionValueRegex *
OptionValue::GetAsRegex ()
{
if (GetType () == OptionValue::eTypeRegex)
return static_cast<OptionValueRegex *>(this);
return NULL;
}
const OptionValueRegex *
OptionValue::GetAsRegex () const
{
if (GetType () == OptionValue::eTypeRegex)
return static_cast<const OptionValueRegex *>(this);
return NULL;
}
OptionValueSInt64 *
OptionValue::GetAsSInt64 ()
{
if (GetType () == OptionValue::eTypeSInt64)
return static_cast<OptionValueSInt64 *>(this);
return NULL;
}
const OptionValueSInt64 *
OptionValue::GetAsSInt64 () const
{
if (GetType () == OptionValue::eTypeSInt64)
return static_cast<const OptionValueSInt64 *>(this);
return NULL;
}
OptionValueString *
OptionValue::GetAsString ()
{
if (GetType () == OptionValue::eTypeString)
return static_cast<OptionValueString *>(this);
return NULL;
}
const OptionValueString *
OptionValue::GetAsString () const
{
if (GetType () == OptionValue::eTypeString)
return static_cast<const OptionValueString *>(this);
return NULL;
}
OptionValueUInt64 *
OptionValue::GetAsUInt64 ()
{
if (GetType () == OptionValue::eTypeUInt64)
return static_cast<OptionValueUInt64 *>(this);
return NULL;
}
const OptionValueUInt64 *
OptionValue::GetAsUInt64 () const
{
if (GetType () == OptionValue::eTypeUInt64)
return static_cast<const OptionValueUInt64 *>(this);
return NULL;
}
OptionValueUUID *
OptionValue::GetAsUUID ()
{
if (GetType () == OptionValue::eTypeUUID)
return static_cast<OptionValueUUID *>(this);
return NULL;
}
const OptionValueUUID *
OptionValue::GetAsUUID () const
{
if (GetType () == OptionValue::eTypeUUID)
return static_cast<const OptionValueUUID *>(this);
return NULL;
}
bool
OptionValue::GetBooleanValue (bool fail_value) const
{
const OptionValueBoolean *option_value = GetAsBoolean ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
bool
OptionValue::SetBooleanValue (bool new_value)
{
OptionValueBoolean *option_value = GetAsBoolean ();
if (option_value)
{
option_value->SetCurrentValue(new_value);
return true;
}
return false;
}
int64_t
OptionValue::GetEnumerationValue (int64_t fail_value) const
{
const OptionValueEnumeration *option_value = GetAsEnumeration();
if (option_value)
option_value->GetCurrentValue();
return fail_value;
}
bool
OptionValue::SetEnumerationValue (int64_t value)
{
OptionValueEnumeration *option_value = GetAsEnumeration();
if (option_value)
{
option_value->SetCurrentValue(value);
return true;
}
return false;
}
FileSpec
OptionValue::GetFileSpecValue () const
{
const OptionValueFileSpec *option_value = GetAsFileSpec ();
if (option_value)
return option_value->GetCurrentValue();
return FileSpec();
}
bool
OptionValue::SetFileSpecValue (const FileSpec &file_spec)
{
OptionValueFileSpec *option_value = GetAsFileSpec ();
if (option_value)
{
option_value->SetCurrentValue(file_spec);
return true;
}
return false;
}
FileSpecList
OptionValue::GetFileSpecListValue () const
{
const OptionValueFileSpecList *option_value = GetAsFileSpecList ();
if (option_value)
return option_value->GetCurrentValue();
return FileSpecList();
}
lldb::Format
OptionValue::GetFormatValue (lldb::Format fail_value) const
{
const OptionValueFormat *option_value = GetAsFormat ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
bool
OptionValue::SetFormatValue (lldb::Format new_value)
{
OptionValueFormat *option_value = GetAsFormat ();
if (option_value)
{
option_value->SetCurrentValue(new_value);
return true;
}
return false;
}
const RegularExpression *
OptionValue::GetRegexValue () const
{
const OptionValueRegex *option_value = GetAsRegex ();
if (option_value)
return option_value->GetCurrentValue();
return NULL;
}
int64_t
OptionValue::GetSInt64Value (int64_t fail_value) const
{
const OptionValueSInt64 *option_value = GetAsSInt64 ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
bool
OptionValue::SetSInt64Value (int64_t new_value)
{
OptionValueSInt64 *option_value = GetAsSInt64 ();
if (option_value)
{
option_value->SetCurrentValue(new_value);
return true;
}
return false;
}
const char *
OptionValue::GetStringValue (const char *fail_value) const
{
const OptionValueString *option_value = GetAsString ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
bool
OptionValue::SetStringValue (const char *new_value)
{
OptionValueString *option_value = GetAsString ();
if (option_value)
{
option_value->SetCurrentValue(new_value);
return true;
}
return false;
}
uint64_t
OptionValue::GetUInt64Value (uint64_t fail_value) const
{
const OptionValueUInt64 *option_value = GetAsUInt64 ();
if (option_value)
return option_value->GetCurrentValue();
return fail_value;
}
bool
OptionValue::SetUInt64Value (uint64_t new_value)
{
OptionValueUInt64 *option_value = GetAsUInt64 ();
if (option_value)
{
option_value->SetCurrentValue(new_value);
return true;
}
return false;
}
UUID
OptionValue::GetUUIDValue () const
{
const OptionValueUUID *option_value = GetAsUUID();
if (option_value)
return option_value->GetCurrentValue();
return UUID();
}
bool
OptionValue::SetUUIDValue (const UUID &uuid)
{
OptionValueUUID *option_value = GetAsUUID();
if (option_value)
{
option_value->SetCurrentValue(uuid);
return true;
}
return false;
}
const char *
OptionValue::GetBuiltinTypeAsCString (Type t)
{
switch (t)
{
case eTypeInvalid: return "invalid";
case eTypeArch: return "arch";
case eTypeArgs: return "arguments";
case eTypeArray: return "array";
case eTypeBoolean: return "boolean";
case eTypeDictionary: return "dictionary";
case eTypeEnum: return "enum";
case eTypeFileSpec: return "file";
case eTypeFileSpecList: return "file-list";
case eTypeFormat: return "format";
case eTypePathMap: return "path-map";
case eTypeProperties: return "properties";
case eTypeRegex: return "regex";
case eTypeSInt64: return "int";
case eTypeString: return "string";
case eTypeUInt64: return "unsigned";
case eTypeUUID: return "uuid";
}
return NULL;
}
lldb::OptionValueSP
OptionValue::CreateValueFromCStringForTypeMask (const char *value_cstr, uint32_t type_mask, Error &error)
{
// If only 1 bit is set in the type mask for a dictionary or array
// then we know how to decode a value from a cstring
lldb::OptionValueSP value_sp;
switch (type_mask)
{
case 1u << eTypeArch: value_sp.reset(new OptionValueArch()); break;
case 1u << eTypeBoolean: value_sp.reset(new OptionValueBoolean(false)); break;
case 1u << eTypeFileSpec: value_sp.reset(new OptionValueFileSpec()); break;
case 1u << eTypeFormat: value_sp.reset(new OptionValueFormat(eFormatInvalid)); break;
case 1u << eTypeSInt64: value_sp.reset(new OptionValueSInt64()); break;
case 1u << eTypeString: value_sp.reset(new OptionValueString()); break;
case 1u << eTypeUInt64: value_sp.reset(new OptionValueUInt64()); break;
case 1u << eTypeUUID: value_sp.reset(new OptionValueUUID()); break;
}
if (value_sp)
error = value_sp->SetValueFromCString (value_cstr, eVarSetOperationAssign);
else
error.SetErrorString("unsupported type mask");
return value_sp;
}
bool
OptionValue::DumpQualifiedName (Stream &strm) const
{
bool dumped_something = false;
lldb::OptionValueSP m_parent_sp(m_parent_wp.lock());
if (m_parent_sp)
{
if (m_parent_sp->DumpQualifiedName(strm))
dumped_something = true;
}
ConstString name (GetName());
if (name)
{
if (dumped_something)
strm.PutChar('.');
else
dumped_something = true;
strm << name;
}
return dumped_something;
}
size_t
OptionValue::AutoComplete (CommandInterpreter &interpreter,
const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches)
{
word_complete = false;
matches.Clear();
return matches.GetSize();
}
Error
OptionValue::SetValueFromCString (const char *value, VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationReplace:
error.SetErrorStringWithFormat ("%s objects do not support the 'replace' operation", GetTypeAsCString());
break;
case eVarSetOperationInsertBefore:
error.SetErrorStringWithFormat ("%s objects do not support the 'insert-before' operation", GetTypeAsCString());
break;
case eVarSetOperationInsertAfter:
error.SetErrorStringWithFormat ("%s objects do not support the 'insert-after' operation", GetTypeAsCString());
break;
case eVarSetOperationRemove:
error.SetErrorStringWithFormat ("%s objects do not support the 'remove' operation", GetTypeAsCString());
break;
case eVarSetOperationAppend:
error.SetErrorStringWithFormat ("%s objects do not support the 'append' operation", GetTypeAsCString());
break;
case eVarSetOperationClear:
error.SetErrorStringWithFormat ("%s objects do not support the 'clear' operation", GetTypeAsCString());
break;
case eVarSetOperationAssign:
error.SetErrorStringWithFormat ("%s objects do not support the 'assign' operation", GetTypeAsCString());
break;
case eVarSetOperationInvalid:
error.SetErrorStringWithFormat ("invalid operation performed on a %s object", GetTypeAsCString());
break;
}
return error;
}

View File

@ -0,0 +1,109 @@
//===-- OptionValueArch.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/OptionValueArch.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueArch::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
if (m_current_value.IsValid())
{
const char *arch_name = m_current_value.GetArchitectureName();
if (arch_name)
strm.PutCString (arch_name);
}
}
}
Error
OptionValueArch::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
if (value_cstr && value_cstr[0])
{
if (m_current_value.SetTriple (value_cstr))
m_value_was_set = true;
else
error.SetErrorStringWithFormat("unsupported architecture '%s'", value_cstr);
}
else
{
error.SetErrorString("invalid value string");
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueArch::DeepCopy () const
{
return OptionValueSP(new OptionValueArch(*this));
}
size_t
OptionValueArch::AutoComplete (CommandInterpreter &interpreter,
const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches)
{
word_complete = false;
matches.Clear();
CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
CommandCompletions::eArchitectureCompletion,
s,
match_start_point,
max_return_elements,
NULL,
word_complete,
matches);
return matches.GetSize();
}

View File

@ -0,0 +1,38 @@
//===-- OptionValueArgs.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/OptionValueArgs.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
size_t
OptionValueArgs::GetArgs (Args &args)
{
const uint32_t size = m_values.size();
std::vector<const char *> argv;
for (uint32_t i = 0; i<size; ++i)
{
const char *string_value = m_values[i]->GetStringValue ();
if (string_value)
argv.push_back(string_value);
}
if (argv.empty())
args.Clear();
else
args.SetArguments(argv.size(), &argv[0]);
return args.GetArgumentCount();
}

View File

@ -0,0 +1,350 @@
//===-- OptionValueArray.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/OptionValueArray.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueArray::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
const Type array_element_type = ConvertTypeMaskToType (m_type_mask);
if (dump_mask & eDumpOptionType)
{
if ((GetType() == eTypeArray) && (m_type_mask != eTypeInvalid))
strm.Printf ("(%s of %ss)", GetTypeAsCString(), GetBuiltinTypeAsCString(array_element_type));
else
strm.Printf ("(%s)", GetTypeAsCString());
}
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.Printf (" =%s", (m_values.size() > 0) ? "\n" : "");
strm.IndentMore();
const uint32_t size = m_values.size();
for (uint32_t i = 0; i<size; ++i)
{
strm.Indent();
strm.Printf("[%u]: ", i);
const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0;
switch (array_element_type)
{
default:
case eTypeArray:
case eTypeDictionary:
case eTypeProperties:
case eTypeFileSpecList:
case eTypePathMap:
m_values[i]->DumpValue(exe_ctx, strm, dump_mask | extra_dump_options);
break;
case eTypeBoolean:
case eTypeEnum:
case eTypeFileSpec:
case eTypeFormat:
case eTypeSInt64:
case eTypeString:
case eTypeUInt64:
case eTypeUUID:
// No need to show the type for dictionaries of simple items
m_values[i]->DumpValue(exe_ctx, strm, (dump_mask & (~eDumpOptionType)) | extra_dump_options);
break;
}
if (i < (size - 1))
strm.EOL();
}
strm.IndentLess();
}
}
Error
OptionValueArray::SetValueFromCString (const char *value, VarSetOperationType op)
{
Args args(value);
return SetArgs (args, op);
}
lldb::OptionValueSP
OptionValueArray::GetSubValue (const ExecutionContext *exe_ctx,
const char *name,
bool will_modify,
Error &error) const
{
if (name && name[0] == '[')
{
const char *end_bracket = strchr (name+1, ']');
if (end_bracket)
{
const char *sub_value = NULL;
if (end_bracket[1])
sub_value = end_bracket + 1;
std::string index_str (name+1, end_bracket);
const size_t array_count = m_values.size();
int32_t idx = Args::StringToSInt32(index_str.c_str(), INT32_MAX, 0, NULL);
if (idx != INT32_MAX)
{
;
uint32_t new_idx = UINT32_MAX;
if (idx < 0)
{
// Access from the end of the array if the index is negative
new_idx = array_count - idx;
}
else
{
// Just a standard index
new_idx = idx;
}
if (new_idx < array_count)
{
if (m_values[new_idx])
{
if (sub_value)
return m_values[new_idx]->GetSubValue (exe_ctx, sub_value, will_modify, error);
else
return m_values[new_idx];
}
}
else
{
if (array_count == 0)
error.SetErrorStringWithFormat("index %i is not valid for an empty array", idx);
else if (idx > 0)
error.SetErrorStringWithFormat("index %i out of range, valid values are 0 through %zu", idx, array_count - 1);
else
error.SetErrorStringWithFormat("negative index %i out of range, valid values are -1 through -%zu", idx, array_count);
}
}
}
}
else
{
error.SetErrorStringWithFormat("invalid value path '%s', %s values only support '[<index>]' subvalues where <index> is a positive or negative array index", name, GetTypeAsCString());
}
return OptionValueSP();
}
size_t
OptionValueArray::GetArgs (Args &args) const
{
const uint32_t size = m_values.size();
std::vector<const char *> argv;
for (uint32_t i = 0; i<size; ++i)
{
const char *string_value = m_values[i]->GetStringValue ();
if (string_value)
argv.push_back(string_value);
}
if (argv.empty())
args.Clear();
else
args.SetArguments(argv.size(), &argv[0]);
return args.GetArgumentCount();
}
Error
OptionValueArray::SetArgs (const Args &args, VarSetOperationType op)
{
Error error;
const size_t argc = args.GetArgumentCount();
switch (op)
{
case eVarSetOperationInvalid:
error.SetErrorString("unsupported operation");
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
if (argc > 1)
{
uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
const uint32_t count = GetSize();
if (idx > count)
{
error.SetErrorStringWithFormat("invalid insert array index %u, index must be 0 through %u", idx, count);
}
else
{
if (op == eVarSetOperationInsertAfter)
++idx;
for (size_t i=1; i<argc; ++i, ++idx)
{
lldb::OptionValueSP value_sp (CreateValueFromCStringForTypeMask (args.GetArgumentAtIndex(i),
m_type_mask,
error));
if (value_sp)
{
if (error.Fail())
return error;
if (idx >= m_values.size())
m_values.push_back(value_sp);
else
m_values.insert(m_values.begin() + idx, value_sp);
}
else
{
error.SetErrorString("array of complex types must subclass OptionValueArray");
return error;
}
}
}
}
else
{
error.SetErrorString("insert operation takes an array index followed by one or more values");
}
break;
case eVarSetOperationRemove:
if (argc > 0)
{
const uint32_t size = m_values.size();
std::vector<int> remove_indexes;
bool all_indexes_valid = true;
size_t i;
for (i=0; i<argc; ++i)
{
const int idx = Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
if (idx >= size)
{
all_indexes_valid = false;
break;
}
else
remove_indexes.push_back(idx);
}
if (all_indexes_valid)
{
size_t num_remove_indexes = remove_indexes.size();
if (num_remove_indexes)
{
// Sort and then erase in reverse so indexes are always valid
if (num_remove_indexes > 1)
{
std::sort(remove_indexes.begin(), remove_indexes.end());
for (std::vector<int>::const_reverse_iterator pos = remove_indexes.rbegin(), end = remove_indexes.rend(); pos != end; ++pos)
{
m_values.erase(m_values.begin() + *pos);
}
}
else
{
// Only one index
m_values.erase(m_values.begin() + remove_indexes.front());
}
}
}
else
{
error.SetErrorStringWithFormat("invalid array index '%s', aborting remove operation", args.GetArgumentAtIndex(i));
}
}
else
{
error.SetErrorString("remove operation takes one or more array indices");
}
break;
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
if (argc > 1)
{
uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
const uint32_t count = GetSize();
if (idx > count)
{
error.SetErrorStringWithFormat("invalid replace array index %u, index must be 0 through %u", idx, count);
}
else
{
for (size_t i=1; i<argc; ++i, ++idx)
{
lldb::OptionValueSP value_sp (CreateValueFromCStringForTypeMask (args.GetArgumentAtIndex(i),
m_type_mask,
error));
if (value_sp)
{
if (error.Fail())
return error;
if (idx < count)
m_values[idx] = value_sp;
else
m_values.push_back(value_sp);
}
else
{
error.SetErrorString("array of complex types must subclass OptionValueArray");
return error;
}
}
}
}
else
{
error.SetErrorString("replace operation takes an array index followed by one or more values");
}
break;
case eVarSetOperationAssign:
m_values.clear();
// Fall through to append case
case eVarSetOperationAppend:
for (size_t i=0; i<argc; ++i)
{
lldb::OptionValueSP value_sp (CreateValueFromCStringForTypeMask (args.GetArgumentAtIndex(i),
m_type_mask,
error));
if (value_sp)
{
if (error.Fail())
return error;
m_value_was_set = true;
AppendValue(value_sp);
}
else
{
error.SetErrorString("array of complex types must subclass OptionValueArray");
}
}
break;
}
return error;
}
lldb::OptionValueSP
OptionValueArray::DeepCopy () const
{
OptionValueArray *copied_array = new OptionValueArray (m_type_mask, m_raw_value_dump);
lldb::OptionValueSP copied_value_sp(copied_array);
const uint32_t size = m_values.size();
for (uint32_t i = 0; i<size; ++i)
{
copied_array->AppendValue (m_values[i]->DeepCopy());
}
return copied_value_sp;
}

View File

@ -0,0 +1,87 @@
//===-- OptionValueBoolean.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/OptionValueBoolean.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueBoolean::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
// if (dump_mask & eDumpOptionName)
// DumpQualifiedName (strm);
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
strm.PutCString (m_current_value ? "true" : "false");
}
}
Error
OptionValueBoolean::SetValueFromCString (const char *value_cstr,
VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
{
bool success = false;
bool value = Args::StringToBoolean(value_cstr, false, &success);
if (success)
{
m_value_was_set = true;
m_current_value = value;
}
else
{
if (value_cstr == NULL)
error.SetErrorString ("invalid boolean string value: NULL");
else if (value_cstr[0] == '\0')
error.SetErrorString ("invalid boolean string value <empty>");
else
error.SetErrorStringWithFormat ("invalid boolean string value: '%s'", value_cstr);
}
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueBoolean::DeepCopy () const
{
return OptionValueSP(new OptionValueBoolean(*this));
}

View File

@ -0,0 +1,434 @@
//===-- OptionValueDictionary.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/OptionValueDictionary.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
// Project includes
#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/OptionValueString.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueDictionary::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
const Type dict_type = ConvertTypeMaskToType (m_type_mask);
if (dump_mask & eDumpOptionType)
{
if (m_type_mask != eTypeInvalid)
strm.Printf ("(%s of %ss)", GetTypeAsCString(), GetBuiltinTypeAsCString(dict_type));
else
strm.Printf ("(%s)", GetTypeAsCString());
}
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" =");
collection::iterator pos, end = m_values.end();
strm.IndentMore();
for (pos = m_values.begin(); pos != end; ++pos)
{
OptionValue *option_value = pos->second.get();
strm.EOL();
strm.Indent(pos->first.GetCString());
const uint32_t extra_dump_options = m_raw_value_dump ? eDumpOptionRaw : 0;
switch (dict_type)
{
default:
case eTypeArray:
case eTypeDictionary:
case eTypeProperties:
case eTypeFileSpecList:
case eTypePathMap:
strm.PutChar (' ');
option_value->DumpValue(exe_ctx, strm, dump_mask | extra_dump_options);
break;
case eTypeBoolean:
case eTypeEnum:
case eTypeFileSpec:
case eTypeFormat:
case eTypeSInt64:
case eTypeString:
case eTypeUInt64:
case eTypeUUID:
// No need to show the type for dictionaries of simple items
strm.PutCString("=");
option_value->DumpValue(exe_ctx, strm, (dump_mask & (~eDumpOptionType)) | extra_dump_options);
break;
}
}
strm.IndentLess();
}
}
size_t
OptionValueDictionary::GetArgs (Args &args) const
{
args.Clear();
collection::const_iterator pos, end = m_values.end();
for (pos = m_values.begin(); pos != end; ++pos)
{
StreamString strm;
strm.Printf("%s=", pos->first.GetCString());
pos->second->DumpValue(NULL, strm, eDumpOptionValue|eDumpOptionRaw);
args.AppendArgument(strm.GetString().c_str());
}
return args.GetArgumentCount();
}
Error
OptionValueDictionary::SetArgs (const Args &args, VarSetOperationType op)
{
Error error;
const size_t argc = args.GetArgumentCount();
switch (op)
{
case eVarSetOperationClear:
Clear();
break;
case eVarSetOperationAppend:
case eVarSetOperationReplace:
case eVarSetOperationAssign:
if (argc > 0)
{
for (size_t i=0; i<argc; ++i)
{
llvm::StringRef key_and_value(args.GetArgumentAtIndex(i));
if (!key_and_value.empty())
{
std::pair<llvm::StringRef, llvm::StringRef> kvp(key_and_value.split('='));
llvm::StringRef key = kvp.first;
bool key_valid = false;
if (!key.empty())
{
if (key.front() == '[')
{
// Key name starts with '[', so the the key value must be in single or double quotes like:
// ['<key>']
// ["<key>"]
if ((key.size() > 2) && (key.back() == ']'))
{
// Strip leading '[' and trailing ']'
key = key.substr(1, key.size()-2);
const char quote_char = key.front();
if ((quote_char == '\'') || (quote_char == '"'))
{
if ((key.size() > 2) && (key.back() == quote_char))
{
// Strip the quotes
key = key.substr(1, key.size()-2);
key_valid = true;
}
}
else
{
// square brackets, no quotes
key_valid = true;
}
}
}
else
{
// No square brackets or quotes
key_valid = true;
}
}
if (!key_valid)
{
error.SetErrorStringWithFormat("invalid key \"%s\", the key must be a bare string or surrounded by brackets with optional quotes: [<key>] or ['<key>'] or [\"<key>\"]", kvp.first.str().c_str());
return error;
}
lldb::OptionValueSP value_sp (CreateValueFromCStringForTypeMask (kvp.second.data(),
m_type_mask,
error));
if (value_sp)
{
if (error.Fail())
return error;
m_value_was_set = true;
SetValueForKey (ConstString(key), value_sp, true);
}
else
{
error.SetErrorString("dictionaries that can contain multiple types must subclass OptionValueArray");
}
}
else
{
error.SetErrorString("empty argument");
}
}
}
else
{
error.SetErrorString("assign operation takes one or more key=value arguments");
}
break;
case eVarSetOperationRemove:
if (argc > 0)
{
for (size_t i=0; i<argc; ++i)
{
ConstString key(args.GetArgumentAtIndex(i));
if (!DeleteValueForKey(key))
{
error.SetErrorStringWithFormat("no value found named '%s', aborting remove operation", key.GetCString());
break;
}
}
}
else
{
error.SetErrorString("remove operation takes one or more key arguments");
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (NULL, op);
break;
}
return error;
}
Error
OptionValueDictionary::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
{
Args args(value_cstr);
return SetArgs (args, op);
}
lldb::OptionValueSP
OptionValueDictionary::GetSubValue (const ExecutionContext *exe_ctx, const char *name, bool will_modify, Error &error) const
{
lldb::OptionValueSP value_sp;
if (name && name[0])
{
const char *sub_name = NULL;
ConstString key;
const char *open_bracket = ::strchr (name, '[');
if (open_bracket)
{
const char *key_start = open_bracket + 1;
const char *key_end = NULL;
switch (open_bracket[1])
{
case '\'':
++key_start;
key_end = strchr(key_start, '\'');
if (key_end)
{
if (key_end[1] == ']')
{
if (key_end[2])
sub_name = key_end + 2;
}
else
{
error.SetErrorStringWithFormat ("invalid value path '%s', single quoted key names must be formatted as ['<key>'] where <key> is a string that doesn't contain quotes", name);
return value_sp;
}
}
else
{
error.SetErrorString ("missing '] key name terminator, key name started with ['");
return value_sp;
}
break;
case '"':
++key_start;
key_end = strchr(key_start, '"');
if (key_end)
{
if (key_end[1] == ']')
{
if (key_end[2])
sub_name = key_end + 2;
break;
}
error.SetErrorStringWithFormat ("invalid value path '%s', double quoted key names must be formatted as [\"<key>\"] where <key> is a string that doesn't contain quotes", name);
return value_sp;
}
else
{
error.SetErrorString ("missing \"] key name terminator, key name started with [\"");
return value_sp;
}
break;
default:
key_end = strchr(key_start, ']');
if (key_end)
{
if (key_end[1])
sub_name = key_end + 1;
}
else
{
error.SetErrorString ("missing ] key name terminator, key name started with [");
return value_sp;
}
break;
}
if (key_start && key_end)
{
key.SetCStringWithLength (key_start, key_end - key_start);
value_sp = GetValueForKey (key);
if (value_sp)
{
if (sub_name)
return value_sp->GetSubValue (exe_ctx, sub_name, will_modify, error);
}
else
{
error.SetErrorStringWithFormat("dictionary does not contain a value for the key name '%s'", key.GetCString());
}
}
}
if (!value_sp && error.AsCString() == NULL)
{
error.SetErrorStringWithFormat ("invalid value path '%s', %s values only support '[<key>]' subvalues where <key> a string value optionally delimitted by single or double quotes",
name,
GetTypeAsCString());
}
}
return value_sp;
}
Error
OptionValueDictionary::SetSubValue (const ExecutionContext *exe_ctx, VarSetOperationType op, const char *name, const char *value)
{
Error error;
const bool will_modify = true;
lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, name, will_modify, error));
if (value_sp)
error = value_sp->SetValueFromCString(value, op);
else
{
if (error.AsCString() == NULL)
error.SetErrorStringWithFormat("invalid value path '%s'", name);
}
return error;
}
lldb::OptionValueSP
OptionValueDictionary::GetValueForKey (const ConstString &key) const
{
lldb::OptionValueSP value_sp;
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
value_sp = pos->second;
return value_sp;
}
const char *
OptionValueDictionary::GetStringValueForKey (const ConstString &key)
{
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
{
OptionValueString *string_value = pos->second->GetAsString();
if (string_value)
return string_value->GetCurrentValue();
}
return NULL;
}
bool
OptionValueDictionary::SetStringValueForKey (const ConstString &key,
const char *value,
bool can_replace)
{
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
{
if (!can_replace)
return false;
if (pos->second->GetType() == OptionValue::eTypeString)
{
pos->second->SetValueFromCString(value);
return true;
}
}
m_values[key] = OptionValueSP (new OptionValueString (value));
return true;
}
bool
OptionValueDictionary::SetValueForKey (const ConstString &key,
const lldb::OptionValueSP &value_sp,
bool can_replace)
{
// Make sure the value_sp object is allowed to contain
// values of the type passed in...
if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
{
if (!can_replace)
{
collection::const_iterator pos = m_values.find (key);
if (pos != m_values.end())
return false;
}
m_values[key] = value_sp;
return true;
}
return false;
}
bool
OptionValueDictionary::DeleteValueForKey (const ConstString &key)
{
collection::iterator pos = m_values.find (key);
if (pos != m_values.end())
{
m_values.erase(pos);
return true;
}
return false;
}
lldb::OptionValueSP
OptionValueDictionary::DeepCopy () const
{
OptionValueDictionary *copied_dict = new OptionValueDictionary (m_type_mask, m_raw_value_dump);
lldb::OptionValueSP copied_value_sp(copied_dict);
collection::const_iterator pos, end = m_values.end();
for (pos = m_values.begin(); pos != end; ++pos)
{
StreamString strm;
strm.Printf("%s=", pos->first.GetCString());
copied_dict->SetValueForKey (pos->first, pos->second->DeepCopy(), true);
}
return copied_value_sp;
}

View File

@ -0,0 +1,131 @@
//===-- OptionValueEnumeration.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/OptionValueEnumeration.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
using namespace lldb;
using namespace lldb_private;
OptionValueEnumeration::OptionValueEnumeration (const OptionEnumValueElement *enumerators,
enum_type value) :
OptionValue(),
m_current_value (value),
m_default_value (value),
m_enumerations ()
{
SetEnumerations(enumerators);
}
OptionValueEnumeration::~OptionValueEnumeration()
{
}
void
OptionValueEnumeration::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
const size_t count = m_enumerations.GetSize ();
for (size_t i=0; i<count; ++i)
{
if (m_enumerations.GetValueAtIndexUnchecked(i).value == m_current_value)
{
strm.PutCString(m_enumerations.GetCStringAtIndex(i));
return;
}
}
strm.Printf("%llu", (uint64_t)m_current_value);
}
}
Error
OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
if (value && value[0])
{
ConstString const_enumerator_name(value);
const EnumerationMapEntry *enumerator_entry = m_enumerations.FindFirstValueForName (const_enumerator_name.GetCString());
if (enumerator_entry)
{
m_current_value = enumerator_entry->value.value;
}
else
{
StreamString error_strm;
error_strm.Printf("invalid enumeration value '%s'", value);
const size_t count = m_enumerations.GetSize ();
if (count)
{
error_strm.Printf(", valid values are: %s", m_enumerations.GetCStringAtIndex(0));
for (size_t i=1; i<count; ++i)
{
error_strm.Printf (", %s", m_enumerations.GetCStringAtIndex(i));
}
}
error.SetErrorString(error_strm.GetData());
}
}
else
{
error.SetErrorString("invalid enumeration value");
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value, op);
break;
}
return error;
}
void
OptionValueEnumeration::SetEnumerations (const OptionEnumValueElement *enumerators)
{
m_enumerations.Clear();
if (enumerators)
{
for (size_t i=0; enumerators[i].string_value != NULL; ++i)
{
ConstString const_enumerator_name(enumerators[i].string_value);
EnumeratorInfo enumerator_info = { enumerators[i].value, enumerators[i].usage };
m_enumerations.Append (const_enumerator_name.GetCString(), enumerator_info);
}
m_enumerations.Sort();
}
}
lldb::OptionValueSP
OptionValueEnumeration::DeepCopy () const
{
return OptionValueSP(new OptionValueEnumeration(*this));
}

View File

@ -0,0 +1,116 @@
//===-- OptionValueFileSpec.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/OptionValueFileSpec.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueFileSpec::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
if (m_current_value)
{
if (m_current_value.GetDirectory())
{
strm << '"' << m_current_value.GetDirectory();
if (m_current_value.GetFilename())
strm << '/' << m_current_value.GetFilename();
strm << '"';
}
else
{
strm << '"' << m_current_value.GetFilename() << '"';
}
}
}
}
Error
OptionValueFileSpec::SetValueFromCString (const char *value_cstr,
VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
if (value_cstr && value_cstr[0])
{
m_value_was_set = true;
m_current_value.SetFile(value_cstr, false);
}
else
{
error.SetErrorString("invalid value string");
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueFileSpec::DeepCopy () const
{
return OptionValueSP(new OptionValueFileSpec(*this));
}
size_t
OptionValueFileSpec::AutoComplete (CommandInterpreter &interpreter,
const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches)
{
word_complete = false;
matches.Clear();
CommandCompletions::InvokeCommonCompletionCallbacks (interpreter,
CommandCompletions::eDiskFileCompletion,
s,
match_start_point,
max_return_elements,
NULL,
word_complete,
matches);
return matches.GetSize();
}

View File

@ -0,0 +1,186 @@
//===-- OptionValueFileSpecList.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/OptionValueFileSpecList.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueFileSpecList::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.Printf (" =%s", m_current_value.GetSize() > 0 ? "\n" : "");
strm.IndentMore();
const uint32_t size = m_current_value.GetSize();
for (uint32_t i = 0; i<size; ++i)
{
strm.Indent();
strm.Printf("[%u]: ", i);
m_current_value.GetFileSpecAtIndex(i).Dump(&strm);
}
strm.IndentLess();
}
}
Error
OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperationType op)
{
Error error;
Args args(value);
const size_t argc = args.GetArgumentCount();
switch (op)
{
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
if (argc > 1)
{
uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
const uint32_t count = m_current_value.GetSize();
if (idx > count)
{
error.SetErrorStringWithFormat("invalid file list index %u, index must be 0 through %u", idx, count);
}
else
{
for (size_t i=1; i<argc; ++i, ++idx)
{
FileSpec file (args.GetArgumentAtIndex(i), false);
if (idx < count)
m_current_value.Replace(idx, file);
else
m_current_value.Append(file);
}
}
}
else
{
error.SetErrorString("replace operation takes an array index followed by one or more values");
}
break;
case eVarSetOperationAssign:
m_current_value.Clear();
// Fall through to append case
case eVarSetOperationAppend:
if (argc > 0)
{
m_value_was_set = true;
for (size_t i=0; i<argc; ++i)
{
FileSpec file (args.GetArgumentAtIndex(i), false);
m_current_value.Append(file);
}
}
else
{
error.SetErrorString("assign operation takes at least one file path argument");
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
if (argc > 1)
{
uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
const uint32_t count = m_current_value.GetSize();
if (idx > count)
{
error.SetErrorStringWithFormat("invalid insert file list index %u, index must be 0 through %u", idx, count);
}
else
{
if (op == eVarSetOperationInsertAfter)
++idx;
for (size_t i=1; i<argc; ++i, ++idx)
{
FileSpec file (args.GetArgumentAtIndex(i), false);
m_current_value.Insert (idx, file);
}
}
}
else
{
error.SetErrorString("insert operation takes an array index followed by one or more values");
}
break;
case eVarSetOperationRemove:
if (argc > 0)
{
std::vector<int> remove_indexes;
bool all_indexes_valid = true;
size_t i;
for (i=0; all_indexes_valid && i<argc; ++i)
{
const int idx = Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
if (idx == INT32_MAX)
all_indexes_valid = false;
else
remove_indexes.push_back(idx);
}
if (all_indexes_valid)
{
size_t num_remove_indexes = remove_indexes.size();
if (num_remove_indexes)
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
for (int i=num_remove_indexes-1; i<num_remove_indexes; ++i)
{
m_current_value.Remove (i);
}
}
}
else
{
error.SetErrorStringWithFormat("invalid array index '%s', aborting remove operation", args.GetArgumentAtIndex(i));
}
}
else
{
error.SetErrorString("remove operation takes one or more array index");
}
break;
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value, op);
break;
}
return error;
m_value_was_set = true;
return Error();
}
lldb::OptionValueSP
OptionValueFileSpecList::DeepCopy () const
{
return OptionValueSP(new OptionValueFileSpecList(*this));
}

View File

@ -0,0 +1,76 @@
//===-- OptionValueFormat.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/OptionValueFormat.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/FormatManager.h"
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueFormat::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
strm.PutCString (FormatManager::GetFormatAsCString (m_current_value));
}
}
Error
OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
{
Format new_format;
error = Args::StringToFormat (value_cstr, new_format, NULL);
if (error.Success())
{
m_value_was_set = true;
m_current_value = new_format;
}
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueFormat::DeepCopy () const
{
return OptionValueSP(new OptionValueFormat(*this));
}

View File

@ -0,0 +1,185 @@
//===-- OptionValuePathMappings.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/OptionValuePathMappings.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValuePathMappings::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.Printf (" =%s", (m_path_mappings.GetSize() > 0) ? "\n" : "");
m_path_mappings.Dump(&strm);
}
}
Error
OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperationType op)
{
Error error;
Args args(value);
const size_t argc = args.GetArgumentCount();
switch (op)
{
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
// Must be at least one index + 1 pair of paths, and the pair count must be even
if (argc >= 3 && (((argc - 1) & 1) == 0))
{
uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
const uint32_t count = m_path_mappings.GetSize();
if (idx > count)
{
error.SetErrorStringWithFormat("invalid file list index %u, index must be 0 through %u", idx, count);
}
else
{
for (size_t i=1; i<argc; i += 2, ++idx)
{
ConstString a(args.GetArgumentAtIndex(i));
ConstString b(args.GetArgumentAtIndex(i+1));
if (!m_path_mappings.Replace (a, b, idx, m_notify_changes))
m_path_mappings.Append(a, b, m_notify_changes);
}
}
}
else
{
error.SetErrorString("replace operation takes an array index followed by one or more path pairs");
}
break;
case eVarSetOperationAssign:
if (argc < 2 || (argc & 1))
{
error.SetErrorString("assign operation takes one or more path pairs");
break;
}
m_path_mappings.Clear(m_notify_changes);
// Fall through to append case
case eVarSetOperationAppend:
if (argc < 2 || (argc & 1))
{
error.SetErrorString("append operation takes one or more path pairs");
break;
}
else
{
for (size_t i=0; i<argc; i += 2)
{
ConstString a(args.GetArgumentAtIndex(i));
ConstString b(args.GetArgumentAtIndex(i+1));
m_path_mappings.Append(a, b, m_notify_changes);
m_value_was_set = true;
}
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
// Must be at least one index + 1 pair of paths, and the pair count must be even
if (argc >= 3 && (((argc - 1) & 1) == 0))
{
uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
const uint32_t count = m_path_mappings.GetSize();
if (idx > count)
{
error.SetErrorStringWithFormat("invalid file list index %u, index must be 0 through %u", idx, count);
}
else
{
if (op == eVarSetOperationInsertAfter)
++idx;
for (size_t i=1; i<argc; i += 2, ++idx)
{
ConstString a(args.GetArgumentAtIndex(i));
ConstString b(args.GetArgumentAtIndex(i+1));
m_path_mappings.Insert (a, b, idx, m_notify_changes);
}
}
}
else
{
error.SetErrorString("insert operation takes an array index followed by one or more path pairs");
}
break;
case eVarSetOperationRemove:
if (argc > 0)
{
std::vector<int> remove_indexes;
bool all_indexes_valid = true;
size_t i;
for (i=0; all_indexes_valid && i<argc; ++i)
{
const int idx = Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX);
if (idx == INT32_MAX)
all_indexes_valid = false;
else
remove_indexes.push_back(idx);
}
if (all_indexes_valid)
{
size_t num_remove_indexes = remove_indexes.size();
if (num_remove_indexes)
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
for (int i=num_remove_indexes-1; i<num_remove_indexes; ++i)
{
m_path_mappings.Remove (i, m_notify_changes);
}
}
}
else
{
error.SetErrorStringWithFormat("invalid array index '%s', aborting remove operation", args.GetArgumentAtIndex(i));
}
}
else
{
error.SetErrorString("remove operation takes one or more array index");
}
break;
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value, op);
break;
}
return error;
m_value_was_set = true;
return Error();
}
lldb::OptionValueSP
OptionValuePathMappings::DeepCopy () const
{
return OptionValueSP(new OptionValuePathMappings(*this));
}

View File

@ -0,0 +1,719 @@
//===-- OptionValueProperties.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/OptionValueProperties.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Flags.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StringList.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/OptionValues.h"
#include "lldb/Interpreter/Property.h"
using namespace lldb;
using namespace lldb_private;
OptionValueProperties::OptionValueProperties (const ConstString &name) :
m_name (name)
{
}
OptionValueProperties::OptionValueProperties (const OptionValueProperties &global_properties) :
m_name (global_properties.m_name),
m_properties (global_properties.m_properties),
m_name_to_index (global_properties.m_name_to_index)
{
// We now have an exact copy of "global_properties". We need to now
// find all non-global settings and copy the property values so that
// all non-global settings get new OptionValue instances created for
// them.
const size_t num_properties = m_properties.size();
for (size_t i=0; i<num_properties; ++i)
{
// Duplicate any values that are not global when contructing properties from
// a global copy
if (m_properties[i].IsGlobal() == false)
{
lldb::OptionValueSP new_value_sp (m_properties[i].GetValue()->DeepCopy());
m_properties[i].SetOptionValue(new_value_sp);
}
}
}
size_t
OptionValueProperties::GetNumProperties() const
{
return m_properties.size();
}
void
OptionValueProperties::Initialize (const PropertyDefinition *defs)
{
for (size_t i=0; defs[i].name; ++i)
{
Property property(defs[i]);
assert(property.IsValid());
m_name_to_index.Append(property.GetName().GetCString(),m_properties.size());
property.GetValue()->SetParent(shared_from_this());
m_properties.push_back(property);
}
m_name_to_index.Sort();
}
void
OptionValueProperties::AppendProperty(const ConstString &name,
const ConstString &desc,
bool is_global,
const OptionValueSP &value_sp)
{
Property property(name, desc, is_global, value_sp);
m_name_to_index.Append(name.GetCString(),m_properties.size());
m_properties.push_back(property);
value_sp->SetParent (shared_from_this());
m_name_to_index.Sort();
}
//bool
//OptionValueProperties::GetQualifiedName (Stream &strm)
//{
// bool dumped_something = false;
//// lldb::OptionValuePropertiesSP parent_sp(GetParent ());
//// if (parent_sp)
//// {
//// parent_sp->GetQualifiedName (strm);
//// strm.PutChar('.');
//// dumped_something = true;
//// }
// if (m_name)
// {
// strm << m_name;
// dumped_something = true;
// }
// return dumped_something;
//}
//
lldb::OptionValueSP
OptionValueProperties::GetValueForKey (const ExecutionContext *exe_ctx,
const ConstString &key,
bool will_modify) const
{
lldb::OptionValueSP value_sp;
size_t idx = m_name_to_index.Find (key.GetCString(), SIZE_MAX);
if (idx < m_properties.size())
value_sp = GetPropertyAtIndex(exe_ctx, will_modify, idx)->GetValue();
return value_sp;
}
lldb::OptionValueSP
OptionValueProperties::GetSubValue (const ExecutionContext *exe_ctx,
const char *name,
bool will_modify,
Error &error) const
{
lldb::OptionValueSP value_sp;
if (name && name[0])
{
const char *sub_name = NULL;
ConstString key;
size_t key_len = ::strcspn (name, ".[{");
if (name[key_len])
{
key.SetCStringWithLength (name, key_len);
sub_name = name + key_len;
}
else
key.SetCString (name);
value_sp = GetValueForKey (exe_ctx, key, will_modify);
if (sub_name && value_sp)
{
switch (sub_name[0])
{
case '.':
return value_sp->GetSubValue (exe_ctx, sub_name + 1, will_modify, error);
case '{':
// Predicate matching for predicates like
// "<setting-name>{<predicate>}"
// strings are parsed by the current OptionValueProperties subclass
// to mean whatever they want to. For instance a subclass of
// OptionValueProperties for a lldb_private::Target might implement:
// "target.run-args{arch==i386}" -- only set run args if the arch is i386
// "target.run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the path matches
// "target.run-args{basename==test&&arch==x86_64}" -- only set run args if exectable basename is "test" and arch is "x86_64"
if (sub_name[1])
{
const char *predicate_start = sub_name + 1;
const char *predicate_end = strchr(predicate_start, '}');
if (predicate_end)
{
std::string predicate(predicate_start, predicate_end);
if (PredicateMatches(exe_ctx, predicate.c_str()))
{
if (predicate_end[1])
{
// Still more subvalue string to evaluate
return value_sp->GetSubValue (exe_ctx, predicate_end + 1, will_modify, error);
}
else
{
// We have a match!
break;
}
}
}
}
// Predicate didn't match or wasn't correctly formed
value_sp.reset();
break;
case '[':
// Array or dictionary access for subvalues like:
// "[12]" -- access 12th array element
// "['hello']" -- dictionary access of key named hello
return value_sp->GetSubValue (exe_ctx, sub_name, will_modify, error);
default:
value_sp.reset();
break;
}
}
}
return value_sp;
}
Error
OptionValueProperties::SetSubValue (const ExecutionContext *exe_ctx,
VarSetOperationType op,
const char *name,
const char *value)
{
Error error;
const bool will_modify = true;
lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, name, will_modify, error));
if (value_sp)
error = value_sp->SetValueFromCString(value, op);
else
{
if (error.AsCString() == NULL)
error.SetErrorStringWithFormat("invalid value path '%s'", name);
}
return error;
}
ConstString
OptionValueProperties::GetPropertyNameAtIndex (uint32_t idx) const
{
const Property *property = GetPropertyAtIndex(NULL, false, idx);
if (property)
return property->GetName();
return ConstString();
}
const char *
OptionValueProperties::GetPropertyDescriptionAtIndex (uint32_t idx) const
{
const Property *property = GetPropertyAtIndex(NULL, false, idx);
if (property)
return property->GetDescription();
return NULL;
}
uint32_t
OptionValueProperties::GetPropertyIndex (const ConstString &name) const
{
return m_name_to_index.Find (name.GetCString(), SIZE_MAX);
}
const Property *
OptionValueProperties::GetProperty (const ExecutionContext *exe_ctx, bool will_modify, const ConstString &name) const
{
return GetPropertyAtIndex (exe_ctx, will_modify, m_name_to_index.Find (name.GetCString(), SIZE_MAX));
}
const Property *
OptionValueProperties::GetPropertyAtIndex (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const
{
return ProtectedGetPropertyAtIndex (idx);
}
lldb::OptionValueSP
OptionValueProperties::GetPropertyValueAtIndex (const ExecutionContext *exe_ctx,
bool will_modify,
uint32_t idx) const
{
const Property *setting = GetPropertyAtIndex (exe_ctx, will_modify, idx);
if (setting)
return setting->GetValue();
return OptionValueSP();
}
OptionValuePathMappings *
OptionValueProperties::GetPropertyAtIndexAsOptionValuePathMappings (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const
{
OptionValueSP value_sp(GetPropertyValueAtIndex (exe_ctx, will_modify, idx));
if (value_sp)
return value_sp->GetAsPathMappings();
return NULL;
}
OptionValueFileSpecList *
OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpecList (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const
{
OptionValueSP value_sp(GetPropertyValueAtIndex (exe_ctx, will_modify, idx));
if (value_sp)
return value_sp->GetAsFileSpecList();
return NULL;
}
OptionValueArch *
OptionValueProperties::GetPropertyAtIndexAsOptionValueArch (const ExecutionContext *exe_ctx, uint32_t idx) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
return property->GetValue()->GetAsArch();
return NULL;
}
bool
OptionValueProperties::GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
{
const OptionValueArray *array = value->GetAsArray();
if (array)
return array->GetArgs(args);
else
{
const OptionValueDictionary *dict = value->GetAsDictionary();
if (dict)
return dict->GetArgs(args);
}
}
}
return false;
}
bool
OptionValueProperties::SetPropertyAtIndexFromArgs (const ExecutionContext *exe_ctx, uint32_t idx, const Args &args)
{
const Property *property = GetPropertyAtIndex (exe_ctx, true, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
{
OptionValueArray *array = value->GetAsArray();
if (array)
return array->SetArgs(args, eVarSetOperationAssign).Success();
else
{
OptionValueDictionary *dict = value->GetAsDictionary();
if (dict)
return dict->SetArgs(args, eVarSetOperationAssign).Success();
}
}
}
return false;
}
bool
OptionValueProperties::GetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool fail_value) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetBooleanValue(fail_value);
}
return fail_value;
}
bool
OptionValueProperties::SetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool new_value)
{
const Property *property = GetPropertyAtIndex (exe_ctx, true, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
{
value->SetBooleanValue(new_value);
return true;
}
}
return false;
}
OptionValueDictionary *
OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary (const ExecutionContext *exe_ctx, uint32_t idx) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
return property->GetValue()->GetAsDictionary();
return NULL;
}
int64_t
OptionValueProperties::GetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetEnumerationValue(fail_value);
}
return fail_value;
}
bool
OptionValueProperties::SetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value)
{
const Property *property = GetPropertyAtIndex (exe_ctx, true, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->SetEnumerationValue(new_value);
}
return false;
}
FileSpec
OptionValueProperties::GetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetFileSpecValue();
}
return FileSpec();
}
bool
OptionValueProperties::SetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx, const FileSpec &new_file_spec)
{
const Property *property = GetPropertyAtIndex (exe_ctx, true, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->SetFileSpecValue(new_file_spec);
}
return false;
}
const RegularExpression *
OptionValueProperties::GetPropertyAtIndexAsOptionValueRegex (const ExecutionContext *exe_ctx, uint32_t idx) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetRegexValue();
}
return NULL;
}
OptionValueSInt64 *
OptionValueProperties::GetPropertyAtIndexAsOptionValueSInt64 (const ExecutionContext *exe_ctx, uint32_t idx) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetAsSInt64();
}
return NULL;
}
int64_t
OptionValueProperties::GetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetSInt64Value(fail_value);
}
return fail_value;
}
bool
OptionValueProperties::SetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value)
{
const Property *property = GetPropertyAtIndex (exe_ctx, true, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->SetSInt64Value(new_value);
}
return false;
}
const char *
OptionValueProperties::GetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *fail_value) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetStringValue(fail_value);
}
return fail_value;
}
bool
OptionValueProperties::SetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *new_value)
{
const Property *property = GetPropertyAtIndex (exe_ctx, true, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->SetStringValue(new_value);
}
return false;
}
uint64_t
OptionValueProperties::GetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t fail_value) const
{
const Property *property = GetPropertyAtIndex (exe_ctx, false, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->GetUInt64Value(fail_value);
}
return fail_value;
}
bool
OptionValueProperties::SetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t new_value)
{
const Property *property = GetPropertyAtIndex (exe_ctx, true, idx);
if (property)
{
OptionValue *value = property->GetValue().get();
if (value)
return value->SetUInt64Value(new_value);
}
return false;
}
bool
OptionValueProperties::Clear ()
{
const size_t num_properties = m_properties.size();
for (size_t i=0; i<num_properties; ++i)
m_properties[i].GetValue()->Clear();
return true;
}
Error
OptionValueProperties::SetValueFromCString (const char *value, VarSetOperationType op)
{
Error error;
// Args args(value_cstr);
// const size_t argc = args.GetArgumentCount();
switch (op)
{
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
case eVarSetOperationRemove:
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value, op);
break;
}
return error;
}
void
OptionValueProperties::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
const size_t num_properties = m_properties.size();
for (size_t i=0; i<num_properties; ++i)
{
const Property *property = GetPropertyAtIndex(exe_ctx, false, i);
if (property)
{
OptionValue *option_value = property->GetValue().get();
assert (option_value);
const bool transparent_value = option_value->ValueIsTransparent ();
property->Dump (exe_ctx,
strm,
dump_mask);
if (!transparent_value)
strm.EOL();
}
}
}
Error
OptionValueProperties::DumpPropertyValue (const ExecutionContext *exe_ctx,
Stream &strm,
const char *property_path,
uint32_t dump_mask)
{
Error error;
const bool will_modify = false;
lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, property_path, will_modify, error));
if (value_sp)
{
if (!value_sp->ValueIsTransparent ())
{
if (dump_mask & eDumpOptionName)
strm.PutCString (property_path);
if (dump_mask & ~eDumpOptionName)
strm.PutChar (' ');
}
value_sp->DumpValue (exe_ctx, strm, dump_mask);
}
return error;
}
lldb::OptionValueSP
OptionValueProperties::DeepCopy () const
{
assert(!"this shouldn't happen");
}
const Property *
OptionValueProperties::GetPropertyAtPath (const ExecutionContext *exe_ctx,
bool will_modify,
const char *name) const
{
const Property *property = NULL;
if (name && name[0])
{
const char *sub_name = NULL;
ConstString key;
size_t key_len = ::strcspn (name, ".[{");
if (name[key_len])
{
key.SetCStringWithLength (name, key_len);
sub_name = name + key_len;
}
else
key.SetCString (name);
property = GetProperty (exe_ctx, will_modify, key);
if (sub_name && property)
{
if (sub_name[0] == '.')
{
OptionValueProperties *sub_properties = property->GetValue()->GetAsProperties();
if (sub_properties)
return sub_properties->GetPropertyAtPath(exe_ctx, will_modify, sub_name + 1);
}
property = NULL;
}
}
return property;
}
void
OptionValueProperties::DumpAllDescriptions (CommandInterpreter &interpreter,
Stream &strm) const
{
size_t max_name_len = 0;
const size_t num_properties = m_properties.size();
for (size_t i=0; i<num_properties; ++i)
{
const Property *property = ProtectedGetPropertyAtIndex(i);
if (property)
max_name_len = std::max<size_t>(property->GetName().GetLength(), max_name_len);
}
for (size_t i=0; i<num_properties; ++i)
{
const Property *property = ProtectedGetPropertyAtIndex(i);
if (property)
property->DumpDescription (interpreter, strm, max_name_len, false);
}
}
void
OptionValueProperties::Apropos (const char *keyword, std::vector<const Property *> &matching_properties) const
{
const size_t num_properties = m_properties.size();
StreamString strm;
for (size_t i=0; i<num_properties; ++i)
{
const Property *property = ProtectedGetPropertyAtIndex(i);
if (property)
{
const OptionValueProperties *properties = property->GetValue()->GetAsProperties();
if (properties)
{
properties->Apropos (keyword, matching_properties);
}
else
{
bool match = false;
const char *name = property->GetName().GetCString();
if (name && ::strcasestr(name, keyword))
match = true;
else
{
const char *desc = property->GetDescription();
if (desc && ::strcasestr(desc, keyword))
match = true;
}
if (match)
{
matching_properties.push_back (property);
}
}
}
}
}

View File

@ -0,0 +1,86 @@
//===-- OptionValueRegex.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/OptionValueRegex.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueRegex::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
if (m_regex.IsValid())
{
const char *regex_text = m_regex.GetText();
if (regex_text && regex_text[0])
strm.Printf ("%s", regex_text);
}
else
{
}
}
}
Error
OptionValueRegex::SetValueFromCString (const char *value_cstr,
VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationInvalid:
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
case eVarSetOperationClear:
Clear();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
if (m_regex.Compile (value_cstr, m_regex.GetCompileFlags()))
{
m_value_was_set = true;
}
else
{
char regex_error[1024];
if (m_regex.GetErrorAsCString(regex_error, sizeof(regex_error)))
error.SetErrorString (regex_error);
else
error.SetErrorStringWithFormat ("regex error %u", m_regex.GetErrorCode());
}
break;
}
return error;
}
lldb::OptionValueSP
OptionValueRegex::DeepCopy () const
{
return OptionValueSP(new OptionValueRegex(m_regex.GetText(), m_regex.GetCompileFlags()));
}

View File

@ -0,0 +1,89 @@
//===-- OptionValueSInt64.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/OptionValueSInt64.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueSInt64::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
//printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %lli\n", this, exe_ctx, m_current_value);
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
// if (dump_mask & eDumpOptionName)
// DumpQualifiedName (strm);
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
strm.Printf ("%lli", m_current_value);
}
}
Error
OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
{
//printf ("%p: SetValueFromCString (s=\"%s\", op=%i)\n", this, value_cstr, op);
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
{
bool success = false;
int64_t value = Args::StringToSInt64 (value_cstr, 0, 0, &success);
if (success)
{
if (value >= m_min_value && value <= m_max_value)
{
m_value_was_set = true;
m_current_value = value;
}
else
error.SetErrorStringWithFormat ("%lli is out of range, valid values must be between %lli and %lli.",
value,
m_min_value,
m_max_value);
}
else
{
error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'", value_cstr);
}
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueSInt64::DeepCopy () const
{
return OptionValueSP(new OptionValueSInt64(*this));
}

View File

@ -0,0 +1,77 @@
//===-- OptionValueString.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/OptionValueString.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueString::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
if (!m_current_value.empty() || m_value_was_set)
{
if (dump_mask & eDumpOptionRaw)
strm.Printf ("%s", m_current_value.c_str());
else
strm.Printf ("\"%s\"", m_current_value.c_str());
}
}
}
Error
OptionValueString::SetValueFromCString (const char *value_cstr,
VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationInvalid:
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
case eVarSetOperationAppend:
if (value_cstr && value_cstr[0])
m_current_value += value_cstr;
break;
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
m_value_was_set = true;
SetCurrentValue (value_cstr);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueString::DeepCopy () const
{
return OptionValueSP(new OptionValueString(*this));
}

View File

@ -0,0 +1,89 @@
//===-- OptionValueUInt64.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/OptionValueUInt64.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
using namespace lldb_private;
lldb::OptionValueSP
OptionValueUInt64::Create (const char *value_cstr, Error &error)
{
lldb::OptionValueSP value_sp (new OptionValueUInt64());
error = value_sp->SetValueFromCString (value_cstr);
if (error.Fail())
value_sp.reset();
return value_sp;
}
void
OptionValueUInt64::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
strm.Printf ("%llu", m_current_value);
}
}
Error
OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear ();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
{
bool success = false;
uint64_t value = Args::StringToUInt64 (value_cstr, 0, 0, &success);
if (success)
{
m_value_was_set = true;
m_current_value = value;
}
else
{
error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'", value_cstr);
}
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueUInt64::DeepCopy () const
{
return OptionValueSP(new OptionValueUInt64(*this));
}

View File

@ -0,0 +1,70 @@
//===-- OptionValueUUID.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/OptionValueUUID.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueUUID::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
m_uuid.Dump (&strm);
}
}
Error
OptionValueUUID::SetValueFromCString (const char *value_cstr,
VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationClear:
Clear();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
{
if (m_uuid.SetfromCString(value_cstr) == 0)
error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr);
else
m_value_was_set = true;
}
break;
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
}
return error;
}
lldb::OptionValueSP
OptionValueUUID::DeepCopy () const
{
return OptionValueSP(new OptionValueUUID(*this));
}

View File

@ -0,0 +1,268 @@
//===-- Property.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/Property.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionValues.h"
using namespace lldb;
using namespace lldb_private;
Property::Property (const PropertyDefinition &definition) :
m_name (definition.name),
m_description (definition.description),
m_value_sp (),
m_is_global (definition.global)
{
switch (definition.type)
{
case OptionValue::eTypeInvalid:
case OptionValue::eTypeProperties:
break;
case OptionValue::eTypeArch:
// "definition.default_uint_value" is not used
// "definition.default_cstr_value" as a string value that represents the default string value for the architecture/triple
m_value_sp.reset (new OptionValueArch(definition.default_cstr_value));
break;
case OptionValue::eTypeArgs:
// "definition.default_uint_value" is always a OptionValue::Type
m_value_sp.reset (new OptionValueArgs());
break;
case OptionValue::eTypeArray:
// "definition.default_uint_value" is always a OptionValue::Type
m_value_sp.reset (new OptionValueArray(OptionValue::ConvertTypeToMask((OptionValue::Type)definition.default_uint_value)));
break;
case OptionValue::eTypeBoolean:
// "definition.default_uint_value" is the default boolean value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
if (definition.default_cstr_value)
m_value_sp.reset (new OptionValueBoolean(Args::StringToBoolean (definition.default_cstr_value, false, NULL)));
else
m_value_sp.reset (new OptionValueBoolean(definition.default_uint_value != 0));
break;
case OptionValue::eTypeDictionary:
// "definition.default_uint_value" is always a OptionValue::Type
m_value_sp.reset (new OptionValueDictionary(OptionValue::ConvertTypeToMask((OptionValue::Type)definition.default_uint_value)));
break;
case OptionValue::eTypeEnum:
// "definition.default_uint_value" is the default enumeration value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
{
OptionValueEnumeration *enum_value = new OptionValueEnumeration(definition.enum_values, definition.default_uint_value);
m_value_sp.reset (enum_value);
if (definition.default_cstr_value)
{
if (enum_value->SetValueFromCString(definition.default_cstr_value).Success())
{
enum_value->SetDefaultValue(enum_value->GetCurrentValue());
// Call Clear() since we don't want the value to appear as
// having been set since we called SetValueFromCString() above.
// Clear will set the current value to the default and clear
// the boolean that says that the value has been set.
enum_value->Clear();
}
}
}
break;
case OptionValue::eTypeFileSpec:
// "definition.default_uint_value" represents if the "definition.default_cstr_value" should
// be resolved or not
m_value_sp.reset (new OptionValueFileSpec(FileSpec(definition.default_cstr_value, definition.default_uint_value != 0)));
break;
case OptionValue::eTypeFileSpecList:
// "definition.default_uint_value" is not used for a OptionValue::eTypeFileSpecList
m_value_sp.reset (new OptionValueFileSpecList());
break;
case OptionValue::eTypeFormat:
// "definition.default_uint_value" is the default format enumeration value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
{
Format new_format = eFormatInvalid;
if (definition.default_cstr_value)
Args::StringToFormat (definition.default_cstr_value, new_format, NULL);
else
new_format = (Format)definition.default_uint_value;
m_value_sp.reset (new OptionValueFormat(new_format));
}
break;
case OptionValue::eTypePathMap:
// "definition.default_uint_value" tells us if notifications should occur for
// path mappings
m_value_sp.reset (new OptionValuePathMappings(definition.default_uint_value != 0));
break;
case OptionValue::eTypeRegex:
// "definition.default_uint_value" is used to the regular expression flags
// "definition.default_cstr_value" the default regular expression value
// value.
m_value_sp.reset (new OptionValueRegex(definition.default_cstr_value, definition.default_uint_value));
break;
case OptionValue::eTypeSInt64:
// "definition.default_uint_value" is the default integer value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
m_value_sp.reset (new OptionValueSInt64(definition.default_cstr_value ? Args::StringToSInt64 (definition.default_cstr_value) : definition.default_uint_value));
break;
case OptionValue::eTypeUInt64:
// "definition.default_uint_value" is the default unsigned integer value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the default
// value.
m_value_sp.reset (new OptionValueUInt64(definition.default_cstr_value ? Args::StringToUInt64 (definition.default_cstr_value) : definition.default_uint_value));
break;
case OptionValue::eTypeUUID:
// "definition.default_uint_value" is not used for a OptionValue::eTypeUUID
// "definition.default_cstr_value" can contain a default UUID value
{
UUID uuid;
if (definition.default_cstr_value)
uuid.SetfromCString (definition.default_cstr_value);
m_value_sp.reset (new OptionValueUUID(uuid));
}
break;
case OptionValue::eTypeString:
// "definition.default_uint_value" is not used for a OptionValueFileSpecList
// "definition.default_cstr_value" can contain a default string value
m_value_sp.reset (new OptionValueString(definition.default_cstr_value));
break;
}
}
Property::Property (const ConstString &name,
const ConstString &desc,
bool is_global,
const lldb::OptionValueSP &value_sp) :
m_name (name),
m_description (desc),
m_value_sp (value_sp),
m_is_global (is_global)
{
}
bool
Property::DumpQualifiedName(Stream &strm) const
{
if (m_name)
{
if (m_value_sp->DumpQualifiedName(strm))
strm.PutChar('.');
strm << m_name;
return true;
}
return false;
}
void
Property::Dump (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) const
{
if (m_value_sp)
{
const bool dump_desc = dump_mask & OptionValue::eDumpOptionDescription;
const bool transparent = m_value_sp->ValueIsTransparent ();
if (dump_desc || !transparent)
{
if ((dump_mask & OptionValue::eDumpOptionName) && m_name)
{
DumpQualifiedName(strm);
if (dump_mask & ~OptionValue::eDumpOptionName)
strm.PutChar(' ');
}
}
if (dump_desc)
{
const char *desc = GetDescription();
if (desc)
strm.Printf ("-- %s", desc);
if (transparent && (dump_mask == (OptionValue::eDumpOptionName | OptionValue::eDumpOptionDescription)))
strm.EOL();
}
m_value_sp->DumpValue(exe_ctx, strm, dump_mask);
}
}
void
Property::DumpDescription (CommandInterpreter &interpreter,
Stream &strm,
uint32_t output_width,
bool display_qualified_name) const
{
if (m_value_sp)
{
const char *desc = GetDescription();
if (desc)
{
StreamString qualified_name;
const OptionValueProperties *sub_properties = m_value_sp->GetAsProperties();
if (sub_properties)
{
strm.EOL();
if (m_value_sp->DumpQualifiedName(qualified_name))
strm.Printf("'%s' variables:\n\n", qualified_name.GetString().c_str());
sub_properties->DumpAllDescriptions(interpreter, strm);
}
else
{
if (desc)
{
if (display_qualified_name)
{
StreamString qualified_name;
DumpQualifiedName(qualified_name);
interpreter.OutputFormattedHelpText (strm,
qualified_name.GetString().c_str(),
"--",
desc,
output_width);
}
else
{
interpreter.OutputFormattedHelpText (strm,
m_name.GetCString(),
"--",
desc,
output_width);
}
}
}
}
}
}

View File

@ -16,6 +16,8 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Stream.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueDictionary.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "Plugins/Process/Utility/ARMDefines.h"

View File

@ -12,7 +12,6 @@
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Error.h"
#include "lldb/Interpreter/NamedOptionValue.h"
#include "Plugins/Process/Utility/ARMDefines.h"
namespace lldb_private {

View File

@ -11,6 +11,8 @@
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Interpreter/OptionValueArray.h"
#include "lldb/Interpreter/OptionValueDictionary.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/RegisterContext.h"

View File

@ -14,7 +14,6 @@
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/Opcode.h"
#include "lldb/Interpreter/NamedOptionValue.h"
class EmulationStateARM {
public:

View File

@ -18,14 +18,13 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Value.h"
#include "lldb/Expression/ClangExpression.h"
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Expression/ClangUtilityFunction.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"

View File

@ -864,3 +864,14 @@ PlatformDarwin::SetThreadCreationBreakpoint (Target &target)
return bp_sp;
}
size_t
PlatformDarwin::GetEnvironment (StringList &env)
{
if (IsRemote())
{
if (m_remote_platform_sp)
return m_remote_platform_sp->GetEnvironment(env);
return 0;
}
return Host::GetEnvironment(env);
}

View File

@ -98,7 +98,10 @@ public:
virtual bool
ModuleIsExcludedForNonModuleSpecificSearches (lldb_private::Target &target, const lldb::ModuleSP &module_sp);
virtual size_t
GetEnvironment (lldb_private::StringList &environment);
bool
ARMGetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);

View File

@ -111,6 +111,21 @@ PathMappingList::Insert (const ConstString &path,
m_callback (*this, m_callback_baton);
}
bool
PathMappingList::Replace (const ConstString &path,
const ConstString &replacement,
uint32_t index,
bool notify)
{
iterator insert_iter;
if (index >= m_pairs.size())
return false;
m_pairs[index] = pair(path, replacement);
if (notify && m_callback)
m_callback (*this, m_callback_baton);
return true;
}
bool
PathMappingList::Remove (off_t index, bool notify)
{

View File

@ -685,3 +685,10 @@ Platform::SetThreadCreationBreakpoint (lldb_private::Target &target)
return lldb::BreakpointSP();
}
size_t
Platform::GetEnvironment (StringList &environment)
{
environment.Clear();
return false;
}

View File

@ -41,6 +41,109 @@
using namespace lldb;
using namespace lldb_private;
// Comment out line below to disable memory caching, overriding the process setting
// target.process.disable-memory-cache
#define ENABLE_MEMORY_CACHING
#ifdef ENABLE_MEMORY_CACHING
#define DISABLE_MEM_CACHE_DEFAULT false
#else
#define DISABLE_MEM_CACHE_DEFAULT true
#endif
class ProcessOptionValueProperties : public OptionValueProperties
{
public:
ProcessOptionValueProperties (const ConstString &name) :
OptionValueProperties (name)
{
}
// This constructor is used when creating ProcessOptionValueProperties when it
// is part of a new lldb_private::Process instance. It will copy all current
// global property values as needed
ProcessOptionValueProperties (ProcessProperties *global_properties) :
OptionValueProperties(*global_properties->GetValueProperties())
{
}
virtual const Property *
GetPropertyAtIndex (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const
{
// When gettings the value for a key from the process options, we will always
// try and grab the setting from the current process if there is one. Else we just
// use the one from this instance.
if (exe_ctx)
{
Process *process = exe_ctx->GetProcessPtr();
if (process)
{
ProcessOptionValueProperties *instance_properties = static_cast<ProcessOptionValueProperties *>(process->GetValueProperties().get());
if (this != instance_properties)
return instance_properties->ProtectedGetPropertyAtIndex (idx);
}
}
return ProtectedGetPropertyAtIndex (idx);
}
};
static PropertyDefinition
g_properties[] =
{
{ "disable-memory-cache" , OptionValue::eTypeBoolean, false, DISABLE_MEM_CACHE_DEFAULT, NULL, NULL, "Disable reading and caching of memory in fixed-size units." },
{ "extra-startup-command", OptionValue::eTypeArray , false, OptionValue::eTypeString, NULL, NULL, "A list containing extra commands understood by the particular process plugin used." },
{ NULL , OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL }
};
enum {
ePropertyDisableMemCache,
ePropertyExtraStartCommand
};
ProcessProperties::ProcessProperties (bool is_global) :
Properties ()
{
if (is_global)
{
m_collection_sp.reset (new ProcessOptionValueProperties(ConstString("process")));
m_collection_sp->Initialize(g_properties);
m_collection_sp->AppendProperty(ConstString("thread"),
ConstString("Settings specify to threads."),
true,
Thread::GetGlobalProperties()->GetValueProperties());
}
else
m_collection_sp.reset (new ProcessOptionValueProperties(Process::GetGlobalProperties().get()));
}
ProcessProperties::~ProcessProperties()
{
}
bool
ProcessProperties::GetDisableMemoryCache() const
{
const uint32_t idx = ePropertyDisableMemCache;
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
Args
ProcessProperties::GetExtraStartupCommands () const
{
Args args;
const uint32_t idx = ePropertyExtraStartCommand;
m_collection_sp->GetPropertyAtIndexAsArgs(NULL, idx, args);
return args;
}
void
ProcessProperties::SetExtraStartupCommands (const Args &args)
{
const uint32_t idx = ePropertyExtraStartCommand;
m_collection_sp->SetPropertyAtIndexFromArgs(NULL, idx, args);
}
void
ProcessInstanceInfo::Dump (Stream &s, Platform *platform) const
{
@ -270,9 +373,9 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty)
// (lldb) settings set target.input-path
// (lldb) settings set target.output-path
// (lldb) settings set target.error-path
const char *in_path = NULL;
const char *out_path = NULL;
const char *err_path = NULL;
FileSpec in_path;
FileSpec out_path;
FileSpec err_path;
if (target)
{
in_path = target->GetStandardInputPath();
@ -280,23 +383,28 @@ ProcessLaunchInfo::FinalizeFileActions (Target *target, bool default_to_use_pty)
err_path = target->GetStandardErrorPath();
}
if (default_to_use_pty && (!in_path && !out_path && !err_path))
if (in_path || out_path || err_path)
{
char path[PATH_MAX];
if (in_path && in_path.GetPath(path, sizeof(path)))
AppendOpenFileAction(STDIN_FILENO, path, true, false);
if (out_path && out_path.GetPath(path, sizeof(path)))
AppendOpenFileAction(STDOUT_FILENO, path, false, true);
if (err_path && err_path.GetPath(path, sizeof(path)))
AppendOpenFileAction(STDERR_FILENO, path, false, true);
}
else if (default_to_use_pty)
{
if (m_pty.OpenFirstAvailableMaster (O_RDWR|O_NOCTTY, NULL, 0))
{
in_path = out_path = err_path = m_pty.GetSlaveName (NULL, 0);
const char *slave_path = m_pty.GetSlaveName (NULL, 0);
AppendOpenFileAction(STDIN_FILENO, slave_path, true, false);
AppendOpenFileAction(STDOUT_FILENO, slave_path, false, true);
AppendOpenFileAction(STDERR_FILENO, slave_path, false, true);
}
}
if (in_path)
AppendOpenFileAction(STDIN_FILENO, in_path, true, false);
if (out_path)
AppendOpenFileAction(STDOUT_FILENO, out_path, false, true);
if (err_path)
AppendOpenFileAction(STDERR_FILENO, err_path, false, true);
}
}
}
@ -779,9 +887,9 @@ Process::GetStaticBroadcasterClass ()
// Process constructor
//----------------------------------------------------------------------
Process::Process(Target &target, Listener &listener) :
ProcessProperties (false),
UserID (LLDB_INVALID_PROCESS_ID),
Broadcaster (&(target.GetDebugger()), "lldb.process"),
ProcessInstanceSettings (GetSettingsController()),
m_target (target),
m_public_state (eStateUnloaded),
m_private_state (eStateUnloaded),
@ -815,8 +923,6 @@ Process::Process(Target &target, Listener &listener) :
m_currently_handling_event(false),
m_can_jit(eCanJITDontKnow)
{
UpdateInstanceName();
CheckInWithManager ();
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
@ -855,6 +961,15 @@ Process::~Process()
StopPrivateStateThread();
}
const ProcessPropertiesSP &
Process::GetGlobalProperties()
{
static ProcessPropertiesSP g_settings_sp;
if (!g_settings_sp)
g_settings_sp.reset (new ProcessProperties (true));
return g_settings_sp;
}
void
Process::Finalize()
{
@ -1945,9 +2060,6 @@ Process::DisableSoftwareBreakpoint (BreakpointSite *bp_site)
}
// Comment out line below to disable memory caching, overriding the process setting
// target.process.disable-memory-cache
#define ENABLE_MEMORY_CACHING
// Uncomment to verify memory caching works after making changes to caching code
//#define VERIFY_MEMORY_READS
@ -3921,88 +4033,66 @@ Process::PopProcessInputReader ()
void
Process::SettingsInitialize ()
{
static std::vector<OptionEnumValueElement> g_plugins;
int i=0;
const char *name;
OptionEnumValueElement option_enum;
while ((name = PluginManager::GetProcessPluginNameAtIndex (i)) != NULL)
{
if (name)
{
option_enum.value = i;
option_enum.string_value = name;
option_enum.usage = PluginManager::GetProcessPluginDescriptionAtIndex (i);
g_plugins.push_back (option_enum);
}
++i;
}
option_enum.value = 0;
option_enum.string_value = NULL;
option_enum.usage = NULL;
g_plugins.push_back (option_enum);
for (i=0; (name = SettingsController::instance_settings_table[i].var_name); ++i)
{
if (::strcmp (name, "plugin") == 0)
{
SettingsController::instance_settings_table[i].enum_values = &g_plugins[0];
break;
}
}
UserSettingsControllerSP &usc = GetSettingsController();
UserSettingsController::InitializeSettingsController (usc,
SettingsController::global_settings_table,
SettingsController::instance_settings_table);
// Now call SettingsInitialize() for each 'child' of Process settings
Thread::SettingsInitialize ();
// static std::vector<OptionEnumValueElement> g_plugins;
//
// int i=0;
// const char *name;
// OptionEnumValueElement option_enum;
// while ((name = PluginManager::GetProcessPluginNameAtIndex (i)) != NULL)
// {
// if (name)
// {
// option_enum.value = i;
// option_enum.string_value = name;
// option_enum.usage = PluginManager::GetProcessPluginDescriptionAtIndex (i);
// g_plugins.push_back (option_enum);
// }
// ++i;
// }
// option_enum.value = 0;
// option_enum.string_value = NULL;
// option_enum.usage = NULL;
// g_plugins.push_back (option_enum);
//
// for (i=0; (name = SettingsController::instance_settings_table[i].var_name); ++i)
// {
// if (::strcmp (name, "plugin") == 0)
// {
// SettingsController::instance_settings_table[i].enum_values = &g_plugins[0];
// break;
// }
// }
// UserSettingsControllerSP &usc = GetSettingsController();
// UserSettingsController::InitializeSettingsController (usc,
// SettingsController::global_settings_table,
// SettingsController::instance_settings_table);
//
// // Now call SettingsInitialize() for each 'child' of Process settings
// Thread::SettingsInitialize ();
}
void
Process::SettingsTerminate ()
{
// Must call SettingsTerminate() on each 'child' of Process settings before terminating Process settings.
Thread::SettingsTerminate ();
// Now terminate Process Settings.
UserSettingsControllerSP &usc = GetSettingsController();
UserSettingsController::FinalizeSettingsController (usc);
usc.reset();
// // Must call SettingsTerminate() on each 'child' of Process settings before terminating Process settings.
//
// Thread::SettingsTerminate ();
//
// // Now terminate Process Settings.
//
// UserSettingsControllerSP &usc = GetSettingsController();
// UserSettingsController::FinalizeSettingsController (usc);
// usc.reset();
}
UserSettingsControllerSP &
Process::GetSettingsController ()
{
static UserSettingsControllerSP g_settings_controller_sp;
if (!g_settings_controller_sp)
{
g_settings_controller_sp.reset (new Process::SettingsController);
// The first shared pointer to Process::SettingsController in
// g_settings_controller_sp must be fully created above so that
// the TargetInstanceSettings can use a weak_ptr to refer back
// to the master setttings controller
InstanceSettingsSP default_instance_settings_sp (new ProcessInstanceSettings (g_settings_controller_sp,
false,
InstanceSettings::GetDefaultName().AsCString()));
g_settings_controller_sp->SetDefaultInstanceSettings (default_instance_settings_sp);
}
return g_settings_controller_sp;
}
void
Process::UpdateInstanceName ()
{
Module *module = GetTarget().GetExecutableModulePointer();
if (module && module->GetFileSpec().GetFilename())
{
GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(),
module->GetFileSpec().GetFilename().AsCString());
}
}
//PropertiesSP &
//Process::GetProperties ()
//{
// static PropertiesSP g_settings_sp;
// if (!g_settings_sp)
// g_settings_sp.reset (new ProcessProperties());
// return g_settings_sp;
//}
ExecutionResults
Process::RunThreadPlan (ExecutionContext &exe_ctx,
@ -4840,217 +4930,217 @@ Process::Flush ()
// class Process::SettingsController
//--------------------------------------------------------------
Process::SettingsController::SettingsController () :
UserSettingsController ("process", Target::GetSettingsController())
{
}
Process::SettingsController::~SettingsController ()
{
}
lldb::InstanceSettingsSP
Process::SettingsController::CreateInstanceSettings (const char *instance_name)
{
lldb::InstanceSettingsSP new_settings_sp (new ProcessInstanceSettings (GetSettingsController(),
false,
instance_name));
return new_settings_sp;
}
//Process::SettingsController::SettingsController () :
// UserSettingsController ("process", Target::GetSettingsController())
//{
//}
//
//Process::SettingsController::~SettingsController ()
//{
//}
//
//lldb::InstanceSettingsSP
//Process::SettingsController::CreateInstanceSettings (const char *instance_name)
//{
// lldb::InstanceSettingsSP new_settings_sp (new ProcessInstanceSettings (GetSettingsController(),
// false,
// instance_name));
// return new_settings_sp;
//}
//--------------------------------------------------------------
// class ProcessInstanceSettings
//--------------------------------------------------------------
ProcessInstanceSettings::ProcessInstanceSettings
(
const UserSettingsControllerSP &owner_sp,
bool live_instance,
const char *name
) :
InstanceSettings (owner_sp, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance)
{
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for ProcessInstanceSettings are properly set up, i.e. AFTER all the initializers.
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
// This is true for CreateInstanceName() too.
if (GetInstanceName () == InstanceSettings::InvalidName())
{
ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
owner_sp->RegisterInstanceSettings (this);
}
if (live_instance)
{
const lldb::InstanceSettingsSP &pending_settings = owner_sp->FindPendingSettings (m_instance_name);
CopyInstanceSettings (pending_settings,false);
}
}
ProcessInstanceSettings::ProcessInstanceSettings (const ProcessInstanceSettings &rhs) :
InstanceSettings (Process::GetSettingsController(), CreateInstanceName().AsCString()),
m_disable_memory_cache(rhs.m_disable_memory_cache),
m_extra_startup_commands (rhs.m_extra_startup_commands)
{
if (m_instance_name != InstanceSettings::GetDefaultName())
{
UserSettingsControllerSP owner_sp (m_owner_wp.lock());
if (owner_sp)
{
CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name), false);
owner_sp->RemovePendingSettings (m_instance_name);
}
}
}
ProcessInstanceSettings::~ProcessInstanceSettings ()
{
}
ProcessInstanceSettings&
ProcessInstanceSettings::operator= (const ProcessInstanceSettings &rhs)
{
if (this != &rhs)
{
m_disable_memory_cache = rhs.m_disable_memory_cache;
m_extra_startup_commands = rhs.m_extra_startup_commands;
}
return *this;
}
void
ProcessInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const ConstString &instance_name,
const SettingEntry &entry,
VarSetOperationType op,
Error &err,
bool pending)
{
if (var_name == GetDisableMemoryCacheVarName())
{
bool success;
bool result = Args::StringToBoolean(value, false, &success);
if (success)
{
m_disable_memory_cache = result;
}
else
{
err.SetErrorStringWithFormat ("Bad value \"%s\" for %s, should be Boolean.", value, GetDisableMemoryCacheVarName().AsCString());
}
}
else if (var_name == GetExtraStartupCommandVarName())
{
UserSettingsController::UpdateStringArrayVariable (op, index_value, m_extra_startup_commands, value, err);
}
}
void
ProcessInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending)
{
if (new_settings.get() == NULL)
return;
ProcessInstanceSettings *new_settings_ptr = static_cast <ProcessInstanceSettings *> (new_settings.get());
if (!new_settings_ptr)
return;
*this = *new_settings_ptr;
}
bool
ProcessInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error *err)
{
if (var_name == GetDisableMemoryCacheVarName())
{
value.AppendString(m_disable_memory_cache ? "true" : "false");
return true;
}
else if (var_name == GetExtraStartupCommandVarName())
{
if (m_extra_startup_commands.GetArgumentCount() > 0)
{
for (int i = 0; i < m_extra_startup_commands.GetArgumentCount(); ++i)
value.AppendString (m_extra_startup_commands.GetArgumentAtIndex (i));
}
return true;
}
else
{
if (err)
err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
return false;
}
}
const ConstString
ProcessInstanceSettings::CreateInstanceName ()
{
static int instance_count = 1;
StreamString sstr;
sstr.Printf ("process_%d", instance_count);
++instance_count;
const ConstString ret_val (sstr.GetData());
return ret_val;
}
const ConstString &
ProcessInstanceSettings::GetDisableMemoryCacheVarName () const
{
static ConstString disable_memory_cache_var_name ("disable-memory-cache");
return disable_memory_cache_var_name;
}
const ConstString &
ProcessInstanceSettings::GetExtraStartupCommandVarName () const
{
static ConstString extra_startup_command_var_name ("extra-startup-command");
return extra_startup_command_var_name;
}
//--------------------------------------------------
// SettingsController Variable Tables
//--------------------------------------------------
SettingEntry
Process::SettingsController::global_settings_table[] =
{
//{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"},
{ NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
};
SettingEntry
Process::SettingsController::instance_settings_table[] =
{
//{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"},
{ "disable-memory-cache", eSetVarTypeBoolean,
#ifdef ENABLE_MEMORY_CACHING
"false",
#else
"true",
#endif
NULL, false, false, "Disable reading and caching of memory in fixed-size units." },
{ "extra-startup-command", eSetVarTypeArray, NULL, NULL, false, false, "A list containing extra commands understood by the particular process plugin used." },
{ NULL, eSetVarTypeNone, NULL, NULL, false, false, NULL }
};
//
//ProcessInstanceSettings::ProcessInstanceSettings
//(
// const UserSettingsControllerSP &owner_sp,
// bool live_instance,
// const char *name
//) :
// InstanceSettings (owner_sp, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance)
//{
// // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// // until the vtables for ProcessInstanceSettings are properly set up, i.e. AFTER all the initializers.
// // For this reason it has to be called here, rather than in the initializer or in the parent constructor.
// // This is true for CreateInstanceName() too.
//
// if (GetInstanceName () == InstanceSettings::InvalidName())
// {
// ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
// owner_sp->RegisterInstanceSettings (this);
// }
//
// if (live_instance)
// {
// const lldb::InstanceSettingsSP &pending_settings = owner_sp->FindPendingSettings (m_instance_name);
// CopyInstanceSettings (pending_settings,false);
// }
//}
//
//ProcessInstanceSettings::ProcessInstanceSettings (const ProcessInstanceSettings &rhs) :
// InstanceSettings (Process::GetSettingsController(), CreateInstanceName().AsCString()),
// m_disable_memory_cache(rhs.m_disable_memory_cache),
// m_extra_startup_commands (rhs.m_extra_startup_commands)
//{
// if (m_instance_name != InstanceSettings::GetDefaultName())
// {
// UserSettingsControllerSP owner_sp (m_owner_wp.lock());
// if (owner_sp)
// {
// CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name), false);
// owner_sp->RemovePendingSettings (m_instance_name);
// }
// }
//}
//
//ProcessInstanceSettings::~ProcessInstanceSettings ()
//{
//}
//
//ProcessInstanceSettings&
//ProcessInstanceSettings::operator= (const ProcessInstanceSettings &rhs)
//{
// if (this != &rhs)
// {
// m_disable_memory_cache = rhs.m_disable_memory_cache;
// m_extra_startup_commands = rhs.m_extra_startup_commands;
// }
//
// return *this;
//}
//
//
//void
//ProcessInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const ConstString &instance_name,
// const SettingEntry &entry,
// VarSetOperationType op,
// Error &err,
// bool pending)
//{
// if (var_name == GetDisableMemoryCacheVarName())
// {
// bool success;
// bool result = Args::StringToBoolean(value, false, &success);
//
// if (success)
// {
// m_disable_memory_cache = result;
// }
// else
// {
// err.SetErrorStringWithFormat ("Bad value \"%s\" for %s, should be Boolean.", value, GetDisableMemoryCacheVarName().AsCString());
// }
//
// }
// else if (var_name == GetExtraStartupCommandVarName())
// {
// UserSettingsController::UpdateStringArrayVariable (op, index_value, m_extra_startup_commands, value, err);
// }
//}
//
//void
//ProcessInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
// bool pending)
//{
// if (new_settings.get() == NULL)
// return;
//
// ProcessInstanceSettings *new_settings_ptr = static_cast <ProcessInstanceSettings *> (new_settings.get());
//
// if (!new_settings_ptr)
// return;
//
// *this = *new_settings_ptr;
//}
//
//bool
//ProcessInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
// const ConstString &var_name,
// StringList &value,
// Error *err)
//{
// if (var_name == GetDisableMemoryCacheVarName())
// {
// value.AppendString(m_disable_memory_cache ? "true" : "false");
// return true;
// }
// else if (var_name == GetExtraStartupCommandVarName())
// {
// if (m_extra_startup_commands.GetArgumentCount() > 0)
// {
// for (int i = 0; i < m_extra_startup_commands.GetArgumentCount(); ++i)
// value.AppendString (m_extra_startup_commands.GetArgumentAtIndex (i));
// }
// return true;
// }
// else
// {
// if (err)
// err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
// return false;
// }
//}
//
//const ConstString
//ProcessInstanceSettings::CreateInstanceName ()
//{
// static int instance_count = 1;
// StreamString sstr;
//
// sstr.Printf ("process_%d", instance_count);
// ++instance_count;
//
// const ConstString ret_val (sstr.GetData());
// return ret_val;
//}
//
//const ConstString &
//ProcessInstanceSettings::GetDisableMemoryCacheVarName () const
//{
// static ConstString disable_memory_cache_var_name ("disable-memory-cache");
//
// return disable_memory_cache_var_name;
//}
//
//const ConstString &
//ProcessInstanceSettings::GetExtraStartupCommandVarName () const
//{
// static ConstString extra_startup_command_var_name ("extra-startup-command");
//
// return extra_startup_command_var_name;
//}
//
////--------------------------------------------------
//// SettingsController Variable Tables
////--------------------------------------------------
//
//SettingEntry
//Process::SettingsController::global_settings_table[] =
//{
// //{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"},
// { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
//};
//
//
//SettingEntry
//Process::SettingsController::instance_settings_table[] =
//{
// //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"},
// { "disable-memory-cache", eSetVarTypeBoolean,
//#ifdef ENABLE_MEMORY_CACHING
// "false",
//#else
// "true",
//#endif
// NULL, false, false, "Disable reading and caching of memory in fixed-size units." },
// { "extra-startup-command", eSetVarTypeArray, NULL, NULL, false, false, "A list containing extra commands understood by the particular process plugin used." },
// { NULL, eSetVarTypeNone, NULL, NULL, false, false, NULL }
//};
//
//

View File

@ -1350,7 +1350,7 @@ StackFrame::GetStatus (Stream& strm,
{
ExecutionContext exe_ctx (shared_from_this());
bool have_source = false;
DebuggerInstanceSettings::StopDisassemblyType disasm_display = DebuggerInstanceSettings::eStopDisassemblyTypeNever;
Debugger::StopDisassemblyType disasm_display = Debugger::eStopDisassemblyTypeNever;
Target *target = exe_ctx.GetTargetPtr();
if (target)
{
@ -1378,14 +1378,14 @@ StackFrame::GetStatus (Stream& strm,
}
switch (disasm_display)
{
case DebuggerInstanceSettings::eStopDisassemblyTypeNever:
case Debugger::eStopDisassemblyTypeNever:
break;
case DebuggerInstanceSettings::eStopDisassemblyTypeNoSource:
case Debugger::eStopDisassemblyTypeNoSource:
if (have_source)
break;
// Fall through to next case
case DebuggerInstanceSettings::eStopDisassemblyTypeAlways:
case Debugger::eStopDisassemblyTypeAlways:
if (target)
{
const uint32_t disasm_lines = debugger.GetDisassemblyLineCount();

File diff suppressed because it is too large Load Diff

View File

@ -216,7 +216,7 @@ TargetList::CreateTarget
if (target_sp)
{
target_sp->UpdateInstanceName();
//target_sp->UpdateInstanceName();
Mutex::Locker locker(m_target_list_mutex);
m_selected_target_idx = m_target_list.size();

View File

@ -43,9 +43,103 @@
using namespace lldb;
using namespace lldb_private;
const ThreadPropertiesSP &
Thread::GetGlobalProperties()
{
static ThreadPropertiesSP g_settings_sp;
if (!g_settings_sp)
g_settings_sp.reset (new ThreadProperties (true));
return g_settings_sp;
}
static PropertyDefinition
g_properties[] =
{
{ "step-avoid-regexp", OptionValue::eTypeRegex , true , REG_EXTENDED, "^std::", NULL, "A regular expression defining functions step-in won't stop in." },
{ "trace-thread", OptionValue::eTypeBoolean, false, false, NULL, NULL, "If true, this thread will single-step and log execution." },
{ NULL , OptionValue::eTypeInvalid, false, 0 , NULL, NULL, NULL }
};
enum {
ePropertyStepAvoidRegex,
ePropertyEnableThreadTrace
};
class ThreadOptionValueProperties : public OptionValueProperties
{
public:
ThreadOptionValueProperties (const ConstString &name) :
OptionValueProperties (name)
{
}
// This constructor is used when creating ThreadOptionValueProperties when it
// is part of a new lldb_private::Thread instance. It will copy all current
// global property values as needed
ThreadOptionValueProperties (ThreadProperties *global_properties) :
OptionValueProperties(*global_properties->GetValueProperties())
{
}
virtual const Property *
GetPropertyAtIndex (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const
{
// When gettings the value for a key from the thread options, we will always
// try and grab the setting from the current thread if there is one. Else we just
// use the one from this instance.
if (exe_ctx)
{
Thread *thread = exe_ctx->GetThreadPtr();
if (thread)
{
ThreadOptionValueProperties *instance_properties = static_cast<ThreadOptionValueProperties *>(thread->GetValueProperties().get());
if (this != instance_properties)
return instance_properties->ProtectedGetPropertyAtIndex (idx);
}
}
return ProtectedGetPropertyAtIndex (idx);
}
};
ThreadProperties::ThreadProperties (bool is_global) :
Properties ()
{
if (is_global)
{
m_collection_sp.reset (new ThreadOptionValueProperties(ConstString("thread")));
m_collection_sp->Initialize(g_properties);
}
else
m_collection_sp.reset (new ThreadOptionValueProperties(Thread::GetGlobalProperties().get()));
}
ThreadProperties::~ThreadProperties()
{
}
const RegularExpression *
ThreadProperties::GetSymbolsToAvoidRegexp()
{
const uint32_t idx = ePropertyStepAvoidRegex;
return m_collection_sp->GetPropertyAtIndexAsOptionValueRegex (NULL, idx);
}
bool
ThreadProperties::GetTraceEnabledState() const
{
const uint32_t idx = ePropertyEnableThreadTrace;
return m_collection_sp->GetPropertyAtIndexAsBoolean (NULL, idx, g_properties[idx].default_uint_value != 0);
}
Thread::Thread (const ProcessSP &process_sp, lldb::tid_t tid) :
ThreadProperties (false),
UserID (tid),
ThreadInstanceSettings (GetSettingsController()),
//ThreadInstanceSettings (GetSettingsController()),
m_process_wp (process_sp),
m_actual_stop_info_sp (),
m_index_id (process_sp->GetNextThreadIndexID ()),
@ -70,7 +164,7 @@ Thread::Thread (const ProcessSP &process_sp, lldb::tid_t tid) :
log->Printf ("%p Thread::Thread(tid = 0x%4.4llx)", this, GetID());
QueueFundamentalPlan(true);
UpdateInstanceName();
//UpdateInstanceName();
}
@ -1196,10 +1290,10 @@ Thread::DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx)
void
Thread::SettingsInitialize ()
{
UserSettingsController::InitializeSettingsController (GetSettingsController(),
SettingsController::global_settings_table,
SettingsController::instance_settings_table);
// UserSettingsController::InitializeSettingsController (GetSettingsController(),
// SettingsController::global_settings_table,
// SettingsController::instance_settings_table);
//
// Now call SettingsInitialize() on each 'child' setting of Thread.
// Currently there are none.
}
@ -1211,46 +1305,46 @@ Thread::SettingsTerminate ()
// Currently there are none.
// Now terminate Thread Settings.
UserSettingsControllerSP &usc = GetSettingsController();
UserSettingsController::FinalizeSettingsController (usc);
usc.reset();
//
// UserSettingsControllerSP &usc = GetSettingsController();
// UserSettingsController::FinalizeSettingsController (usc);
// usc.reset();
}
UserSettingsControllerSP &
Thread::GetSettingsController ()
{
static UserSettingsControllerSP g_settings_controller_sp;
if (!g_settings_controller_sp)
{
g_settings_controller_sp.reset (new Thread::SettingsController);
// The first shared pointer to Target::SettingsController in
// g_settings_controller_sp must be fully created above so that
// the TargetInstanceSettings can use a weak_ptr to refer back
// to the master setttings controller
InstanceSettingsSP default_instance_settings_sp (new ThreadInstanceSettings (g_settings_controller_sp,
false,
InstanceSettings::GetDefaultName().AsCString()));
//UserSettingsControllerSP &
//Thread::GetSettingsController ()
//{
// static UserSettingsControllerSP g_settings_controller_sp;
// if (!g_settings_controller_sp)
// {
// g_settings_controller_sp.reset (new Thread::SettingsController);
// // The first shared pointer to Target::SettingsController in
// // g_settings_controller_sp must be fully created above so that
// // the TargetInstanceSettings can use a weak_ptr to refer back
// // to the master setttings controller
// InstanceSettingsSP default_instance_settings_sp (new ThreadInstanceSettings (g_settings_controller_sp,
// false,
// InstanceSettings::GetDefaultName().AsCString()));
//
// g_settings_controller_sp->SetDefaultInstanceSettings (default_instance_settings_sp);
// }
// return g_settings_controller_sp;
//}
g_settings_controller_sp->SetDefaultInstanceSettings (default_instance_settings_sp);
}
return g_settings_controller_sp;
}
void
Thread::UpdateInstanceName ()
{
StreamString sstr;
const char *name = GetName();
if (name && name[0] != '\0')
sstr.Printf ("%s", name);
else if ((GetIndexID() != 0) || (GetID() != 0))
sstr.Printf ("0x%4.4x", GetIndexID());
if (sstr.GetSize() > 0)
Thread::GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), sstr.GetData());
}
//void
//Thread::UpdateInstanceName ()
//{
// StreamString sstr;
// const char *name = GetName();
//
// if (name && name[0] != '\0')
// sstr.Printf ("%s", name);
// else if ((GetIndexID() != 0) || (GetID() != 0))
// sstr.Printf ("0x%4.4x", GetIndexID());
//
// if (sstr.GetSize() > 0)
// Thread::GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), sstr.GetData());
//}
lldb::StackFrameSP
Thread::GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr)
@ -1422,225 +1516,225 @@ Thread::Flush ()
//--------------------------------------------------------------
// class Thread::SettingsController
//--------------------------------------------------------------
//
//Thread::SettingsController::SettingsController () :
// UserSettingsController ("thread", Process::GetSettingsController())
//{
//}
//
//Thread::SettingsController::~SettingsController ()
//{
//}
//
//lldb::InstanceSettingsSP
//Thread::SettingsController::CreateInstanceSettings (const char *instance_name)
//{
// lldb::InstanceSettingsSP new_settings_sp (new ThreadInstanceSettings (GetSettingsController(),
// false,
// instance_name));
// return new_settings_sp;
//}
Thread::SettingsController::SettingsController () :
UserSettingsController ("thread", Process::GetSettingsController())
{
}
Thread::SettingsController::~SettingsController ()
{
}
lldb::InstanceSettingsSP
Thread::SettingsController::CreateInstanceSettings (const char *instance_name)
{
lldb::InstanceSettingsSP new_settings_sp (new ThreadInstanceSettings (GetSettingsController(),
false,
instance_name));
return new_settings_sp;
}
#pragma mark "ThreadInstanceSettings"
//--------------------------------------------------------------
// class ThreadInstanceSettings
//--------------------------------------------------------------
ThreadInstanceSettings::ThreadInstanceSettings (const UserSettingsControllerSP &owner_sp, bool live_instance, const char *name) :
InstanceSettings (owner_sp, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance),
m_avoid_regexp_ap (),
m_trace_enabled (false)
{
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for ThreadInstanceSettings are properly set up, i.e. AFTER all the initializers.
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
// This is true for CreateInstanceName() too.
if (GetInstanceName() == InstanceSettings::InvalidName())
{
ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
owner_sp->RegisterInstanceSettings (this);
}
if (live_instance)
{
CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name),false);
}
}
ThreadInstanceSettings::ThreadInstanceSettings (const ThreadInstanceSettings &rhs) :
InstanceSettings (Thread::GetSettingsController(), CreateInstanceName().AsCString()),
m_avoid_regexp_ap (),
m_trace_enabled (rhs.m_trace_enabled)
{
if (m_instance_name != InstanceSettings::GetDefaultName())
{
UserSettingsControllerSP owner_sp (m_owner_wp.lock());
if (owner_sp)
{
CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name), false);
owner_sp->RemovePendingSettings (m_instance_name);
}
}
if (rhs.m_avoid_regexp_ap.get() != NULL)
m_avoid_regexp_ap.reset(new RegularExpression(rhs.m_avoid_regexp_ap->GetText()));
}
ThreadInstanceSettings::~ThreadInstanceSettings ()
{
}
ThreadInstanceSettings&
ThreadInstanceSettings::operator= (const ThreadInstanceSettings &rhs)
{
if (this != &rhs)
{
if (rhs.m_avoid_regexp_ap.get() != NULL)
m_avoid_regexp_ap.reset(new RegularExpression(rhs.m_avoid_regexp_ap->GetText()));
else
m_avoid_regexp_ap.reset(NULL);
}
m_trace_enabled = rhs.m_trace_enabled;
return *this;
}
void
ThreadInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
const ConstString &instance_name,
const SettingEntry &entry,
VarSetOperationType op,
Error &err,
bool pending)
{
if (var_name == StepAvoidRegexpVarName())
{
std::string regexp_text;
if (m_avoid_regexp_ap.get() != NULL)
regexp_text.append (m_avoid_regexp_ap->GetText());
UserSettingsController::UpdateStringVariable (op, regexp_text, value, err);
if (regexp_text.empty())
m_avoid_regexp_ap.reset();
else
{
m_avoid_regexp_ap.reset(new RegularExpression(regexp_text.c_str()));
}
}
else if (var_name == GetTraceThreadVarName())
{
bool success;
bool result = Args::StringToBoolean(value, false, &success);
if (success)
{
m_trace_enabled = result;
if (!pending)
{
Thread *myself = static_cast<Thread *> (this);
myself->EnableTracer(m_trace_enabled, true);
}
}
else
{
err.SetErrorStringWithFormat ("Bad value \"%s\" for trace-thread, should be Boolean.", value);
}
}
}
void
ThreadInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
bool pending)
{
if (new_settings.get() == NULL)
return;
ThreadInstanceSettings *new_process_settings = (ThreadInstanceSettings *) new_settings.get();
if (new_process_settings->GetSymbolsToAvoidRegexp() != NULL)
m_avoid_regexp_ap.reset (new RegularExpression (new_process_settings->GetSymbolsToAvoidRegexp()->GetText()));
else
m_avoid_regexp_ap.reset ();
}
bool
ThreadInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error *err)
{
if (var_name == StepAvoidRegexpVarName())
{
if (m_avoid_regexp_ap.get() != NULL)
{
std::string regexp_text("\"");
regexp_text.append(m_avoid_regexp_ap->GetText());
regexp_text.append ("\"");
value.AppendString (regexp_text.c_str());
}
}
else if (var_name == GetTraceThreadVarName())
{
value.AppendString(m_trace_enabled ? "true" : "false");
}
else
{
if (err)
err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
return false;
}
return true;
}
const ConstString
ThreadInstanceSettings::CreateInstanceName ()
{
static int instance_count = 1;
StreamString sstr;
sstr.Printf ("thread_%d", instance_count);
++instance_count;
const ConstString ret_val (sstr.GetData());
return ret_val;
}
const ConstString &
ThreadInstanceSettings::StepAvoidRegexpVarName ()
{
static ConstString step_avoid_var_name ("step-avoid-regexp");
return step_avoid_var_name;
}
const ConstString &
ThreadInstanceSettings::GetTraceThreadVarName ()
{
static ConstString trace_thread_var_name ("trace-thread");
return trace_thread_var_name;
}
//#pragma mark "ThreadInstanceSettings"
////--------------------------------------------------------------
//// class ThreadInstanceSettings
////--------------------------------------------------------------
//
//ThreadInstanceSettings::ThreadInstanceSettings (const UserSettingsControllerSP &owner_sp, bool live_instance, const char *name) :
// InstanceSettings (owner_sp, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance),
// m_avoid_regexp_ap (),
// m_trace_enabled (false)
//{
// // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// // until the vtables for ThreadInstanceSettings are properly set up, i.e. AFTER all the initializers.
// // For this reason it has to be called here, rather than in the initializer or in the parent constructor.
// // This is true for CreateInstanceName() too.
//
// if (GetInstanceName() == InstanceSettings::InvalidName())
// {
// ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
// owner_sp->RegisterInstanceSettings (this);
// }
//
// if (live_instance)
// {
// CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name),false);
// }
//}
//
//ThreadInstanceSettings::ThreadInstanceSettings (const ThreadInstanceSettings &rhs) :
// InstanceSettings (Thread::GetSettingsController(), CreateInstanceName().AsCString()),
// m_avoid_regexp_ap (),
// m_trace_enabled (rhs.m_trace_enabled)
//{
// if (m_instance_name != InstanceSettings::GetDefaultName())
// {
// UserSettingsControllerSP owner_sp (m_owner_wp.lock());
// if (owner_sp)
// {
// CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name), false);
// owner_sp->RemovePendingSettings (m_instance_name);
// }
// }
// if (rhs.m_avoid_regexp_ap.get() != NULL)
// m_avoid_regexp_ap.reset(new RegularExpression(rhs.m_avoid_regexp_ap->GetText()));
//}
//
//ThreadInstanceSettings::~ThreadInstanceSettings ()
//{
//}
//
//ThreadInstanceSettings&
//ThreadInstanceSettings::operator= (const ThreadInstanceSettings &rhs)
//{
// if (this != &rhs)
// {
// if (rhs.m_avoid_regexp_ap.get() != NULL)
// m_avoid_regexp_ap.reset(new RegularExpression(rhs.m_avoid_regexp_ap->GetText()));
// else
// m_avoid_regexp_ap.reset(NULL);
// }
// m_trace_enabled = rhs.m_trace_enabled;
// return *this;
//}
//
//
//void
//ThreadInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name,
// const char *index_value,
// const char *value,
// const ConstString &instance_name,
// const SettingEntry &entry,
// VarSetOperationType op,
// Error &err,
// bool pending)
//{
// if (var_name == StepAvoidRegexpVarName())
// {
// std::string regexp_text;
// if (m_avoid_regexp_ap.get() != NULL)
// regexp_text.append (m_avoid_regexp_ap->GetText());
// UserSettingsController::UpdateStringVariable (op, regexp_text, value, err);
// if (regexp_text.empty())
// m_avoid_regexp_ap.reset();
// else
// {
// m_avoid_regexp_ap.reset(new RegularExpression(regexp_text.c_str()));
//
// }
// }
// else if (var_name == GetTraceThreadVarName())
// {
// bool success;
// bool result = Args::StringToBoolean(value, false, &success);
//
// if (success)
// {
// m_trace_enabled = result;
// if (!pending)
// {
// Thread *myself = static_cast<Thread *> (this);
// myself->EnableTracer(m_trace_enabled, true);
// }
// }
// else
// {
// err.SetErrorStringWithFormat ("Bad value \"%s\" for trace-thread, should be Boolean.", value);
// }
//
// }
//}
//
//void
//ThreadInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
// bool pending)
//{
// if (new_settings.get() == NULL)
// return;
//
// ThreadInstanceSettings *new_process_settings = (ThreadInstanceSettings *) new_settings.get();
// if (new_process_settings->GetSymbolsToAvoidRegexp() != NULL)
// m_avoid_regexp_ap.reset (new RegularExpression (new_process_settings->GetSymbolsToAvoidRegexp()->GetText()));
// else
// m_avoid_regexp_ap.reset ();
//}
//
//bool
//ThreadInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
// const ConstString &var_name,
// StringList &value,
// Error *err)
//{
// if (var_name == StepAvoidRegexpVarName())
// {
// if (m_avoid_regexp_ap.get() != NULL)
// {
// std::string regexp_text("\"");
// regexp_text.append(m_avoid_regexp_ap->GetText());
// regexp_text.append ("\"");
// value.AppendString (regexp_text.c_str());
// }
//
// }
// else if (var_name == GetTraceThreadVarName())
// {
// value.AppendString(m_trace_enabled ? "true" : "false");
// }
// else
// {
// if (err)
// err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
// return false;
// }
// return true;
//}
//
//const ConstString
//ThreadInstanceSettings::CreateInstanceName ()
//{
// static int instance_count = 1;
// StreamString sstr;
//
// sstr.Printf ("thread_%d", instance_count);
// ++instance_count;
//
// const ConstString ret_val (sstr.GetData());
// return ret_val;
//}
//
//const ConstString &
//ThreadInstanceSettings::StepAvoidRegexpVarName ()
//{
// static ConstString step_avoid_var_name ("step-avoid-regexp");
//
// return step_avoid_var_name;
//}
//
//const ConstString &
//ThreadInstanceSettings::GetTraceThreadVarName ()
//{
// static ConstString trace_thread_var_name ("trace-thread");
//
// return trace_thread_var_name;
//}
//
//--------------------------------------------------
// SettingsController Variable Tables
//--------------------------------------------------
SettingEntry
Thread::SettingsController::global_settings_table[] =
{
//{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"},
{ NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
};
SettingEntry
Thread::SettingsController::instance_settings_table[] =
{
//{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"},
{ "step-avoid-regexp", eSetVarTypeString, "", NULL, false, false, "A regular expression defining functions step-in won't stop in." },
{ "trace-thread", eSetVarTypeBoolean, "false", NULL, false, false, "If true, this thread will single-step and log execution." },
{ NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
};
//
//SettingEntry
//Thread::SettingsController::global_settings_table[] =
//{
// //{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"},
// { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
//};
//
//
//SettingEntry
//Thread::SettingsController::instance_settings_table[] =
//{
// //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"},
// { "step-avoid-regexp", eSetVarTypeString, "", NULL, false, false, "A regular expression defining functions step-in won't stop in." },
// { "trace-thread", eSetVarTypeBoolean, "false", NULL, false, false, "If true, this thread will single-step and log execution." },
// { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
//};

View File

@ -234,9 +234,7 @@ ThreadPlanStepInRange::FrameMatchesAvoidRegexp ()
{
StackFrame *frame = GetThread().GetStackFrameAtIndex(0).get();
RegularExpression *avoid_regexp_to_use;
avoid_regexp_to_use = m_avoid_regexp_ap.get();
const RegularExpression *avoid_regexp_to_use = m_avoid_regexp_ap.get();
if (avoid_regexp_to_use == NULL)
avoid_regexp_to_use = GetThread().GetSymbolsToAvoidRegexp();

View File

@ -47,7 +47,7 @@ class AbbreviationsTestCase(TestBase):
startstr = 'prompt (string) = "[with-three-trailing-spaces] "')
self.runCmd("settings set -r prompt")
self.runCmd("settings clear prompt")
self.expect("settings show prompt",
startstr = 'prompt (string) = "(lldb) "')
@ -59,7 +59,7 @@ class AbbreviationsTestCase(TestBase):
self.expect("se sh prompt",
startstr = 'prompt (string) = "Sycamore> "')
self.runCmd("se se -r prompt")
self.runCmd("se cl prompt")
self.expect("set sh prompt",
startstr = 'prompt (string) = "(lldb) "')

View File

@ -85,12 +85,12 @@ class CommandLineCompletionTestCase(TestBase):
self.complete_from_to('settings set th', 'settings set thread-format')
def test_settings_s_dash(self):
"""Test that 'settings set -' completes to ['Available completions:', '-n', '-r']."""
self.complete_from_to('settings set -', ['Available completions:', '-n', '-r'])
"""Test that 'settings set -' completes to 'settings set -g'."""
self.complete_from_to('settings set -', 'settings set -g')
def test_settings_set_dash_r_th(self):
"""Test that 'settings set -r th' completes to 'settings set -r thread-format'."""
self.complete_from_to('settings set -r th', 'settings set -r thread-format')
def test_settings_clear_th(self):
"""Test that 'settings clear th' completes to 'settings clear thread-format'."""
self.complete_from_to('settings clear th', 'settings clear thread-format')
def test_settings_set_ta(self):
"""Test that 'settings set ta' completes to 'settings set target.'."""
@ -98,7 +98,7 @@ class CommandLineCompletionTestCase(TestBase):
def test_settings_set_target_exec(self):
"""Test that 'settings set target.exec' completes to 'settings set target.exec-search-paths '."""
self.complete_from_to('settings set target.exec', 'settings set target.exec-search-paths ')
self.complete_from_to('settings set target.exec', 'settings set target.exec-search-paths')
def test_settings_set_target_pr(self):
"""Test that 'settings set target.pr' completes to ['Available completions:',

Some files were not shown because too many files have changed in this diff Show More