Lines Matching refs:ElfStatus
46 std::ostream& operator<<(std::ostream& os, const ElfStatus& status) { in operator <<()
48 case ElfStatus::NO_ERROR: in operator <<()
51 case ElfStatus::FILE_NOT_FOUND: in operator <<()
54 case ElfStatus::READ_FAILED: in operator <<()
57 case ElfStatus::FILE_MALFORMED: in operator <<()
60 case ElfStatus::NO_SYMBOL_TABLE: in operator <<()
63 case ElfStatus::NO_BUILD_ID: in operator <<()
66 case ElfStatus::BUILD_ID_MISMATCH: in operator <<()
69 case ElfStatus::SECTION_NOT_FOUND: in operator <<()
81 ElfStatus IsValidElfFile(int fd) { in IsValidElfFile()
84 return ElfStatus::READ_FAILED; in IsValidElfFile()
86 return IsValidElfFileMagic(buf, 4) ? ElfStatus::NO_ERROR : ElfStatus::FILE_MALFORMED; in IsValidElfFile()
89 ElfStatus IsValidElfPath(const std::string& filename) { in IsValidElfPath()
91 return ElfStatus::FILE_NOT_FOUND; in IsValidElfPath()
96 return ElfStatus::READ_FAILED; in IsValidElfPath()
98 ElfStatus result = IsValidElfFile(fileno(fp)); in IsValidElfPath()
133 ElfStatus GetBuildIdFromNoteFile(const std::string& filename, BuildId* build_id) { in GetBuildIdFromNoteFile()
136 return ElfStatus::READ_FAILED; in GetBuildIdFromNoteFile()
139 return ElfStatus::NO_BUILD_ID; in GetBuildIdFromNoteFile()
141 return ElfStatus::NO_ERROR; in GetBuildIdFromNoteFile()
145 ElfStatus GetBuildIdFromELFFile(const llvm::object::ELFObjectFile<ELFT>* elf, BuildId* build_id) { in GetBuildIdFromELFFile()
153 return ElfStatus::READ_FAILED; in GetBuildIdFromELFFile()
156 return ElfStatus::NO_BUILD_ID; in GetBuildIdFromELFFile()
159 return ElfStatus::NO_ERROR; in GetBuildIdFromELFFile()
163 return ElfStatus::NO_BUILD_ID; in GetBuildIdFromELFFile()
166 static ElfStatus GetBuildIdFromObjectFile(llvm::object::ObjectFile* obj, BuildId* build_id) { in GetBuildIdFromObjectFile()
172 return ElfStatus::FILE_MALFORMED; in GetBuildIdFromObjectFile()
183 static ElfStatus OpenObjectFile(const std::string& filename, uint64_t file_offset, in OpenObjectFile()
187 return ElfStatus::READ_FAILED; in OpenObjectFile()
192 return ElfStatus::READ_FAILED; in OpenObjectFile()
197 return ElfStatus::READ_FAILED; in OpenObjectFile()
201 return ElfStatus::READ_FAILED; in OpenObjectFile()
207 return ElfStatus::FILE_MALFORMED; in OpenObjectFile()
209 return ElfStatus::NO_ERROR; in OpenObjectFile()
212 static ElfStatus OpenObjectFileInMemory(const char* data, size_t size, BinaryWrapper* wrapper) { in OpenObjectFileInMemory()
216 return ElfStatus::FILE_MALFORMED; in OpenObjectFileInMemory()
222 return ElfStatus::FILE_MALFORMED; in OpenObjectFileInMemory()
224 return ElfStatus::NO_ERROR; in OpenObjectFileInMemory()
227 ElfStatus GetBuildIdFromElfFile(const std::string& filename, BuildId* build_id) { in GetBuildIdFromElfFile()
228 ElfStatus result = IsValidElfPath(filename); in GetBuildIdFromElfFile()
229 if (result != ElfStatus::NO_ERROR) { in GetBuildIdFromElfFile()
235 ElfStatus GetBuildIdFromEmbeddedElfFile(const std::string& filename, uint64_t file_offset, in GetBuildIdFromEmbeddedElfFile()
238 ElfStatus result = OpenObjectFile(filename, file_offset, file_size, &wrapper); in GetBuildIdFromEmbeddedElfFile()
239 if (result != ElfStatus::NO_ERROR) { in GetBuildIdFromEmbeddedElfFile()
246 ElfStatus ReadSectionFromELFFile(const llvm::object::ELFObjectFile<ELFT>* elf, const std::string& s… in ReadSectionFromELFFile()
256 return ElfStatus::READ_FAILED; in ReadSectionFromELFFile()
259 return ElfStatus::NO_ERROR; in ReadSectionFromELFFile()
261 return ElfStatus::SECTION_NOT_FOUND; in ReadSectionFromELFFile()
381 ElfStatus ParseSymbolsFromELFFile(const llvm::object::ELFObjectFile<ELFT>* elf, in ParseSymbolsFromELFFile()
393 return ElfStatus::NO_ERROR; in ParseSymbolsFromELFFile()
400 ElfStatus result = ReadSectionFromELFFile(elf, ".gnu_debugdata", &debugdata); in ParseSymbolsFromELFFile()
401 if (result == ElfStatus::SECTION_NOT_FOUND) { in ParseSymbolsFromELFFile()
402 return ElfStatus::NO_SYMBOL_TABLE; in ParseSymbolsFromELFFile()
403 } else if (result == ElfStatus::NO_ERROR) { in ParseSymbolsFromELFFile()
409 if (result == ElfStatus::NO_ERROR) { in ParseSymbolsFromELFFile()
415 return ElfStatus::FILE_MALFORMED; in ParseSymbolsFromELFFile()
423 ElfStatus MatchBuildId(llvm::object::ObjectFile* obj, const BuildId& expected_build_id) { in MatchBuildId()
425 return ElfStatus::NO_ERROR; in MatchBuildId()
428 ElfStatus result = GetBuildIdFromObjectFile(obj, &real_build_id); in MatchBuildId()
429 if (result != ElfStatus::NO_ERROR) { in MatchBuildId()
433 return ElfStatus::BUILD_ID_MISMATCH; in MatchBuildId()
435 return ElfStatus::NO_ERROR; in MatchBuildId()
438 ElfStatus ParseSymbolsFromElfFile(const std::string& filename, in ParseSymbolsFromElfFile()
441 ElfStatus result = IsValidElfPath(filename); in ParseSymbolsFromElfFile()
442 if (result != ElfStatus::NO_ERROR) { in ParseSymbolsFromElfFile()
448 ElfStatus ParseSymbolsFromEmbeddedElfFile(const std::string& filename, uint64_t file_offset, in ParseSymbolsFromEmbeddedElfFile()
452 ElfStatus result = OpenObjectFile(filename, file_offset, file_size, &wrapper); in ParseSymbolsFromEmbeddedElfFile()
453 if (result != ElfStatus::NO_ERROR) { in ParseSymbolsFromEmbeddedElfFile()
457 if (result != ElfStatus::NO_ERROR) { in ParseSymbolsFromEmbeddedElfFile()
465 return ElfStatus::FILE_MALFORMED; in ParseSymbolsFromEmbeddedElfFile()
468 ElfStatus ParseSymbolsFromElfFileInMemory(const char* data, size_t size, in ParseSymbolsFromElfFileInMemory()
471 ElfStatus result = OpenObjectFileInMemory(data, size, &wrapper); in ParseSymbolsFromElfFileInMemory()
472 if (result != ElfStatus::NO_ERROR) { in ParseSymbolsFromElfFileInMemory()
480 return ElfStatus::FILE_MALFORMED; in ParseSymbolsFromElfFileInMemory()
484 ElfStatus ParseDynamicSymbolsFromELFFile(const llvm::object::ELFObjectFile<ELFT>* elf, in ParseDynamicSymbolsFromELFFile()
490 return ElfStatus::NO_ERROR; in ParseDynamicSymbolsFromELFFile()
493 ElfStatus ParseDynamicSymbolsFromElfFile(const std::string& filename, in ParseDynamicSymbolsFromElfFile()
496 ElfStatus result = OpenObjectFile(filename, 0, 0, &wrapper); in ParseDynamicSymbolsFromElfFile()
497 if (result != ElfStatus::NO_ERROR) { in ParseDynamicSymbolsFromElfFile()
505 return ElfStatus::FILE_MALFORMED; in ParseDynamicSymbolsFromElfFile()
509 ElfStatus ReadMinExecutableVirtualAddress(const llvm::object::ELFFile<ELFT>* elf, in ReadMinExecutableVirtualAddress()
529 return ElfStatus::NO_ERROR; in ReadMinExecutableVirtualAddress()
532 ElfStatus ReadMinExecutableVirtualAddressFromElfFile(const std::string& filename, in ReadMinExecutableVirtualAddressFromElfFile()
536 ElfStatus result = IsValidElfPath(filename); in ReadMinExecutableVirtualAddressFromElfFile()
537 if (result != ElfStatus::NO_ERROR) { in ReadMinExecutableVirtualAddressFromElfFile()
544 ElfStatus ReadMinExecutableVirtualAddressFromEmbeddedElfFile(const std::string& filename, in ReadMinExecutableVirtualAddressFromEmbeddedElfFile()
551 ElfStatus result = OpenObjectFile(filename, file_offset, file_size, &wrapper); in ReadMinExecutableVirtualAddressFromEmbeddedElfFile()
552 if (result != ElfStatus::NO_ERROR) { in ReadMinExecutableVirtualAddressFromEmbeddedElfFile()
556 if (result != ElfStatus::NO_ERROR) { in ReadMinExecutableVirtualAddressFromEmbeddedElfFile()
564 return ElfStatus::FILE_MALFORMED; in ReadMinExecutableVirtualAddressFromEmbeddedElfFile()
567 ElfStatus ReadSectionFromElfFile(const std::string& filename, const std::string& section_name, in ReadSectionFromElfFile()
569 ElfStatus result = IsValidElfPath(filename); in ReadSectionFromElfFile()
570 if (result != ElfStatus::NO_ERROR) { in ReadSectionFromElfFile()
575 if (result != ElfStatus::NO_ERROR) { in ReadSectionFromElfFile()
583 return ElfStatus::FILE_MALFORMED; in ReadSectionFromElfFile()