summaryrefslogtreecommitdiffstats
path: root/lldb/unittests/ObjectFile
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/unittests/ObjectFile')
-rw-r--r--lldb/unittests/ObjectFile/ELF/CMakeLists.txt1
-rw-r--r--lldb/unittests/ObjectFile/ELF/Inputs/early-section-headers.sobin0 -> 5815 bytes
-rw-r--r--lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp14
3 files changed, 15 insertions, 0 deletions
diff --git a/lldb/unittests/ObjectFile/ELF/CMakeLists.txt b/lldb/unittests/ObjectFile/ELF/CMakeLists.txt
index 652c221a6d8..3d53f542791 100644
--- a/lldb/unittests/ObjectFile/ELF/CMakeLists.txt
+++ b/lldb/unittests/ObjectFile/ELF/CMakeLists.txt
@@ -13,6 +13,7 @@ add_dependencies(ObjectFileELFTests yaml2obj)
add_definitions(-DYAML2OBJ="$<TARGET_FILE:yaml2obj>")
set(test_inputs
+ early-section-headers.so
sections-resolve-consistently.yaml
)
add_unittest_inputs(ObjectFileELFTests "${test_inputs}")
diff --git a/lldb/unittests/ObjectFile/ELF/Inputs/early-section-headers.so b/lldb/unittests/ObjectFile/ELF/Inputs/early-section-headers.so
new file mode 100644
index 00000000000..4d529748e5d
--- /dev/null
+++ b/lldb/unittests/ObjectFile/ELF/Inputs/early-section-headers.so
Binary files differ
diff --git a/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp b/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
index 056799ee919..fe8ea7cae8a 100644
--- a/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
+++ b/lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
@@ -98,3 +98,17 @@ TEST_F(ObjectFileELFTest, SectionsResolveConsistently) {
ASSERT_NE(nullptr, start);
EXPECT_EQ(text_sp, start->GetAddress().GetSection());
}
+
+// Test that GetModuleSpecifications works on an "atypical" object file which
+// has section headers right after the ELF header (instead of the more common
+// layout where the section headers are at the very end of the object file).
+TEST_F(ObjectFileELFTest, GetModuleSpecifications_EarlySectionHeaders) {
+ std::string SO = GetInputFilePath("early-section-headers.so");
+ ModuleSpecList Specs;
+ ASSERT_EQ(1u, ObjectFile::GetModuleSpecifications(FileSpec(SO, false), 0, 0, Specs));
+ ModuleSpec Spec;
+ ASSERT_TRUE(Specs.GetModuleSpecAtIndex(0, Spec)) ;
+ UUID Uuid;
+ Uuid.SetFromStringRef("1b8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9", 20);
+ EXPECT_EQ(Spec.GetUUID(), Uuid);
+}
OpenPOWER on IntegriCloud