diff options
Diffstat (limited to 'lldb/source')
18 files changed, 110 insertions, 29 deletions
diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp index 6d283d6b927..7df149234bd 100644 --- a/lldb/source/Interpreter/OptionValueArch.cpp +++ b/lldb/source/Interpreter/OptionValueArch.cpp @@ -50,6 +50,7 @@ OptionValueArch::SetValueFromCString (const char *value_cstr, VarSetOperationTyp { case eVarSetOperationClear: Clear(); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -57,7 +58,10 @@ OptionValueArch::SetValueFromCString (const char *value_cstr, VarSetOperationTyp if (value_cstr && value_cstr[0]) { if (m_current_value.SetTriple (value_cstr)) + { m_value_was_set = true; + NotifyValueChanged(); + } else error.SetErrorStringWithFormat("unsupported architecture '%s'", value_cstr); } diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp index 82ac74555b6..c0d48c1e7bd 100644 --- a/lldb/source/Interpreter/OptionValueArray.cpp +++ b/lldb/source/Interpreter/OptionValueArray.cpp @@ -76,6 +76,7 @@ Error OptionValueArray::SetValueFromCString (const char *value, VarSetOperationType op) { Args args(value); + NotifyValueChanged(); return SetArgs (args, op); } diff --git a/lldb/source/Interpreter/OptionValueBoolean.cpp b/lldb/source/Interpreter/OptionValueBoolean.cpp index bf153a1442c..71cc2afb98e 100644 --- a/lldb/source/Interpreter/OptionValueBoolean.cpp +++ b/lldb/source/Interpreter/OptionValueBoolean.cpp @@ -45,6 +45,7 @@ OptionValueBoolean::SetValueFromCString (const char *value_cstr, { case eVarSetOperationClear: Clear(); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -56,6 +57,7 @@ OptionValueBoolean::SetValueFromCString (const char *value_cstr, { m_value_was_set = true; m_current_value = value; + NotifyValueChanged(); } else { diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp index 3357cd48883..e5299f8cc39 100644 --- a/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -221,7 +221,10 @@ Error OptionValueDictionary::SetValueFromCString (const char *value_cstr, VarSetOperationType op) { Args args(value_cstr); - return SetArgs (args, op); + Error error = SetArgs (args, op); + if (error.Success()) + NotifyValueChanged(); + return error; } lldb::OptionValueSP diff --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp b/lldb/source/Interpreter/OptionValueEnumeration.cpp index 7aceac91b60..dbaeb185fa3 100644 --- a/lldb/source/Interpreter/OptionValueEnumeration.cpp +++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp @@ -62,6 +62,7 @@ OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationT { case eVarSetOperationClear: Clear (); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -73,6 +74,7 @@ OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationT if (enumerator_entry) { m_current_value = enumerator_entry->value.value; + NotifyValueChanged(); } else { diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index c8aaadef23b..3f466985a83 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -78,6 +78,7 @@ OptionValueFileSpec::SetValueFromCString (const char *value_cstr, { case eVarSetOperationClear: Clear (); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -100,6 +101,7 @@ OptionValueFileSpec::SetValueFromCString (const char *value_cstr, m_value_was_set = true; m_current_value.SetFile(filepath.c_str(), true); m_data_sp.reset(); + NotifyValueChanged(); } else { diff --git a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp index 89d2e429e59..7150ad47464 100644 --- a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp @@ -51,6 +51,7 @@ OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperation { case eVarSetOperationClear: Clear (); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -72,6 +73,7 @@ OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperation else m_current_value.Append(file); } + NotifyValueChanged(); } } else @@ -94,6 +96,7 @@ OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperation FileSpec file (args.GetArgumentAtIndex(i), false); m_current_value.Append(file); } + NotifyValueChanged(); } else { @@ -120,6 +123,7 @@ OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperation FileSpec file (args.GetArgumentAtIndex(i), false); m_current_value.Insert (idx, file); } + NotifyValueChanged(); } } else @@ -155,6 +159,7 @@ OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperation m_current_value.Remove (j); } } + NotifyValueChanged(); } else { diff --git a/lldb/source/Interpreter/OptionValueFormat.cpp b/lldb/source/Interpreter/OptionValueFormat.cpp index 296dd983208..d91f10b0ede 100644 --- a/lldb/source/Interpreter/OptionValueFormat.cpp +++ b/lldb/source/Interpreter/OptionValueFormat.cpp @@ -43,6 +43,7 @@ OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationT { case eVarSetOperationClear: Clear(); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -54,6 +55,7 @@ OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationT { m_value_was_set = true; m_current_value = new_format; + NotifyValueChanged(); } } break; diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp index b442277a610..56f2ecf4f5f 100644 --- a/lldb/source/Interpreter/OptionValuePathMappings.cpp +++ b/lldb/source/Interpreter/OptionValuePathMappings.cpp @@ -43,6 +43,7 @@ OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperation { case eVarSetOperationClear: Clear (); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -64,6 +65,7 @@ OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperation if (!m_path_mappings.Replace (a, b, idx, m_notify_changes)) m_path_mappings.Append(a, b, m_notify_changes); } + NotifyValueChanged(); } } else @@ -97,6 +99,7 @@ OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperation m_path_mappings.Append(a, b, m_notify_changes); m_value_was_set = true; } + NotifyValueChanged(); } break; @@ -121,6 +124,7 @@ OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperation ConstString b(args.GetArgumentAtIndex(i+1)); m_path_mappings.Insert (a, b, idx, m_notify_changes); } + NotifyValueChanged(); } } else @@ -156,6 +160,7 @@ OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperation m_path_mappings.Remove (j, m_notify_changes); } } + NotifyValueChanged(); } else { diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index 0497ee1c15d..6ec2aa569fa 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -81,6 +81,16 @@ OptionValueProperties::Initialize (const PropertyDefinition *defs) } void +OptionValueProperties::SetValueChangedCallback (uint32_t property_idx, + OptionValueChangedCallback callback, + void *baton) +{ + Property *property = ProtectedGetPropertyAtIndex (property_idx); + if (property) + property->SetValueChangedCallback (callback, baton); +} + +void OptionValueProperties::AppendProperty(const ConstString &name, const ConstString &desc, bool is_global, diff --git a/lldb/source/Interpreter/OptionValueRegex.cpp b/lldb/source/Interpreter/OptionValueRegex.cpp index f1ba0ed04d6..f51cf02edf5 100644 --- a/lldb/source/Interpreter/OptionValueRegex.cpp +++ b/lldb/source/Interpreter/OptionValueRegex.cpp @@ -57,6 +57,7 @@ OptionValueRegex::SetValueFromCString (const char *value_cstr, case eVarSetOperationClear: Clear(); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -64,6 +65,7 @@ OptionValueRegex::SetValueFromCString (const char *value_cstr, if (m_regex.Compile (value_cstr, m_regex.GetCompileFlags())) { m_value_was_set = true; + NotifyValueChanged(); } else { diff --git a/lldb/source/Interpreter/OptionValueSInt64.cpp b/lldb/source/Interpreter/OptionValueSInt64.cpp index 04bf9306ade..1827cc1d873 100644 --- a/lldb/source/Interpreter/OptionValueSInt64.cpp +++ b/lldb/source/Interpreter/OptionValueSInt64.cpp @@ -44,6 +44,7 @@ OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT { case eVarSetOperationClear: Clear(); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -57,6 +58,7 @@ OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT { m_value_was_set = true; m_current_value = value; + NotifyValueChanged(); } else error.SetErrorStringWithFormat ("%" PRIi64 " is out of range, valid values must be between %" PRIi64 " and %" PRIi64 ".", diff --git a/lldb/source/Interpreter/OptionValueString.cpp b/lldb/source/Interpreter/OptionValueString.cpp index df047bd9899..a1b80d8fc4f 100644 --- a/lldb/source/Interpreter/OptionValueString.cpp +++ b/lldb/source/Interpreter/OptionValueString.cpp @@ -94,30 +94,32 @@ OptionValueString::SetValueFromCString (const char *value_cstr, case eVarSetOperationAppend: { - std::string new_value(m_current_value); - if (value_cstr && value_cstr[0]) - { - if (m_options.Test (eOptionEncodeCharacterEscapeSequences)) + std::string new_value(m_current_value); + if (value_cstr && value_cstr[0]) { - std::string str; - Args::EncodeEscapeSequences (value_cstr, str); - new_value.append(str); + if (m_options.Test (eOptionEncodeCharacterEscapeSequences)) + { + std::string str; + Args::EncodeEscapeSequences (value_cstr, str); + new_value.append(str); + } + else + new_value.append(value_cstr); } - else - new_value.append(value_cstr); - } - if (m_validator) - { - error = m_validator(new_value.c_str(),m_validator_baton); - if (error.Fail()) - return error; - } - m_current_value.assign(new_value); + if (m_validator) + { + error = m_validator(new_value.c_str(),m_validator_baton); + if (error.Fail()) + return error; + } + m_current_value.assign(new_value); + NotifyValueChanged(); } break; case eVarSetOperationClear: Clear (); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -137,6 +139,7 @@ OptionValueString::SetValueFromCString (const char *value_cstr, { SetCurrentValue (value_cstr); } + NotifyValueChanged(); break; } return error; diff --git a/lldb/source/Interpreter/OptionValueUInt64.cpp b/lldb/source/Interpreter/OptionValueUInt64.cpp index 56b3a1c7470..3e12c030255 100644 --- a/lldb/source/Interpreter/OptionValueUInt64.cpp +++ b/lldb/source/Interpreter/OptionValueUInt64.cpp @@ -51,6 +51,7 @@ OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT { case eVarSetOperationClear: Clear (); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -62,6 +63,7 @@ OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT { m_value_was_set = true; m_current_value = value; + NotifyValueChanged(); } else { diff --git a/lldb/source/Interpreter/OptionValueUUID.cpp b/lldb/source/Interpreter/OptionValueUUID.cpp index 0141911d97a..c228cf6e415 100644 --- a/lldb/source/Interpreter/OptionValueUUID.cpp +++ b/lldb/source/Interpreter/OptionValueUUID.cpp @@ -45,6 +45,7 @@ OptionValueUUID::SetValueFromCString (const char *value_cstr, { case eVarSetOperationClear: Clear(); + NotifyValueChanged(); break; case eVarSetOperationReplace: @@ -53,7 +54,10 @@ OptionValueUUID::SetValueFromCString (const char *value_cstr, if (m_uuid.SetFromCString(value_cstr) == 0) error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr); else + { m_value_was_set = true; + NotifyValueChanged(); + } } break; diff --git a/lldb/source/Interpreter/Property.cpp b/lldb/source/Interpreter/Property.cpp index 4d4d75a2bab..7f7219fc0d5 100644 --- a/lldb/source/Interpreter/Property.cpp +++ b/lldb/source/Interpreter/Property.cpp @@ -277,3 +277,12 @@ Property::DumpDescription (CommandInterpreter &interpreter, } } + +void +Property::SetValueChangedCallback (OptionValueChangedCallback callback, void *baton) +{ + if (m_value_sp) + m_value_sp->SetValueChangedCallback (callback, baton); +} + + diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index eeadc843895..e1b4ae0b7b4 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -397,7 +397,7 @@ ProcessMachCore::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new_ { const uint32_t num_threads = old_thread_list.GetSize(false); for (uint32_t i=0; i<num_threads; ++i) - new_thread_list.AddThread (old_thread_list.GetThreadAtIndex (i)); + new_thread_list.AddThread (old_thread_list.GetThreadAtIndex (i, false)); } return new_thread_list.GetSize(false) > 0; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 936e2aaff31..106678da268 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -127,11 +127,13 @@ enum { ePropertyMemCacheLineSize }; -ProcessProperties::ProcessProperties (bool is_global) : - Properties () +ProcessProperties::ProcessProperties (lldb_private::Process *process) : + Properties (), + m_process (process) // Can be NULL for global ProcessProperties { - if (is_global) + if (process == NULL) { + // Global process properties, set them up one time m_collection_sp.reset (new ProcessOptionValueProperties(ConstString("process"))); m_collection_sp->Initialize(g_properties); m_collection_sp->AppendProperty(ConstString("thread"), @@ -140,13 +142,24 @@ ProcessProperties::ProcessProperties (bool is_global) : Thread::GetGlobalProperties()->GetValueProperties()); } else + { m_collection_sp.reset (new ProcessOptionValueProperties(Process::GetGlobalProperties().get())); + m_collection_sp->SetValueChangedCallback(ePropertyPythonOSPluginPath, ProcessProperties::OptionValueChangedCallback, this); + } } ProcessProperties::~ProcessProperties() { } +void +ProcessProperties::OptionValueChangedCallback (void *baton, OptionValue *option_value) +{ + ProcessProperties *properties = (ProcessProperties *)baton; + if (properties->m_process) + properties->m_process->LoadOperatingSystemPlugin(true); +} + bool ProcessProperties::GetDisableMemoryCache() const { @@ -673,7 +686,7 @@ Process::Process(Target &target, Listener &listener) : } Process::Process(Target &target, Listener &listener, const UnixSignalsSP &unix_signals_sp) : - ProcessProperties (false), + ProcessProperties (this), UserID (LLDB_INVALID_PROCESS_ID), Broadcaster (&(target.GetDebugger()), "lldb.process"), m_target (target), @@ -786,7 +799,7 @@ Process::GetGlobalProperties() { static ProcessPropertiesSP g_settings_sp; if (!g_settings_sp) - g_settings_sp.reset (new ProcessProperties (true)); + g_settings_sp.reset (new ProcessProperties (NULL)); return g_settings_sp; } @@ -2994,6 +3007,16 @@ Process::WaitForProcessStopPrivate (const TimeValue *timeout, EventSP &event_sp) return state; } +void +Process::LoadOperatingSystemPlugin(bool flush) +{ + if (flush) + m_thread_list.Clear(); + m_os_ap.reset (OperatingSystem::FindPlugin (this, NULL)); + if (flush) + Flush(); +} + Error Process::Launch (ProcessLaunchInfo &launch_info) { @@ -3084,7 +3107,7 @@ Process::Launch (ProcessLaunchInfo &launch_info) if (system_runtime) system_runtime->DidLaunch(); - m_os_ap.reset (OperatingSystem::FindPlugin (this, NULL)); + LoadOperatingSystemPlugin(false); // Note, the stop event was consumed above, but not handled. This was done // to give DidLaunch a chance to run. The target is either stopped or crashed. @@ -6142,21 +6165,21 @@ Process::GetThreadStatus (Stream &strm, // ID's, and look them up one by one: uint32_t num_threads; - std::vector<uint32_t> thread_index_array; + std::vector<lldb::tid_t> thread_id_array; //Scope for thread list locker; { Mutex::Locker locker (GetThreadList().GetMutex()); ThreadList &curr_thread_list = GetThreadList(); num_threads = curr_thread_list.GetSize(); uint32_t idx; - thread_index_array.resize(num_threads); + thread_id_array.resize(num_threads); for (idx = 0; idx < num_threads; ++idx) - thread_index_array[idx] = curr_thread_list.GetThreadAtIndex(idx)->GetID(); + thread_id_array[idx] = curr_thread_list.GetThreadAtIndex(idx)->GetID(); } for (uint32_t i = 0; i < num_threads; i++) { - ThreadSP thread_sp(GetThreadList().FindThreadByID(thread_index_array[i])); + ThreadSP thread_sp(GetThreadList().FindThreadByID(thread_id_array[i])); if (thread_sp) { if (only_threads_with_stop_reason) |