diff options
author | Greg Clayton <gclayton@apple.com> | 2014-09-19 20:11:50 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2014-09-19 20:11:50 +0000 |
commit | 615eb7e6097c035e0b64992798fda7c939e93303 (patch) | |
tree | 5ce9aa21d619eff5b07fba9b6f14cadbdb81b333 /lldb/source/API/SBDebugger.cpp | |
parent | 4f1561a5dd875711fcb5018de791bf953d25c817 (diff) | |
download | bcm5719-llvm-615eb7e6097c035e0b64992798fda7c939e93303.tar.gz bcm5719-llvm-615eb7e6097c035e0b64992798fda7c939e93303.zip |
Test suite runs better again after recent fixes that would select a platform if a "file a.out" auto selected a different platform than the selected one.
Changes include:
- fix it so you can select the "host" platform using "platform select host"
- change all callbacks that create platforms to returns shared pointers
- fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host"
- Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform
- cache platforms that are created and re-use them instead of always creating a new one
llvm-svn: 218145
Diffstat (limited to 'lldb/source/API/SBDebugger.cpp')
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index dae567525a4..b53dec2a21d 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -1186,19 +1186,42 @@ SBDebugger::GetID() SBError -SBDebugger::SetCurrentPlatform (const char *platform_name) +SBDebugger::SetCurrentPlatform (const char *platform_name_cstr) { SBError sb_error; if (m_opaque_sp) { - PlatformSP platform_sp (Platform::Create (platform_name, sb_error.ref())); - - if (platform_sp) + if (platform_name_cstr && platform_name_cstr[0]) + { + ConstString platform_name (platform_name_cstr); + PlatformSP platform_sp (Platform::Find (platform_name)); + + if (platform_sp) + { + // Already have a platform with this name, just select it + m_opaque_sp->GetPlatformList().SetSelectedPlatform(platform_sp); + } + else + { + // We don't have a platform by this name yet, create one + platform_sp = Platform::Create (platform_name, sb_error.ref()); + if (platform_sp) + { + // We created the platform, now append and select it + bool make_selected = true; + m_opaque_sp->GetPlatformList().Append (platform_sp, make_selected); + } + } + } + else { - bool make_selected = true; - m_opaque_sp->GetPlatformList().Append (platform_sp, make_selected); + sb_error.ref().SetErrorString("invalid platform name"); } } + else + { + sb_error.ref().SetErrorString("invalid debugger"); + } return sb_error; } |