From 332e8b1cd4644fb9a7e9632b5e7ed34f7db6606d Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Tue, 13 Jan 2015 21:13:08 +0000 Subject: [PATCH] Fixed an issue where if the operating system python plug-in is changed at runtime, it wouldn't cause the process to reload the new operating system plug-in, now it does. This is currently controlled by a setting: (lldb) settings set target.process.python-os-plugin-path Or clearing it with: (lldb) settings clear target.process.python-os-plugin-path The process will now reload the OperatingSystem plug-in. This was implemented by: - adding the ability to set a notify callback for when an option value is changed - added the ability for the process plug-in to load the operating system plug-in on the fly - fixed bugs in the Process::GetStatus() so all threads are displayed if their thread IDs are larger than 32 bits - adding a callback in ProcessProperties to tell when the "python-os-plugin-path" is changed by the user - fixing a crasher in ProcessMachCore that happens when updating the thread list when the OS plugin is reloaded llvm-svn: 225831 --- lldb/include/lldb/Interpreter/OptionValue.h | 22 ++++++++++ .../lldb/Interpreter/OptionValueProperties.h | 14 +++++- lldb/include/lldb/Interpreter/Property.h | 3 ++ lldb/include/lldb/Target/Process.h | 13 +++++- lldb/include/lldb/lldb-private-interfaces.h | 1 + lldb/source/Interpreter/OptionValueArch.cpp | 4 ++ lldb/source/Interpreter/OptionValueArray.cpp | 1 + .../source/Interpreter/OptionValueBoolean.cpp | 2 + .../Interpreter/OptionValueDictionary.cpp | 5 ++- .../Interpreter/OptionValueEnumeration.cpp | 2 + .../Interpreter/OptionValueFileSpec.cpp | 2 + .../Interpreter/OptionValueFileSpecLIst.cpp | 5 +++ lldb/source/Interpreter/OptionValueFormat.cpp | 2 + .../Interpreter/OptionValuePathMappings.cpp | 5 +++ .../Interpreter/OptionValueProperties.cpp | 10 +++++ lldb/source/Interpreter/OptionValueRegex.cpp | 2 + lldb/source/Interpreter/OptionValueSInt64.cpp | 2 + lldb/source/Interpreter/OptionValueString.cpp | 37 ++++++++-------- lldb/source/Interpreter/OptionValueUInt64.cpp | 2 + lldb/source/Interpreter/OptionValueUUID.cpp | 4 ++ lldb/source/Interpreter/Property.cpp | 9 ++++ .../Process/mach-core/ProcessMachCore.cpp | 2 +- lldb/source/Target/Process.cpp | 43 ++++++++++++++----- 23 files changed, 161 insertions(+), 31 deletions(-) diff --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h index dd266ce618c3..0e8f23453a8a 100644 --- a/lldb/include/lldb/Interpreter/OptionValue.h +++ b/lldb/include/lldb/Interpreter/OptionValue.h @@ -60,11 +60,15 @@ namespace lldb_private { OptionValue () : + m_callback (nullptr), + m_baton(nullptr), m_value_was_set (false) { } OptionValue (const OptionValue &rhs) : + m_callback (rhs.m_callback), + m_baton (rhs.m_baton), m_value_was_set (rhs.m_value_was_set) { } @@ -381,8 +385,26 @@ namespace lldb_private { { m_parent_wp = parent_sp; } + + void + SetValueChangedCallback (OptionValueChangedCallback callback, + void *baton) + { + assert (m_callback == NULL); + m_callback = callback; + m_baton = baton; + } + + void + NotifyValueChanged () + { + if (m_callback) + m_callback (m_baton, this); + } protected: lldb::OptionValueWP m_parent_wp; + OptionValueChangedCallback m_callback; + void *m_baton; bool m_value_was_set; // This can be used to see if a value has been set // by a call to SetValueFromCString(). It is often // handy to know if an option value was set from diff --git a/lldb/include/lldb/Interpreter/OptionValueProperties.h b/lldb/include/lldb/Interpreter/OptionValueProperties.h index 0024f20e2ff6..a67ea5d66e54 100644 --- a/lldb/include/lldb/Interpreter/OptionValueProperties.h +++ b/lldb/include/lldb/Interpreter/OptionValueProperties.h @@ -243,8 +243,20 @@ public: GetSubProperty (const ExecutionContext *exe_ctx, const ConstString &name); + void + SetValueChangedCallback (uint32_t property_idx, + OptionValueChangedCallback callback, + void *baton); protected: - + + Property * + ProtectedGetPropertyAtIndex (uint32_t idx) + { + if (idx < m_properties.size()) + return &m_properties[idx]; + return NULL; + } + const Property * ProtectedGetPropertyAtIndex (uint32_t idx) const { diff --git a/lldb/include/lldb/Interpreter/Property.h b/lldb/include/lldb/Interpreter/Property.h index 6025adce4c71..cb4c827ded06 100644 --- a/lldb/include/lldb/Interpreter/Property.h +++ b/lldb/include/lldb/Interpreter/Property.h @@ -97,6 +97,9 @@ namespace lldb_private { uint32_t output_width, bool display_qualified_name) const; + void + SetValueChangedCallback (OptionValueChangedCallback callback, void *baton); + protected: ConstString m_name; ConstString m_description; diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 23630fd81e76..e04de511c797 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -62,7 +62,8 @@ namespace lldb_private { class ProcessProperties : public Properties { public: - ProcessProperties(bool is_global); + // Pass NULL for "process" if the ProcessProperties are to be the global copy + ProcessProperties (lldb_private::Process *process); virtual ~ProcessProperties(); @@ -108,6 +109,13 @@ public: void SetDetachKeepsStopped (bool keep_stopped); + +protected: + + static void + OptionValueChangedCallback (void *baton, OptionValue *option_value); + + Process * m_process; // Can be NULL for global ProcessProperties }; typedef std::shared_ptr ProcessPropertiesSP; @@ -2814,6 +2822,7 @@ public: Process &m_process; }; friend class ProcessEventHijacker; + friend class ProcessProperties; //------------------------------------------------------------------ /// If you need to ensure that you and only you will hear about some public /// event, then make a new listener, set to listen to process events, and @@ -3279,6 +3288,8 @@ protected: bool StateChangedIsExternallyHijacked(); + void + LoadOperatingSystemPlugin(bool flush); private: //------------------------------------------------------------------ // For Process only diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h index 4d608fe10cc4..f35938ce17b7 100644 --- a/lldb/include/lldb/lldb-private-interfaces.h +++ b/lldb/include/lldb/lldb-private-interfaces.h @@ -36,6 +36,7 @@ namespace lldb_private typedef SymbolVendor* (*SymbolVendorCreateInstance) (const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm); // Module can be NULL for default system symbol vendor typedef bool (*BreakpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); typedef bool (*WatchpointHitCallback) (void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id); + typedef void (*OptionValueChangedCallback) (void *baton, OptionValue *option_value); typedef bool (*ThreadPlanShouldStopHereCallback) (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton); typedef lldb::ThreadPlanSP (*ThreadPlanStepFromHereCallback) (ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, void *baton); typedef UnwindAssembly* (*UnwindAssemblyCreateInstance) (const ArchSpec &arch); diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp index 6d283d6b9275..7df149234bda 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 82ac74555b6b..c0d48c1e7bd2 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 bf153a1442c7..71cc2afb98e1 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 3357cd48883a..e5299f8cc390 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 7aceac91b601..dbaeb185fa3a 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 c8aaadef23bc..3f466985a83a 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 89d2e429e59c..7150ad474643 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 296dd983208c..d91f10b0edeb 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 b442277a610f..56f2ecf4f5fe 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 0497ee1c15d7..6ec2aa569fa3 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -80,6 +80,16 @@ OptionValueProperties::Initialize (const PropertyDefinition *defs) m_name_to_index.Sort(); } +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, diff --git a/lldb/source/Interpreter/OptionValueRegex.cpp b/lldb/source/Interpreter/OptionValueRegex.cpp index f1ba0ed04d6c..f51cf02edf56 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 04bf9306ade6..1827cc1d873f 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 df047bd98996..a1b80d8fc4f6 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 56b3a1c74702..3e12c030255c 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 0141911d97ad..c228cf6e415e 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 4d4d75a2babe..7f7219fc0d50 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 eeadc8438950..e1b4ae0b7b42 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 0; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 936e2aaff311..106678da2684 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 thread_index_array; + std::vector 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)