From 91879fdaf892563b0e58b872895e4f60d5e668e1 Mon Sep 17 00:00:00 2001 From: liwentao_uiw Date: Thu, 20 Oct 2022 14:34:07 +0800 Subject: [PATCH] Disable Create host sysroot link if uuid is invalid (conflict for two same files) Signed-off-by: liwentao Change-Id: I8b1ce40e326e61312ff9ec9b3ff8cbd7157c97b0 --- lldb/source/Target/ModuleCache.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp index 20661a7b7a25..08fb43bf7a57 100644 --- a/lldb/source/Target/ModuleCache.cpp +++ b/lldb/source/Target/ModuleCache.cpp @@ -128,9 +128,26 @@ Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, const FileSpec &platform_module_spec, const FileSpec &local_module_spec, bool delete_existing) { + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES)); const auto sysroot_module_path_spec = JoinPath(JoinPath(root_dir_spec, hostname), platform_module_spec.GetPath().c_str()); + UUID module_uuid; + { + auto module_sp = + std::make_shared(ModuleSpec(sysroot_module_path_spec)); + module_uuid = module_sp->GetUUID(); + } + + if (!module_uuid.IsValid()) { + LLDB_LOGF(log, "Try CreateHostSysRootModuleLink but uuid is invalid %s", + module_uuid.GetAsString().c_str()); + return Status(); + } + + LLDB_LOGF(log, "CreateHostSysRootModuleLink with uuid %s", + module_uuid.GetAsString().c_str()); + if (FileSystem::Instance().Exists(sysroot_module_path_spec)) { if (!delete_existing) return Status(); -- Gitee