summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-09-16 19:05:55 +0000
committerCaroline Tice <ctice@apple.com>2010-09-16 19:05:55 +0000
commit9e41c15d8484ec71b31bb791bac3d3b41719bf5f (patch)
tree86927a8ccf1e6c5d95a7c166cc51bc1f798f570c /lldb/source/Core
parent20154b3ed4d7214e96986e90612f5d009a3e6348 (diff)
downloadbcm5719-llvm-9e41c15d8484ec71b31bb791bac3d3b41719bf5f.tar.gz
bcm5719-llvm-9e41c15d8484ec71b31bb791bac3d3b41719bf5f.zip
Fix issues with CreateInstanceName, a virtual function, being called
in an initializer. llvm-svn: 114107
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/Debugger.cpp9
-rw-r--r--lldb/source/Core/UserSettingsController.cpp9
2 files changed, 17 insertions, 1 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 408220437b6..8fd0271241a 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -639,13 +639,20 @@ Debugger::DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Erro
DebuggerInstanceSettings::DebuggerInstanceSettings (UserSettingsController &owner, bool live_instance,
const char *name) :
- InstanceSettings (owner, (name == NULL ? CreateInstanceName ().AsCString() : name), live_instance),
+ InstanceSettings (owner, (name == NULL ? InstanceSettings::InvalidName().AsCString() : name), live_instance),
m_prompt (),
m_script_lang ()
{
// 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.
+ // The same is true of CreateInstanceName().
+
+ if (GetInstanceName() == InstanceSettings::InvalidName())
+ {
+ ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
+ m_owner.RegisterInstanceSettings (this);
+ }
if (live_instance)
{
diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp
index b97aa1d7ea7..4a604cac38b 100644
--- a/lldb/source/Core/UserSettingsController.cpp
+++ b/lldb/source/Core/UserSettingsController.cpp
@@ -2187,6 +2187,7 @@ InstanceSettings::InstanceSettings (UserSettingsController &owner, const char *i
m_instance_name (instance_name)
{
if ((m_instance_name != InstanceSettings::GetDefaultName())
+ && (m_instance_name != InstanceSettings::InvalidName())
&& live_instance)
m_owner.RegisterInstanceSettings (this);
}
@@ -2205,6 +2206,14 @@ InstanceSettings::GetDefaultName ()
return g_default_settings_name;
}
+const ConstString &
+InstanceSettings::InvalidName ()
+{
+ static const ConstString g_invalid_name ("Invalid instance name");
+
+ return g_invalid_name;
+}
+
void
InstanceSettings::ChangeInstanceName (const std::string &new_instance_name)
{
OpenPOWER on IntegriCloud