[Lldb-commits] [lldb] r113519 - in /lldb/trunk/source: Core/Debugger.cpp Target/Process.cpp Target/Thread.cpp

Caroline Tice ctice at apple.com
Thu Sep 9 11:26:37 PDT 2010


Author: ctice
Date: Thu Sep  9 13:26:37 2010
New Revision: 113519

URL: http://llvm.org/viewvc/llvm-project?rev=113519&view=rev
Log:
Add comments to InstanceSettings constructors explaining why they have 
to be set up the way they are.  Comment out code that removes pending
settings for live instances (after the settings are copied over).


Modified:
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=113519&r1=113518&r2=113519&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu Sep  9 13:26:37 2010
@@ -633,11 +633,15 @@
     m_prompt (),
     m_script_lang ()
 {
-    if (name == NULL && live_instance)
+    // 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.
+
+    if (live_instance)
     {
         const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
         CopyInstanceSettings (pending_settings, false);
-        m_owner.RemovePendingSettings (m_instance_name);
+      //m_owner.RemovePendingSettings (m_instance_name);
     }
 }
 

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=113519&r1=113518&r2=113519&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Sep  9 13:26:37 2010
@@ -1974,7 +1974,7 @@
 
 ProcessInstanceSettings::ProcessInstanceSettings (UserSettingsController &owner, bool live_instance, 
                                                   const char *name) :
-  InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance), 
+    InstanceSettings (owner, (name == NULL ? CreateInstanceName().AsCString() : name), live_instance), 
     m_run_args (),
     m_env_vars (),
     m_input_path (),
@@ -1983,11 +1983,15 @@
     m_plugin (),
     m_disable_aslr (true)
 {
-    if (m_instance_name != InstanceSettings::GetDefaultName() && live_instance)
+    // 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.
+
+    if (live_instance)
     {
         const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
         CopyInstanceSettings (pending_settings,false);
-        m_owner.RemovePendingSettings (m_instance_name);
+        //m_owner.RemovePendingSettings (m_instance_name);
     }
 }
 

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=113519&r1=113518&r2=113519&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu Sep  9 13:26:37 2010
@@ -970,13 +970,15 @@
     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() && live_instance)
+    // 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.
+
+    if (live_instance)
     {
         const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
         CopyInstanceSettings (pending_settings,false);
-        m_owner.RemovePendingSettings (m_instance_name);
+        //m_owner.RemovePendingSettings (m_instance_name);
     }
 }
 





More information about the lldb-commits mailing list