Use _r_debug instead of /proc/<pid>/maps for folly::symbolizer
Summary: Using _r_debug offers a number of benefits: - It allows us to symbolize addresses in data segments like .bss that are marked "[heap]" in /proc/<pid>/maps. - It requires a lot less code. It also fixes a preexisting bug where we would fail to symbolize addresses that fell in any section past the first in any position- independent objects. Since `elfFile->getBaseAddress()` should always return 0 for any PIEs, we wouldn't correctly adjust the address to be ELF-relative when performing symbol lookup. (For the first section, we just used the start of the range we found in /perf/<pid>/maps.) There is a minor downside: - We have to open an ELF header for each object in order to check if a given address is in the range of some segment. Before, we used /proc/<pid>/maps to make the range check, and only opened the header once we knew it was the one we wanted. In the common case, however, where the addresses are from our own executable, we don't open any more files than before (and, in fact, one fewer). Reviewed By: luciang Differential Revision: D3695872 fbshipit-source-id: 9bdcc77da4d658ffad5c671f9b8ea65a471ed64f
Showing
Please register or sign in to comment