summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-01-13 21:13:08 +0000
committerGreg Clayton <gclayton@apple.com>2015-01-13 21:13:08 +0000
commit4c978c81002a8517f42806f7077789311f048013 (patch)
treebf9a8d54dfc974052b0db935d5f8fb4f4573fbb3
parent30cab7eca247a6d9ed1398d35c613554cabb905a (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225831 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/lldb/Interpreter/OptionValue.h22
-rw-r--r--include/lldb/Interpreter/OptionValueProperties.h14
-rw-r--r--include/lldb/Interpreter/Property.h3
-rw-r--r--include/lldb/Target/Process.h13
-rw-r--r--include/lldb/lldb-private-interfaces.h1
-rw-r--r--source/Interpreter/OptionValueArch.cpp4
-rw-r--r--source/Interpreter/OptionValueArray.cpp1
-rw-r--r--source/Interpreter/OptionValueBoolean.cpp2
-rw-r--r--source/Interpreter/OptionValueDictionary.cpp5
-rw-r--r--source/Interpreter/OptionValueEnumeration.cpp2
-rw-r--r--source/Interpreter/OptionValueFileSpec.cpp2
-rw-r--r--source/Interpreter/OptionValueFileSpecLIst.cpp5
-rw-r--r--source/Interpreter/OptionValueFormat.cpp2
-rw-r--r--source/Interpreter/OptionValuePathMappings.cpp5
-rw-r--r--source/Interpreter/OptionValueProperties.cpp10
-rw-r--r--source/Interpreter/OptionValueRegex.cpp2
-rw-r--r--source/Interpreter/OptionValueSInt64.cpp2
-rw-r--r--source/Interpreter/OptionValueString.cpp37
-rw-r--r--source/Interpreter/OptionValueUInt64.cpp2
-rw-r--r--source/Interpreter/OptionValueUUID.cpp4
-rw-r--r--source/Interpreter/Property.cpp9
-rw-r--r--source/Plugins/Process/mach-core/ProcessMachCore.cpp2
-rw-r--r--source/Target/Process.cpp43
23 files changed, 161 insertions, 31 deletions
diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h
index dd266ce61..0e8f23453 100644
--- a/include/lldb/Interpreter/OptionValue.h
+++ b/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/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h
index 0024f20e2..a67ea5d66 100644
--- a/include/lldb/Interpreter/OptionValueProperties.h
+++ b/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/include/lldb/Interpreter/Property.h b/include/lldb/Interpreter/Property.h
index 6025adce4..cb4c827de 100644
--- a/include/lldb/Interpreter/Property.h
+++ b/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/include/lldb/Target/Process.h b/include/lldb/Target/Process.h
index 23630fd81..e04de511c 100644
--- a/include/lldb/Target/Process.h
+++ b/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<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
diff --git a/include/lldb/lldb-private-interfaces.h b/include/lldb/lldb-private-interfaces.h
index 4d608fe10..f35938ce1 100644
--- a/include/lldb/lldb-private-interfaces.h
+++ b/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/source/Interpreter/OptionValueArch.cpp b/source/Interpreter/OptionValueArch.cpp
index 6d283d6b9..7df149234 100644
--- a/source/Interpreter/OptionValueArch.cpp
+++ b/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/source/Interpreter/OptionValueArray.cpp b/source/Interpreter/OptionValueArray.cpp
index 82ac74555..c0d48c1e7 100644
--- a/source/Interpreter/OptionValueArray.cpp
+++ b/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/source/Interpreter/OptionValueBoolean.cpp b/source/Interpreter/OptionValueBoolean.cpp
index bf153a144..71cc2afb9 100644
--- a/source/Interpreter/OptionValueBoolean.cpp
+++ b/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/source/Interpreter/OptionValueDictionary.cpp b/source/Interpreter/OptionValueDictionary.cpp
index 3357cd488..e5299f8cc 100644
--- a/source/Interpreter/OptionValueDictionary.cpp
+++ b/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/source/Interpreter/OptionValueEnumeration.cpp b/source/Interpreter/OptionValueEnumeration.cpp
index 7aceac91b..dbaeb185f 100644
--- a/source/Interpreter/OptionValueEnumeration.cpp
+++ b/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/source/Interpreter/OptionValueFileSpec.cpp b/source/Interpreter/OptionValueFileSpec.cpp
index c8aaadef2..3f466985a 100644
--- a/source/Interpreter/OptionValueFileSpec.cpp
+++ b/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/source/Interpreter/OptionValueFileSpecLIst.cpp b/source/Interpreter/OptionValueFileSpecLIst.cpp
index 89d2e429e..7150ad474 100644
--- a/source/Interpreter/OptionValueFileSpecLIst.cpp
+++ b/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/source/Interpreter/OptionValueFormat.cpp b/source/Interpreter/OptionValueFormat.cpp
index 296dd9832..d91f10b0e 100644
--- a/source/Interpreter/OptionValueFormat.cpp
+++ b/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/source/Interpreter/OptionValuePathMappings.cpp b/source/Interpreter/OptionValuePathMappings.cpp
index b442277a6..56f2ecf4f 100644
--- a/source/Interpreter/OptionValuePathMappings.cpp
+++ b/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/source/Interpreter/OptionValueProperties.cpp b/source/Interpreter/OptionValueProperties.cpp
index 0497ee1c1..6ec2aa569 100644
--- a/source/Interpreter/OptionValueProperties.cpp
+++ b/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/source/Interpreter/OptionValueRegex.cpp b/source/Interpreter/OptionValueRegex.cpp
index f1ba0ed04..f51cf02ed 100644
--- a/source/Interpreter/OptionValueRegex.cpp
+++ b/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/source/Interpreter/OptionValueSInt64.cpp b/source/Interpreter/OptionValueSInt64.cpp
index 04bf9306a..1827cc1d8 100644
--- a/source/Interpreter/OptionValueSInt64.cpp
+++ b/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/source/Interpreter/OptionValueString.cpp b/source/Interpreter/OptionValueString.cpp
index df047bd98..a1b80d8fc 100644
--- a/source/Interpreter/OptionValueString.cpp
+++ b/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/source/Interpreter/OptionValueUInt64.cpp b/source/Interpreter/OptionValueUInt64.cpp
index 56b3a1c74..3e12c0302 100644
--- a/source/Interpreter/OptionValueUInt64.cpp
+++ b/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/source/Interpreter/OptionValueUUID.cpp b/source/Interpreter/OptionValueUUID.cpp
index 0141911d9..c228cf6e4 100644
--- a/source/Interpreter/OptionValueUUID.cpp
+++ b/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/source/Interpreter/Property.cpp b/source/Interpreter/Property.cpp
index 4d4d75a2b..7f7219fc0 100644
--- a/source/Interpreter/Property.cpp
+++ b/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/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/source/Plugins/Process/mach-core/ProcessMachCore.cpp
index eeadc8438..e1b4ae0b7 100644
--- a/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ b/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/source/Target/Process.cpp b/source/Target/Process.cpp
index 936e2aaff..106678da2 100644
--- a/source/Target/Process.cpp
+++ b/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)