Skip to content

Revert commits that got automerged from the llvm.org 11.x release branch. #2242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions lldb/include/lldb/Core/ModuleList.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,7 @@ class ModuleList {
///
/// \param[in] module_sp
/// A shared pointer to a module to replace in this collection.
///
/// \param[in] old_modules
/// Optional pointer to a vector which, if provided, will have shared
/// pointers to the replaced module(s) appended to it.
void ReplaceEquivalent(
const lldb::ModuleSP &module_sp,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules = nullptr);
void ReplaceEquivalent(const lldb::ModuleSP &module_sp);

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

static bool ModuleIsInCache(const Module *module_ptr);

static Status
GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
bool *did_create_ptr, bool always_create = false);
static Status GetSharedModule(const ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
lldb::ModuleSP *old_module_sp_ptr,
bool *did_create_ptr,
bool always_create = false);

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

Expand Down
9 changes: 5 additions & 4 deletions lldb/include/lldb/Target/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,11 @@ class Platform : public PluginInterface {
LocateExecutableScriptingResources(Target *target, Module &module,
Stream *feedback_stream);

virtual Status GetSharedModule(
const ModuleSpec &module_spec, Process *process,
lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr);
virtual Status GetSharedModule(const ModuleSpec &module_spec,
Process *process, lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
lldb::ModuleSP *old_module_sp_ptr,
bool *did_create_ptr);

virtual bool GetModuleSpec(const FileSpec &module_file_spec,
const ArchSpec &arch, ModuleSpec &module_spec);
Expand Down
39 changes: 18 additions & 21 deletions lldb/source/Core/ModuleList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ void ModuleList::Append(const ModuleSP &module_sp, bool notify) {
AppendImpl(module_sp, notify);
}

void ModuleList::ReplaceEquivalent(
const ModuleSP &module_sp,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules) {
void ModuleList::ReplaceEquivalent(const ModuleSP &module_sp) {
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);

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

size_t idx = 0;
while (idx < m_modules.size()) {
ModuleSP test_module_sp(m_modules[idx]);
if (test_module_sp->MatchesModuleSpec(equivalent_module_spec)) {
if (old_modules)
old_modules->push_back(test_module_sp);
ModuleSP module_sp(m_modules[idx]);
if (module_sp->MatchesModuleSpec(equivalent_module_spec))
RemoveImpl(m_modules.begin() + idx);
} else {
else
++idx;
}
}
// Now add the new module to the list
Append(module_sp);
Expand Down Expand Up @@ -737,11 +732,11 @@ size_t ModuleList::RemoveOrphanSharedModules(bool mandatory) {
return GetSharedModuleList().RemoveOrphans(mandatory);
}

Status
ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
bool *did_create_ptr, bool always_create) {
Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
ModuleSP *old_module_sp_ptr,
bool *did_create_ptr, bool always_create) {
ModuleList &shared_module_list = GetSharedModuleList();
std::lock_guard<std::recursive_mutex> guard(
shared_module_list.m_modules_mutex);
Expand All @@ -753,6 +748,8 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,

if (did_create_ptr)
*did_create_ptr = false;
if (old_module_sp_ptr)
old_module_sp_ptr->reset();

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

// Make sure the file for the module hasn't been modified
if (module_sp->FileHasChanged()) {
if (old_modules)
old_modules->push_back(module_sp);
if (old_module_sp_ptr && !*old_module_sp_ptr)
*old_module_sp_ptr = module_sp;

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

shared_module_list.ReplaceEquivalent(module_sp, old_modules);
shared_module_list.ReplaceEquivalent(module_sp);
return error;
}
}
Expand Down Expand Up @@ -853,7 +850,7 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
if (did_create_ptr)
*did_create_ptr = true;

shared_module_list.ReplaceEquivalent(module_sp, old_modules);
shared_module_list.ReplaceEquivalent(module_sp);
return Status();
}
}
Expand Down Expand Up @@ -928,8 +925,8 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
located_binary_modulespec.GetFileSpec());
if (file_spec_mod_time != llvm::sys::TimePoint<>()) {
if (file_spec_mod_time != module_sp->GetModificationTime()) {
if (old_modules)
old_modules->push_back(module_sp);
if (old_module_sp_ptr)
*old_module_sp_ptr = module_sp;
shared_module_list.Remove(module_sp);
module_sp.reset();
}
Expand All @@ -951,7 +948,7 @@ ModuleList::GetSharedModule(const ModuleSpec &module_spec, ModuleSP &module_sp,
if (did_create_ptr)
*did_create_ptr = true;

shared_module_list.ReplaceEquivalent(module_sp, old_modules);
shared_module_list.ReplaceEquivalent(module_sp);
}
} else {
located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path));
Expand Down
32 changes: 16 additions & 16 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ BringInRemoteFile(Platform *platform,
lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules, bool *did_create_ptr) {
lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) {

Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM));
LLDB_LOGF(log,
Expand Down Expand Up @@ -262,7 +262,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
}

err = ModuleList::GetSharedModule(module_spec, module_sp,
module_search_paths_ptr, old_modules,
module_search_paths_ptr, old_module_sp_ptr,
did_create_ptr);
if (module_sp)
return err;
Expand Down Expand Up @@ -365,8 +365,8 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(

Status PlatformDarwin::GetSharedModule(
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
bool *did_create_ptr) {
Status error;
module_sp.reset();

Expand All @@ -375,16 +375,16 @@ Status PlatformDarwin::GetSharedModule(
// module first.
if (m_remote_platform_sp) {
error = m_remote_platform_sp->GetSharedModule(
module_spec, process, module_sp, module_search_paths_ptr, old_modules,
did_create_ptr);
module_spec, process, module_sp, module_search_paths_ptr,
old_module_sp_ptr, did_create_ptr);
}
}

if (!module_sp) {
// Fall back to the local platform and find the file locally
error = Platform::GetSharedModule(module_spec, process, module_sp,
module_search_paths_ptr, old_modules,
did_create_ptr);
module_search_paths_ptr,
old_module_sp_ptr, did_create_ptr);

const FileSpec &platform_file = module_spec.GetFileSpec();
if (!module_sp && module_search_paths_ptr && platform_file) {
Expand All @@ -397,7 +397,7 @@ Status PlatformDarwin::GetSharedModule(
new_module_spec.GetFileSpec() = bundle_directory;
if (Host::ResolveExecutableInBundle(new_module_spec.GetFileSpec())) {
Status new_error(Platform::GetSharedModule(
new_module_spec, process, module_sp, nullptr, old_modules,
new_module_spec, process, module_sp, nullptr, old_module_sp_ptr,
did_create_ptr));

if (module_sp)
Expand All @@ -424,8 +424,8 @@ Status PlatformDarwin::GetSharedModule(
ModuleSpec new_module_spec(module_spec);
new_module_spec.GetFileSpec() = new_file_spec;
Status new_error(Platform::GetSharedModule(
new_module_spec, process, module_sp, nullptr, old_modules,
did_create_ptr));
new_module_spec, process, module_sp, nullptr,
old_module_sp_ptr, did_create_ptr));

if (module_sp) {
module_sp->SetPlatformFileSpec(new_file_spec);
Expand Down Expand Up @@ -1683,8 +1683,8 @@ PlatformDarwin::LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) {

lldb_private::Status PlatformDarwin::FindBundleBinaryInExecSearchPaths(
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
bool *did_create_ptr) {
const FileSpec &platform_file = module_spec.GetFileSpec();
// See if the file is present in any of the module_search_paths_ptr
// directories.
Expand Down Expand Up @@ -1741,9 +1741,9 @@ lldb_private::Status PlatformDarwin::FindBundleBinaryInExecSearchPaths(
if (FileSystem::Instance().Exists(path_to_try)) {
ModuleSpec new_module_spec(module_spec);
new_module_spec.GetFileSpec() = path_to_try;
Status new_error(
Platform::GetSharedModule(new_module_spec, process, module_sp,
nullptr, old_modules, did_create_ptr));
Status new_error(Platform::GetSharedModule(
new_module_spec, process, module_sp, nullptr, old_module_sp_ptr,
did_create_ptr));

if (module_sp) {
module_sp->SetPlatformFileSpec(path_to_try);
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PlatformDarwin : public PlatformPOSIX {
GetSharedModule(const lldb_private::ModuleSpec &module_spec,
lldb_private::Process *process, lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
lldb::ModuleSP *old_module_sp_ptr,
bool *did_create_ptr) override;

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

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

static std::string FindComponentInPath(llvm::StringRef path,
llvm::StringRef component);
Expand Down
28 changes: 14 additions & 14 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ PlatformDarwinKernel::GetDWARFBinaryInDSYMBundle(FileSpec dsym_bundle) {

Status PlatformDarwinKernel::GetSharedModule(
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
bool *did_create_ptr) {
Status error;
module_sp.reset();
const FileSpec &platform_file = module_spec.GetFileSpec();
Expand All @@ -740,26 +740,26 @@ Status PlatformDarwinKernel::GetSharedModule(
if (!kext_bundle_id.empty() && module_spec.GetUUID().IsValid()) {
if (kext_bundle_id == "mach_kernel") {
return GetSharedModuleKernel(module_spec, process, module_sp,
module_search_paths_ptr, old_modules,
module_search_paths_ptr, old_module_sp_ptr,
did_create_ptr);
} else {
return GetSharedModuleKext(module_spec, process, module_sp,
module_search_paths_ptr, old_modules,
module_search_paths_ptr, old_module_sp_ptr,
did_create_ptr);
}
} else {
// Give the generic methods, including possibly calling into DebugSymbols
// framework on macOS systems, a chance.
return PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
module_search_paths_ptr, old_modules,
did_create_ptr);
module_search_paths_ptr,
old_module_sp_ptr, did_create_ptr);
}
}

Status PlatformDarwinKernel::GetSharedModuleKext(
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
bool *did_create_ptr) {
Status error;
module_sp.reset();
const FileSpec &platform_file = module_spec.GetFileSpec();
Expand All @@ -785,8 +785,8 @@ Status PlatformDarwinKernel::GetSharedModuleKext(
// Give the generic methods, including possibly calling into DebugSymbols
// framework on macOS systems, a chance.
error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
module_search_paths_ptr, old_modules,
did_create_ptr);
module_search_paths_ptr,
old_module_sp_ptr, did_create_ptr);
if (error.Success() && module_sp.get()) {
return error;
}
Expand All @@ -811,8 +811,8 @@ Status PlatformDarwinKernel::GetSharedModuleKext(

Status PlatformDarwinKernel::GetSharedModuleKernel(
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr,
bool *did_create_ptr) {
Status error;
module_sp.reset();

Expand Down Expand Up @@ -878,8 +878,8 @@ Status PlatformDarwinKernel::GetSharedModuleKernel(
// Give the generic methods, including possibly calling into DebugSymbols
// framework on macOS systems, a chance.
error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
module_search_paths_ptr, old_modules,
did_create_ptr);
module_search_paths_ptr,
old_module_sp_ptr, did_create_ptr);
if (error.Success() && module_sp.get()) {
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PlatformDarwinKernel : public PlatformDarwin {
GetSharedModule(const lldb_private::ModuleSpec &module_spec,
lldb_private::Process *process, lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr,
llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
lldb::ModuleSP *old_module_sp_ptr,
bool *did_create_ptr) override;

bool GetSupportedArchitectureAtIndex(uint32_t idx,
Expand Down
Loading