Fixed an issue where if you ask to search the global list of modules for a module with "target modules list", if it found a match in the current target, it would skip looking at the global list. Now if you ask for the global list, we use it and skip the target.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160072 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index e193c48..23d1742 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -1743,27 +1743,7 @@
const size_t initial_size = module_list.GetSize ();
- size_t num_matches = 0;
-
- if (target)
- {
- num_matches = target->GetImages().FindModules (module_spec, module_list);
-
- // Not found in our module list for our target, check the main
- // shared module list in case it is a extra file used somewhere
- // else
- if (num_matches == 0)
- {
- module_spec.GetArchitecture() = target->GetArchitecture();
- num_matches = ModuleList::FindSharedModules (module_spec, module_list);
- }
- }
- else
- {
- num_matches = ModuleList::FindSharedModules (module_spec,module_list);
- }
-
- if (check_global_list && num_matches == 0)
+ if (check_global_list)
{
// Check the global list
Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
@@ -1783,6 +1763,27 @@
}
}
}
+ else
+ {
+ if (target)
+ {
+ const size_t num_matches = target->GetImages().FindModules (module_spec, module_list);
+
+ // Not found in our module list for our target, check the main
+ // shared module list in case it is a extra file used somewhere
+ // else
+ if (num_matches == 0)
+ {
+ module_spec.GetArchitecture() = target->GetArchitecture();
+ ModuleList::FindSharedModules (module_spec, module_list);
+ }
+ }
+ else
+ {
+ ModuleList::FindSharedModules (module_spec,module_list);
+ }
+ }
+
return module_list.GetSize () - initial_size;
}