linux - How to use Android ltrace tool to trace an app? -


i want use ltrace tool included in aosp trace closed source app. here did:

  1. i built aosp 6.0.1 nexus 5, using userdebug option. ltrace built default.
  2. i launched app (a game named minecraft).
  3. in adb shell, ran ltrace -p <pid>

ltrace did not gave tracing output:

root@hammerhead:/data/tmp # ps | grep minecraftpe u0_a52    5534  214   1132728 178176 sys_epoll_ b6cde894 s com.mojang.minecraftpe root@hammerhead:/data/tmp # ltrace -p 5534 can't open com.mojang.minecraftpe: no such file or directory couldn't determine base address of com.mojang.minecraftpe couldn't load elf object com.mojang.minecraftpe: bad file descriptor backend initialization failed. couldn't load elf object /system/bin/linker: bad file descriptor backend initialization failed. couldn't load elf object /data/dalvik-cache/arm/system@framework@boot.oat: bad file descriptor backend initialization failed. couldn't load elf object /data/app/com.mojang.minecraftpe-1/oat/arm/base.odex: bad file descriptor +++ exited (status 0) +++ +++ exited (status 0) +++ ... +++ exited (status 0) +++ root@hammerhead:/data/tmp # 

however ltrace work on native executables. here 2 proofs:

case 1: running command child process of ltrace.

root@hammerhead:/data/tmp # ltrace ls can't open ls: no such file or directory couldn't determine base address of ls couldn't load elf object ls: bad file descriptor backend initialization failed. couldn't load elf object /system/bin/linker: bad file descriptor __libc_init(0xbea06b00, 0, 0xb6fd1b5d, 0xbea06ae8 <unfinished ...> signal(13, 0xb6fd1d19, 0xbea06b0c, 2)            = 0xb6fad661 strrchr(0xbea06c16, 47, 0xbea06a90, 1)           = 0 ... strcmp(0xb6d4c03b, 0xb6fe05f0, 0, 46)            = 0 readdir(0xb6d4c000, 0x2e00, 0x2e00, 46)          = 0 free(0, 0, 0, 0)                                 = 0 closedir(0xb6d4c000, 0xb6ec0240, 0xb6ea30e1, 46) = 0 +++ exited (status 0) +++ root@hammerhead:/data/tmp # 

case 2: attaching running native program.

root@hammerhead:/data/tmp # sleep 30 & [1] 5370 root@hammerhead:/data/tmp # bg [1] sleep 30 root@hammerhead:/data/tmp # ltrace -p 5370 backend initialization failed. couldn't load elf object /system/bin/linker: i/o error sigprocmask(2, 0xbe858458, 0, 0)                 = 0 free(0xb6ccf658, 0xb6ccb004, 0xb6ccf6a8, 0)      = 24 free(0xb6ccf6a8, 0xb6cc2518, 0, 67)              = 24 ... close(0, 1, 0, 0xbe858470)                       = 0 exit(0, 1, -272, 0xbe858470 <no return ...> +++ exited (status 0) +++ [1] + done                 sleep 30 root@hammerhead:/data/tmp # 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -