diff options
author | Jason Molenda <jmolenda@apple.com> | 2016-08-24 23:46:48 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2016-08-24 23:46:48 +0000 |
commit | 541ec9bde8822c08168056d7b2a111877e3a46cf (patch) | |
tree | 57612e383fa2ffc855fd55d059ccbb456f8986b7 /lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp | |
parent | 3d0a039e9617667af482be751e1c6363a40e35bf (diff) | |
download | bcm5719-llvm-541ec9bde8822c08168056d7b2a111877e3a46cf.tar.gz bcm5719-llvm-541ec9bde8822c08168056d7b2a111877e3a46cf.zip |
Rewrite the GetFileInSDK methods in PlatformRemoteiOS,
PlatformRemoteAppleWatch, PlatformRemoteAppleTV and remove the
GetFileInSDKRoot method from those classes.
The rewrite uses the more modern FileSpec etc API to simplify,
and handles the case where an SDK Root is given to lldb with
the "/Symbols" directory name already appended. The new version
will try appending "/Symbols" and "/Symbols.Internal" to the
sdk root directories, and will also try appending nothing to
the sdk root directory in case it's handed such an sdkroot.
<rdar://problem/28000054>
llvm-svn: 279688
Diffstat (limited to 'lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp')
-rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp | 87 |
1 files changed, 19 insertions, 68 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp index 30af2bb2250..7827ae84e71 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -613,82 +613,33 @@ PlatformRemoteAppleTV::GetFileInSDK (const char *platform_file_path, uint32_t sdk_idx, lldb_private::FileSpec &local_file) { + Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (sdk_idx < m_sdk_directory_infos.size()) { - char sdkroot_path[PATH_MAX]; - const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[sdk_idx]; - if (sdk_dir_info.directory.GetPath(sdkroot_path, sizeof(sdkroot_path))) + std::string sdkroot_path = m_sdk_directory_infos[sdk_idx].directory.GetPath(); + if (!sdkroot_path.empty() && platform_file_path && platform_file_path[0]) { - const bool symbols_dirs_only = true; + // We may need to interpose "/Symbols/" or "/Symbols.Internal/" between the + // SDK root directory and the file path. - return GetFileInSDKRoot (platform_file_path, - sdkroot_path, - symbols_dirs_only, - local_file); - } - } - return false; -} - -bool -PlatformRemoteAppleTV::GetFileInSDKRoot (const char *platform_file_path, - const char *sdkroot_path, - bool symbols_dirs_only, - lldb_private::FileSpec &local_file) -{ - Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); - if (sdkroot_path && sdkroot_path[0] && platform_file_path && platform_file_path[0]) - { - char resolved_path[PATH_MAX]; - - if (!symbols_dirs_only) - { - ::snprintf (resolved_path, - sizeof(resolved_path), - "%s%s", - sdkroot_path, - platform_file_path); - - local_file.SetFile(resolved_path, true); - if (local_file.Exists()) + const char *paths_to_try[] = { "Symbols", "", "Symbols.Internal", nullptr }; + for (size_t i = 0; paths_to_try[i] != nullptr; i++) { - if (log) + local_file.SetFile (sdkroot_path.c_str(), false); + if (paths_to_try[i][0] != '\0') + local_file.AppendPathComponent (paths_to_try[i]); + local_file.AppendPathComponent (platform_file_path); + local_file.ResolvePath(); + if (local_file.Exists()) { - log->Printf ("Found a copy of %s in the SDK dir %s", platform_file_path, sdkroot_path); + if (log) + log->Printf ("Found a copy of %s in the SDK dir %s/%s", platform_file_path, + sdkroot_path.c_str(), + paths_to_try[i]); + return true; } - return true; - } - } - - ::snprintf (resolved_path, - sizeof(resolved_path), - "%s/Symbols.Internal%s", - sdkroot_path, - platform_file_path); - - local_file.SetFile(resolved_path, true); - if (local_file.Exists()) - { - if (log) - { - log->Printf ("Found a copy of %s in the SDK dir %s/Symbols.Internal", platform_file_path, sdkroot_path); - } - return true; - } - ::snprintf (resolved_path, - sizeof(resolved_path), - "%s/Symbols%s", - sdkroot_path, - platform_file_path); - - local_file.SetFile(resolved_path, true); - if (local_file.Exists()) - { - if (log) - { - log->Printf ("Found a copy of %s in the SDK dir %s/Symbols", platform_file_path, sdkroot_path); + local_file.Clear(); } - return true; } } return false; |