From 278ef3485a617e185cf6224f545822fb2ee89627 Mon Sep 17 00:00:00 2001 From: xwx1135370 Date: Thu, 2 Mar 2023 22:00:04 +0800 Subject: [PATCH] [LLDB][Container]The attach command times out due to the same UUID in different paths of module_cache Signed-off-by: xwx1135370 --- .../Plugins/Platform/HOS/PlatformHOS.cpp | 19 +++++++++++++++++-- .../source/Plugins/Platform/HOS/PlatformHOS.h | 2 +- lldb/source/Target/ModuleCache.cpp | 9 +++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp b/lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp index c279f9368210..3483223ec250 100644 --- a/lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp +++ b/lldb/source/Plugins/Platform/HOS/PlatformHOS.cpp @@ -36,9 +36,13 @@ LLDB_PLUGIN_DEFINE(PlatformHOS) using PrefixMap = std::pair; -static constexpr std::array PATH_PREFIX_MAP {{ +static constexpr std::array PATH_PREFIX_MAP {{ { "/data", "/data/ohos_data" }, - { "/vendor", "/vendor/ohos/vendor" }, + { "/vendor/aosp/system/lib64/libqdMetaData.system.so", "/system/system_ext/lib64/libqdMetaData.system.so"}, + { "/vendor/aosp/system/lib64/libgralloc.system.qti.so", "/system/system_ext/lib64/libgralloc.system.qti.so"}, + { "/vendor/aosp/vendor/lib64", "/vendor/lib64" }, + { "/vendor/aosp/system/lib64", "/system/lib64" }, + { "/vendor/lib64", "/system/ohos/vendor/lib64" }, { "/system", "/system/ohos/system" }, }}; @@ -132,6 +136,17 @@ PlatformHOS::PlatformHOS(bool is_host) PlatformHOS::~PlatformHOS() {} +ConstString PlatformHOS::GetPluginName() { + if (GetContainer()) { + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); + static ConstString g_remote_name("remote-hos-inner"); + LLDB_LOGF(log, "PlatformHOS::GetPluginName g_remote_name(%s)", g_remote_name.GetCString()); + return g_remote_name; + } + + return GetPluginNameStatic(IsHost()); +} + ConstString PlatformHOS::GetPluginNameStatic(bool is_host) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) { diff --git a/lldb/source/Plugins/Platform/HOS/PlatformHOS.h b/lldb/source/Plugins/Platform/HOS/PlatformHOS.h index d7ce912e6166..4df6d018252d 100644 --- a/lldb/source/Plugins/Platform/HOS/PlatformHOS.h +++ b/lldb/source/Plugins/Platform/HOS/PlatformHOS.h @@ -36,7 +36,7 @@ public: static const char *GetPluginDescriptionStatic(bool is_host); - ConstString GetPluginName() override { return GetPluginNameStatic(IsHost()); } + ConstString GetPluginName() override; uint32_t GetPluginVersion() override { return 1; } diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp index 2fb6b308b0e5..765da16e2d07 100644 --- a/lldb/source/Target/ModuleCache.cpp +++ b/lldb/source/Target/ModuleCache.cpp @@ -134,6 +134,15 @@ Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec, platform_module_spec.GetPath().c_str()); if (FileSystem::Instance().Exists(sysroot_module_path_spec)) { + if (FileSystem::Instance().Exists(local_module_spec)) { + UUID sysroot_module_sp_uuid = (std::make_shared(ModuleSpec(sysroot_module_path_spec)))->GetUUID(); + UUID module_spec_uuid = (std::make_shared(ModuleSpec(local_module_spec)))->GetUUID(); + if (sysroot_module_sp_uuid.IsValid() && (sysroot_module_sp_uuid == module_spec_uuid)) { + delete_existing = false; + } + LLDB_LOGF(log, "CreateHostSysRootModuleLink delete_existing(%i)", delete_existing); + } + if (!delete_existing) return Status(); -- Gitee