diff options
author | Caroline Tice <ctice@apple.com> | 2010-09-08 17:48:55 +0000 |
---|---|---|
committer | Caroline Tice <ctice@apple.com> | 2010-09-08 17:48:55 +0000 |
commit | 91123da2d1ee7d4f09e3f62e59d33ddf8aa0b27e (patch) | |
tree | 3619476dca69d0acd798c70a1c4ca3d249d9eb16 /lldb/source/Core | |
parent | f7fee1c1859340bd0c8188a507127aa959bcef68 (diff) | |
download | bcm5719-llvm-91123da2d1ee7d4f09e3f62e59d33ddf8aa0b27e.tar.gz bcm5719-llvm-91123da2d1ee7d4f09e3f62e59d33ddf8aa0b27e.zip |
Make sure creating a pending instance doesn't also trigger creating a live instance; also make sure creating a
pending instance uses the specified instance name rather than creating a new one; add brackets to instance names
when searching for and removing pending instances.
llvm-svn: 113370
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Core/UserSettingsController.cpp | 37 |
2 files changed, 36 insertions, 16 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 08033d04ec6..fea9209af9b 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -565,7 +565,8 @@ Debugger::DebuggerSettingsController::DebuggerSettingsController () : UserSettingsController ("", lldb::UserSettingsControllerSP()), m_term_width (80) { - m_default_settings.reset (new DebuggerInstanceSettings (*this, InstanceSettings::GetDefaultName().AsCString())); + m_default_settings.reset (new DebuggerInstanceSettings (*this, false, + InstanceSettings::GetDefaultName().AsCString())); } Debugger::DebuggerSettingsController::~DebuggerSettingsController () @@ -574,9 +575,10 @@ Debugger::DebuggerSettingsController::~DebuggerSettingsController () lldb::InstanceSettingsSP -Debugger::DebuggerSettingsController::CreateNewInstanceSettings () +Debugger::DebuggerSettingsController::CreateNewInstanceSettings (const char *instance_name) { - DebuggerInstanceSettings *new_settings = new DebuggerInstanceSettings (*(Debugger::GetSettingsController().get())); + DebuggerInstanceSettings *new_settings = new DebuggerInstanceSettings (*(Debugger::GetSettingsController().get()), + false, instance_name); lldb::InstanceSettingsSP new_settings_sp (new_settings); return new_settings_sp; } @@ -626,12 +628,13 @@ Debugger::DebuggerSettingsController::ValidTermWidthValue (const char *value, Er // class DebuggerInstanceSettings //-------------------------------------------------- -DebuggerInstanceSettings::DebuggerInstanceSettings (UserSettingsController &owner, const char *name) : - InstanceSettings (owner, (name == NULL ? CreateInstanceName ().AsCString() : name)), +DebuggerInstanceSettings::DebuggerInstanceSettings (UserSettingsController &owner, bool live_instance, + const char *name) : + InstanceSettings (owner, (name == NULL ? CreateInstanceName ().AsCString() : name), live_instance), m_prompt (), m_script_lang () { - if (name == NULL) + if (name == NULL && live_instance) { const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name); CopyInstanceSettings (pending_settings, false); diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index ea61e863508..aee898974f9 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -47,10 +47,10 @@ UserSettingsController::InitializeSettingsController (lldb::UserSettingsControll if (parent) parent->RegisterChild (controller_sp); - controller_sp->CreateSettingsVector (global_settings, true); - controller_sp->CreateSettingsVector (instance_settings, false); + controller_sp->CreateSettingsVector (global_settings, true); + controller_sp->CreateSettingsVector (instance_settings, false); - controller_sp->InitializeGlobalVariables (); + controller_sp->InitializeGlobalVariables (); controller_sp->CreateDefaultInstanceSettings (); return true; @@ -565,8 +565,17 @@ UserSettingsController::GetVariable (const char *full_dot_name, lldb::SettableVa void UserSettingsController::RemovePendingSettings (const ConstString &instance_name) { + StreamString tmp_name; + + // Add surrounding brackets to instance name if not already present. + + if (instance_name.AsCString()[0] != '[') + tmp_name.Printf ("[%s]", instance_name.AsCString()); + else + tmp_name.Printf ("%s", instance_name.AsCString()); + + std::string instance_name_str (tmp_name.GetData()); std::map<std::string, lldb::InstanceSettingsSP>::iterator pos; - std::string instance_name_str (instance_name.AsCString()); Mutex::Locker locker (m_pending_settings_mutex); m_pending_settings.erase (instance_name_str); @@ -576,7 +585,16 @@ const lldb::InstanceSettingsSP & UserSettingsController::FindPendingSettings (const ConstString &instance_name) { std::map<std::string, lldb::InstanceSettingsSP>::iterator pos; - std::string instance_name_str (instance_name.AsCString()); + StreamString tmp_name; + + // Add surrounding brackets to instance name if not already present. + + if (instance_name.AsCString()[0] != '[') + tmp_name.Printf ("[%s]", instance_name.AsCString()); + else + tmp_name.Printf ("%s", instance_name.AsCString()); + + std::string instance_name_str (tmp_name.GetData()); // Need std::string for std::map look-up { // Scope for mutex. Mutex::Locker locker (m_pending_settings_mutex); @@ -655,9 +673,7 @@ UserSettingsController::PendingSettingsForInstance (const ConstString &instance_ } else { - lldb::InstanceSettingsSP default_settings_sp = - m_pending_settings[InstanceSettings::GetDefaultName().AsCString()]; - lldb::InstanceSettingsSP new_settings_sp = CreateNewInstanceSettings (); + lldb::InstanceSettingsSP new_settings_sp = CreateNewInstanceSettings (instance_name.AsCString()); CopyDefaultSettings (new_settings_sp, instance_name, true); m_pending_settings[name_str] = new_settings_sp; return new_settings_sp; @@ -1861,11 +1877,12 @@ UserSettingsController::UpdateEnumVariable (lldb::OptionEnumValueElement *enum_v // class InstanceSettings //---------------------------------------------------------------------- -InstanceSettings::InstanceSettings (UserSettingsController &owner, const char *instance_name) : +InstanceSettings::InstanceSettings (UserSettingsController &owner, const char *instance_name, bool live_instance) : m_owner (owner), m_instance_name (instance_name) { - if (m_instance_name != InstanceSettings::GetDefaultName()) + if ((m_instance_name != InstanceSettings::GetDefaultName()) + && live_instance) m_owner.RegisterInstanceSettings (this); } |