Addr2line: enter an address and specify an executable with-G compilation. ProgramTo print out the corresponding CodeLine.
In fact, GDB also has this function, but the advantage of addr2line is that, in many cases, bugs are hard to reproduce, and we only have one crash log. In this way, you can use addr2line to find the corresponding code line, which is very convenient. Prerequisites:
1. the executable program is compiled with-g, with debugging information (the so-called debugging information is a correspondence between the Code and the address ).
2. If the crash is in a so object, addr2line cannot directly provide the code line. As we all know, the address in so can be reallocate when the executable file is loaded. I also mentioned the DLL loading logic in Windows core programming. Therefore, if there is only one so address and the corresponding code line needs to be identified, a base address and offset should be given to addr2line, or based on the SMAP information of the executable program, convert the address to an offset address relative to the so base address.