Init .gnu_debugdata in GetElf().
- Modify the tests to share some code for the generation of the elf data.
- Move the gnu_debugdata files into a separate directory.
- Add tests for GetElf().
- Move the CreateMemory() tests and the GetElf() tests into separate files.
Bug: 23762183
Test: New unit tests pass.
Change-Id: Ie3380296bb49753c2ac8801cfa11f93d6ff7121d
diff --git a/libunwindstack/MapInfo.cpp b/libunwindstack/MapInfo.cpp
index 051f700..d7b483d 100644
--- a/libunwindstack/MapInfo.cpp
+++ b/libunwindstack/MapInfo.cpp
@@ -73,13 +73,15 @@
return new MemoryRange(memory, start, end);
}
-Elf* MapInfo::GetElf(pid_t pid, bool) {
+Elf* MapInfo::GetElf(pid_t pid, bool init_gnu_debugdata) {
if (elf) {
return elf;
}
elf = new Elf(CreateMemory(pid));
- elf->Init();
+ if (elf->Init() && init_gnu_debugdata) {
+ elf->InitGnuDebugdata();
+ }
// If the init fails, keep the elf around as an invalid object so we
// don't try to reinit the object.
return elf;