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.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178836 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectPlatform.cpp b/source/Commands/CommandObjectPlatform.cpp
index 6bf9c60..a762db4 100644
--- a/source/Commands/CommandObjectPlatform.cpp
+++ b/source/Commands/CommandObjectPlatform.cpp
@@ -207,7 +207,16 @@
{
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 @@
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 @@
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 @@
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();