forked from OSchip/llvm-project
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
This commit is contained in:
parent
f7fee1c185
commit
91123da2d1
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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[];
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue