MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / parseFile

Method parseFile

src/symbols_linux.cpp:313–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313bool ElfParser::parseFile(CodeCache* cc, const char* base, const char* file_name, bool use_debug) {
314 int fd = open(file_name, O_RDONLY);
315 if (fd == -1) {
316 return false;
317 }
318
319 size_t length = (size_t)lseek(fd, 0, SEEK_END);
320 void* addr = mmap(NULL, length, PROT_READ, MAP_PRIVATE, fd, 0);
321 close(fd);
322
323 if (addr == MAP_FAILED) {
324 Log::warn("Could not parse symbols from %s: %s", file_name, strerror(errno));
325 } else {
326 ElfParser elf(cc, base, addr, file_name, false);
327 if (elf.validHeader()) {
328 elf.calcVirtualLoadAddress();
329 elf.loadSymbols(use_debug);
330 }
331 munmap(addr, length);
332 }
333 return true;
334}
335
336void ElfParser::parseProgramHeaders(CodeCache* cc, const char* base, const char* end, bool relocate_dyn) {
337 ElfParser elf(cc, base, base, NULL, relocate_dyn);

Callers

nothing calls this directly

Calls 3

validHeaderMethod · 0.80
loadSymbolsMethod · 0.45

Tested by

no test coverage detected