summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/Core/Debugger.h4
-rw-r--r--lldb/include/lldb/Core/UserSettingsController.h4
-rw-r--r--lldb/include/lldb/Target/Process.h4
-rw-r--r--lldb/include/lldb/Target/Thread.h4
-rw-r--r--lldb/source/Core/Debugger.cpp15
-rw-r--r--lldb/source/Core/UserSettingsController.cpp37
-rw-r--r--lldb/source/Target/Process.cpp15
-rw-r--r--lldb/source/Target/Thread.cpp14
8 files changed, 61 insertions, 36 deletions
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index cac01c197e6..2649b3f2956 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -40,7 +40,7 @@ class DebuggerInstanceSettings : public InstanceSettings
{
public:
- DebuggerInstanceSettings (UserSettingsController &owner, const char *name = NULL);
+ DebuggerInstanceSettings (UserSettingsController &owner, bool live_instance = true, const char *name = NULL);
DebuggerInstanceSettings (const DebuggerInstanceSettings &rhs);
@@ -124,7 +124,7 @@ public:
protected:
lldb::InstanceSettingsSP
- CreateNewInstanceSettings ();
+ CreateNewInstanceSettings (const char *instance_name);
bool
ValidTermWidthValue (const char *value, Error err);
diff --git a/lldb/include/lldb/Core/UserSettingsController.h b/lldb/include/lldb/Core/UserSettingsController.h
index 0a41f0ee74d..b9e88e2f13f 100644
--- a/lldb/include/lldb/Core/UserSettingsController.h
+++ b/lldb/include/lldb/Core/UserSettingsController.h
@@ -61,7 +61,7 @@ public:
// Pure virtual functions, which all sub-classes must implement.
virtual lldb::InstanceSettingsSP
- CreateNewInstanceSettings () = 0;
+ CreateNewInstanceSettings (const char *instance_name) = 0;
virtual void
UpdateGlobalVariable (const ConstString &var_name,
@@ -334,7 +334,7 @@ class InstanceSettings
{
public:
- InstanceSettings (UserSettingsController &owner, const char *instance_name);
+ InstanceSettings (UserSettingsController &owner, const char *instance_name, bool live_instance = true);
InstanceSettings (const InstanceSettings &rhs);
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 36eb791dee2..b7e21d4698e 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -41,7 +41,7 @@ class ProcessInstanceSettings : public InstanceSettings
{
public:
- ProcessInstanceSettings (UserSettingsController &owner, const char *name = NULL);
+ ProcessInstanceSettings (UserSettingsController &owner, bool live_instance = true, const char *name = NULL);
ProcessInstanceSettings (const ProcessInstanceSettings &rhs);
@@ -251,7 +251,7 @@ public:
protected:
lldb::InstanceSettingsSP
- CreateNewInstanceSettings ();
+ CreateNewInstanceSettings (const char *instance_name);
static lldb::OptionEnumValueElement g_plugins[];
diff --git a/lldb/include/lldb/Target/Thread.h b/lldb/include/lldb/Target/Thread.h
index 7a28e1ae8b1..ab964e9ee88 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -29,7 +29,7 @@ class ThreadInstanceSettings : public InstanceSettings
{
public:
- ThreadInstanceSettings (UserSettingsController &owner, const char *name = NULL);
+ ThreadInstanceSettings (UserSettingsController &owner, bool live_instance = true, const char *name = NULL);
ThreadInstanceSettings (const ThreadInstanceSettings &rhs);
@@ -112,7 +112,7 @@ public:
protected:
lldb::InstanceSettingsSP
- CreateNewInstanceSettings ();
+ CreateNewInstanceSettings (const char *instance_name);
private:
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);
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index fa0fd19dcae..ee2ad0fbe42 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1951,7 +1951,8 @@ Process::GetSettingsController (bool finish)
Process::ProcessSettingsController::ProcessSettingsController () :
UserSettingsController ("process", Debugger::GetSettingsController())
{
- m_default_settings.reset (new ProcessInstanceSettings (*this, InstanceSettings::GetDefaultName().AsCString()));
+ m_default_settings.reset (new ProcessInstanceSettings (*this, false,
+ InstanceSettings::GetDefaultName().AsCString()));
}
Process::ProcessSettingsController::~ProcessSettingsController ()
@@ -1959,9 +1960,10 @@ Process::ProcessSettingsController::~ProcessSettingsController ()
}
lldb::InstanceSettingsSP
-Process::ProcessSettingsController::CreateNewInstanceSettings ()
+Process::ProcessSettingsController::CreateNewInstanceSettings (const char *instance_name)
{
- ProcessInstanceSettings *new_settings = new ProcessInstanceSettings (*(Process::GetSettingsController().get()));
+ ProcessInstanceSettings *new_settings = new ProcessInstanceSettings (*(Process::GetSettingsController().get()),
+ false, instance_name);
lldb::InstanceSettingsSP new_settings_sp (new_settings);
return new_settings_sp;
}
@@ -1970,8 +1972,9 @@ Process::ProcessSettingsController::CreateNewInstanceSettings ()
// class ProcessInstanceSettings
//--------------------------------------------------------------
-ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner, const char *name) :
- InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name)),
+ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner, bool live_instance,
+ const char *name) :
+ InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance),
m_run_args (),
m_env_vars (),
m_input_path (),
@@ -1980,7 +1983,7 @@ ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner,
m_plugin (),
m_disable_aslr (true)
{
- if (m_instance_name != InstanceSettings::GetDefaultName())
+ if (m_instance_name != InstanceSettings::GetDefaultName() && live_instance)
{
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
CopyInstanceSettings (pending_settings,false);
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 44b6f12d96c..422257f8ad0 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -945,7 +945,8 @@ Thread::GetSettingsController (bool finish)
Thread::ThreadSettingsController::ThreadSettingsController () :
UserSettingsController ("thread", Process::GetSettingsController())
{
- m_default_settings.reset (new ThreadInstanceSettings (*this, InstanceSettings::GetDefaultName().AsCString()));
+ m_default_settings.reset (new ThreadInstanceSettings (*this, false,
+ InstanceSettings::GetDefaultName().AsCString()));
}
Thread::ThreadSettingsController::~ThreadSettingsController ()
@@ -953,9 +954,10 @@ Thread::ThreadSettingsController::~ThreadSettingsController ()
}
lldb::InstanceSettingsSP
-Thread::ThreadSettingsController::CreateNewInstanceSettings ()
+Thread::ThreadSettingsController::CreateNewInstanceSettings (const char *instance_name)
{
- ThreadInstanceSettings *new_settings = new ThreadInstanceSettings (*(Thread::GetSettingsController().get()));
+ ThreadInstanceSettings *new_settings = new ThreadInstanceSettings (*(Thread::GetSettingsController().get()),
+ false, instance_name);
lldb::InstanceSettingsSP new_settings_sp (new_settings);
return new_settings_sp;
}
@@ -964,13 +966,13 @@ Thread::ThreadSettingsController::CreateNewInstanceSettings ()
// class ThreadInstanceSettings
//--------------------------------------------------------------
-ThreadInstanceSettings::ThreadInstanceSettings (UserSettingsController &owner, const char *name) :
- InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name)),
+ThreadInstanceSettings::ThreadInstanceSettings (UserSettingsController &owner, bool live_instance, const char *name) :
+ InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance),
m_avoid_regexp_ap ()
{
// FIXME: This seems like generic code, why was it duplicated (with the slight difference that
// DebuggerInstanceSettings checks name, not m_instance_name below) in Process & Debugger?
- if (m_instance_name != InstanceSettings::GetDefaultName())
+ if (m_instance_name != InstanceSettings::GetDefaultName() && live_instance)
{
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
CopyInstanceSettings (pending_settings,false);
OpenPOWER on IntegriCloud