The Android NDK uses addr2line to symbolize the problem of getting the wrong function name

Source: Internet
Author: User

After the general Android NDK crashes, we use the Addr2line tool to symbolize it. If you use some of the features of C++11, be aware that it is possible that you will get the wrong function name. Our company is to provide crash analysis related services, the acquisition of the user's crash log, uploaded to the backend server, will be symbolized. have been good before, recently there are users said the result is not correct symbolic, function name and file and line number is inconsistent.

This question is actually quite strange, to say that Addr2line is an operating system level of tools, countless people use, it is impossible to make such a low-level error AH. However, in order to further verify, ready to re-use Addr2line on their own PC, the results found that no problem, symbolic is correct. Again to the server test, found still wrong. To view the version of Addr2line, the discovery is different, as shown below.

[[email protected] ~]# addr2line --versiongnu  Addr2line version 2.20.51.0.2-5.42.el6 20100205copyright 2009 free software  Foundation, Inc.This program is free software; you may  Redistribute it under the terms ofthe gnu general public license  version 3 or  (at your option)  any later version. This program has absolutely no warranty. 
[Email protected]:~/templates/tyrion-debug-tusuo$ addr2line--versiongnu addr2line (GNU Binutils for Ubuntu) 2.24Copyright free software Foundation, inc.this program was free software; Redistribute it under the terms ofthe GNU general public License version 3 or (at your option) any later version.t His program has absolutely no warranty.

It should be the problem, and the operating system is different, its own is Ubuntu, the server is CentOS. As we all know, the general version of the software on CentOS is older, and repo source does not have the latest version of the update, you need to add the source.


First of all, if you want to put your PC's addr2line on the server, you can solve the problem, because this file is written in C language binary files. As a result, the following error occurred:

[Email protected] ~]#/addr2line-f-e libgame.so 0x33e17b./addr2line:error while loading shared libraries:libbfd-2.24 -system.so:cannot open Shared object file:no such file or directory

Check the source code of Addr2line can be found, it will refer to # include "Bfd.h", will rely on libbfdxxx.so.


Then only download the new version from the official, and then recompile, for the Addr2line version upgrade. Website address is

FTP://SOURCEWARE.ORG/PUB/BINUTILS/SNAPSHOTS/BINUTILS-2.24.90.TAR.BZ2, you can also synchronize the code from GIT to recompile.


Note It is best to compile on the target machine. After upgrading the Addr2line, everything was fine.

This article is from the "Snow to Sword" blog, please make sure to keep this source http://jazka.blog.51cto.com/809003/1679337

The Android NDK uses addr2line to symbolize the problem of getting the wrong function name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.