diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 81 | ||||
-rw-r--r-- | lldb/source/Commands/CommandCompletions.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 940 | ||||
-rw-r--r-- | lldb/source/Core/UserSettingsController.cpp | 44 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionValue.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionValueFileSpec.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionValueProperties.cpp | 14 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 245 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 898 | ||||
-rw-r--r-- | lldb/source/Target/TargetList.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/Thread.cpp | 283 |
11 files changed, 106 insertions, 2416 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index ca648b7caa7..ccb900e4e4d 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -908,55 +908,62 @@ SBDebugger::FindDebuggerWithID (int id) const char * SBDebugger::GetInstanceName() { - // TODO: SETTINGS -- fill this in -// if (m_opaque_sp) -// return m_opaque_sp->GetInstanceName().AsCString(); -// else + 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) { - // 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(); + SBError sb_error; + DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName (ConstString(debugger_instance_name))); + Error error; + if (debugger_sp) + { + ExecutionContext exe_ctx (debugger_sp->GetCommandInterpreter().GetExecutionContext()); + error = debugger_sp->SetPropertyValue (&exe_ctx, + eVarSetOperationAssign, + var_name, + value); + } + else + { + error.SetErrorStringWithFormat ("invalid debugger instance name '%s'", debugger_instance_name); + } + if (error.Fail()) + sb_error.SetError(error); + return sb_error; } SBStringList SBDebugger::GetInternalVariableValue (const char *var_name, const char *debugger_instance_name) { SBStringList ret_value; - // 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; + DebuggerSP debugger_sp(Debugger::FindDebuggerWithInstanceName (ConstString(debugger_instance_name))); + Error error; + if (debugger_sp) + { + ExecutionContext exe_ctx (debugger_sp->GetCommandInterpreter().GetExecutionContext()); + lldb::OptionValueSP value_sp (debugger_sp->GetPropertyValue (&exe_ctx, + var_name, + false, + error)); + if (value_sp) + { + StreamString value_strm; + value_sp->DumpValue (&exe_ctx, value_strm, OptionValue::eDumpOptionValue); + const std::string &value_str = value_strm.GetString(); + if (!value_str.empty()) + { + StringList string_list; + string_list.SplitIntoLines(value_str.c_str(), value_str.size()); + return SBStringList(&string_list); + } + } + } + return SBStringList(); } uint32_t diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index bb8b8aa7caa..adeebe311e5 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -422,11 +422,6 @@ CommandCompletions::SettingsNames (CommandInterpreter &interpreter, 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; } diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 3a2da84578d..682d57cd4bf 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -65,91 +65,6 @@ GetDebuggerList() static DebuggerList g_list; return g_list; } -// -// -//static const ConstString & -//PromptVarName () -//{ -// static ConstString g_const_string ("prompt"); -// return g_const_string; -//} -// -//static const ConstString & -//GetNotifyVoidName () -//{ -// static ConstString g_const_string ("notify-void"); -// return g_const_string; -//} -// -//static const ConstString & -//GetFrameFormatName () -//{ -// static ConstString g_const_string ("frame-format"); -// return g_const_string; -//} -// -//static const ConstString & -//GetThreadFormatName () -//{ -// static ConstString g_const_string ("thread-format"); -// return g_const_string; -//} -// -//static const ConstString & -//ScriptLangVarName () -//{ -// static ConstString g_const_string ("script-lang"); -// return g_const_string; -//} -// -//static const ConstString & -//TermWidthVarName () -//{ -// static ConstString g_const_string ("term-width"); -// return g_const_string; -//} -// -//static const ConstString & -//UseExternalEditorVarName () -//{ -// static ConstString g_const_string ("use-external-editor"); -// return g_const_string; -//} -// -//static const ConstString & -//AutoConfirmName () -//{ -// static ConstString g_const_string ("auto-confirm"); -// return g_const_string; -//} -// -//static const ConstString & -//StopSourceContextBeforeName () -//{ -// static ConstString g_const_string ("stop-line-count-before"); -// return g_const_string; -//} -// -//static const ConstString & -//StopSourceContextAfterName () -//{ -// static ConstString g_const_string ("stop-line-count-after"); -// return g_const_string; -//} -// -//static const ConstString & -//StopDisassemblyCountName () -//{ -// static ConstString g_const_string ("stop-disassembly-count"); -// return g_const_string; -//} -// -//static const ConstString & -//StopDisassemblyDisplayName () -//{ -// static ConstString g_const_string ("stop-disassembly-display"); -// return g_const_string; -//} OptionEnumValueElement g_show_disassembly_enum_values[] = @@ -383,33 +298,13 @@ Debugger::Terminate () void Debugger::SettingsInitialize () { -// static bool g_initialized = false; -// -// if (!g_initialized) -// { -// g_initialized = true; -// UserSettingsController::InitializeSettingsController (GetSettingsController(), -// SettingsController::global_settings_table, -// SettingsController::instance_settings_table); -// // Now call SettingsInitialize for each settings 'child' of Debugger -// Target::SettingsInitialize (); -// } + Target::SettingsInitialize (); } void Debugger::SettingsTerminate () { -// -// // Must call SettingsTerminate() for each settings 'child' of Debugger, before terminating the Debugger's -// // Settings. -// -// Target::SettingsTerminate (); -// -// // Now terminate the Debugger Settings. -// -// UserSettingsControllerSP &usc = GetSettingsController(); -// UserSettingsController::FinalizeSettingsController (usc); -// usc.reset(); + Target::SettingsTerminate (); } DebuggerSP @@ -452,22 +347,21 @@ DebuggerSP Debugger::FindDebuggerWithInstanceName (const ConstString &instance_name) { DebuggerSP debugger_sp; - // TODO: SETTINGS -// if (g_shared_debugger_refcount > 0) -// { -// Mutex::Locker locker (GetDebuggerListMutex ()); -// DebuggerList &debugger_list = GetDebuggerList(); -// DebuggerList::iterator pos, end = debugger_list.end(); -// -// for (pos = debugger_list.begin(); pos != end; ++pos) -// { -// if ((*pos).get()->m_instance_name == instance_name) -// { -// debugger_sp = *pos; -// break; -// } -// } -// } + if (g_shared_debugger_refcount > 0) + { + Mutex::Locker locker (GetDebuggerListMutex ()); + DebuggerList &debugger_list = GetDebuggerList(); + DebuggerList::iterator pos, end = debugger_list.end(); + + for (pos = debugger_list.begin(); pos != end; ++pos) + { + if ((*pos).get()->m_instance_name == instance_name) + { + debugger_sp = *pos; + break; + } + } + } return debugger_sp; } @@ -2591,803 +2485,3 @@ Debugger::EnableLog (const char *channel, const char **categories, const char *l return false; } -#pragma mark Debugger::SettingsController - -//-------------------------------------------------- -// class Debugger::SettingsController -//-------------------------------------------------- - -//Debugger::SettingsController::SettingsController () : -// UserSettingsController ("", UserSettingsControllerSP()) -//{ -//} -// -//Debugger::SettingsController::~SettingsController () -//{ -//} -// -// -//InstanceSettingsSP -//Debugger::SettingsController::CreateInstanceSettings (const char *instance_name) -//{ -// InstanceSettingsSP new_settings_sp (new DebuggerInstanceSettings (GetSettingsController(), -// false, -// instance_name)); -// return new_settings_sp; -//} - -#pragma mark DebuggerInstanceSettings -//-------------------------------------------------- -// class DebuggerInstanceSettings -//-------------------------------------------------- - -//DebuggerInstanceSettings::DebuggerInstanceSettings -//( -// const UserSettingsControllerSP &m_owner_sp, -// bool live_instance, -// const char *name -//) : -// InstanceSettings (m_owner_sp, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance), -// m_term_width (80), -// m_stop_source_before_count (3), -// m_stop_source_after_count (3), -// m_stop_disassembly_count (4), -// m_stop_disassembly_display (eStopDisassemblyTypeNoSource), -// m_prompt (), -// m_frame_format (), -// m_thread_format (), -// m_script_lang (), -// m_use_external_editor (false), -// m_auto_confirm_on (false) -//{ -// // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called -// // until the vtables for DebuggerInstanceSettings 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. -// // The same is true of CreateInstanceName(). -// -// if (GetInstanceName() == InstanceSettings::InvalidName()) -// { -// ChangeInstanceName (std::string (CreateInstanceName().AsCString())); -// m_owner_sp->RegisterInstanceSettings (this); -// } -// -// if (live_instance) -// { -// const InstanceSettingsSP &pending_settings = m_owner_sp->FindPendingSettings (m_instance_name); -// CopyInstanceSettings (pending_settings, false); -// } -//} -// -//DebuggerInstanceSettings::DebuggerInstanceSettings (const DebuggerInstanceSettings &rhs) : -// InstanceSettings (Debugger::GetSettingsController(), CreateInstanceName ().AsCString()), -// m_prompt (rhs.m_prompt), -// m_frame_format (rhs.m_frame_format), -// m_thread_format (rhs.m_thread_format), -// m_script_lang (rhs.m_script_lang), -// m_use_external_editor (rhs.m_use_external_editor), -// m_auto_confirm_on(rhs.m_auto_confirm_on) -//{ -// UserSettingsControllerSP owner_sp (m_owner_wp.lock()); -// if (owner_sp) -// { -// CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name), false); -// owner_sp->RemovePendingSettings (m_instance_name); -// } -//} -// -//DebuggerInstanceSettings::~DebuggerInstanceSettings () -//{ -//} -// -//DebuggerInstanceSettings& -//DebuggerInstanceSettings::operator= (const DebuggerInstanceSettings &rhs) -//{ -// if (this != &rhs) -// { -// m_term_width = rhs.m_term_width; -// m_prompt = rhs.m_prompt; -// m_frame_format = rhs.m_frame_format; -// m_thread_format = rhs.m_thread_format; -// m_script_lang = rhs.m_script_lang; -// m_use_external_editor = rhs.m_use_external_editor; -// m_auto_confirm_on = rhs.m_auto_confirm_on; -// } -// -// return *this; -//} -// -//bool -//DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Error err) -//{ -// bool valid = false; -// -// // Verify we have a value string. -// if (value == NULL || value[0] == '\0') -// { -// err.SetErrorString ("missing value, can't set terminal width without a value"); -// } -// else -// { -// char *end = NULL; -// const uint32_t width = ::strtoul (value, &end, 0); -// -// if (end && end[0] == '\0') -// { -// return ValidTermWidthValue (width, err); -// } -// else -// err.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string", value); -// } -// -// return valid; -//} -// -//bool -//DebuggerInstanceSettings::ValidTermWidthValue (uint32_t value, Error err) -//{ -// if (value >= 10 && value <= 1024) -// return true; -// else -// { -// err.SetErrorString ("invalid term-width value; value must be between 10 and 1024"); -// return false; -// } -//} -// -//void -//DebuggerInstanceSettings::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 == TermWidthVarName()) -// { -// if (ValidTermWidthValue (value, err)) -// { -// m_term_width = ::strtoul (value, NULL, 0); -// } -// } -// else if (var_name == PromptVarName()) -// { -// UserSettingsController::UpdateStringVariable (op, m_prompt, value, err); -// if (!pending) -// { -// // 'instance_name' is actually (probably) in the form '[<instance_name>]'; if so, we need to -// // strip off the brackets before passing it to BroadcastPromptChange. -// -// std::string tmp_instance_name (instance_name.AsCString()); -// if ((tmp_instance_name[0] == '[') -// && (tmp_instance_name[instance_name.GetLength() - 1] == ']')) -// tmp_instance_name = tmp_instance_name.substr (1, instance_name.GetLength() - 2); -// ConstString new_name (tmp_instance_name.c_str()); -// -// BroadcastPromptChange (new_name, m_prompt.c_str()); -// } -// } -// else if (var_name == GetFrameFormatName()) -// { -// UserSettingsController::UpdateStringVariable (op, m_frame_format, value, err); -// } -// else if (var_name == GetThreadFormatName()) -// { -// UserSettingsController::UpdateStringVariable (op, m_thread_format, value, err); -// } -// else if (var_name == ScriptLangVarName()) -// { -// bool success; -// m_script_lang = Args::StringToScriptLanguage (value, eScriptLanguageDefault, -// &success); -// } -// else if (var_name == UseExternalEditorVarName ()) -// { -// UserSettingsController::UpdateBooleanVariable (op, m_use_external_editor, value, false, err); -// } -// else if (var_name == AutoConfirmName ()) -// { -// UserSettingsController::UpdateBooleanVariable (op, m_auto_confirm_on, value, false, err); -// } -// else if (var_name == StopSourceContextBeforeName ()) -// { -// uint32_t new_value = Args::StringToUInt32(value, UINT32_MAX, 10, NULL); -// if (new_value != UINT32_MAX) -// m_stop_source_before_count = new_value; -// else -// err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextBeforeName ().GetCString()); -// } -// else if (var_name == StopSourceContextAfterName ()) -// { -// uint32_t new_value = Args::StringToUInt32(value, UINT32_MAX, 10, NULL); -// if (new_value != UINT32_MAX) -// m_stop_source_after_count = new_value; -// else -// err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextAfterName ().GetCString()); -// } -// else if (var_name == StopDisassemblyCountName ()) -// { -// uint32_t new_value = Args::StringToUInt32(value, UINT32_MAX, 10, NULL); -// if (new_value != UINT32_MAX) -// m_stop_disassembly_count = new_value; -// else -// err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopDisassemblyCountName ().GetCString()); -// } -// else if (var_name == StopDisassemblyDisplayName ()) -// { -// int new_value; -// UserSettingsController::UpdateEnumVariable (g_show_disassembly_enum_values, &new_value, value, err); -// if (err.Success()) -// m_stop_disassembly_display = (StopDisassemblyType)new_value; -// } -//} -// -//bool -//DebuggerInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry, -// const ConstString &var_name, -// StringList &value, -// Error *err) -//{ -// if (var_name == PromptVarName()) -// { -// value.AppendString (m_prompt.c_str(), m_prompt.size()); -// -// } -// else if (var_name == ScriptLangVarName()) -// { -// value.AppendString (ScriptInterpreter::LanguageToString (m_script_lang).c_str()); -// } -// else if (var_name == TermWidthVarName()) -// { -// StreamString width_str; -// width_str.Printf ("%u", m_term_width); -// value.AppendString (width_str.GetData()); -// } -// else if (var_name == GetFrameFormatName ()) -// { -// value.AppendString(m_frame_format.c_str(), m_frame_format.size()); -// } -// else if (var_name == GetThreadFormatName ()) -// { -// value.AppendString(m_thread_format.c_str(), m_thread_format.size()); -// } -// else if (var_name == UseExternalEditorVarName()) -// { -// if (m_use_external_editor) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == AutoConfirmName()) -// { -// if (m_auto_confirm_on) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == StopSourceContextAfterName ()) -// { -// StreamString strm; -// strm.Printf ("%u", m_stop_source_after_count); -// value.AppendString (strm.GetData()); -// } -// else if (var_name == StopSourceContextBeforeName ()) -// { -// StreamString strm; -// strm.Printf ("%u", m_stop_source_before_count); -// value.AppendString (strm.GetData()); -// } -// else if (var_name == StopDisassemblyCountName ()) -// { -// StreamString strm; -// strm.Printf ("%u", m_stop_disassembly_count); -// value.AppendString (strm.GetData()); -// } -// else if (var_name == StopDisassemblyDisplayName ()) -// { -// if (m_stop_disassembly_display >= eStopDisassemblyTypeNever && m_stop_disassembly_display <= eStopDisassemblyTypeAlways) -// value.AppendString (g_show_disassembly_enum_values[m_stop_disassembly_display].string_value); -// else -// value.AppendString ("<invalid>"); -// } -// else -// { -// if (err) -// err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString()); -// return false; -// } -// return true; -//} -// -//void -//DebuggerInstanceSettings::CopyInstanceSettings (const InstanceSettingsSP &new_settings, -// bool pending) -//{ -// if (new_settings.get() == NULL) -// return; -// -// DebuggerInstanceSettings *new_debugger_settings = (DebuggerInstanceSettings *) new_settings.get(); -// -// m_prompt = new_debugger_settings->m_prompt; -// if (!pending) -// { -// // 'instance_name' is actually (probably) in the form '[<instance_name>]'; if so, we need to -// // strip off the brackets before passing it to BroadcastPromptChange. -// -// std::string tmp_instance_name (m_instance_name.AsCString()); -// if ((tmp_instance_name[0] == '[') -// && (tmp_instance_name[m_instance_name.GetLength() - 1] == ']')) -// tmp_instance_name = tmp_instance_name.substr (1, m_instance_name.GetLength() - 2); -// ConstString new_name (tmp_instance_name.c_str()); -// -// BroadcastPromptChange (new_name, m_prompt.c_str()); -// } -// m_frame_format = new_debugger_settings->m_frame_format; -// m_thread_format = new_debugger_settings->m_thread_format; -// m_term_width = new_debugger_settings->m_term_width; -// m_script_lang = new_debugger_settings->m_script_lang; -// m_use_external_editor = new_debugger_settings->m_use_external_editor; -// m_auto_confirm_on = new_debugger_settings->m_auto_confirm_on; -//} -// -// -//bool -//DebuggerInstanceSettings::BroadcastPromptChange (const ConstString &instance_name, const char *new_prompt) -//{ -// std::string tmp_prompt; -// -// if (new_prompt != NULL) -// { -// tmp_prompt = new_prompt ; -// int len = tmp_prompt.size(); -// if (len > 1 -// && (tmp_prompt[0] == '\'' || tmp_prompt[0] == '"') -// && (tmp_prompt[len-1] == tmp_prompt[0])) -// { -// tmp_prompt = tmp_prompt.substr(1,len-2); -// } -// len = tmp_prompt.size(); -// if (tmp_prompt[len-1] != ' ') -// tmp_prompt.append(" "); -// } -// EventSP new_event_sp; -// new_event_sp.reset (new Event(CommandInterpreter::eBroadcastBitResetPrompt, -// new EventDataBytes (tmp_prompt.c_str()))); -// -// if (instance_name.GetLength() != 0) -// { -// // Set prompt for a particular instance. -// Debugger *dbg = Debugger::FindDebuggerWithInstanceName (instance_name).get(); -// if (dbg != NULL) -// { -// dbg->GetCommandInterpreter().BroadcastEvent (new_event_sp); -// } -// } -// -// return true; -//} -// -//const ConstString -//DebuggerInstanceSettings::CreateInstanceName () -//{ -// static int instance_count = 1; -// StreamString sstr; -// -// sstr.Printf ("debugger_%d", instance_count); -// ++instance_count; -// -// const ConstString ret_val (sstr.GetData()); -// -// return ret_val; -//} -// -// - -//DebuggerInstanceSettings::DebuggerInstanceSettings -//( -// const UserSettingsControllerSP &m_owner_sp, -// bool live_instance, -// const char *name -//) : -// InstanceSettings (m_owner_sp, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance), -// m_term_width (80), -// m_stop_source_before_count (3), -// m_stop_source_after_count (3), -// m_stop_disassembly_count (4), -// m_stop_disassembly_display (eStopDisassemblyTypeNoSource), -// m_prompt (), -// m_notify_void (false), -// m_frame_format (), -// m_thread_format (), -// m_script_lang (), -// m_use_external_editor (false), -// m_auto_confirm_on (false) -//{ -// // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called -// // until the vtables for DebuggerInstanceSettings 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. -// // The same is true of CreateInstanceName(). -// -// if (GetInstanceName() == InstanceSettings::InvalidName()) -// { -// ChangeInstanceName (std::string (CreateInstanceName().AsCString())); -// m_owner_sp->RegisterInstanceSettings (this); -// } -// -// if (live_instance) -// { -// const InstanceSettingsSP &pending_settings = m_owner_sp->FindPendingSettings (m_instance_name); -// CopyInstanceSettings (pending_settings, false); -// } -//} -// -//DebuggerInstanceSettings::DebuggerInstanceSettings (const DebuggerInstanceSettings &rhs) : -// InstanceSettings (Debugger::GetSettingsController(), CreateInstanceName ().AsCString()), -// m_prompt (rhs.m_prompt), -// m_notify_void (rhs.m_notify_void), -// m_frame_format (rhs.m_frame_format), -// m_thread_format (rhs.m_thread_format), -// m_script_lang (rhs.m_script_lang), -// m_use_external_editor (rhs.m_use_external_editor), -// m_auto_confirm_on(rhs.m_auto_confirm_on) -//{ -// UserSettingsControllerSP owner_sp (m_owner_wp.lock()); -// if (owner_sp) -// { -// CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name), false); -// owner_sp->RemovePendingSettings (m_instance_name); -// } -//} -// -//DebuggerInstanceSettings::~DebuggerInstanceSettings () -//{ -//} -// -//DebuggerInstanceSettings& -//DebuggerInstanceSettings::operator= (const DebuggerInstanceSettings &rhs) -//{ -// if (this != &rhs) -// { -// m_term_width = rhs.m_term_width; -// m_prompt = rhs.m_prompt; -// m_notify_void = rhs.m_notify_void; -// m_frame_format = rhs.m_frame_format; -// m_thread_format = rhs.m_thread_format; -// m_script_lang = rhs.m_script_lang; -// m_use_external_editor = rhs.m_use_external_editor; -// m_auto_confirm_on = rhs.m_auto_confirm_on; -// } -// -// return *this; -//} -// -//bool -//DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Error err) -//{ -// bool valid = false; -// -// // Verify we have a value string. -// if (value == NULL || value[0] == '\0') -// { -// err.SetErrorString ("missing value, can't set terminal width without a value"); -// } -// else -// { -// char *end = NULL; -// const uint32_t width = ::strtoul (value, &end, 0); -// -// if (end && end[0] == '\0') -// { -// return ValidTermWidthValue (width, err); -// } -// else -// err.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string", value); -// } -// -// return valid; -//} -// -//bool -//DebuggerInstanceSettings::ValidTermWidthValue (uint32_t value, Error err) -//{ -// if (value >= 10 && value <= 1024) -// return true; -// else -// { -// err.SetErrorString ("invalid term-width value; value must be between 10 and 1024"); -// return false; -// } -//} -// -//void -//DebuggerInstanceSettings::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 == TermWidthVarName()) -// { -// if (ValidTermWidthValue (value, err)) -// { -// m_term_width = ::strtoul (value, NULL, 0); -// } -// } -// else if (var_name == PromptVarName()) -// { -// UserSettingsController::UpdateStringVariable (op, m_prompt, value, err); -// if (!pending) -// { -// // 'instance_name' is actually (probably) in the form '[<instance_name>]'; if so, we need to -// // strip off the brackets before passing it to BroadcastPromptChange. -// -// std::string tmp_instance_name (instance_name.AsCString()); -// if ((tmp_instance_name[0] == '[') -// && (tmp_instance_name[instance_name.GetLength() - 1] == ']')) -// tmp_instance_name = tmp_instance_name.substr (1, instance_name.GetLength() - 2); -// ConstString new_name (tmp_instance_name.c_str()); -// -// BroadcastPromptChange (new_name, m_prompt.c_str()); -// } -// } -// else if (var_name == GetNotifyVoidName()) -// { -// UserSettingsController::UpdateBooleanVariable (op, m_notify_void, value, false, err); -// } -// else if (var_name == GetFrameFormatName()) -// { -// UserSettingsController::UpdateStringVariable (op, m_frame_format, value, err); -// } -// else if (var_name == GetThreadFormatName()) -// { -// UserSettingsController::UpdateStringVariable (op, m_thread_format, value, err); -// } -// else if (var_name == ScriptLangVarName()) -// { -// bool success; -// m_script_lang = Args::StringToScriptLanguage (value, eScriptLanguageDefault, -// &success); -// } -// else if (var_name == UseExternalEditorVarName ()) -// { -// UserSettingsController::UpdateBooleanVariable (op, m_use_external_editor, value, false, err); -// } -// else if (var_name == AutoConfirmName ()) -// { -// UserSettingsController::UpdateBooleanVariable (op, m_auto_confirm_on, value, false, err); -// } -// else if (var_name == StopSourceContextBeforeName ()) -// { -// uint32_t new_value = Args::StringToUInt32(value, UINT32_MAX, 10, NULL); -// if (new_value != UINT32_MAX) -// m_stop_source_before_count = new_value; -// else -// err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextBeforeName ().GetCString()); -// } -// else if (var_name == StopSourceContextAfterName ()) -// { -// uint32_t new_value = Args::StringToUInt32(value, UINT32_MAX, 10, NULL); -// if (new_value != UINT32_MAX) -// m_stop_source_after_count = new_value; -// else -// err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopSourceContextAfterName ().GetCString()); -// } -// else if (var_name == StopDisassemblyCountName ()) -// { -// uint32_t new_value = Args::StringToUInt32(value, UINT32_MAX, 10, NULL); -// if (new_value != UINT32_MAX) -// m_stop_disassembly_count = new_value; -// else -// err.SetErrorStringWithFormat("invalid unsigned string value '%s' for the '%s' setting", value, StopDisassemblyCountName ().GetCString()); -// } -// else if (var_name == StopDisassemblyDisplayName ()) -// { -// int new_value; -// UserSettingsController::UpdateEnumVariable (g_show_disassembly_enum_values, &new_value, value, err); -// if (err.Success()) -// m_stop_disassembly_display = (StopDisassemblyType)new_value; -// } -//} -// -//bool -//DebuggerInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry, -// const ConstString &var_name, -// StringList &value, -// Error *err) -//{ -// if (var_name == PromptVarName()) -// { -// value.AppendString (m_prompt.c_str(), m_prompt.size()); -// } -// else if (var_name == GetNotifyVoidName()) -// { -// value.AppendString (m_notify_void ? "true" : "false"); -// } -// else if (var_name == ScriptLangVarName()) -// { -// value.AppendString (ScriptInterpreter::LanguageToString (m_script_lang).c_str()); -// } -// else if (var_name == TermWidthVarName()) -// { -// StreamString width_str; -// width_str.Printf ("%u", m_term_width); -// value.AppendString (width_str.GetData()); -// } -// else if (var_name == GetFrameFormatName ()) -// { -// value.AppendString(m_frame_format.c_str(), m_frame_format.size()); -// } -// else if (var_name == GetThreadFormatName ()) -// { -// value.AppendString(m_thread_format.c_str(), m_thread_format.size()); -// } -// else if (var_name == UseExternalEditorVarName()) -// { -// if (m_use_external_editor) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == AutoConfirmName()) -// { -// if (m_auto_confirm_on) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == StopSourceContextAfterName ()) -// { -// StreamString strm; -// strm.Printf ("%u", m_stop_source_after_count); -// value.AppendString (strm.GetData()); -// } -// else if (var_name == StopSourceContextBeforeName ()) -// { -// StreamString strm; -// strm.Printf ("%u", m_stop_source_before_count); -// value.AppendString (strm.GetData()); -// } -// else if (var_name == StopDisassemblyCountName ()) -// { -// StreamString strm; -// strm.Printf ("%u", m_stop_disassembly_count); -// value.AppendString (strm.GetData()); -// } -// else if (var_name == StopDisassemblyDisplayName ()) -// { -// if (m_stop_disassembly_display >= eStopDisassemblyTypeNever && m_stop_disassembly_display <= eStopDisassemblyTypeAlways) -// value.AppendString (g_show_disassembly_enum_values[m_stop_disassembly_display].string_value); -// else -// value.AppendString ("<invalid>"); -// } -// else -// { -// if (err) -// err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString()); -// return false; -// } -// return true; -//} -// -//void -//DebuggerInstanceSettings::CopyInstanceSettings (const InstanceSettingsSP &new_settings, -// bool pending) -//{ -// if (new_settings.get() == NULL) -// return; -// -// DebuggerInstanceSettings *new_debugger_settings = (DebuggerInstanceSettings *) new_settings.get(); -// -// m_prompt = new_debugger_settings->m_prompt; -// if (!pending) -// { -// // 'instance_name' is actually (probably) in the form '[<instance_name>]'; if so, we need to -// // strip off the brackets before passing it to BroadcastPromptChange. -// -// std::string tmp_instance_name (m_instance_name.AsCString()); -// if ((tmp_instance_name[0] == '[') -// && (tmp_instance_name[m_instance_name.GetLength() - 1] == ']')) -// tmp_instance_name = tmp_instance_name.substr (1, m_instance_name.GetLength() - 2); -// ConstString new_name (tmp_instance_name.c_str()); -// -// BroadcastPromptChange (new_name, m_prompt.c_str()); -// } -// m_notify_void = new_debugger_settings->m_notify_void; -// m_frame_format = new_debugger_settings->m_frame_format; -// m_thread_format = new_debugger_settings->m_thread_format; -// m_term_width = new_debugger_settings->m_term_width; -// m_script_lang = new_debugger_settings->m_script_lang; -// m_use_external_editor = new_debugger_settings->m_use_external_editor; -// m_auto_confirm_on = new_debugger_settings->m_auto_confirm_on; -//} -// -// -//bool -//DebuggerInstanceSettings::BroadcastPromptChange (const ConstString &instance_name, const char *new_prompt) -//{ -// std::string tmp_prompt; -// -// if (new_prompt != NULL) -// { -// tmp_prompt = new_prompt ; -// int len = tmp_prompt.size(); -// if (len > 1 -// && (tmp_prompt[0] == '\'' || tmp_prompt[0] == '"') -// && (tmp_prompt[len-1] == tmp_prompt[0])) -// { -// tmp_prompt = tmp_prompt.substr(1,len-2); -// } -// len = tmp_prompt.size(); -// if (tmp_prompt[len-1] != ' ') -// tmp_prompt.append(" "); -// } -// EventSP new_event_sp; -// new_event_sp.reset (new Event(CommandInterpreter::eBroadcastBitResetPrompt, -// new EventDataBytes (tmp_prompt.c_str()))); -// -// if (instance_name.GetLength() != 0) -// { -// // Set prompt for a particular instance. -// Debugger *dbg = Debugger::FindDebuggerWithInstanceName (instance_name).get(); -// if (dbg != NULL) -// { -// dbg->GetCommandInterpreter().BroadcastEvent (new_event_sp); -// } -// } -// -// return true; -//} -// -//const ConstString -//DebuggerInstanceSettings::CreateInstanceName () -//{ -// static int instance_count = 1; -// StreamString sstr; -// -// sstr.Printf ("debugger_%d", instance_count); -// ++instance_count; -// -// const ConstString ret_val (sstr.GetData()); -// -// return ret_val; -//} -// - -//-------------------------------------------------- -// SettingsController Variable Tables -//-------------------------------------------------- - -// -//SettingEntry -//Debugger::SettingsController::global_settings_table[] = -//{ -// //{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"}, -// // The Debugger level global table should always be empty; all Debugger settable variables should be instance -// // variables. -// { NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL } -//}; - -//SettingEntry -//Debugger::SettingsController::instance_settings_table[] = -//{ -//// NAME Setting variable type Default Enum Init'd Hidden Help -//// ======================= ======================= ====================== ==== ====== ====== ====================== -//{ "frame-format", eSetVarTypeString, DEFAULT_FRAME_FORMAT, NULL, false, false, "The default frame format string to use when displaying thread information." }, -//{ "prompt", eSetVarTypeString, "(lldb) ", NULL, false, false, "The debugger command line prompt displayed for the user." }, -//{ "script-lang", eSetVarTypeString, "python", NULL, false, false, "The script language to be used for evaluating user-written scripts." }, -//{ "term-width", eSetVarTypeInt, "80" , NULL, false, false, "The maximum number of columns to use for displaying text." }, -//{ "thread-format", eSetVarTypeString, DEFAULT_THREAD_FORMAT, NULL, false, false, "The default thread format string to use when displaying thread information." }, -//{ "use-external-editor", eSetVarTypeBoolean, "false", NULL, false, false, "Whether to use an external editor or not." }, -//{ "auto-confirm", eSetVarTypeBoolean, "false", NULL, false, false, "If true all confirmation prompts will receive their default reply." }, -//{ "stop-line-count-before",eSetVarTypeInt, "3", NULL, false, false, "The number of sources lines to display that come before the current source line when displaying a stopped context." }, -//{ "stop-line-count-after", eSetVarTypeInt, "3", NULL, false, false, "The number of sources lines to display that come after the current source line when displaying a stopped context." }, -//{ "stop-disassembly-count", eSetVarTypeInt, "0", NULL, false, false, "The number of disassembly lines to show when displaying a stopped context." }, -//{ "stop-disassembly-display", eSetVarTypeEnum, "no-source", g_show_disassembly_enum_values, false, false, "Control when to display disassembly when displaying a stopped context." }, -//{ NULL, eSetVarTypeNone, NULL, NULL, false, false, NULL } -//}; diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index b7ea6af0e90..68e1a625043 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -21,50 +21,6 @@ using namespace lldb; using namespace lldb_private; -//static void -//DumpSettingEntry (CommandInterpreter &interpreter, -// Stream &strm, -// const uint32_t max_len, -// const SettingEntry &entry) -//{ -// StreamString description; -// -// if (entry.description) -// description.Printf ("%s", entry.description); -// -// if (entry.default_value && entry.default_value[0]) -// description.Printf (" (default: %s)", entry.default_value); -// -// interpreter.OutputFormattedHelpText (strm, -// entry.var_name, -// "--", -// description.GetData(), -// max_len); -// -// if (entry.enum_values && entry.enum_values[0].string_value) -// { -// interpreter.OutputFormattedHelpText (strm, -// "", -// " ", -// "Enumeration values:", -// max_len); -// for (uint32_t enum_idx=0; entry.enum_values[enum_idx].string_value != NULL; ++enum_idx) -// { -// description.Clear(); -// if (entry.enum_values[enum_idx].usage) -// description.Printf ("%s = %s", -// entry.enum_values[enum_idx].string_value, -// entry.enum_values[enum_idx].usage); -// else -// description.Printf ("%s", entry.enum_values[enum_idx].string_value); -// interpreter.OutputFormattedHelpText (strm, -// "", -// " ", -// description.GetData(), -// max_len); -// } -// } -//} lldb::OptionValueSP Properties::GetPropertyValue (const ExecutionContext *exe_ctx, diff --git a/lldb/source/Interpreter/OptionValue.cpp b/lldb/source/Interpreter/OptionValue.cpp index 01ba65cf107..564fec8bc28 100644 --- a/lldb/source/Interpreter/OptionValue.cpp +++ b/lldb/source/Interpreter/OptionValue.cpp @@ -379,7 +379,7 @@ OptionValue::SetFileSpecValue (const FileSpec &file_spec) OptionValueFileSpec *option_value = GetAsFileSpec (); if (option_value) { - option_value->SetCurrentValue(file_spec); + option_value->SetCurrentValue(file_spec, false); return true; } return false; diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index 20b0b043e0b..3a1f26dd5f6 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -113,4 +113,12 @@ OptionValueFileSpec::AutoComplete (CommandInterpreter &interpreter, +const lldb::DataBufferSP & +OptionValueFileSpec::GetFileContents() +{ + if (!m_data_sp && m_current_value) + m_data_sp = m_current_value.ReadFileContents(); + return m_data_sp; +} + diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index ce31c15678a..304ce6299ed 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -407,6 +407,20 @@ OptionValueProperties::SetPropertyAtIndexAsEnumeration (const ExecutionContext * } +OptionValueFileSpec * +OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpec (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const +{ + const Property *property = GetPropertyAtIndex (exe_ctx, false, idx); + if (property) + { + OptionValue *value = property->GetValue().get(); + if (value) + return value->GetAsFileSpec(); + } + return NULL; +} + + FileSpec OptionValueProperties::GetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx) const { diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 47b64aa971c..29f3793c360 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -4062,38 +4062,16 @@ Process::SettingsInitialize () // 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 (); + 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(); + Thread::SettingsTerminate (); } -//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, lldb::ThreadPlanSP &thread_plan_sp, @@ -4925,222 +4903,3 @@ Process::Flush () { m_thread_list.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; -//} - -//-------------------------------------------------------------- -// 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 } -//}; -// -// - - diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 73432876d67..5a49aab8e4e 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -56,7 +56,6 @@ Target::GetStaticBroadcasterClass () Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp) : TargetProperties (this), Broadcaster (&debugger, "lldb.target"), -//TargetInstanceSettings (GetSettingsController()), ExecutionContextScope (), m_debugger (debugger), m_platform_sp (platform_sp), @@ -966,8 +965,6 @@ Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files) } } } - -// UpdateInstanceName(); } @@ -999,7 +996,7 @@ Target::SetArchitecture (const ArchSpec &arch_spec) ModuleSpec module_spec (executable_sp->GetFileSpec(), arch_spec); Error error = ModuleList::GetSharedModule (module_spec, executable_sp, - NULL, // &GetExecutableSearchPaths(), // TODO: SETTINGS + &GetExecutableSearchPaths(), NULL, NULL); @@ -1350,7 +1347,7 @@ Target::GetSharedModule (const ModuleSpec &module_spec, Error *error_ptr) transformed_spec.GetFileSpec().GetFilename() = module_spec.GetFileSpec().GetFilename(); error = ModuleList::GetSharedModule (transformed_spec, module_sp, - NULL, // TODO: SETTINGS &GetExecutableSearchPaths(), + &GetExecutableSearchPaths(), &old_module_sp, &did_create_module); } @@ -1371,7 +1368,7 @@ Target::GetSharedModule (const ModuleSpec &module_spec, Error *error_ptr) // We have a UUID, it is OK to check the global module list... error = ModuleList::GetSharedModule (module_spec, module_sp, - NULL, // TODO: SETTINGS &GetExecutableSearchPaths(), + &GetExecutableSearchPaths(), &old_module_sp, &did_create_module); } @@ -1385,7 +1382,7 @@ Target::GetSharedModule (const ModuleSpec &module_spec, Error *error_ptr) FileSpec platform_file_spec; error = m_platform_sp->GetSharedModule (module_spec, module_sp, - NULL, // TODO: SETTINGS &GetExecutableSearchPaths(), + &GetExecutableSearchPaths(), &old_module_sp, &did_create_module); } @@ -1527,47 +1524,14 @@ Target::GetClangASTImporter() void Target::SettingsInitialize () { -// UserSettingsController::InitializeSettingsController (GetSettingsController(), -// SettingsController::global_settings_table, -// SettingsController::instance_settings_table); -// -// // Now call SettingsInitialize() on each 'child' setting of Target -// Process::SettingsInitialize (); + Process::SettingsInitialize (); } void Target::SettingsTerminate () { - - // Must call SettingsTerminate() on each settings 'child' of Target, before terminating Target's Settings. -// -// Process::SettingsTerminate (); -// -// // Now terminate Target Settings. -// -// UserSettingsControllerSP &usc = GetSettingsController(); -// UserSettingsController::FinalizeSettingsController (usc); -// usc.reset(); -} - -//UserSettingsControllerSP & -//Target::GetSettingsController () -//{ -// static UserSettingsControllerSP g_settings_controller_sp; -// if (!g_settings_controller_sp) -// { -// g_settings_controller_sp.reset (new Target::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 TargetInstanceSettings (g_settings_controller_sp, -// false, -// InstanceSettings::GetDefaultName().AsCString())); -// g_settings_controller_sp->SetDefaultInstanceSettings (default_instance_settings_sp); -// } -// return g_settings_controller_sp; -//} + Process::SettingsTerminate (); +} FileSpecList Target::GetDefaultExecutableSearchPaths () @@ -1610,31 +1574,6 @@ Target::GetTargetFromContexts (const ExecutionContext *exe_ctx_ptr, const Symbol return target; } - -//void -//Target::UpdateInstanceName () -//{ -// StreamString sstr; -// -// Module *exe_module = GetExecutableModulePointer(); -// if (exe_module) -// { -// sstr.Printf ("%s_%s", -// exe_module->GetFileSpec().GetFilename().AsCString(), -// exe_module->GetArchitecture().GetArchitectureName()); -// GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), sstr.GetData()); -// } -//} -// -const char * -Target::GetExpressionPrefixContentsAsCString () -{ - // TODO: SETTINGS -// if (!m_expr_prefix_contents.empty()) -// return m_expr_prefix_contents.c_str(); - return NULL; -} - ExecutionResults Target::EvaluateExpression ( @@ -2140,214 +2079,6 @@ Target::StopHook::GetDescription (Stream *s, lldb::DescriptionLevel level) const s->SetIndentLevel (indent_level); } - -//-------------------------------------------------------------- -// class Target::SettingsController -//-------------------------------------------------------------- - -//Target::SettingsController::SettingsController () : -// UserSettingsController ("target", Debugger::GetSettingsController()), -// m_default_architecture () -//{ -//} -// -//Target::SettingsController::~SettingsController () -//{ -//} -// -//lldb::InstanceSettingsSP -//Target::SettingsController::CreateInstanceSettings (const char *instance_name) -//{ -// lldb::InstanceSettingsSP new_settings_sp (new TargetInstanceSettings (GetSettingsController(), -// false, -// instance_name)); -// return new_settings_sp; -//} -// -// -//#define TSC_DEFAULT_ARCH "default-arch" -//#define TSC_EXPR_PREFIX "expr-prefix" -//#define TSC_PREFER_DYNAMIC "prefer-dynamic-value" -//#define TSC_ENABLE_SYNTHETIC "enable-synthetic-value" -//#define TSC_SKIP_PROLOGUE "skip-prologue" -//#define TSC_SOURCE_MAP "source-map" -//#define TSC_EXE_SEARCH_PATHS "exec-search-paths" -//#define TSC_MAX_CHILDREN "max-children-count" -//#define TSC_MAX_STRLENSUMMARY "max-string-summary-length" -//#define TSC_PLATFORM_AVOID "breakpoints-use-platform-avoid-list" -//#define TSC_RUN_ARGS "run-args" -//#define TSC_ENV_VARS "env-vars" -//#define TSC_INHERIT_ENV "inherit-env" -//#define TSC_STDIN_PATH "input-path" -//#define TSC_STDOUT_PATH "output-path" -//#define TSC_STDERR_PATH "error-path" -//#define TSC_DISABLE_ASLR "disable-aslr" -//#define TSC_DISABLE_STDIO "disable-stdio" -// -// -//static const ConstString & -//GetSettingNameForDefaultArch () -//{ -// static ConstString g_const_string (TSC_DEFAULT_ARCH); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForExpressionPrefix () -//{ -// static ConstString g_const_string (TSC_EXPR_PREFIX); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForPreferDynamicValue () -//{ -// static ConstString g_const_string (TSC_PREFER_DYNAMIC); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForEnableSyntheticValue () -//{ -// static ConstString g_const_string (TSC_ENABLE_SYNTHETIC); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForSourcePathMap () -//{ -// static ConstString g_const_string (TSC_SOURCE_MAP); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForExecutableSearchPaths () -//{ -// static ConstString g_const_string (TSC_EXE_SEARCH_PATHS); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForSkipPrologue () -//{ -// static ConstString g_const_string (TSC_SKIP_PROLOGUE); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForMaxChildren () -//{ -// static ConstString g_const_string (TSC_MAX_CHILDREN); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForMaxStringSummaryLength () -//{ -// static ConstString g_const_string (TSC_MAX_STRLENSUMMARY); -// return g_const_string; -//} -// -//static const ConstString & -//GetSettingNameForPlatformAvoid () -//{ -// static ConstString g_const_string (TSC_PLATFORM_AVOID); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForRunArgs () -//{ -// static ConstString g_const_string (TSC_RUN_ARGS); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForEnvVars () -//{ -// static ConstString g_const_string (TSC_ENV_VARS); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForInheritHostEnv () -//{ -// static ConstString g_const_string (TSC_INHERIT_ENV); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForInputPath () -//{ -// static ConstString g_const_string (TSC_STDIN_PATH); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForOutputPath () -//{ -// static ConstString g_const_string (TSC_STDOUT_PATH); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForErrorPath () -//{ -// static ConstString g_const_string (TSC_STDERR_PATH); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForDisableASLR () -//{ -// static ConstString g_const_string (TSC_DISABLE_ASLR); -// return g_const_string; -//} -// -//const ConstString & -//GetSettingNameForDisableSTDIO () -//{ -// static ConstString g_const_string (TSC_DISABLE_STDIO); -// return g_const_string; -//} -// -//bool -//Target::SettingsController::SetGlobalVariable (const ConstString &var_name, -// const char *index_value, -// const char *value, -// const SettingEntry &entry, -// const VarSetOperationType op, -// Error&err) -//{ -// if (var_name == GetSettingNameForDefaultArch()) -// { -// m_default_architecture.SetTriple (value); -// if (!m_default_architecture.IsValid()) -// err.SetErrorStringWithFormat ("'%s' is not a valid architecture or triple.", value); -// } -// return true; -//} -// -// -//bool -//Target::SettingsController::GetGlobalVariable (const ConstString &var_name, -// StringList &value, -// Error &err) -//{ -// if (var_name == GetSettingNameForDefaultArch()) -// { -// // If the arch is invalid (the default), don't show a string for it -// if (m_default_architecture.IsValid()) -// value.AppendString (m_default_architecture.GetArchitectureName()); -// return true; -// } -// else -// err.SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString()); -// -// return false; -//} - - //-------------------------------------------------------------- // class TargetProperties //-------------------------------------------------------------- @@ -2621,7 +2352,7 @@ TargetProperties::GetSourcePathMap () const } FileSpecList & -TargetProperties::GetExecutableSearchPaths () const +TargetProperties::GetExecutableSearchPaths () { const uint32_t idx = ePropertyExecutableSearchPaths; OptionValueFileSpecList *option_value = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpecList (NULL, false, idx); @@ -2685,6 +2416,16 @@ TargetProperties::GetStandardErrorPath () const return m_collection_sp->GetPropertyAtIndexAsFileSpec(NULL, idx); } +const char * +TargetProperties::GetExpressionPrefixContentsAsCString () +{ + const uint32_t idx = ePropertyExprPrefix; + OptionValueFileSpec *file = m_collection_sp->GetPropertyAtIndexAsOptionValueFileSpec (NULL, false, idx); + if (file) + return (const char *)file->GetFileContents()->GetBytes(); + return NULL; +} + void TargetProperties::SetStandardErrorPath (const char *p) { @@ -2710,609 +2451,6 @@ Target::GetGlobalProperties() return g_settings_sp; } -// TODO: SETTINGS -//bool -//TargetProperties::GetRunArguments (Args &args) const -//{ -// if (m_run_args) -// { -// m_run_args->GetArgs(args); -// return true; -// } -// else if (m_parent_sp) -// { -// return m_parent_sp->GetRunArguments(args); -// } -// return false; -//} -// -//void -//TargetProperties::SetRunArguments (const Args &args) -//{ -// // TODO: SETTINGS -//} - - -//-------------------------------------------------------------- -// class TargetInstanceSettings -//-------------------------------------------------------------- - -//TargetInstanceSettings::TargetInstanceSettings -//( -// const lldb::UserSettingsControllerSP &owner_sp, -// bool live_instance, -// const char *name -//) : -// InstanceSettings (owner_sp, name ? name : InstanceSettings::InvalidName().AsCString(), live_instance), -// m_expr_prefix_file (), -// m_expr_prefix_contents (), -// m_prefer_dynamic_value (2), -// m_enable_synthetic_value(true, true), -// m_skip_prologue (true, true), -// m_source_map (NULL, NULL), -// m_exe_search_paths (), -// m_max_children_display(256), -// m_max_strlen_length(1024), -// m_breakpoints_use_platform_avoid (true, true), -// m_run_args (), -// m_env_vars (), -// m_input_path (), -// m_output_path (), -// m_error_path (), -// m_disable_aslr (true), -// m_disable_stdio (false), -// m_inherit_host_env (true), -// m_got_host_env (false) -//{ -// // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called -// // until the vtables for TargetInstanceSettings 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); -// } -//} -// -//TargetInstanceSettings::TargetInstanceSettings (const TargetInstanceSettings &rhs) : -// InstanceSettings (Target::GetSettingsController(), CreateInstanceName().AsCString()), -// m_expr_prefix_file (rhs.m_expr_prefix_file), -// m_expr_prefix_contents (rhs.m_expr_prefix_contents), -// m_prefer_dynamic_value (rhs.m_prefer_dynamic_value), -// m_enable_synthetic_value(rhs.m_enable_synthetic_value), -// m_skip_prologue (rhs.m_skip_prologue), -// m_source_map (rhs.m_source_map), -// m_exe_search_paths (rhs.m_exe_search_paths), -// m_max_children_display (rhs.m_max_children_display), -// m_max_strlen_length (rhs.m_max_strlen_length), -// m_breakpoints_use_platform_avoid (rhs.m_breakpoints_use_platform_avoid), -// m_run_args (rhs.m_run_args), -// m_env_vars (rhs.m_env_vars), -// m_input_path (rhs.m_input_path), -// m_output_path (rhs.m_output_path), -// m_error_path (rhs.m_error_path), -// m_disable_aslr (rhs.m_disable_aslr), -// m_disable_stdio (rhs.m_disable_stdio), -// m_inherit_host_env (rhs.m_inherit_host_env) -//{ -// if (m_instance_name != InstanceSettings::GetDefaultName()) -// { -// UserSettingsControllerSP owner_sp (m_owner_wp.lock()); -// if (owner_sp) -// CopyInstanceSettings (owner_sp->FindPendingSettings (m_instance_name),false); -// } -//} -// -//TargetInstanceSettings::~TargetInstanceSettings () -//{ -//} -// -//TargetInstanceSettings& -//TargetInstanceSettings::operator= (const TargetInstanceSettings &rhs) -//{ -// if (this != &rhs) -// { -// m_expr_prefix_file = rhs.m_expr_prefix_file; -// m_expr_prefix_contents = rhs.m_expr_prefix_contents; -// m_prefer_dynamic_value = rhs.m_prefer_dynamic_value; -// m_enable_synthetic_value = rhs.m_enable_synthetic_value; -// m_skip_prologue = rhs.m_skip_prologue; -// m_source_map = rhs.m_source_map; -// m_exe_search_paths = rhs.m_exe_search_paths; -// m_max_children_display = rhs.m_max_children_display; -// m_max_strlen_length = rhs.m_max_strlen_length; -// m_breakpoints_use_platform_avoid = rhs.m_breakpoints_use_platform_avoid; -// m_run_args = rhs.m_run_args; -// m_env_vars = rhs.m_env_vars; -// m_input_path = rhs.m_input_path; -// m_output_path = rhs.m_output_path; -// m_error_path = rhs.m_error_path; -// m_disable_aslr = rhs.m_disable_aslr; -// m_disable_stdio = rhs.m_disable_stdio; -// m_inherit_host_env = rhs.m_inherit_host_env; -// } -// -// return *this; -//} -// -//void -//TargetInstanceSettings::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 == GetSettingNameForExpressionPrefix ()) -// { -// err = UserSettingsController::UpdateFileSpecOptionValue (value, op, m_expr_prefix_file); -// if (err.Success()) -// { -// switch (op) -// { -// default: -// break; -// case eVarSetOperationAssign: -// case eVarSetOperationAppend: -// { -// m_expr_prefix_contents.clear(); -// -// if (!m_expr_prefix_file.GetCurrentValue().Exists()) -// { -// err.SetErrorToGenericError (); -// err.SetErrorStringWithFormat ("%s does not exist", value); -// return; -// } -// -// DataBufferSP file_data_sp (m_expr_prefix_file.GetCurrentValue().ReadFileContents(0, SIZE_MAX, &err)); -// -// if (err.Success()) -// { -// if (file_data_sp && file_data_sp->GetByteSize() > 0) -// { -// m_expr_prefix_contents.assign((const char*)file_data_sp->GetBytes(), file_data_sp->GetByteSize()); -// } -// else -// { -// err.SetErrorStringWithFormat ("couldn't read data from '%s'", value); -// } -// } -// } -// break; -// case eVarSetOperationClear: -// m_expr_prefix_contents.clear(); -// } -// } -// } -// else if (var_name == GetSettingNameForPreferDynamicValue()) -// { -// int new_value; -// UserSettingsController::UpdateEnumVariable (g_dynamic_value_types, &new_value, value, err); -// if (err.Success()) -// m_prefer_dynamic_value = new_value; -// } -// else if (var_name == GetSettingNameForEnableSyntheticValue()) -// { -// bool ok; -// bool new_value = Args::StringToBoolean(value, true, &ok); -// if (ok) -// m_enable_synthetic_value.SetCurrentValue(new_value); -// } -// else if (var_name == GetSettingNameForSkipPrologue()) -// { -// err = UserSettingsController::UpdateBooleanOptionValue (value, op, m_skip_prologue); -// } -// else if (var_name == GetSettingNameForMaxChildren()) -// { -// bool ok; -// uint32_t new_value = Args::StringToUInt32(value, 0, 10, &ok); -// if (ok) -// m_max_children_display = new_value; -// } -// else if (var_name == GetSettingNameForMaxStringSummaryLength()) -// { -// bool ok; -// uint32_t new_value = Args::StringToUInt32(value, 0, 10, &ok); -// if (ok) -// m_max_strlen_length = new_value; -// } -// else if (var_name == GetSettingNameForExecutableSearchPaths()) -// { -// switch (op) -// { -// case eVarSetOperationReplace: -// case eVarSetOperationInsertBefore: -// case eVarSetOperationInsertAfter: -// case eVarSetOperationRemove: -// default: -// break; -// case eVarSetOperationAssign: -// m_exe_search_paths.Clear(); -// // Fall through to append.... -// case eVarSetOperationAppend: -// { -// Args args(value); -// const uint32_t argc = args.GetArgumentCount(); -// if (argc > 0) -// { -// const char *exe_search_path_dir; -// for (uint32_t idx = 0; (exe_search_path_dir = args.GetArgumentAtIndex(idx)) != NULL; ++idx) -// { -// FileSpec file_spec; -// file_spec.GetDirectory().SetCString(exe_search_path_dir); -// FileSpec::FileType file_type = file_spec.GetFileType(); -// if (file_type == FileSpec::eFileTypeDirectory || file_type == FileSpec::eFileTypeInvalid) -// { -// m_exe_search_paths.Append(file_spec); -// } -// else -// { -// err.SetErrorStringWithFormat("executable search path '%s' exists, but it does not resolve to a directory", exe_search_path_dir); -// } -// } -// } -// } -// break; -// -// case eVarSetOperationClear: -// m_exe_search_paths.Clear(); -// break; -// } -// } -// else if (var_name == GetSettingNameForSourcePathMap ()) -// { -// switch (op) -// { -// case eVarSetOperationReplace: -// case eVarSetOperationInsertBefore: -// case eVarSetOperationInsertAfter: -// case eVarSetOperationRemove: -// default: -// break; -// case eVarSetOperationAssign: -// m_source_map.Clear(true); -// // Fall through to append.... -// case eVarSetOperationAppend: -// { -// Args args(value); -// const uint32_t argc = args.GetArgumentCount(); -// if (argc & 1 || argc == 0) -// { -// err.SetErrorStringWithFormat ("an even number of paths must be supplied to to the source-map setting: %u arguments given", argc); -// } -// else -// { -// char resolved_new_path[PATH_MAX]; -// FileSpec file_spec; -// const char *old_path; -// for (uint32_t idx = 0; (old_path = args.GetArgumentAtIndex(idx)) != NULL; idx += 2) -// { -// const char *new_path = args.GetArgumentAtIndex(idx+1); -// assert (new_path); // We have an even number of paths, this shouldn't happen! -// -// file_spec.SetFile(new_path, true); -// if (file_spec.Exists()) -// { -// if (file_spec.GetPath (resolved_new_path, sizeof(resolved_new_path)) >= sizeof(resolved_new_path)) -// { -// err.SetErrorStringWithFormat("new path '%s' is too long", new_path); -// return; -// } -// } -// else -// { -// err.SetErrorStringWithFormat("new path '%s' doesn't exist", new_path); -// return; -// } -// m_source_map.Append(ConstString (old_path), ConstString (resolved_new_path), true); -// } -// } -// } -// break; -// -// case eVarSetOperationClear: -// m_source_map.Clear(true); -// break; -// } -// } -// else if (var_name == GetSettingNameForPlatformAvoid ()) -// { -// err = UserSettingsController::UpdateBooleanOptionValue (value, op, m_breakpoints_use_platform_avoid); -// } -// else if (var_name == GetSettingNameForRunArgs()) -// { -// UserSettingsController::UpdateStringArrayVariable (op, index_value, m_run_args, value, err); -// } -// else if (var_name == GetSettingNameForEnvVars()) -// { -// // This is nice for local debugging, but it is isn't correct for -// // remote debugging. We need to stop process.env-vars from being -// // populated with the host environment and add this as a launch option -// // and get the correct environment from the Target's platform. -// // GetHostEnvironmentIfNeeded (); -// UserSettingsController::UpdateDictionaryVariable (op, index_value, m_env_vars, value, err); -// } -// else if (var_name == GetSettingNameForInputPath()) -// { -// UserSettingsController::UpdateStringVariable (op, m_input_path, value, err); -// } -// else if (var_name == GetSettingNameForOutputPath()) -// { -// UserSettingsController::UpdateStringVariable (op, m_output_path, value, err); -// } -// else if (var_name == GetSettingNameForErrorPath()) -// { -// UserSettingsController::UpdateStringVariable (op, m_error_path, value, err); -// } -// else if (var_name == GetSettingNameForDisableASLR()) -// { -// UserSettingsController::UpdateBooleanVariable (op, m_disable_aslr, value, true, err); -// } -// else if (var_name == GetSettingNameForDisableSTDIO ()) -// { -// UserSettingsController::UpdateBooleanVariable (op, m_disable_stdio, value, false, err); -// } -//} -// -//void -//TargetInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings, bool pending) -//{ -// TargetInstanceSettings *new_settings_ptr = static_cast <TargetInstanceSettings *> (new_settings.get()); -// -// if (!new_settings_ptr) -// return; -// -// *this = *new_settings_ptr; -//} -// -//bool -//TargetInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry, -// const ConstString &var_name, -// StringList &value, -// Error *err) -//{ -// if (var_name == GetSettingNameForExpressionPrefix ()) -// { -// char path[PATH_MAX]; -// const size_t path_len = m_expr_prefix_file.GetCurrentValue().GetPath (path, sizeof(path)); -// if (path_len > 0) -// value.AppendString (path, path_len); -// } -// else if (var_name == GetSettingNameForPreferDynamicValue()) -// { -// value.AppendString (g_dynamic_value_types[m_prefer_dynamic_value].string_value); -// } -// else if (var_name == GetSettingNameForEnableSyntheticValue()) -// { -// if (m_skip_prologue) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == GetSettingNameForSkipPrologue()) -// { -// if (m_skip_prologue) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == GetSettingNameForExecutableSearchPaths()) -// { -// if (m_exe_search_paths.GetSize()) -// { -// for (size_t i = 0, n = m_exe_search_paths.GetSize(); i < n; ++i) -// { -// value.AppendString(m_exe_search_paths.GetFileSpecAtIndex (i).GetDirectory().AsCString()); -// } -// } -// } -// else if (var_name == GetSettingNameForSourcePathMap ()) -// { -// if (m_source_map.GetSize()) -// { -// size_t i; -// for (i = 0; i < m_source_map.GetSize(); ++i) { -// StreamString sstr; -// m_source_map.Dump(&sstr, i); -// value.AppendString(sstr.GetData()); -// } -// } -// } -// else if (var_name == GetSettingNameForMaxChildren()) -// { -// StreamString count_str; -// count_str.Printf ("%d", m_max_children_display); -// value.AppendString (count_str.GetData()); -// } -// else if (var_name == GetSettingNameForMaxStringSummaryLength()) -// { -// StreamString count_str; -// count_str.Printf ("%d", m_max_strlen_length); -// value.AppendString (count_str.GetData()); -// } -// else if (var_name == GetSettingNameForPlatformAvoid()) -// { -// if (m_breakpoints_use_platform_avoid) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == GetSettingNameForRunArgs()) -// { -// if (m_run_args.GetArgumentCount() > 0) -// { -// for (int i = 0; i < m_run_args.GetArgumentCount(); ++i) -// value.AppendString (m_run_args.GetArgumentAtIndex (i)); -// } -// } -// else if (var_name == GetSettingNameForEnvVars()) -// { -// GetHostEnvironmentIfNeeded (); -// -// if (m_env_vars.size() > 0) -// { -// std::map<std::string, std::string>::iterator pos; -// for (pos = m_env_vars.begin(); pos != m_env_vars.end(); ++pos) -// { -// StreamString value_str; -// value_str.Printf ("%s=%s", pos->first.c_str(), pos->second.c_str()); -// value.AppendString (value_str.GetData()); -// } -// } -// } -// else if (var_name == GetSettingNameForInputPath()) -// { -// value.AppendString (m_input_path.c_str()); -// } -// else if (var_name == GetSettingNameForOutputPath()) -// { -// value.AppendString (m_output_path.c_str()); -// } -// else if (var_name == GetSettingNameForErrorPath()) -// { -// value.AppendString (m_error_path.c_str()); -// } -// else if (var_name == GetSettingNameForInheritHostEnv()) -// { -// if (m_inherit_host_env) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == GetSettingNameForDisableASLR()) -// { -// if (m_disable_aslr) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else if (var_name == GetSettingNameForDisableSTDIO()) -// { -// if (m_disable_stdio) -// value.AppendString ("true"); -// else -// value.AppendString ("false"); -// } -// else -// { -// if (err) -// err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString()); -// return false; -// } -// return true; -//} -// -//void -//Target::TargetInstanceSettings::GetHostEnvironmentIfNeeded () -//{ -// if (m_inherit_host_env && !m_got_host_env) -// { -// m_got_host_env = true; -// StringList host_env; -// const size_t host_env_count = Host::GetEnvironment (host_env); -// for (size_t idx=0; idx<host_env_count; idx++) -// { -// const char *env_entry = host_env.GetStringAtIndex (idx); -// if (env_entry) -// { -// const char *equal_pos = ::strchr(env_entry, '='); -// if (equal_pos) -// { -// std::string key (env_entry, equal_pos - env_entry); -// std::string value (equal_pos + 1); -// if (m_env_vars.find (key) == m_env_vars.end()) -// m_env_vars[key] = value; -// } -// } -// } -// } -//} -// -// -//size_t -//Target::TargetInstanceSettings::GetEnvironmentAsArgs (Args &env) -//{ -// GetHostEnvironmentIfNeeded (); -// -// dictionary::const_iterator pos, end = m_env_vars.end(); -// for (pos = m_env_vars.begin(); pos != end; ++pos) -// { -// std::string env_var_equal_value (pos->first); -// env_var_equal_value.append(1, '='); -// env_var_equal_value.append (pos->second); -// env.AppendArgument (env_var_equal_value.c_str()); -// } -// return env.GetArgumentCount(); -//} -// -// -//const ConstString -//TargetInstanceSettings::CreateInstanceName () -//{ -// StreamString sstr; -// static int instance_count = 1; -// -// sstr.Printf ("target_%d", instance_count); -// ++instance_count; -// -// const ConstString ret_val (sstr.GetData()); -// return ret_val; -//} -// -////-------------------------------------------------- -//// Target::SettingsController Variable Tables -////-------------------------------------------------- -// -// -//SettingEntry -//Target::SettingsController::global_settings_table[] = -//{ -// // var-name var-type default enum init'd hidden help-text -// // ================= ================== =========== ==== ====== ====== ========================================================================= -// { TSC_DEFAULT_ARCH , eSetVarTypeString , NULL , NULL, false, false, "Default architecture to choose, when there's a choice." }, -// { NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL } -//}; -// -//SettingEntry -//Target::SettingsController::instance_settings_table[] = -//{ -// // var-name var-type default enum init'd hidden help-text -// // ================= ================== =============== ======================= ====== ====== ========================================================================= -// { TSC_EXPR_PREFIX , eSetVarTypeString , NULL , NULL, false, false, "Path to a file containing expressions to be prepended to all expressions." }, -// { TSC_PREFER_DYNAMIC , eSetVarTypeEnum , NULL , g_dynamic_value_types, false, false, "Should printed values be shown as their dynamic value." }, -// { TSC_ENABLE_SYNTHETIC , eSetVarTypeBoolean, "true" , NULL, false, false, "Should synthetic values be used by default whenever available." }, -// { TSC_SKIP_PROLOGUE , eSetVarTypeBoolean, "true" , NULL, false, false, "Skip function prologues when setting breakpoints by name." }, -// { TSC_SOURCE_MAP , eSetVarTypeArray , NULL , NULL, false, false, "Source path remappings used to track the change of location between a source file when built, and " -// "where it exists on the current system. It consists of an array of duples, the first element of each duple is " -// "some part (starting at the root) of the path to the file when it was built, " -// "and the second is where the remainder of the original build hierarchy is rooted on the local system. " -// "Each element of the array is checked in order and the first one that results in a match wins." }, -// { TSC_EXE_SEARCH_PATHS , eSetVarTypeArray , NULL , NULL, false, false, "Executable search paths to use when locating executable files whose paths don't match the local file system." }, -// { TSC_MAX_CHILDREN , eSetVarTypeInt , "256" , NULL, true, false, "Maximum number of children to expand in any level of depth." }, -// { TSC_MAX_STRLENSUMMARY , eSetVarTypeInt , "1024" , NULL, true, false, "Maximum number of characters to show when using %s in summary strings." }, -// { TSC_PLATFORM_AVOID , eSetVarTypeBoolean, "true" , NULL, false, false, "Consult the platform module avoid list when setting non-module specific breakpoints." }, -// { TSC_RUN_ARGS , eSetVarTypeArray , NULL , NULL, false, false, "A list containing all the arguments to be passed to the executable when it is run." }, -// { TSC_ENV_VARS , eSetVarTypeDictionary, NULL , NULL, false, false, "A list of all the environment variables to be passed to the executable's environment, and their values." }, -// { TSC_INHERIT_ENV , eSetVarTypeBoolean, "true" , NULL, false, false, "Inherit the environment from the process that is running LLDB." }, -// { TSC_STDIN_PATH , eSetVarTypeString , NULL , NULL, false, false, "The file/path to be used by the executable program for reading its standard input." }, -// { TSC_STDOUT_PATH , eSetVarTypeString , NULL , NULL, false, false, "The file/path to be used by the executable program for writing its standard output." }, -// { TSC_STDERR_PATH , eSetVarTypeString , NULL , NULL, false, false, "The file/path to be used by the executable program for writing its standard error." }, -//// { "plugin", eSetVarTypeEnum, NULL, NULL, false, false, "The plugin to be used to run the process." }, -// { TSC_DISABLE_ASLR , eSetVarTypeBoolean, "true" , NULL, false, false, "Disable Address Space Layout Randomization (ASLR)" }, -// { TSC_DISABLE_STDIO , eSetVarTypeBoolean, "false" , NULL, false, false, "Disable stdin/stdout for process (e.g. for a GUI application)" }, -// { NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL } -//}; -// const ConstString & Target::TargetEventData::GetFlavorString () { diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 26a69a0ea1c..850179aa4fc 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -216,8 +216,6 @@ TargetList::CreateTarget if (target_sp) { - //target_sp->UpdateInstanceName(); - Mutex::Locker locker(m_target_list_mutex); m_selected_target_idx = m_target_list.size(); m_target_list.push_back(target_sp); diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index e120153be19..df86869cc33 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -79,7 +79,7 @@ public: // 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()) + OptionValueProperties(*global_properties->GetValueProperties()) { } @@ -139,7 +139,6 @@ ThreadProperties::GetTraceEnabledState() const Thread::Thread (const ProcessSP &process_sp, lldb::tid_t tid) : ThreadProperties (false), UserID (tid), -//ThreadInstanceSettings (GetSettingsController()), m_process_wp (process_sp), m_actual_stop_info_sp (), m_index_id (process_sp->GetNextThreadIndexID ()), @@ -164,7 +163,6 @@ Thread::Thread (const ProcessSP &process_sp, lldb::tid_t tid) : log->Printf ("%p Thread::Thread(tid = 0x%4.4llx)", this, GetID()); QueueFundamentalPlan(true); - //UpdateInstanceName(); } @@ -1290,61 +1288,12 @@ Thread::DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx) void Thread::SettingsInitialize () { -// UserSettingsController::InitializeSettingsController (GetSettingsController(), -// SettingsController::global_settings_table, -// SettingsController::instance_settings_table); -// - // Now call SettingsInitialize() on each 'child' setting of Thread. - // Currently there are none. } void Thread::SettingsTerminate () { - // Must call SettingsTerminate() on each 'child' setting of Thread before terminating Thread settings. - // Currently there are none. - - // Now terminate Thread Settings. -// -// 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())); -// -// 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()); -//} +} lldb::StackFrameSP Thread::GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr) @@ -1510,231 +1459,3 @@ Thread::Flush () ClearStackFrames (); m_reg_context_sp.reset(); } - - -#pragma mark "Thread::SettingsController" -//-------------------------------------------------------------- -// 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; -//} - -//#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 } -//}; |