[Lldb-commits] [lldb] r178836 - Change CommandObjectPlatform commands to get the current platform

Jason Molenda jmolenda at apple.com
Thu Apr 4 19:59:09 PDT 2013


Author: jmolenda
Date: Thu Apr  4 21:59:09 2013
New Revision: 178836

URL: http://llvm.org/viewvc/llvm-project?rev=178836&view=rev
Log:
Change CommandObjectPlatform commands to get the current platform
from the current Target, if there is one, else back off to getting
the currently selected platform from the Debugger (as it ws doing
previously.)

Remove code from DynamicLoaderDarwinKernel that was setting the platform
in both the Target and in the Debugger.

Modified:
    lldb/trunk/source/Commands/CommandObjectPlatform.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=178836&r1=178835&r2=178836&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Thu Apr  4 21:59:09 2013
@@ -207,7 +207,16 @@ protected:
     {
         Stream &ostrm = result.GetOutputStream();      
         
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+        PlatformSP platform_sp;
+        if (target)
+        {
+            platform_sp = target->GetPlatform();
+        }
+        if (!platform_sp)
+        {
+            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
+        }
         if (platform_sp)
         {
             platform_sp->GetStatus (ostrm);
@@ -381,8 +390,17 @@ protected:
     virtual bool
     DoExecute (Args& args, CommandReturnObject &result)
     {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+        PlatformSP platform_sp;
+        if (target)
+        {   
+            platform_sp = target->GetPlatform();
+        }   
+        if (!platform_sp)
+        {
+            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
+        }   
+
         if (platform_sp)
         {
             Error error;
@@ -490,7 +508,16 @@ protected:
     virtual bool
     DoExecute (Args& args, CommandReturnObject &result)
     {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+        PlatformSP platform_sp;
+        if (target)
+        {   
+            platform_sp = target->GetPlatform();
+        }   
+        if (!platform_sp)
+        {
+            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
+        }   
         
         if (platform_sp)
         {
@@ -770,7 +797,17 @@ protected:
     virtual bool
     DoExecute (Args& args, CommandReturnObject &result)
     {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+        PlatformSP platform_sp;
+        if (target)
+        {   
+            platform_sp = target->GetPlatform();
+        }   
+        if (!platform_sp)
+        {
+            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
+        }   
+
         if (platform_sp)
         {
             const size_t argc = args.GetArgumentCount();

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=178836&r1=178835&r2=178836&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Thu Apr  4 21:59:09 2013
@@ -464,7 +464,6 @@ DynamicLoaderDarwinKernel::DynamicLoader
     if (platform_sp.get() && GetGlobalProperties()->GetLoadKexts())
     {
         process->GetTarget().SetPlatform (platform_sp);
-        process->GetTarget().GetDebugger().GetPlatformList().SetSelectedPlatform (platform_sp);
     }
 }
 





More information about the lldb-commits mailing list