summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Symbol/ObjectFile.h6
-rw-r--r--lldb/source/Core/Module.cpp2
-rw-r--r--lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp5
-rw-r--r--lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h2
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp60
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h2
-rw-r--r--lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp4
-rw-r--r--lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h2
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp28
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h7
-rw-r--r--lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp2
-rw-r--r--lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h2
-rw-r--r--lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp4
13 files changed, 55 insertions, 71 deletions
diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h
index 21bea80dcb6..33c1d9e9a39 100644
--- a/lldb/include/lldb/Symbol/ObjectFile.h
+++ b/lldb/include/lldb/Symbol/ObjectFile.h
@@ -408,10 +408,10 @@ public:
/// bytes for the object file (or memory for memory based object files).
///
/// @return
- /// Returns \b true if a UUID was successfully extracted into
- /// \a uuid, \b false otherwise.
+ /// The object file's UUID. In case of an error, an empty UUID is
+ /// returned.
//------------------------------------------------------------------
- virtual bool GetUUID(lldb_private::UUID *uuid) = 0;
+ virtual UUID GetUUID() = 0;
//------------------------------------------------------------------
/// Gets the symbol file spec list for this object file.
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index c10ea779bc7..77d1ab123d1 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -330,7 +330,7 @@ const lldb_private::UUID &Module::GetUUID() {
ObjectFile *obj_file = GetObjectFile();
if (obj_file != nullptr) {
- obj_file->GetUUID(&m_uuid);
+ m_uuid = obj_file->GetUUID();
m_did_set_uuid = true;
}
}
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
index 8825c83f747..5f36638f57c 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
@@ -122,11 +122,6 @@ Symtab *ObjectFileBreakpad::GetSymtab() {
return nullptr;
}
-bool ObjectFileBreakpad::GetUUID(UUID *uuid) {
- *uuid = m_uuid;
- return true;
-}
-
void ObjectFileBreakpad::CreateSections(SectionList &unified_section_list) {
if (m_sections_ap)
return;
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
index 0304eff6e25..15930815cf4 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
@@ -82,7 +82,7 @@ public:
ArchSpec GetArchitecture() override { return m_arch; }
- bool GetUUID(UUID *uuid) override;
+ UUID GetUUID() override { return m_uuid; }
FileSpecList GetDebugSymbolFilePaths() override { return FileSpecList(); }
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 1f1551c0ce5..521e8750858 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -896,49 +896,43 @@ bool ObjectFileELF::ParseHeader() {
return m_header.Parse(m_data, &offset);
}
-bool ObjectFileELF::GetUUID(lldb_private::UUID *uuid) {
+UUID ObjectFileELF::GetUUID() {
// Need to parse the section list to get the UUIDs, so make sure that's been
// done.
if (!ParseSectionHeaders() && GetType() != ObjectFile::eTypeCoreFile)
- return false;
+ return UUID();
- using u32le = llvm::support::ulittle32_t;
- if (m_uuid.IsValid()) {
- // We have the full build id uuid.
- *uuid = m_uuid;
- return true;
- } else if (GetType() == ObjectFile::eTypeCoreFile) {
- uint32_t core_notes_crc = 0;
+ if (!m_uuid) {
+ using u32le = llvm::support::ulittle32_t;
+ if (GetType() == ObjectFile::eTypeCoreFile) {
+ uint32_t core_notes_crc = 0;
- if (!ParseProgramHeaders())
- return false;
+ if (!ParseProgramHeaders())
+ return UUID();
- core_notes_crc = CalculateELFNotesSegmentsCRC32(m_program_headers, m_data);
+ core_notes_crc =
+ CalculateELFNotesSegmentsCRC32(m_program_headers, m_data);
- if (core_notes_crc) {
- // Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make it look
- // different form .gnu_debuglink crc - followed by 4 bytes of note
- // segments crc.
- u32le data[] = {u32le(g_core_uuid_magic), u32le(core_notes_crc)};
- m_uuid = UUID::fromData(data, sizeof(data));
- }
- } else {
- if (!m_gnu_debuglink_crc)
- m_gnu_debuglink_crc =
- calc_gnu_debuglink_crc32(m_data.GetDataStart(), m_data.GetByteSize());
- if (m_gnu_debuglink_crc) {
- // Use 4 bytes of crc from the .gnu_debuglink section.
- u32le data(m_gnu_debuglink_crc);
- m_uuid = UUID::fromData(&data, sizeof(data));
+ if (core_notes_crc) {
+ // Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make it
+ // look different form .gnu_debuglink crc - followed by 4 bytes of note
+ // segments crc.
+ u32le data[] = {u32le(g_core_uuid_magic), u32le(core_notes_crc)};
+ m_uuid = UUID::fromData(data, sizeof(data));
+ }
+ } else {
+ if (!m_gnu_debuglink_crc)
+ m_gnu_debuglink_crc = calc_gnu_debuglink_crc32(m_data.GetDataStart(),
+ m_data.GetByteSize());
+ if (m_gnu_debuglink_crc) {
+ // Use 4 bytes of crc from the .gnu_debuglink section.
+ u32le data(m_gnu_debuglink_crc);
+ m_uuid = UUID::fromData(&data, sizeof(data));
+ }
}
}
- if (m_uuid.IsValid()) {
- *uuid = m_uuid;
- return true;
- }
-
- return false;
+ return m_uuid;
}
lldb_private::FileSpecList ObjectFileELF::GetDebugSymbolFilePaths() {
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
index 570a8baa087..fb51212a0a5 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -122,7 +122,7 @@ public:
lldb_private::ArchSpec GetArchitecture() override;
- bool GetUUID(lldb_private::UUID *uuid) override;
+ lldb_private::UUID GetUUID() override;
lldb_private::FileSpecList GetDebugSymbolFilePaths() override;
diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
index d1e9a5d3d63..ec5500622a4 100644
--- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
+++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
@@ -166,9 +166,9 @@ void ObjectFileJIT::Dump(Stream *s) {
}
}
-bool ObjectFileJIT::GetUUID(lldb_private::UUID *uuid) {
+UUID ObjectFileJIT::GetUUID() {
// TODO: maybe get from delegate, not needed for first pass
- return false;
+ return UUID();
}
uint32_t ObjectFileJIT::GetDependentModules(FileSpecList &files) {
diff --git a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
index 2d0b17d6b72..694bbcdcc9a 100644
--- a/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
+++ b/lldb/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
@@ -74,7 +74,7 @@ public:
lldb_private::ArchSpec GetArchitecture() override;
- bool GetUUID(lldb_private::UUID *uuid) override;
+ lldb_private::UUID GetUUID() override;
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index b4c320f12fe..4046082c02c 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -916,7 +916,7 @@ size_t ObjectFileMachO::GetModuleSpecifications(
spec.GetArchitecture() = GetArchitecture(header, data, data_offset);
if (spec.GetArchitecture().IsValid()) {
- GetUUID(header, data, data_offset, spec.GetUUID());
+ spec.GetUUID() = GetUUID(header, data, data_offset);
specs.Append(spec);
}
}
@@ -4845,10 +4845,9 @@ void ObjectFileMachO::Dump(Stream *s) {
}
}
-bool ObjectFileMachO::GetUUID(const llvm::MachO::mach_header &header,
+UUID ObjectFileMachO::GetUUID(const llvm::MachO::mach_header &header,
const lldb_private::DataExtractor &data,
- lldb::offset_t lc_offset,
- lldb_private::UUID &uuid) {
+ lldb::offset_t lc_offset) {
uint32_t i;
struct uuid_command load_cmd;
@@ -4870,16 +4869,15 @@ bool ObjectFileMachO::GetUUID(const llvm::MachO::mach_header &header,
0xbb, 0x14, 0xf0, 0x0d};
if (!memcmp(uuid_bytes, opencl_uuid, 16))
- return false;
+ return UUID();
- uuid = UUID::fromOptionalData(uuid_bytes, 16);
- return true;
+ return UUID::fromOptionalData(uuid_bytes, 16);
}
- return false;
+ return UUID();
}
offset = cmd_offset + load_cmd.cmdsize;
}
- return false;
+ return UUID();
}
static llvm::StringRef GetOSName(uint32_t cmd) {
@@ -5066,14 +5064,14 @@ ObjectFileMachO::GetArchitecture(const llvm::MachO::mach_header &header,
return arch;
}
-bool ObjectFileMachO::GetUUID(lldb_private::UUID *uuid) {
+UUID ObjectFileMachO::GetUUID() {
ModuleSP module_sp(GetModule());
if (module_sp) {
std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
- return GetUUID(m_header, m_data, offset, *uuid);
+ return GetUUID(m_header, m_data, offset);
}
- return false;
+ return UUID();
}
uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
@@ -5553,8 +5551,7 @@ ObjectFile::Type ObjectFileMachO::CalculateType() {
if (GetAddressByteSize() == 4) {
// 32 bit kexts are just object files, but they do have a valid
// UUID load command.
- UUID uuid;
- if (GetUUID(&uuid)) {
+ if (GetUUID()) {
// this checking for the UUID load command is not enough we could
// eventually look for the symbol named "OSKextGetCurrentIdentifier" as
// this is required of kexts
@@ -5597,8 +5594,7 @@ ObjectFile::Strata ObjectFileMachO::CalculateStrata() {
{
// 32 bit kexts are just object files, but they do have a valid
// UUID load command.
- UUID uuid;
- if (GetUUID(&uuid)) {
+ if (GetUUID()) {
// this checking for the UUID load command is not enough we could
// eventually look for the symbol named "OSKextGetCurrentIdentifier" as
// this is required of kexts
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
index 29ee204d6ee..1ad89c03d2d 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -93,7 +93,7 @@ public:
lldb_private::ArchSpec GetArchitecture() override;
- bool GetUUID(lldb_private::UUID *uuid) override;
+ lldb_private::UUID GetUUID() override;
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
@@ -140,11 +140,10 @@ public:
uint32_t GetPluginVersion() override;
protected:
- static bool
+ static lldb_private::UUID
GetUUID(const llvm::MachO::mach_header &header,
const lldb_private::DataExtractor &data,
- lldb::offset_t lc_offset, // Offset to the first load command
- lldb_private::UUID &uuid);
+ lldb::offset_t lc_offset); // Offset to the first load command
static lldb_private::ArchSpec
GetArchitecture(const llvm::MachO::mach_header &header,
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index e5548842dcc..dc7f61068a5 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -837,7 +837,7 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) {
}
}
-bool ObjectFilePECOFF::GetUUID(UUID *uuid) { return false; }
+UUID ObjectFilePECOFF::GetUUID() { return UUID(); }
uint32_t ObjectFilePECOFF::ParseDependentModules() {
ModuleSP module_sp(GetModule());
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
index cd1cb020031..17f5f4de2d1 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -111,7 +111,7 @@ public:
lldb_private::ArchSpec GetArchitecture() override;
- bool GetUUID(lldb_private::UUID *uuid) override;
+ lldb_private::UUID GetUUID() override;
uint32_t GetDependentModules(lldb_private::FileSpecList &files) override;
diff --git a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
index 4040f20d08b..3aed77b065b 100644
--- a/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
+++ b/lldb/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
@@ -75,8 +75,8 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
if (obj_name != obj_file_elf)
return NULL;
- lldb_private::UUID uuid;
- if (!obj_file->GetUUID(&uuid))
+ lldb_private::UUID uuid = obj_file->GetUUID();
+ if (!uuid)
return NULL;
// Get the .gnu_debuglink file (if specified).
OpenPOWER on IntegriCloud