[Lldb-commits] [PATCH] D84015: [lldb] Remove orphaned modules in a loop
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 20 01:48:21 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG139e2a3f7b27: [lldb] Remove orphaned modules in a loop (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84015/new/
https://reviews.llvm.org/D84015
Files:
lldb/source/Core/ModuleList.cpp
Index: lldb/source/Core/ModuleList.cpp
===================================================================
--- lldb/source/Core/ModuleList.cpp
+++ lldb/source/Core/ModuleList.cpp
@@ -291,14 +291,24 @@
if (!lock.try_lock())
return 0;
}
- collection::iterator pos = m_modules.begin();
size_t remove_count = 0;
- while (pos != m_modules.end()) {
- if (pos->unique()) {
- pos = RemoveImpl(pos);
- ++remove_count;
- } else {
- ++pos;
+ // Modules might hold shared pointers to other modules, so removing one
+ // module might make other other modules orphans. Keep removing modules until
+ // there are no further modules that can be removed.
+ bool made_progress = true;
+ while (made_progress) {
+ // Keep track if we make progress this iteration.
+ made_progress = false;
+ collection::iterator pos = m_modules.begin();
+ while (pos != m_modules.end()) {
+ if (pos->unique()) {
+ pos = RemoveImpl(pos);
+ ++remove_count;
+ // We did make progress.
+ made_progress = true;
+ } else {
+ ++pos;
+ }
}
}
return remove_count;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84015.279144.patch
Type: text/x-patch
Size: 1138 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200720/d3e57cb3/attachment.bin>
More information about the lldb-commits
mailing list