diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index c469ead2be6d..4da5a5ee2d61 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -1180,7 +1180,6 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec)) { char raw_path[PATH_MAX]; - char resolved_path[PATH_MAX]; lldb_file_spec.GetPath(raw_path, sizeof(raw_path)); char *framework_pos = ::strstr (raw_path, "LLDB.framework"); @@ -1189,8 +1188,9 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) framework_pos += strlen("LLDB.framework"); ::strncpy (framework_pos, "/Headers", PATH_MAX - (framework_pos - raw_path)); } - FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path)); - g_lldb_headers_dir.SetCString(resolved_path); + llvm::SmallString<64> resolved_path(raw_path); + FileSpec::Resolve (resolved_path); + g_lldb_headers_dir.SetCString(resolved_path.c_str()); } #else // TODO: Anyone know how we can determine this for linux? Other systems?? @@ -1275,7 +1275,6 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) if (GetLLDBPath (ePathTypeLLDBShlibDir, lldb_file_spec)) { char raw_path[PATH_MAX]; - char resolved_path[PATH_MAX]; lldb_file_spec.GetPath(raw_path, sizeof(raw_path)); char *framework_pos = ::strstr (raw_path, "LLDB.framework"); @@ -1283,8 +1282,9 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) { framework_pos += strlen("LLDB.framework"); ::strncpy (framework_pos, "/Resources/PlugIns", PATH_MAX - (framework_pos - raw_path)); - FileSpec::Resolve (raw_path, resolved_path, sizeof(resolved_path)); - g_lldb_system_plugin_dir.SetCString(resolved_path); + llvm::SmallString<64> resolved_path(raw_path); + FileSpec::Resolve (resolved_path); + g_lldb_system_plugin_dir.SetCString(resolved_path.c_str()); } return false; } @@ -1319,12 +1319,11 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec) static ConstString g_lldb_user_plugin_dir; if (!g_lldb_user_plugin_dir) { - char user_plugin_path[PATH_MAX]; - if (FileSpec::Resolve ("~/Library/Application Support/LLDB/PlugIns", - user_plugin_path, - sizeof(user_plugin_path))) + llvm::SmallString<64> user_plugin_path("~/Library/Application Support/LLDB/PlugIns"); + FileSpec::Resolve (user_plugin_path); + if (user_plugin_path.size()) { - g_lldb_user_plugin_dir.SetCString(user_plugin_path); + g_lldb_user_plugin_dir.SetCString(user_plugin_path.c_str()); } } file_spec.GetDirectory() = g_lldb_user_plugin_dir;