[Lldb-commits] [lldb] r114107 - in /lldb/trunk: include/lldb/Core/UserSettingsController.h source/Core/Debugger.cpp source/Core/UserSettingsController.cpp source/Target/Process.cpp source/Target/Thread.cpp
Caroline Tice
ctice at apple.com
Thu Sep 16 12:05:55 PDT 2010
Author: ctice
Date: Thu Sep 16 14:05:55 2010
New Revision: 114107
URL: http://llvm.org/viewvc/llvm-project?rev=114107&view=rev
Log:
Fix issues with CreateInstanceName, a virtual function, being called
in an initializer.
Modified:
lldb/trunk/include/lldb/Core/UserSettingsController.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/UserSettingsController.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Thread.cpp
Modified: lldb/trunk/include/lldb/Core/UserSettingsController.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/UserSettingsController.h?rev=114107&r1=114106&r2=114107&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/UserSettingsController.h (original)
+++ lldb/trunk/include/lldb/Core/UserSettingsController.h Thu Sep 16 14:05:55 2010
@@ -392,6 +392,9 @@
static const ConstString &
GetDefaultName ();
+ static const ConstString &
+ InvalidName ();
+
protected:
UserSettingsController &m_owner;
Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=114107&r1=114106&r2=114107&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Sep 16 14:05:55 2010
@@ -639,13 +639,20 @@
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)
{
Modified: lldb/trunk/source/Core/UserSettingsController.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/UserSettingsController.cpp?rev=114107&r1=114106&r2=114107&view=diff
==============================================================================
--- lldb/trunk/source/Core/UserSettingsController.cpp (original)
+++ lldb/trunk/source/Core/UserSettingsController.cpp Thu Sep 16 14:05:55 2010
@@ -2187,6 +2187,7 @@
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 @@
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)
{
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=114107&r1=114106&r2=114107&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Sep 16 14:05:55 2010
@@ -1876,7 +1876,7 @@
ProcessInstanceSettings::ProcessInstanceSettings (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_run_args (),
m_env_vars (),
m_input_path (),
@@ -1888,6 +1888,13 @@
// 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.
+ // This is true for CreateInstanceName() too.
+
+ if (GetInstanceName () == InstanceSettings::InvalidName())
+ {
+ ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
+ m_owner.RegisterInstanceSettings (this);
+ }
if (live_instance)
{
Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=114107&r1=114106&r2=114107&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu Sep 16 14:05:55 2010
@@ -967,12 +967,19 @@
//--------------------------------------------------------------
ThreadInstanceSettings::ThreadInstanceSettings (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_avoid_regexp_ap ()
{
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for ThreadInstanceSettings 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.
+ // This is true for CreateInstanceName() too.
+
+ if (GetInstanceName() == InstanceSettings::InvalidName())
+ {
+ ChangeInstanceName (std::string (CreateInstanceName().AsCString()));
+ m_owner.RegisterInstanceSettings (this);
+ }
if (live_instance)
{
More information about the lldb-commits
mailing list