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.

llvm-svn: 178836
This commit is contained in:
Jason Molenda 2013-04-05 02:59:09 +00:00
parent 87a0290941
commit 8c1157ccc4
2 changed files with 42 additions and 6 deletions

View File

@ -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();

View File

@ -464,7 +464,6 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel (Process* process, lldb::ad
if (platform_sp.get() && GetGlobalProperties()->GetLoadKexts())
{
process->GetTarget().SetPlatform (platform_sp);
process->GetTarget().GetDebugger().GetPlatformList().SetSelectedPlatform (platform_sp);
}
}