How to debug a dynamic library on Android

Source: Internet
Author: User

For details about how to debug the gdb process on Android, refer to the previous article.

If an android application contains a dynamic library call, a bunch of addresses are provided after the application exits unexpectedly,

For example

I/debug (841): Signal 11 (SIGSEGV), fault ADDR deadbaad
I/debug (841): R0 00000000 R1 afd1498d R2 00000027 R3 00000070
I/debug (841): R4 afd42328 R5 00000000 R6 00000000 R7 4e6fae30
I/debug (841): R8 00100000 R9 a811c2f9 10 4e5fb000 FP 0013cdb8
I/debug (841): IP Route 173c SP 4e6fa9d8 LR deadbaadPC afd11f40Cpsr60000030
I/debug (841): D0 400000003 eaaaaab D1 3ff0000041f00000
I/debug (841): D2 rj000050baf6de D3 0000000000000000
I/debug (841): D4 00000007000000b4 D5 3fe999999999999a
I/debug (841): D6 3fe1_0000binder: Release proc 1047, transaction 109259, not freed
0 D7 3eaaaaab3f800000
I/debug (841): D8 0000000000000000 D9 0000000000000000
I/debug (841): D10 0000000000000000 D11 0000000000000000
I/debug (841): D12 0000000000000000 D13 0000000000000000
I/debug (841): D14 0000000000000000 D15 0000000000000000
I/debug (841): SCR 80000012

The problematic code location can be inferred based on the PC address and the crash dynamic library,

Location from address to code location using the GCC command arm-eabi-addr2line:

For example, if my dynamic library is Hello. So, place the library locally.
Run

Arm-eabi-addr2line
-C-f-e/path/to/lib/with_sysbols/Hello. So
Afd11f40

The aboveAfd11f40
The PC address when it is crash:

(I/debug
(841): IP Route 173c SP 4e6fa9d8 LR deadbaadPC afd11f40Cpsr60000030

Note:

1. It is best to compile your dynamic debugging version (-g)

2. Put your dynamic experience in the android dynamic library
Sysbols version directory. For example, the directory on my machine is: (eg.)/home/usera/Android/out/target/product/generic/symbols/system/lib.




Related Article

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.