Skip to content

Commit 869e0c1

Browse files
author
Ted Woodward
committedMay 11, 2015
Fix selecting the Platform in TargetList::CreateTargetInternal()
Summary: TargetList::CreateTargetInternal() will only select the current Platform. A previous patch always sets platform_sp to the current Platform, so a check later to see if platform_sp was not defined always failed, and the current Platform was used. This patch removes that check, so if the current Platform is not compatible with the target architecture, CreateTargetInternal() will call Platform::GetPlatformForArchitecture() to select a compatible Platform. Vince, remote linux tests (Ubuntu -> remote Ubuntu) pass the same with and without this patch. Reviewers: vharron, clayborg Reviewed By: clayborg Subscribers: jingham, lldb-commits Differential Revision: http://reviews.llvm.org/D8749 llvm-svn: 237053
1 parent b1da257 commit 869e0c1

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed
 

‎lldb/source/Target/TargetList.cpp

+17-22
Original file line numberDiff line numberDiff line change
@@ -293,32 +293,27 @@ TargetList::CreateTargetInternal (Debugger &debugger,
293293
}
294294
}
295295

296-
if (!platform_sp)
296+
// If we have a valid architecture, make sure the current platform is
297+
// compatible with that architecture
298+
if (!prefer_platform_arch && arch.IsValid())
297299
{
298-
// Get the current platform and make sure it is compatible with the
299-
// current architecture if we have a valid architecture.
300-
platform_sp = debugger.GetPlatformList().GetSelectedPlatform ();
301-
302-
if (!prefer_platform_arch && arch.IsValid())
300+
if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
303301
{
304-
if (!platform_sp->IsCompatibleArchitecture(arch, false, &platform_arch))
305-
{
306-
platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
307-
if (platform_sp)
308-
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
309-
}
302+
platform_sp = Platform::GetPlatformForArchitecture(arch, &platform_arch);
303+
if (platform_sp)
304+
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
310305
}
311-
else if (platform_arch.IsValid())
306+
}
307+
else if (platform_arch.IsValid())
308+
{
309+
// if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with
310+
// a single architecture which should be used
311+
ArchSpec fixed_platform_arch;
312+
if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch))
312313
{
313-
// if "arch" isn't valid, yet "platform_arch" is, it means we have an executable file with
314-
// a single architecture which should be used
315-
ArchSpec fixed_platform_arch;
316-
if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch))
317-
{
318-
platform_sp = Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch);
319-
if (platform_sp)
320-
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
321-
}
314+
platform_sp = Platform::GetPlatformForArchitecture(platform_arch, &fixed_platform_arch);
315+
if (platform_sp)
316+
debugger.GetPlatformList().SetSelectedPlatform(platform_sp);
322317
}
323318
}
324319

0 commit comments

Comments
 (0)
Please sign in to comment.