[Lldb-commits] [lldb] r225831 - 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.

Greg Clayton gclayton at apple.com
Tue Jan 13 13:13:08 PST 2015


Author: gclayton
Date: Tue Jan 13 15:13:08 2015
New Revision: 225831

URL: http://llvm.org/viewvc/llvm-project?rev=225831&view=rev
Log:
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 <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



Modified:
    lldb/trunk/include/lldb/Interpreter/OptionValue.h
    lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
    lldb/trunk/include/lldb/Interpreter/Property.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/include/lldb/lldb-private-interfaces.h
    lldb/trunk/source/Interpreter/OptionValueArch.cpp
    lldb/trunk/source/Interpreter/OptionValueArray.cpp
    lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
    lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
    lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
    lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
    lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
    lldb/trunk/source/Interpreter/OptionValueFormat.cpp
    lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp
    lldb/trunk/source/Interpreter/OptionValueProperties.cpp
    lldb/trunk/source/Interpreter/OptionValueRegex.cpp
    lldb/trunk/source/Interpreter/OptionValueSInt64.cpp
    lldb/trunk/source/Interpreter/OptionValueString.cpp
    lldb/trunk/source/Interpreter/OptionValueUInt64.cpp
    lldb/trunk/source/Interpreter/OptionValueUUID.cpp
    lldb/trunk/source/Interpreter/Property.cpp
    lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValue.h?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValue.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValue.h Tue Jan 13 15:13:08 2015
@@ -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

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Tue Jan 13 15:13:08 2015
@@ -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
     {

Modified: lldb/trunk/include/lldb/Interpreter/Property.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Property.h?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Property.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Property.h Tue Jan 13 15:13:08 2015
@@ -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;

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Jan 13 15:13:08 2015
@@ -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<ProcessProperties> 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

Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Tue Jan 13 15:13:08 2015
@@ -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);

Modified: lldb/trunk/source/Interpreter/OptionValueArch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueArch.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueArch.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueArch.cpp Tue Jan 13 15:13:08 2015
@@ -50,6 +50,7 @@ OptionValueArch::SetValueFromCString (co
     {
     case eVarSetOperationClear:
         Clear();
+        NotifyValueChanged();
         break;
         
     case eVarSetOperationReplace:
@@ -57,7 +58,10 @@ OptionValueArch::SetValueFromCString (co
         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);
         }

Modified: lldb/trunk/source/Interpreter/OptionValueArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueArray.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueArray.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueArray.cpp Tue Jan 13 15:13:08 2015
@@ -76,6 +76,7 @@ Error
 OptionValueArray::SetValueFromCString (const char *value, VarSetOperationType op)
 {
     Args args(value);
+    NotifyValueChanged();
     return SetArgs (args, op);
 }
 

Modified: lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueBoolean.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueBoolean.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueBoolean.cpp Tue Jan 13 15:13:08 2015
@@ -45,6 +45,7 @@ OptionValueBoolean::SetValueFromCString
     {
     case eVarSetOperationClear:
         Clear();
+        NotifyValueChanged();
         break;
 
     case eVarSetOperationReplace:
@@ -56,6 +57,7 @@ OptionValueBoolean::SetValueFromCString
             {
                 m_value_was_set = true;
                 m_current_value = value;
+                NotifyValueChanged();
             }
             else
             {

Modified: lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueDictionary.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueDictionary.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueDictionary.cpp Tue Jan 13 15:13:08 2015
@@ -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

Modified: lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp Tue Jan 13 15:13:08 2015
@@ -62,6 +62,7 @@ OptionValueEnumeration::SetValueFromCStr
     {
         case eVarSetOperationClear:
             Clear ();
+            NotifyValueChanged();
             break;
             
         case eVarSetOperationReplace:
@@ -73,6 +74,7 @@ OptionValueEnumeration::SetValueFromCStr
                 if (enumerator_entry)
                 {
                     m_current_value = enumerator_entry->value.value;
+                    NotifyValueChanged();
                 }
                 else
                 {

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Tue Jan 13 15:13:08 2015
@@ -78,6 +78,7 @@ OptionValueFileSpec::SetValueFromCString
     {
     case eVarSetOperationClear:
         Clear ();
+        NotifyValueChanged();
         break;
         
     case eVarSetOperationReplace:
@@ -100,6 +101,7 @@ OptionValueFileSpec::SetValueFromCString
             m_value_was_set = true;
             m_current_value.SetFile(filepath.c_str(), true);
             m_data_sp.reset();
+            NotifyValueChanged();
         }
         else
         {

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp Tue Jan 13 15:13:08 2015
@@ -51,6 +51,7 @@ OptionValueFileSpecList::SetValueFromCSt
     {
         case eVarSetOperationClear:
             Clear ();
+            NotifyValueChanged();
             break;
             
         case eVarSetOperationReplace:
@@ -72,6 +73,7 @@ OptionValueFileSpecList::SetValueFromCSt
                         else
                             m_current_value.Append(file);
                     }
+                    NotifyValueChanged();
                 }
             }
             else
@@ -94,6 +96,7 @@ OptionValueFileSpecList::SetValueFromCSt
                     FileSpec file (args.GetArgumentAtIndex(i), false);
                     m_current_value.Append(file);
                 }
+                NotifyValueChanged();
             }
             else
             {
@@ -120,6 +123,7 @@ OptionValueFileSpecList::SetValueFromCSt
                         FileSpec file (args.GetArgumentAtIndex(i), false);
                         m_current_value.Insert (idx, file);
                     }
+                    NotifyValueChanged();
                 }
             }
             else
@@ -155,6 +159,7 @@ OptionValueFileSpecList::SetValueFromCSt
                             m_current_value.Remove (j);
                         }
                     }
+                    NotifyValueChanged();
                 }
                 else
                 {

Modified: lldb/trunk/source/Interpreter/OptionValueFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFormat.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFormat.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFormat.cpp Tue Jan 13 15:13:08 2015
@@ -43,6 +43,7 @@ OptionValueFormat::SetValueFromCString (
     {
     case eVarSetOperationClear:
         Clear();
+        NotifyValueChanged();
         break;
         
     case eVarSetOperationReplace:
@@ -54,6 +55,7 @@ OptionValueFormat::SetValueFromCString (
             {
                 m_value_was_set = true;
                 m_current_value = new_format;
+                NotifyValueChanged();
             }
         }
         break;

Modified: lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp Tue Jan 13 15:13:08 2015
@@ -43,6 +43,7 @@ OptionValuePathMappings::SetValueFromCSt
     {
         case eVarSetOperationClear:
             Clear ();
+            NotifyValueChanged();
             break;
             
         case eVarSetOperationReplace:
@@ -64,6 +65,7 @@ OptionValuePathMappings::SetValueFromCSt
                         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::SetValueFromCSt
                     m_path_mappings.Append(a, b, m_notify_changes);
                     m_value_was_set = true;
                 }
+                NotifyValueChanged();
             }
             break;
             
@@ -121,6 +124,7 @@ OptionValuePathMappings::SetValueFromCSt
                         ConstString b(args.GetArgumentAtIndex(i+1));
                         m_path_mappings.Insert (a, b, idx, m_notify_changes);
                     }
+                    NotifyValueChanged();
                 }
             }
             else
@@ -156,6 +160,7 @@ OptionValuePathMappings::SetValueFromCSt
                             m_path_mappings.Remove (j, m_notify_changes);
                         }
                     }
+                    NotifyValueChanged();
                 }
                 else
                 {

Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Tue Jan 13 15:13:08 2015
@@ -81,6 +81,16 @@ OptionValueProperties::Initialize (const
 }
 
 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,

Modified: lldb/trunk/source/Interpreter/OptionValueRegex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueRegex.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueRegex.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueRegex.cpp Tue Jan 13 15:13:08 2015
@@ -57,6 +57,7 @@ OptionValueRegex::SetValueFromCString (c
 
     case eVarSetOperationClear:
         Clear();
+        NotifyValueChanged();
         break;
 
     case eVarSetOperationReplace:
@@ -64,6 +65,7 @@ OptionValueRegex::SetValueFromCString (c
         if (m_regex.Compile (value_cstr, m_regex.GetCompileFlags()))
         {
             m_value_was_set = true;
+            NotifyValueChanged();
         }
         else
         {

Modified: lldb/trunk/source/Interpreter/OptionValueSInt64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueSInt64.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueSInt64.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueSInt64.cpp Tue Jan 13 15:13:08 2015
@@ -44,6 +44,7 @@ OptionValueSInt64::SetValueFromCString (
     {
         case eVarSetOperationClear:
             Clear();
+            NotifyValueChanged();
             break;
             
         case eVarSetOperationReplace:
@@ -57,6 +58,7 @@ OptionValueSInt64::SetValueFromCString (
                     {
                         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 ".",

Modified: lldb/trunk/source/Interpreter/OptionValueString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueString.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueString.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueString.cpp Tue Jan 13 15:13:08 2015
@@ -94,30 +94,32 @@ OptionValueString::SetValueFromCString (
 
     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 (
         {
             SetCurrentValue (value_cstr);
         }
+        NotifyValueChanged();
         break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueUInt64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueUInt64.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueUInt64.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueUInt64.cpp Tue Jan 13 15:13:08 2015
@@ -51,6 +51,7 @@ OptionValueUInt64::SetValueFromCString (
     {
         case eVarSetOperationClear:
             Clear ();
+            NotifyValueChanged();
             break;
             
         case eVarSetOperationReplace:
@@ -62,6 +63,7 @@ OptionValueUInt64::SetValueFromCString (
             {
                 m_value_was_set = true;
                 m_current_value = value;
+                NotifyValueChanged();
             }
             else
             {

Modified: lldb/trunk/source/Interpreter/OptionValueUUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueUUID.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueUUID.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueUUID.cpp Tue Jan 13 15:13:08 2015
@@ -45,6 +45,7 @@ OptionValueUUID::SetValueFromCString (co
     {
         case eVarSetOperationClear:
             Clear();
+            NotifyValueChanged();
             break;
             
         case eVarSetOperationReplace:
@@ -53,7 +54,10 @@ OptionValueUUID::SetValueFromCString (co
                 if (m_uuid.SetFromCString(value_cstr) == 0)
                     error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr);
                 else
+                {
                     m_value_was_set = true;
+                    NotifyValueChanged();
+                }
             }
             break;
             

Modified: lldb/trunk/source/Interpreter/Property.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Property.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Property.cpp (original)
+++ lldb/trunk/source/Interpreter/Property.cpp Tue Jan 13 15:13:08 2015
@@ -277,3 +277,12 @@ Property::DumpDescription (CommandInterp
     }
 }
 
+
+void
+Property::SetValueChangedCallback (OptionValueChangedCallback callback, void *baton)
+{
+    if (m_value_sp)
+        m_value_sp->SetValueChangedCallback (callback, baton);
+}
+
+

Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Tue Jan 13 15:13:08 2015
@@ -397,7 +397,7 @@ ProcessMachCore::UpdateThreadList (Threa
     {
         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;
 }

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=225831&r1=225830&r2=225831&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Jan 13 15:13:08 2015
@@ -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 (bo
                                         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, Listene
 }
 
 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 (cons
     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 &laun
                         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)





More information about the lldb-commits mailing list