• Robin Cheng's avatar
    Make SymbolizerTest pass if compiled as PIE. · 0f0fe916
    Robin Cheng authored
    Summary:
    The symbolizer takes mapped addresses (address listed in ELF, offset by the binary offset (which is zero for non-PIE)) and symbolizes it into non-mapped addresses. In a couple of places in SymbolizerTest, we took the non-mapped addresses and symbolized them again, which wouldn't work if the binary was compiled with PIE. In another place in SymbolizerTest, the mapped address was used to look up DWARF information, whereas we needed the non-mapped address. This diff addresses these issues.
    
    Additionally, I discovered that r_debug::r_map->l_addr is the "right" way to get the PIE offset, so this diff pulls that common functionality to symbolizer/detail/Debug.h and use it for Symbolizer and the three tests so far that need PIE relocation adjustments.
    
    Reviewed By: yfeldblum
    
    Differential Revision: D23492850
    
    fbshipit-source-id: 62353e576c50b44070b323b5477fea9bb4c0b500
    0f0fe916
Symbolizer.cpp 12.9 KB