Android under Print BackTrace

Source: Internet
Author: User

Android under no execinfo.h, you can't print the back trace method under glibc.

Glic print back trace see: http://blog.csdn.net/span76/article/details/11927551


I have written the following method for reference:

 #include <signal.h> #include <corkscrew/backtrace.h>static void Pnpdumpnativestack (int sig) {#if defined (have_android_os) | |    (Defined (Have_alien) &&!defined (ALIEN_LIBC)) const size_t max_depth = 32;    backtrace_frame_t Backtrace[max_depth];    ssize_t frames = Unwind_backtrace_thread (tid, backtrace, 0, max_depth);        if (Frames > 0) {backtrace_symbol_t backtrace_symbols[max_depth];        Get_backtrace_symbols (BackTrace, frames, backtrace_symbols);            for (size_t i = 0; i < size_t (frames); i++) {char line[max_backtrace_line_length]; Format_backtrace_line (i, &backtrace[i], &backtrace_symbols[i], line, max_backtrace_line_length)            ;        Aloge ("==================%s\n", line);    } free_backtrace_symbols (Backtrace_symbols, frames); } #endif}...void dvmcollectgarbageinternal (const gcspec* spec) {signal (SIGSEGV, pnpdumpnativestack); ... 

Android is using a similar Execinfo method provided by Libcorkscrew to get backtrace information.


Unfortunately, every time I print the print is not complete, such as the following 2, for reasons to be identified.

09-30 03:38:49.821 137 137 E DALVIKVM: ================== #00 pc 00026edb/. /system/lib/libdvm.so
09-30 03:38:49.821 137 137 E DALVIKVM: ================== #01 pc 00000400 [VDSO]




Android under Print BackTrace

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.