Loading libunwindstack/Elf.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -194,26 +194,26 @@ bool Elf::IsValidElf(Memory* memory) { return true; } void Elf::GetInfo(Memory* memory, bool* valid, uint64_t* size) { bool Elf::GetInfo(Memory* memory, uint64_t* size) { if (!IsValidElf(memory)) { *valid = false; return; return false; } *size = 0; *valid = true; // Now read the section header information. uint8_t class_type; if (!memory->ReadFully(EI_CLASS, &class_type, 1)) { return; return false; } // Get the maximum size of the elf data from the header. if (class_type == ELFCLASS32) { ElfInterface32::GetMaxSize(memory, size); } else if (class_type == ELFCLASS64) { ElfInterface64::GetMaxSize(memory, size); } else { *valid = false; return false; } return true; } bool Elf::IsValidPc(uint64_t pc) { Loading libunwindstack/MapInfo.cpp +2 −8 Original line number Diff line number Diff line Loading @@ -53,10 +53,8 @@ Memory* MapInfo::GetFileMemory() { return nullptr; } bool valid; uint64_t max_size; Elf::GetInfo(memory.get(), &valid, &max_size); if (!valid) { if (!Elf::GetInfo(memory.get(), &max_size)) { // Init as if the whole file is an elf. if (memory->Init(name, 0)) { elf_offset = offset; Loading Loading @@ -109,11 +107,7 @@ Memory* MapInfo::CreateMemory(const std::shared_ptr<Memory>& process_memory) { // first part of the elf file. This is done if the linker rosegment // option is used. std::unique_ptr<MemoryRange> memory(new MemoryRange(process_memory, start, end - start, 0)); bool valid; uint64_t max_size; Elf::GetInfo(memory.get(), &valid, &max_size); if (valid) { // Valid elf, we are done. if (Elf::IsValidElf(memory.get())) { return memory.release(); } Loading libunwindstack/include/unwindstack/Elf.h +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ class Elf { static bool IsValidElf(Memory* memory); static void GetInfo(Memory* memory, bool* valid, uint64_t* size); static bool GetInfo(Memory* memory, uint64_t* size); static uint64_t GetLoadBias(Memory* memory); Loading Loading
libunwindstack/Elf.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -194,26 +194,26 @@ bool Elf::IsValidElf(Memory* memory) { return true; } void Elf::GetInfo(Memory* memory, bool* valid, uint64_t* size) { bool Elf::GetInfo(Memory* memory, uint64_t* size) { if (!IsValidElf(memory)) { *valid = false; return; return false; } *size = 0; *valid = true; // Now read the section header information. uint8_t class_type; if (!memory->ReadFully(EI_CLASS, &class_type, 1)) { return; return false; } // Get the maximum size of the elf data from the header. if (class_type == ELFCLASS32) { ElfInterface32::GetMaxSize(memory, size); } else if (class_type == ELFCLASS64) { ElfInterface64::GetMaxSize(memory, size); } else { *valid = false; return false; } return true; } bool Elf::IsValidPc(uint64_t pc) { Loading
libunwindstack/MapInfo.cpp +2 −8 Original line number Diff line number Diff line Loading @@ -53,10 +53,8 @@ Memory* MapInfo::GetFileMemory() { return nullptr; } bool valid; uint64_t max_size; Elf::GetInfo(memory.get(), &valid, &max_size); if (!valid) { if (!Elf::GetInfo(memory.get(), &max_size)) { // Init as if the whole file is an elf. if (memory->Init(name, 0)) { elf_offset = offset; Loading Loading @@ -109,11 +107,7 @@ Memory* MapInfo::CreateMemory(const std::shared_ptr<Memory>& process_memory) { // first part of the elf file. This is done if the linker rosegment // option is used. std::unique_ptr<MemoryRange> memory(new MemoryRange(process_memory, start, end - start, 0)); bool valid; uint64_t max_size; Elf::GetInfo(memory.get(), &valid, &max_size); if (valid) { // Valid elf, we are done. if (Elf::IsValidElf(memory.get())) { return memory.release(); } Loading
libunwindstack/include/unwindstack/Elf.h +1 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ class Elf { static bool IsValidElf(Memory* memory); static void GetInfo(Memory* memory, bool* valid, uint64_t* size); static bool GetInfo(Memory* memory, uint64_t* size); static uint64_t GetLoadBias(Memory* memory); Loading