Skip to content

Commit e70a527

Browse files
authored
Merge pull request #2242 from JDevlieghere/llvm.org-release-11.x
Revert commits that got automerged from the llvm.org 11.x release branch.
2 parents a3a3539 + 72c3f6f commit e70a527

File tree

14 files changed

+122
-204
lines changed

14 files changed

+122
-204
lines changed

lldb/include/lldb/Core/ModuleList.h

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,7 @@ class ModuleList {
139139
///
140140
/// \param[in] module_sp
141141
/// A shared pointer to a module to replace in this collection.
142-
///
143-
/// \param[in] old_modules
144-
/// Optional pointer to a vector which, if provided, will have shared
145-
/// pointers to the replaced module(s) appended to it.
146-
void ReplaceEquivalent(
147-
const lldb::ModuleSP &module_sp,
148-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules = nullptr);
142+
void ReplaceEquivalent(const lldb::ModuleSP &module_sp);
149143

150144
/// Append a module to the module list, if it is not already there.
151145
///
@@ -449,11 +443,12 @@ class ModuleList {
449443

450444
static bool ModuleIsInCache(const Module *module_ptr);
451445

452-
static Status
453-
GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
454-
const FileSpecList *module_search_paths_ptr,
455-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
456-
bool *did_create_ptr, bool always_create = false);
446+
static Status GetSharedModule(const ModuleSpec &module_spec,
447+
lldb::ModuleSP &module_sp,
448+
const FileSpecList *module_search_paths_ptr,
449+
lldb::ModuleSP *old_module_sp_ptr,
450+
bool *did_create_ptr,
451+
bool always_create = false);
457452

458453
static bool RemoveSharedModule(lldb::ModuleSP &module_sp);
459454

lldb/include/lldb/Target/Platform.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,11 @@ class Platform : public PluginInterface {
301301
LocateExecutableScriptingResources(Target *target, Module &module,
302302
Stream *feedback_stream);
303303

304-
virtual Status GetSharedModule(
305-
const ModuleSpec &module_spec, Process *process,
306-
lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr,
307-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr);
304+
virtual Status GetSharedModule(const ModuleSpec &module_spec,
305+
Process *process, lldb::ModuleSP &module_sp,
306+
const FileSpecList *module_search_paths_ptr,
307+
lldb::ModuleSP *old_module_sp_ptr,
308+
bool *did_create_ptr);
308309

309310
virtual bool GetModuleSpec(const FileSpec &module_file_spec,
310311
const ArchSpec &arch, ModuleSpec &module_spec);

lldb/source/Core/ModuleList.cpp

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ void ModuleList::Append(const ModuleSP &module_sp, bool notify) {
172172
AppendImpl(module_sp, notify);
173173
}
174174

175-
void ModuleList::ReplaceEquivalent(
176-
const ModuleSP &module_sp,
177-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules) {
175+
void ModuleList::ReplaceEquivalent(const ModuleSP &module_sp) {
178176
if (module_sp) {
179177
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
180178

@@ -187,14 +185,11 @@ void ModuleList::ReplaceEquivalent(
187185

188186
size_t idx = 0;
189187
while (idx < m_modules.size()) {
190-
ModuleSP test_module_sp(m_modules[idx]);
191-
if (test_module_sp->MatchesModuleSpec(equivalent_module_spec)) {
192-
if (old_modules)
193-
old_modules->push_back(test_module_sp);
188+
ModuleSP module_sp(m_modules[idx]);
189+
if (module_sp->MatchesModuleSpec(equivalent_module_spec))
194190
RemoveImpl(m_modules.begin() + idx);
195-
} else {
191+
else
196192
++idx;
197-
}
198193
}
199194
// Now add the new module to the list
200195
Append(module_sp);
@@ -737,11 +732,11 @@ size_t ModuleList::RemoveOrphanSharedModules(bool mandatory) {
737732
return GetSharedModuleList().RemoveOrphans(mandatory);
738733
}
739734

740-
Status
741-
ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
742-
const FileSpecList *module_search_paths_ptr,
743-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
744-
bool *did_create_ptr, bool always_create) {
735+
Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
736+
ModuleSP &module_sp,
737+
const FileSpecList *module_search_paths_ptr,
738+
ModuleSP *old_module_sp_ptr,
739+
bool *did_create_ptr, bool always_create) {
745740
ModuleList &shared_module_list = GetSharedModuleList();
746741
std::lock_guard<std::recursive_mutex> guard(
747742
shared_module_list.m_modules_mutex);
@@ -753,6 +748,8 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
753748

754749
if (did_create_ptr)
755750
*did_create_ptr = false;
751+
if (old_module_sp_ptr)
752+
old_module_sp_ptr->reset();
756753

757754
const UUID *uuid_ptr = module_spec.GetUUIDPtr();
758755
const FileSpec &module_file_spec = module_spec.GetFileSpec();
@@ -773,8 +770,8 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
773770

774771
// Make sure the file for the module hasn't been modified
775772
if (module_sp->FileHasChanged()) {
776-
if (old_modules)
777-
old_modules->push_back(module_sp);
773+
if (old_module_sp_ptr && !*old_module_sp_ptr)
774+
*old_module_sp_ptr = module_sp;
778775

779776
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_MODULES));
780777
if (log != nullptr)
@@ -816,7 +813,7 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
816813
*did_create_ptr = true;
817814
}
818815

819-
shared_module_list.ReplaceEquivalent(module_sp, old_modules);
816+
shared_module_list.ReplaceEquivalent(module_sp);
820817
return error;
821818
}
822819
}
@@ -853,7 +850,7 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
853850
if (did_create_ptr)
854851
*did_create_ptr = true;
855852

856-
shared_module_list.ReplaceEquivalent(module_sp, old_modules);
853+
shared_module_list.ReplaceEquivalent(module_sp);
857854
return Status();
858855
}
859856
}
@@ -928,8 +925,8 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
928925
located_binary_modulespec.GetFileSpec());
929926
if (file_spec_mod_time != llvm::sys::TimePoint<>()) {
930927
if (file_spec_mod_time != module_sp->GetModificationTime()) {
931-
if (old_modules)
932-
old_modules->push_back(module_sp);
928+
if (old_module_sp_ptr)
929+
*old_module_sp_ptr = module_sp;
933930
shared_module_list.Remove(module_sp);
934931
module_sp.reset();
935932
}
@@ -951,7 +948,7 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
951948
if (did_create_ptr)
952949
*did_create_ptr = true;
953950

954-
shared_module_list.ReplaceEquivalent(module_sp, old_modules);
951+
shared_module_list.ReplaceEquivalent(module_sp);
955952
}
956953
} else {
957954
located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));

lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ BringInRemoteFile(Platform *platform,
221221
lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
222222
const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
223223
const lldb_private::FileSpecList *module_search_paths_ptr,
224-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr) {
224+
lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) {
225225

226226
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
227227
LLDB_LOGF(log,
@@ -262,7 +262,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
262262
}
263263

264264
err = ModuleList::GetSharedModule(module_spec, module_sp,
265-
module_search_paths_ptr, old_modules,
265+
module_search_paths_ptr, old_module_sp_ptr,
266266
did_create_ptr);
267267
if (module_sp)
268268
return err;
@@ -365,8 +365,8 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
365365

366366
Status PlatformDarwin::GetSharedModule(
367367
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
368-
const FileSpecList *module_search_paths_ptr,
369-
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
368+
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
369+
bool *did_create_ptr) {
370370
Status error;
371371
module_sp.reset();
372372

@@ -375,16 +375,16 @@ Status PlatformDarwin::GetSharedModule(
375375
// module first.
376376
if (m_remote_platform_sp) {
377377
error = m_remote_platform_sp->GetSharedModule(
378-
module_spec, process, module_sp, module_search_paths_ptr, old_modules,
379-
did_create_ptr);
378+
module_spec, process, module_sp, module_search_paths_ptr,
379+
old_module_sp_ptr, did_create_ptr);
380380
}
381381
}
382382

383383
if (!module_sp) {
384384
// Fall back to the local platform and find the file locally
385385
error = Platform::GetSharedModule(module_spec, process, module_sp,
386-
module_search_paths_ptr, old_modules,
387-
did_create_ptr);
386+
module_search_paths_ptr,
387+
old_module_sp_ptr, did_create_ptr);
388388

389389
const FileSpec &platform_file = module_spec.GetFileSpec();
390390
if (!module_sp && module_search_paths_ptr && platform_file) {
@@ -397,7 +397,7 @@ Status PlatformDarwin::GetSharedModule(
397397
new_module_spec.GetFileSpec() = bundle_directory;
398398
if (Host::ResolveExecutableInBundle(new_module_spec.GetFileSpec())) {
399399
Status new_error(Platform::GetSharedModule(
400-
new_module_spec, process, module_sp, nullptr, old_modules,
400+
new_module_spec, process, module_sp, nullptr, old_module_sp_ptr,
401401
did_create_ptr));
402402

403403
if (module_sp)
@@ -424,8 +424,8 @@ Status PlatformDarwin::GetSharedModule(
424424
ModuleSpec new_module_spec(module_spec);
425425
new_module_spec.GetFileSpec() = new_file_spec;
426426
Status new_error(Platform::GetSharedModule(
427-
new_module_spec, process, module_sp, nullptr, old_modules,
428-
did_create_ptr));
427+
new_module_spec, process, module_sp, nullptr,
428+
old_module_sp_ptr, did_create_ptr));
429429

430430
if (module_sp) {
431431
module_sp->SetPlatformFileSpec(new_file_spec);
@@ -1683,8 +1683,8 @@ PlatformDarwin::LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) {
16831683

16841684
lldb_private::Status PlatformDarwin::FindBundleBinaryInExecSearchPaths(
16851685
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
1686-
const FileSpecList *module_search_paths_ptr,
1687-
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
1686+
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
1687+
bool *did_create_ptr) {
16881688
const FileSpec &platform_file = module_spec.GetFileSpec();
16891689
// See if the file is present in any of the module_search_paths_ptr
16901690
// directories.
@@ -1741,9 +1741,9 @@ lldb_private::Status PlatformDarwin::FindBundleBinaryInExecSearchPaths(
17411741
if (FileSystem::Instance().Exists(path_to_try)) {
17421742
ModuleSpec new_module_spec(module_spec);
17431743
new_module_spec.GetFileSpec() = path_to_try;
1744-
Status new_error(
1745-
Platform::GetSharedModule(new_module_spec, process, module_sp,
1746-
nullptr, old_modules, did_create_ptr));
1744+
Status new_error(Platform::GetSharedModule(
1745+
new_module_spec, process, module_sp, nullptr, old_module_sp_ptr,
1746+
did_create_ptr));
17471747

17481748
if (module_sp) {
17491749
module_sp->SetPlatformFileSpec(path_to_try);

lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PlatformDarwin : public PlatformPOSIX {
4646
GetSharedModule(const lldb_private::ModuleSpec &module_spec,
4747
lldb_private::Process *process, lldb::ModuleSP &module_sp,
4848
const lldb_private::FileSpecList *module_search_paths_ptr,
49-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
49+
lldb::ModuleSP *old_module_sp_ptr,
5050
bool *did_create_ptr) override;
5151

5252
size_t GetSoftwareBreakpointTrapOpcode(
@@ -132,7 +132,7 @@ class PlatformDarwin : public PlatformPOSIX {
132132
virtual lldb_private::Status GetSharedModuleWithLocalCache(
133133
const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
134134
const lldb_private::FileSpecList *module_search_paths_ptr,
135-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr);
135+
lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr);
136136

137137
struct SDKEnumeratorInfo {
138138
lldb_private::FileSpec found_path;
@@ -158,7 +158,7 @@ class PlatformDarwin : public PlatformPOSIX {
158158
const lldb_private::ModuleSpec &module_spec,
159159
lldb_private::Process *process, lldb::ModuleSP &module_sp,
160160
const lldb_private::FileSpecList *module_search_paths_ptr,
161-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr);
161+
lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr);
162162

163163
static std::string FindComponentInPath(llvm::StringRef path,
164164
llvm::StringRef component);

lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ PlatformDarwinKernel::GetDWARFBinaryInDSYMBundle(FileSpec dsym_bundle) {
727727

728728
Status PlatformDarwinKernel::GetSharedModule(
729729
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
730-
const FileSpecList *module_search_paths_ptr,
731-
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
730+
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
731+
bool *did_create_ptr) {
732732
Status error;
733733
module_sp.reset();
734734
const FileSpec &platform_file = module_spec.GetFileSpec();
@@ -740,26 +740,26 @@ Status PlatformDarwinKernel::GetSharedModule(
740740
if (!kext_bundle_id.empty() && module_spec.GetUUID().IsValid()) {
741741
if (kext_bundle_id == "mach_kernel") {
742742
return GetSharedModuleKernel(module_spec, process, module_sp,
743-
module_search_paths_ptr, old_modules,
743+
module_search_paths_ptr, old_module_sp_ptr,
744744
did_create_ptr);
745745
} else {
746746
return GetSharedModuleKext(module_spec, process, module_sp,
747-
module_search_paths_ptr, old_modules,
747+
module_search_paths_ptr, old_module_sp_ptr,
748748
did_create_ptr);
749749
}
750750
} else {
751751
// Give the generic methods, including possibly calling into DebugSymbols
752752
// framework on macOS systems, a chance.
753753
return PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
754-
module_search_paths_ptr, old_modules,
755-
did_create_ptr);
754+
module_search_paths_ptr,
755+
old_module_sp_ptr, did_create_ptr);
756756
}
757757
}
758758

759759
Status PlatformDarwinKernel::GetSharedModuleKext(
760760
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
761-
const FileSpecList *module_search_paths_ptr,
762-
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
761+
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
762+
bool *did_create_ptr) {
763763
Status error;
764764
module_sp.reset();
765765
const FileSpec &platform_file = module_spec.GetFileSpec();
@@ -785,8 +785,8 @@ Status PlatformDarwinKernel::GetSharedModuleKext(
785785
// Give the generic methods, including possibly calling into DebugSymbols
786786
// framework on macOS systems, a chance.
787787
error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
788-
module_search_paths_ptr, old_modules,
789-
did_create_ptr);
788+
module_search_paths_ptr,
789+
old_module_sp_ptr, did_create_ptr);
790790
if (error.Success() && module_sp.get()) {
791791
return error;
792792
}
@@ -811,8 +811,8 @@ Status PlatformDarwinKernel::GetSharedModuleKext(
811811

812812
Status PlatformDarwinKernel::GetSharedModuleKernel(
813813
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
814-
const FileSpecList *module_search_paths_ptr,
815-
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
814+
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
815+
bool *did_create_ptr) {
816816
Status error;
817817
module_sp.reset();
818818

@@ -878,8 +878,8 @@ Status PlatformDarwinKernel::GetSharedModuleKernel(
878878
// Give the generic methods, including possibly calling into DebugSymbols
879879
// framework on macOS systems, a chance.
880880
error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
881-
module_search_paths_ptr, old_modules,
882-
did_create_ptr);
881+
module_search_paths_ptr,
882+
old_module_sp_ptr, did_create_ptr);
883883
if (error.Success() && module_sp.get()) {
884884
return error;
885885
}

lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class PlatformDarwinKernel : public PlatformDarwin {
5757
GetSharedModule(const lldb_private::ModuleSpec &module_spec,
5858
lldb_private::Process *process, lldb::ModuleSP &module_sp,
5959
const lldb_private::FileSpecList *module_search_paths_ptr,
60-
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
60+
lldb::ModuleSP *old_module_sp_ptr,
6161
bool *did_create_ptr) override;
6262

6363
bool GetSupportedArchitectureAtIndex(uint32_t idx,

0 commit comments

Comments
 (0)