diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 294fd96bc313b4c21d775a0a5952425dc95b4f6c..3af8c71dd977057be8f34b3b5d033f16e4d4cfdc 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -147,6 +147,8 @@ public: FileSpecList GetDebugFileSearchPaths(); + PathMappingList &GetModulesSearchPaths() const; + FileSpecList GetClangModuleSearchPaths(); bool GetEnableAutoImportClangModules() const; diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index c6609b39199af74c5de299315b62e244eac1ce2e..3d39fe8152a531db6e419f3d11e90ff071d22926 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -120,6 +120,11 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, } UpdateLaunchInfoFromProperties(); + + // OHOS_LOCAL begin + // Init modules searching paths by property "target.modules-search-paths". + m_image_search_paths.Append(GetModulesSearchPaths(), false); + // OHOS_LOCAL end } Target::~Target() { @@ -4305,6 +4310,15 @@ FileSpecList TargetProperties::GetDebugFileSearchPaths() { return option_value->GetCurrentValue(); } +PathMappingList &TargetProperties::GetModulesSearchPaths() const { + const uint32_t idx = ePropertyModulesSearchPaths; + OptionValuePathMappings *option_value = + m_collection_sp->GetPropertyAtIndexAsOptionValuePathMappings(nullptr, + false, idx); + assert(option_value); + return option_value->GetCurrentValue(); +} + FileSpecList TargetProperties::GetClangModuleSearchPaths() { const uint32_t idx = ePropertyClangModuleSearchPaths; const OptionValueFileSpecList *option_value = diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td index acee09ca0469ee090433667d9f05c1aca4de7fc7..f9ba215c7793313ee3bc565a28de89fd57fec54f 100644 --- a/lldb/source/Target/TargetProperties.td +++ b/lldb/source/Target/TargetProperties.td @@ -43,6 +43,9 @@ let Definition = "target" in { def DebugFileSearchPaths: Property<"debug-file-search-paths", "FileSpecList">, DefaultStringValue<"">, Desc<"List of directories to be searched when locating debug symbol files. See also symbols.enable-external-lookup.">; + def ModulesSearchPaths: Property<"modules-search-paths", "PathMap">, + DefaultStringValue<"">, + Desc<"Module path remappings apply substitutions to the paths of modules, typically needed to debug remotely. The modules-search-paths property can be seen as a pre configuration instead of command `target modules search-paths add`. This property consists of an array of pairs, the first element is a path prefix, and the second is its replacement. The syntax is `prefix1 replacement1 prefix2 replacement2...`. The pairs are checked in order, the first prefix that matches is used, and that prefix is substituted with the replacement.">; def ClangModuleSearchPaths: Property<"clang-module-search-paths", "FileSpecList">, DefaultStringValue<"">, Desc<"List of directories to be searched when locating modules for Clang.">;