diff options
Diffstat (limited to 'source/Target/TargetList.cpp')
-rw-r--r-- | source/Target/TargetList.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/source/Target/TargetList.cpp b/source/Target/TargetList.cpp index 28ad47e3d81d7..bbed0fb0bc127 100644 --- a/source/Target/TargetList.cpp +++ b/source/Target/TargetList.cpp @@ -98,12 +98,12 @@ TargetList::CreateTarget (Debugger &debugger, Error TargetList::CreateTargetInternal (Debugger &debugger, - const char *user_exe_path, - const char *triple_cstr, - bool get_dependent_files, - const OptionGroupPlatform *platform_options, - TargetSP &target_sp, - bool is_dummy_target) + const char *user_exe_path, + const char *triple_cstr, + bool get_dependent_files, + const OptionGroupPlatform *platform_options, + TargetSP &target_sp, + bool is_dummy_target) { Error error; PlatformSP platform_sp; @@ -126,16 +126,24 @@ TargetList::CreateTargetInternal (Debugger &debugger, bool prefer_platform_arch = false; CommandInterpreter &interpreter = debugger.GetCommandInterpreter(); + + // let's see if there is already an existing plaform before we go creating another... + platform_sp = debugger.GetPlatformList().GetSelectedPlatform(); + if (platform_options && platform_options->PlatformWasSpecified ()) { - const bool select_platform = true; - platform_sp = platform_options->CreatePlatformWithOptions (interpreter, - arch, - select_platform, - error, - platform_arch); - if (!platform_sp) - return error; + // Create a new platform if it doesn't match the selected platform + if (!platform_options->PlatformMatches(platform_sp)) + { + const bool select_platform = true; + platform_sp = platform_options->CreatePlatformWithOptions (interpreter, + arch, + select_platform, + error, + platform_arch); + if (!platform_sp) + return error; + } } if (user_exe_path && user_exe_path[0]) @@ -361,12 +369,12 @@ TargetList::CreateDummyTarget (Debugger &debugger, Error TargetList::CreateTargetInternal (Debugger &debugger, - const char *user_exe_path, - const ArchSpec& specified_arch, - bool get_dependent_files, - lldb::PlatformSP &platform_sp, - lldb::TargetSP &target_sp, - bool is_dummy_target) + const char *user_exe_path, + const ArchSpec& specified_arch, + bool get_dependent_files, + lldb::PlatformSP &platform_sp, + lldb::TargetSP &target_sp, + bool is_dummy_target) { Timer scoped_timer (__PRETTY_FUNCTION__, |