开发者

Offset of shared libries on android

开发者 https://www.devze.com 2023-02-12 16:21 出处:网络
In my project after crash I got log like this I/DEBUG( 1133):r0 0000deedr1 00001234r2 deedbeedr3 00000000

In my project after crash I got log like this

I/DEBUG   ( 1133):  r0 0000deed  r1 00001234  r2 deedbeed  r3 00000000
I/DEBUG   ( 1133):  r4 befab4c0  r5 00000007  r6 befab548  r7 4214cb20
I/DEBUG   ( 1133):  r8 befab49c  r9 4214cb0c  10 4214caf8  fp 81da5368
I/DEBUG   ( 1133):  ip 80003108  sp befab440  lr 845133d4  pc 844ed8f0  cpsr 60000010
I/DEBUG   ( 1133):  d0  7165722068736175  d1  4320585858585865
I/DEBUG   ( 1133):  d2  006f006900740073  d3  00200030003d0074
I/DEBUG   ( 1133):  d4  4214e9804214e94c  d5  4214e9e84214e9b4
I/DEBUG   ( 1133):  d6  3ce2000000000000  d7  000000424214ea84
I/DEBUG   ( 1133):  d8  0000000000000000  d9  0000000000000000
I/DEBUG   ( 1133):  d10 0000000000000000  d11 0000000000000000
I/DEBUG   ( 1133):  d12 0000000000000000  d13 0000000000000000
I/DEBUG   ( 1133):  d14 0000000000000000  d15 0000000000000000
I/DEBUG   ( 1133):  d16 4050800000000000  d17 4050800000000000
I/DEBUG   ( 1133):  d18 4018000000000000  d19 3fe00000000000b4
I/DEBUG   ( 1133):  d20 3ff0000000000000  d21 8000000000000000
I/DEBUG   ( 1133):  d22 0000000000000000  d23 ff00000000000000
I/DEBUG   ( 1133):  d24 ff00000000000000  d25 ff00000000000000
I/DEBUG   ( 1133):  d26 0100010001000100  d27 0100010001000100
I/DEBUG   ( 1133):  d28 0100010001000100  d29 3ff0000000000000
I/DEBUG   ( 1133):  d30 0000000000000000  d31 3ff0000000000000
I/DEBUG   ( 1133):  scr 20000012
I/DEBUG   ( 1133): 
I/DEBUG   ( 1133):          #00  pc 000ed8f0  libmyproject.so
I/DEBUG   ( 1133):          #01  lr 845133d4  libmyproject.so
I/DEBUG   ( 1133): 
I/DEBUG   ( 1133): code around pc:
I/DEBUG   ( 1133): 844ed8d0 e52de004 e24dd014 e58d0004 e58d1000 
I/DEBUG   ( 1133): 844ed8e0 e28d301c e58d300c e59d3004 e5933000 
I/DEBUG   ( 1133): 844ed8f0 e593c238 e59d0004 e59d1000 e59d2018 
I/DEBUG   ( 1133): 844ed900 e59d300c e12fff3c e28dd014 e49de004 
I/DEBUG   ( 1133): 844ed910 e28dd008 e12fff1e e52de004 e24dd00c 
I/DEBUG   ( 1133): 
I/DEBUG   ( 1133): code around lr:
I/DEBUG   ( 1133): 845133b4 e2433013 e58d3024 e59d0024 e3a01c12 
I/DEBUG   ( 1133): 开发者_如何学JAVA845133c4 e2811034 e59f212c e3a03000 ebff693d 
I/DEBUG   ( 1133): 845133d4 ebff5e4c e1a03000 e3530000 0a000008 
I/DEBUG   ( 1133): 845133e4 ebff5e48 e1a03000 e1a00003 ebfffa85 
I/DEBUG   ( 1133): 845133f4 e1a03000 e3530000 0a000001 e3a03001 
I/DEBUG   ( 1133): 
I/DEBUG   ( 1133): stack:
I/DEBUG   ( 1133):     befab400  00770518  
I/DEBUG   ( 1133):     befab404  0000a000  
I/DEBUG   ( 1133):     befab408  befab4a0  
I/DEBUG   ( 1133):     befab40c  4214cafc  
I/DEBUG   ( 1133):     befab410  0000abe0  
I/DEBUG   ( 1133):     befab414  afd13663  /system/lib/libc.so
I/DEBUG   ( 1133):     befab418  0000ce60  
I/DEBUG   ( 1133):     befab41c  00770518  
I/DEBUG   ( 1133):     befab420  befab548  
I/DEBUG   ( 1133):     befab424  4214cb04  
I/DEBUG   ( 1133):     befab428  0000ce60  
I/DEBUG   ( 1133):     befab42c  00770518  
I/DEBUG   ( 1133):     befab430  befab548  
I/DEBUG   ( 1133):     befab434  81d48eb9  /system/lib/libdvm.so
I/DEBUG   ( 1133):     befab438  e3a07077  
I/DEBUG   ( 1133):     befab43c  ef900077  
I/DEBUG   ( 1133): #00 befab440  00001234  
I/DEBUG   ( 1133):     befab444  0000deed  
I/DEBUG   ( 1133):     befab448  00000007  
I/DEBUG   ( 1133):     befab44c  befab45c  
I/DEBUG   ( 1133):     befab450  4214cb20  
I/DEBUG   ( 1133):     befab454  845133d4  libmyproject.so
I/DEBUG   ( 1133):     befab458  deedbeed  
I/DEBUG   ( 1133):     befab45c  00000000  
I/DEBUG   ( 1133):     befab460  000009f4  
I/DEBUG   ( 1133):     befab464  4462e744  
I/DEBUG   ( 1133):     befab468  000001c7  
I/DEBUG   ( 1133):     befab46c  00000000  
I/DEBUG   ( 1133):     befab470  40532730  
I/DEBUG   ( 1133):     befab474  0000abe0  
I/DEBUG   ( 1133):     befab478  befab4c8  
I/DEBUG   ( 1133):     befab47c  81d68e49 
I/DEBUG   ( 1133):     befab480  40532730  
I/DEBUG   ( 1133):     befab484  0000deed  

however my map file doesn't have values like 0x845133d4. I guess that I need to know value of offset. Where I can find it?

EDIT

I found clue (http://groups.google.com/group/android-ndk/browse_thread/thread/83012b9a9633a6d6) how to find this offset, however my /proc/maps is empty

EDIT2

on device with root privileges adb shell cat /proc/<pid>/maps gives me:

...
82000000-83665000 r-xp 00000000 b3:02 5603348    libmyproject.so
83665000-836c6000 rwxp 01664000 b3:02 5603348    libmyproject.so
...

Could anyone confirm that this is possible only on rooted devices? Anyone know how do this without root?


Every app has access to file /proc/self/maps and in this file are information which I was looking for :)


The following procedure worked for me on a non-rooted phone:

  1. adb shell
  2. Find a pid of your app in ps output
  3. run-as com.myapp.package
  4. Under "run-as" you have access to /proc/XXXX/maps
0

精彩评论

暂无评论...
验证码 换一张
取 消