Add comments to InstanceSettings constructors explaining why they have

to be set up the way they are.  Comment out code that removes pending
settings for live instances (after the settings are copied over).

llvm-svn: 113519
This commit is contained in:
Caroline Tice 2010-09-09 18:26:37 +00:00
parent 367a5df8cf
commit f20e8239cd
3 changed files with 19 additions and 9 deletions

View File

@ -633,11 +633,15 @@ DebuggerInstanceSettings::DebuggerInstanceSettings (UserSettingsController &owne
m_prompt (), m_prompt (),
m_script_lang () m_script_lang ()
{ {
if (name == NULL && live_instance) // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for DebuggerInstanceSettings are properly set up, i.e. AFTER all the initializers.
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
if (live_instance)
{ {
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name); const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
CopyInstanceSettings (pending_settings, false); CopyInstanceSettings (pending_settings, false);
m_owner.RemovePendingSettings (m_instance_name); //m_owner.RemovePendingSettings (m_instance_name);
} }
} }

View File

@ -1974,7 +1974,7 @@ Process::ProcessSettingsController::CreateNewInstanceSettings (const char *insta
ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner, bool live_instance, ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner, bool live_instance,
const char *name) : const char *name) :
InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance), InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance),
m_run_args (), m_run_args (),
m_env_vars (), m_env_vars (),
m_input_path (), m_input_path (),
@ -1983,11 +1983,15 @@ ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner,
m_plugin (), m_plugin (),
m_disable_aslr (true) m_disable_aslr (true)
{ {
if (m_instance_name != InstanceSettings::GetDefaultName() && live_instance) // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for ProcessInstanceSettings are properly set up, i.e. AFTER all the initializers.
// For this reason it has to be called here, rather than in the initializer or in the parent constructor.
if (live_instance)
{ {
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name); const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
CopyInstanceSettings (pending_settings,false); CopyInstanceSettings (pending_settings,false);
m_owner.RemovePendingSettings (m_instance_name); //m_owner.RemovePendingSettings (m_instance_name);
} }
} }

View File

@ -970,13 +970,15 @@ ThreadInstanceSettings::ThreadInstanceSettings (UserSettingsController &owner, b
InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance), InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance),
m_avoid_regexp_ap () m_avoid_regexp_ap ()
{ {
// FIXME: This seems like generic code, why was it duplicated (with the slight difference that // CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// DebuggerInstanceSettings checks name, not m_instance_name below) in Process & Debugger? // until the vtables for ThreadInstanceSettings are properly set up, i.e. AFTER all the initializers.
if (m_instance_name != InstanceSettings::GetDefaultName() && live_instance) // For this reason it has to be called here, rather than in the initializer or in the parent constructor.
if (live_instance)
{ {
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name); const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
CopyInstanceSettings (pending_settings,false); CopyInstanceSettings (pending_settings,false);
m_owner.RemovePendingSettings (m_instance_name); //m_owner.RemovePendingSettings (m_instance_name);
} }
} }