Repository navigation
[lldb] Clear up GetModuleSpecifications return value confusion - #188276
Conversation
Some plugins were returning the number of specifications they have added, while others were returning the total final number. Particularly devious plugins (Minidump) were clearing the specification list altogether. This resulted in nondeterministic failures (depending on plugin ininitialization order) in TestSBModule. This PR defines the problem away by having each plugin only return the specifications it is responsible for. If the caller wants to merge them, it is free to do so. This *might* be slighly less efficient, but this is hardly hot code. I'm not touching the ObjectFile::GetModuleSpecifications function (the caller of all these functions) as the PR is big enough, although the same approach might be warranted there as well.
|
@llvm/pr-subscribers-lldb Author: Pavel Labath (labath) ChangesSome plugins were returning the number of specifications they have added, while others were returning the total final number. Particularly devious plugins (Minidump) were clearing the specification list altogether. This resulted in nondeterministic failures (depending on plugin ininitialization order) in TestSBModule. This PR defines the problem away by having each plugin only return the specifications it is responsible for. If the caller wants to merge them, it is free to do so. This might be slighly less efficient, but this is hardly hot code. I'm not touching the ObjectFile::GetModuleSpecifications function (the caller of all these functions) as the PR is big enough, although the same approach might be warranted there as well. Patch is 45.27 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/188276.diff 32 Files Affected:
diff --git a/lldb/include/lldb/Expression/ObjectFileJIT.h b/lldb/include/lldb/Expression/ObjectFileJIT.h
index 0694a969ed8d1..124ae6a9e5042 100644
--- a/lldb/include/lldb/Expression/ObjectFileJIT.h
+++ b/lldb/include/lldb/Expression/ObjectFileJIT.h
@@ -58,12 +58,11 @@ class ObjectFileJIT : public ObjectFile {
const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
- static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
- lldb::DataExtractorSP &extractor_sp,
- lldb::offset_t data_offset,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- lldb_private::ModuleSpecList &specs);
+ static ModuleSpecList
+ GetModuleSpecifications(const lldb_private::FileSpec &file,
+ lldb::DataExtractorSP &extractor_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset, lldb::offset_t length);
// LLVM RTTI support
static char ID;
diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index d70bce6f686c7..e618081cc2cd3 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -46,10 +46,10 @@ typedef ObjectContainer *(*ObjectContainerCreateInstance)(
typedef ObjectContainer *(*ObjectContainerCreateMemoryInstance)(
const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t offset);
-typedef size_t (*ObjectFileGetModuleSpecifications)(
+typedef ModuleSpecList (*ObjectFileGetModuleSpecifications)(
const FileSpec &file, lldb::DataExtractorSP &extractor_sp,
lldb::offset_t data_offset, lldb::offset_t file_offset,
- lldb::offset_t length, ModuleSpecList &module_specs);
+ lldb::offset_t length);
typedef ObjectFile *(*ObjectFileCreateInstance)(
const lldb::ModuleSP &module_sp, lldb::DataExtractorSP extractor_sp,
lldb::offset_t data_offset, const FileSpec *file,
diff --git a/lldb/source/Expression/ObjectFileJIT.cpp b/lldb/source/Expression/ObjectFileJIT.cpp
index 5f51617158197..ee4af0d0ceff9 100644
--- a/lldb/source/Expression/ObjectFileJIT.cpp
+++ b/lldb/source/Expression/ObjectFileJIT.cpp
@@ -60,12 +60,12 @@ ObjectFile *ObjectFileJIT::CreateMemoryInstance(const lldb::ModuleSP &module_sp,
return nullptr;
}
-size_t ObjectFileJIT::GetModuleSpecifications(
+ModuleSpecList ObjectFileJIT::GetModuleSpecifications(
const lldb_private::FileSpec &file, lldb::DataExtractorSP &extractor_sp,
lldb::offset_t data_offset, lldb::offset_t file_offset,
- lldb::offset_t length, lldb_private::ModuleSpecList &specs) {
+ lldb::offset_t length) {
// JIT'ed object file can't be read from a file on disk
- return 0;
+ return {};
}
ObjectFileJIT::ObjectFileJIT(const lldb::ModuleSP &module_sp,
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
index 32604a60841bb..64c16b352acfe 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -434,13 +434,13 @@ ObjectFileSP ObjectContainerBSDArchive::GetObjectFile(const FileSpec *file) {
return ObjectFileSP();
}
-size_t ObjectContainerBSDArchive::GetModuleSpecifications(
+ModuleSpecList ObjectContainerBSDArchive::GetModuleSpecifications(
const FileSpec &file, lldb::DataExtractorSP &extractor_sp,
lldb::offset_t data_offset, lldb::offset_t file_offset,
- lldb::offset_t file_size, ModuleSpecList &specs) {
+ lldb::offset_t file_size) {
if (!file || !extractor_sp)
- return 0;
+ return {};
DataExtractorSP data_extractor_sp =
extractor_sp->GetSubsetExtractorSP(data_offset);
@@ -449,9 +449,8 @@ size_t ObjectContainerBSDArchive::GetModuleSpecifications(
// contents for the archive and cache it
ArchiveType archive_type = MagicBytesMatch(*data_extractor_sp);
if (archive_type == ArchiveType::Invalid)
- return 0;
+ return {};
- const size_t initial_count = specs.GetSize();
llvm::sys::TimePoint<> file_mod_time =
FileSystem::Instance().GetModificationTime(file);
ArchiveSP archive_sp(
@@ -469,6 +468,7 @@ size_t ObjectContainerBSDArchive::GetModuleSpecifications(
}
}
+ ModuleSpecList specs;
if (archive_sp) {
const size_t num_objects = archive_sp->GetNumObjects();
for (size_t idx = 0; idx < num_objects; ++idx) {
@@ -512,11 +512,10 @@ size_t ObjectContainerBSDArchive::GetModuleSpecifications(
}
}
const size_t end_count = specs.GetSize();
- size_t num_specs_added = end_count - initial_count;
- if (set_archive_arch && num_specs_added > 0) {
+ if (set_archive_arch && specs.GetSize() > 0) {
// The archive was created but we didn't have an architecture so we need to
// set it
- for (size_t i = initial_count; i < end_count; ++i) {
+ for (size_t i = 0; i < end_count; ++i) {
ModuleSpec module_spec;
if (specs.GetModuleSpecAtIndex(i, module_spec)) {
if (module_spec.GetArchitecture().IsValid()) {
@@ -526,5 +525,5 @@ size_t ObjectContainerBSDArchive::GetModuleSpecifications(
}
}
}
- return num_specs_added;
+ return specs;
}
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
index 82a23a458d58c..b92ee4653e7fa 100644
--- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
+++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
@@ -9,6 +9,7 @@
#ifndef LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_BSD_ARCHIVE_OBJECTCONTAINERBSDARCHIVE_H
#define LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_BSD_ARCHIVE_OBJECTCONTAINERBSDARCHIVE_H
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Utility/ArchSpec.h"
@@ -54,12 +55,11 @@ class ObjectContainerBSDArchive : public lldb_private::ObjectContainer {
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t offset, lldb::offset_t length);
- static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
- lldb::DataExtractorSP &extractor_sp,
- lldb::offset_t data_offset,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- lldb_private::ModuleSpecList &specs);
+ static lldb_private::ModuleSpecList
+ GetModuleSpecifications(const lldb_private::FileSpec &file,
+ lldb::DataExtractorSP &extractor_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset, lldb::offset_t length);
static ArchiveType
MagicBytesMatch(const lldb_private::DataExtractor &extractor);
diff --git a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
index c25add2827fda..d4dee674a53c0 100644
--- a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.cpp
@@ -43,11 +43,11 @@ ObjectContainer *ObjectContainerBigArchive::CreateInstance(
return nullptr;
}
-size_t ObjectContainerBigArchive::GetModuleSpecifications(
+ModuleSpecList ObjectContainerBigArchive::GetModuleSpecifications(
const lldb_private::FileSpec &file, lldb::DataExtractorSP &extractor_sp,
lldb::offset_t data_offset, lldb::offset_t file_offset,
- lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) {
- return 0;
+ lldb::offset_t file_size) {
+ return {};
}
ObjectContainerBigArchive::ObjectContainerBigArchive(
diff --git a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
index a9f899af6b002..ae3d0c05359de 100644
--- a/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
+++ b/lldb/source/Plugins/ObjectContainer/Big-Archive/ObjectContainerBigArchive.h
@@ -44,12 +44,11 @@ class ObjectContainerBigArchive : public lldb_private::ObjectContainer {
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t offset, lldb::offset_t length);
- static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
- lldb::DataExtractorSP &extractor_sp,
- lldb::offset_t data_offset,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- lldb_private::ModuleSpecList &specs);
+ static lldb_private::ModuleSpecList
+ GetModuleSpecifications(const lldb_private::FileSpec &file,
+ lldb::DataExtractorSP &extractor_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset, lldb::offset_t length);
// Member Functions
bool ParseHeader() override;
diff --git a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
index 4f1405abf8b56..3e04a92ffe20f 100644
--- a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -219,18 +219,18 @@ bool ObjectContainerMachOFileset::ParseHeader() {
return ParseFileset(*m_extractor_sp, *header, m_entries, m_memory_addr);
}
-size_t ObjectContainerMachOFileset::GetModuleSpecifications(
+ModuleSpecList ObjectContainerMachOFileset::GetModuleSpecifications(
const lldb_private::FileSpec &file, lldb::DataExtractorSP &extractor_sp,
lldb::offset_t data_offset, lldb::offset_t file_offset,
- lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) {
- const size_t initial_count = specs.GetSize();
+ lldb::offset_t file_size) {
if (!extractor_sp)
- return initial_count;
+ return {};
DataExtractorSP data_extractor_sp =
extractor_sp->GetSubsetExtractorSP(data_offset);
if (!data_extractor_sp)
- return initial_count;
+ return {};
+ ModuleSpecList specs;
if (MagicBytesMatch(*data_extractor_sp)) {
std::vector<Entry> entries;
if (ParseHeader(*data_extractor_sp, file, file_offset, entries)) {
@@ -244,7 +244,7 @@ size_t ObjectContainerMachOFileset::GetModuleSpecifications(
}
}
}
- return specs.GetSize() - initial_count;
+ return specs;
}
bool ObjectContainerMachOFileset::MagicBytesMatch(DataBufferSP data_sp,
diff --git a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
index 1ba667394ae7e..b0de836056fdd 100644
--- a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
+++ b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.h
@@ -48,12 +48,11 @@ class ObjectContainerMachOFileset : public lldb_private::ObjectContainer {
const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
const lldb::ProcessSP &process_sp, lldb::addr_t header_addr);
- static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
- lldb::DataExtractorSP &extractor_sp,
- lldb::offset_t data_offset,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- lldb_private::ModuleSpecList &specs);
+ static ModuleSpecList
+ GetModuleSpecifications(const lldb_private::FileSpec &file,
+ lldb::DataExtractorSP &extractor_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset, lldb::offset_t length);
static bool MagicBytesMatch(const lldb_private::DataExtractor &data);
static bool MagicBytesMatch(lldb::DataBufferSP data_sp,
diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
index 0ff0a05e24455..6144a02bda6a2 100644
--- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp
@@ -188,14 +188,14 @@ ObjectContainerUniversalMachO::GetObjectFile(const FileSpec *file) {
return ObjectFileSP();
}
-size_t ObjectContainerUniversalMachO::GetModuleSpecifications(
+ModuleSpecList ObjectContainerUniversalMachO::GetModuleSpecifications(
const lldb_private::FileSpec &file, lldb::DataExtractorSP &extractor_sp,
lldb::offset_t data_offset, lldb::offset_t file_offset,
- lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) {
- const size_t initial_count = specs.GetSize();
+ lldb::offset_t file_size) {
if (!extractor_sp)
- return initial_count;
+ return {};
+ ModuleSpecList specs;
DataExtractorSP data_extractor_sp =
extractor_sp->GetSubsetExtractorSP(data_offset);
if (ObjectContainerUniversalMachO::MagicBytesMatch(*data_extractor_sp)) {
@@ -212,5 +212,5 @@ size_t ObjectContainerUniversalMachO::GetModuleSpecifications(
}
}
}
- return specs.GetSize() - initial_count;
+ return specs;
}
diff --git a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
index b4d451f740ee4..6b91b81b1e4fe 100644
--- a/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
+++ b/lldb/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h
@@ -39,12 +39,11 @@ class ObjectContainerUniversalMachO : public lldb_private::ObjectContainer {
lldb::offset_t data_offset, const lldb_private::FileSpec *file,
lldb::offset_t offset, lldb::offset_t length);
- static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
- lldb::DataExtractorSP &extractor_sp,
- lldb::offset_t data_offset,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- lldb_private::ModuleSpecList &specs);
+ static lldb_private::ModuleSpecList
+ GetModuleSpecifications(const lldb_private::FileSpec &file,
+ lldb::DataExtractorSP &extractor_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset, lldb::offset_t length);
static bool MagicBytesMatch(const lldb_private::DataExtractor &data);
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
index d3ec0ff1f81a1..bd1687e8a214c 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
@@ -101,11 +101,11 @@ ObjectFile *ObjectFileBreakpad::CreateMemoryInstance(
return nullptr;
}
-size_t ObjectFileBreakpad::GetModuleSpecifications(
+ModuleSpecList ObjectFileBreakpad::GetModuleSpecifications(
const FileSpec &file, DataExtractorSP &extractor_sp, offset_t data_offset,
- offset_t file_offset, offset_t length, ModuleSpecList &specs) {
+ offset_t file_offset, offset_t length) {
if (!extractor_sp || !extractor_sp->HasData())
- return 0;
+ return {};
// If this is opearting on a VirtualDataExtractor, it can have
// gaps between valid bytes in the DataBuffer. We extract an
// ArrayRef of the raw bytes, and can segfault.
@@ -114,11 +114,12 @@ size_t ObjectFileBreakpad::GetModuleSpecifications(
auto text = toStringRef(contiguous_extractor_sp->GetData());
std::optional<Header> header = Header::parse(text);
if (!header)
- return 0;
+ return {};
ModuleSpec spec(file, std::move(header->arch));
spec.GetUUID() = std::move(header->uuid);
+ ModuleSpecList specs;
specs.Append(spec);
- return 1;
+ return specs;
}
ObjectFileBreakpad::ObjectFileBreakpad(const ModuleSP &module_sp,
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
index c866aa73e0cdf..2a186aa5132b6 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
@@ -38,12 +38,11 @@ class ObjectFileBreakpad : public ObjectFile {
const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr);
- static size_t GetModuleSpecifications(const FileSpec &file,
- lldb::DataExtractorSP &extractor_sp,
- lldb::offset_t data_offset,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- ModuleSpecList &specs);
+ static ModuleSpecList
+ GetModuleSpecifications(const FileSpec &file,
+ lldb::DataExtractorSP &extractor_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset, lldb::offset_t length);
// PluginInterface protocol
llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
diff --git a/lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp b/lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp
index 123d1ccf229d8..3f24ba3fb1d2a 100644
--- a/lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp
@@ -113,11 +113,11 @@ lldb_private::ObjectFile *ObjectFileCOFF::CreateMemoryInstance(
return nullptr;
}
-size_t ObjectFileCOFF::GetModuleSpecifications(
+ModuleSpecList ObjectFileCOFF::GetModuleSpecifications(
const FileSpec &file, DataExtractorSP &extractor_sp, offset_t data_offset,
- offset_t file_offset, offset_t length, ModuleSpecList &specs) {
+ offset_t file_offset, offset_t length) {
if (!extractor_sp || !extractor_sp->HasData())
- return 0;
+ return {};
// If this is opearting on a VirtualDataExtractor, it can have
// gaps between valid bytes in the DataBuffer. We extract an
@@ -125,9 +125,9 @@ size_t ObjectFileCOFF::GetModuleSpecifications(
DataExtractorSP contiguous_extractor_sp =
extractor_sp->GetContiguousDataExtractorSP();
if (!contiguous_extractor_sp)
- return 0;
+ return {};
if (!IsCOFFObjectFile(contiguous_extractor_sp->GetData()))
- return 0;
+ return {};
MemoryBufferRef buffer{toStringRef(contiguous_extractor_sp->GetData()),
file.GetFilename().GetStringRef()};
@@ -137,27 +137,28 @@ size_t ObjectFileCOFF::GetModuleSpecifications(
LLDB_LOG_ERROR(log, binary.takeError(),
"Failed to create binary for file ({1}): {0}",
file.GetFilename());
- return 0;
+ return {};
}
std::unique_ptr<COFFObjectFile> object =
unique_dyn_cast<COFFObjectFile>(std::move(*binary));
+ ModuleSpecList specs;
switch (static_cast<COFF::MachineTypes>(object->getMachine())) {
- case COFF::IMAGE_FILE_MACHINE_I386:
specs.Append(ModuleSpec(file, ArchSpec("i686-unknown-windows-msvc")));
- return 1;...
[truncated]
|
JDevlieghere
left a comment
There was a problem hiding this comment.
Welcome back!
This fixes #178625. LGTM.
Thanks. I am back, but unfortunately I won't have much time for LLDB in the near future. |
…fications For consistency with llvm#188276 (and better readability?).
…188276) Some plugins were returning the number of specifications they have added, while others were returning the total final number. Particularly devious plugins (Minidump) were clearing the specification list altogether. This resulted in nondeterministic failures (depending on plugin ininitialization order) in TestSBModule. This PR defines the problem away by having each plugin only return the specifications it is responsible for. If the caller wants to merge them, it is free to do so. This *might* be slighly less efficient, but this is hardly hot code. I'm not touching the ObjectFile::GetModuleSpecifications function (the caller of all these functions) as the PR is big enough, although the same approach might be warranted there as well. Fixes llvm#178625.
…fications (llvm#188509) For consistency with llvm#188276 (and better readability?).
…fications (llvm#188509) For consistency with llvm#188276 (and better readability?).
…#222030) 08c94c0 / llvm#188276 accidentally removed the "case:" for i386.
…#222030) 08c94c0 / llvm#188276 accidentally removed the "case:" for i386.
Some plugins were returning the number of specifications they have added, while others were returning the total final number. Particularly devious plugins (Minidump) were clearing the specification list altogether. This resulted in nondeterministic failures (depending on plugin ininitialization order) in TestSBModule.
This PR defines the problem away by having each plugin only return the specifications it is responsible for. If the caller wants to merge them, it is free to do so. This might be slighly less efficient, but this is hardly hot code.
I'm not touching the ObjectFile::GetModuleSpecifications function (the caller of all these functions) as the PR is big enough, although the same approach might be warranted there as well.
Fixes #178625.