Index: source/Commands/CommandObjectPlatform.cpp =================================================================== --- source/Commands/CommandObjectPlatform.cpp +++ source/Commands/CommandObjectPlatform.cpp @@ -237,20 +237,41 @@ { const bool select = true; m_platform_options.SetPlatformName (platform_name); - Error error; - ArchSpec platform_arch; - PlatformSP platform_sp (m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), select, error, platform_arch)); - if (platform_sp) + + bool found = false; + PlatformList &list = m_interpreter.GetDebugger().GetPlatformList(); + for (size_t i = 0; i < list.GetSize(); ++i) { - m_interpreter.GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp); + PlatformSP platform_sp = list.GetAtIndex(i); + if (m_platform_options.PlatformMatches(platform_sp)) + { + list.SetSelectedPlatform(platform_sp); - platform_sp->GetStatus (result.GetOutputStream()); - result.SetStatus (eReturnStatusSuccessFinishResult); + platform_sp->GetStatus (result.GetOutputStream()); + result.SetStatus (eReturnStatusSuccessFinishResult); + + found = true; + break; + } } - else + + if (!found) { - result.AppendError(error.AsCString()); - result.SetStatus (eReturnStatusFailed); + Error error; + ArchSpec platform_arch; + PlatformSP platform_sp (m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), select, error, platform_arch)); + if (platform_sp) + { + list.SetSelectedPlatform(platform_sp); + + platform_sp->GetStatus (result.GetOutputStream()); + result.SetStatus (eReturnStatusSuccessFinishResult); + } + else + { + result.AppendError(error.AsCString()); + result.SetStatus (eReturnStatusFailed); + } } } else