How can i debug adbd on android?

629 views
Skip to first unread message

tiany

unread,
Oct 17, 2011, 8:56:56 AM10/17/11
to android-...@googlegroups.com

while long time running adbd,(calls sendkeyevent, capture the framebuffer, etc), I found adbd may

receive an sigsegv signal, but the error stack will not be logged into logcat as the common

application does,I have try to make the static libs to shared libs,and rebulid kernel, but seems that does not help.

Is there any issues on debugging the adbd? How does the first developers of adbd debug on it ? Could gdb

server be used?

Best Regards.

tiany

FrankG

unread,
Oct 17, 2011, 10:20:17 AM10/17/11
to android-platform

Maybe you can try this and look then
whether you can see any adbd traces in logcat ?
( redirect stdio printf output to logcat,
but i can be a little bit noisy .. means
you need a apropriate filter )

$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start

Good luck !

Frank

On 17 Okt., 14:56, tiany <lonelin...@gmail.com> wrote:
> while long time running adbd,(calls sendkeyevent, capture the framebuffer,
> etc), I found adbd may
>
> receive an sigsegv signal, but the error stack will not be logged into
> logcat as the common
>
> application does,I have try to make the static libs to shared libs,and
> rebulid kernel, but seems that does not help.
>
> *Is there any issues on debugging the adbd? How does the first developers of
> adbd debug on it ? Could gdb
> *
>
> *server be used?*
>
> *Best Regards.*
>
> *tiany
> *

tiany

unread,
Oct 17, 2011, 10:30:43 PM10/17/11
to android-...@googlegroups.com
Thanks Frank.

But I mean that,  if your code has something like this *((int *)32) = 100, it will raise an sigsegv signal, and the errors stack will be loged into logcat.

I made some error like mentioned above deliberately. The logcat  file is clear and no tombstones folder in /data. 

I know that android implemented outputing the error stack with linker and debuggerd, so I changed to adbd makefile to using android shared library,

but the error stack is still can not be seen in the logcat.

the error stack looked like this :
10-18 10:29:45.866 I/DEBUG   (  908): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-18 10:29:45.866 I/DEBUG   (  908): Build fingerprint: 'Coolpad/coral/coral/coral:2.2.2/2.2.040.P1.8013lab/774:userdebug/test-keys'
10-18 10:29:45.866 I/DEBUG   (  908): pid: 5669, tid: 5669  >>> ./crasher_shared <<<
10-18 10:29:45.866 I/DEBUG   (  908): signal 11 (SIGSEGV), fault addr 00000000
10-18 10:29:45.866 I/DEBUG   (  908):  r0 a5a50000  r1 a5a50001  r2 a5a50002  r3 a5a50003
10-18 10:29:45.866 I/DEBUG   (  908):  r4 a5a50004  r5 a5a50005  r6 a5a50006  r7 a5a50007
10-18 10:29:45.866 I/DEBUG   (  908):  r8 a5a50008  r9 a5a50009  10 a5a50010  fp a5a50011
10-18 10:29:45.866 I/DEBUG   (  908):  ip a5a50012  sp bec28cb8  lr 00000000  pc 00008728  cpsr 60000010
10-18 10:29:45.886 I/DEBUG   (  908):          #00  pc 00008728  /data/crasher_shared
10-18 10:29:45.896 I/DEBUG   (  908):          #01  lr 00000000  <unknown>
10-18 10:29:45.896 I/DEBUG   (  908):
10-18 10:29:45.896 I/DEBUG   (  908): code around pc:
10-18 10:29:45.896 I/DEBUG   (  908): 00008708 e59f6048 e59f7048 e59f8048 e59f9048
10-18 10:29:45.906 I/DEBUG   (  908): 00008718 e59fa048 e59fb048 e59fc048 e3a0e000
10-18 10:29:45.906 I/DEBUG   (  908): 00008728 e59ee000 eafffffe e3a0d000 e3a00000
10-18 10:29:45.906 I/DEBUG   (  908): 00008738 e5900000 eafffffe a5a50000 a5a50001
10-18 10:29:45.906 I/DEBUG   (  908): 00008748 a5a50002 a5a50003 a5a50004 a5a50005
10-18 10:29:45.906 I/DEBUG   (  908):
10-18 10:29:45.906 I/DEBUG   (  908): code around lr:
10-18 10:29:45.916 I/DEBUG   (  908):
10-18 10:29:45.916 I/DEBUG   (  908): stack:
10-18 10:29:45.916 I/DEBUG   (  908):     bec28c78  00000001
10-18 10:29:45.916 I/DEBUG   (  908):     bec28c7c  bec28ca0  [stack]
10-18 10:29:45.926 I/DEBUG   (  908):     bec28c80  afd4054c  /system/lib/libc.so
10-18 10:29:45.926 I/DEBUG   (  908):     bec28c84  eee7f7ad
10-18 10:29:45.926 I/DEBUG   (  908):     bec28c88  00000000
10-18 10:29:45.936 I/DEBUG   (  908):     bec28c8c  00009110  /data/crasher_shared
10-18 10:29:45.936 I/DEBUG   (  908):     bec28c90  bec28d04  [stack]
10-18 10:29:45.936 I/DEBUG   (  908):     bec28c94  afd4054c  /system/lib/libc.so
10-18 10:29:45.936 I/DEBUG   (  908):     bec28c98  00001625
10-18 10:29:45.936 I/DEBUG   (  908):     bec28c9c  afd14b1d  /system/lib/libc.so
10-18 10:29:45.946 I/DEBUG   (  908):     bec28ca0  00008930  /data/crasher_shared
10-18 10:29:45.946 I/DEBUG   (  908):     bec28ca4  bec28cb0  [stack]
10-18 10:29:45.946 I/DEBUG   (  908):     bec28ca8  00008811  /data/crasher_shared
10-18 10:29:45.946 I/DEBUG   (  908):     bec28cac  00008945  /data/crasher_shared
10-18 10:29:45.946 I/DEBUG   (  908):     bec28cb0  df002777
10-18 10:29:45.956 I/DEBUG   (  908):     bec28cb4  e3a070ad
10-18 10:29:45.956 I/DEBUG   (  908): #00 bec28cb8  b000c4a8  /system/bin/linker
10-18 10:29:45.956 I/DEBUG   (  908):     bec28cbc  00000001
10-18 10:29:45.956 I/DEBUG   (  908):     bec28cc0  b00132a0
10-18 10:29:45.956 I/DEBUG   (  908):     bec28cc4  b00148dc
10-18 10:29:45.966 I/DEBUG   (  908):     bec28cc8  00000000
10-18 10:29:45.966 I/DEBUG   (  908):     bec28ccc  00000000
10-18 10:29:45.966 I/DEBUG   (  908):     bec28cd0  00000000
10-18 10:29:45.966 I/DEBUG   (  908):     bec28cd4  00000000
10-18 10:29:45.966 I/DEBUG   (  908):     bec28cd8  00000000
10-18 10:29:45.976 I/DEBUG   (  908):     bec28cdc  00000000
10-18 10:29:45.976 I/DEBUG   (  908):     bec28ce0  00000000
10-18 10:29:45.976 I/DEBUG   (  908):     bec28ce4  00000000
10-18 10:29:45.976 I/DEBUG   (  908):     bec28ce8  00000000
10-18 10:29:45.986 I/DEBUG   (  908):     bec28cec  00000000
10-18 10:29:45.986 I/DEBUG   (  908):     bec28cf0  00000000
10-18 10:29:45.986 I/DEBUG   (  908):     bec28cf4  afd0d365  /system/lib/libc.so
10-18 10:29:45.986 I/DEBUG   (  908):     bec28cf8  00000000
10-18 10:29:45.986 I/DEBUG   (  908):     bec28cfc  b000281d  /system/bin/linker


tiany

unread,
Oct 18, 2011, 10:28:57 PM10/18/11
to android-...@googlegroups.com
I have found the answer, just copy what debugger.c do, after receive the signal, connect to debuggerd, and tell it your pid, it will
track your error stack for you.

But I am really intersted on how the orignal developers debug adbd. Can anyone tell me something about it?

FrankG

unread,
Oct 19, 2011, 5:20:42 AM10/19/11
to android-platform
Sorry, but then I have no clue about this .. btw. can you see
something
with "dmesg" ?

Thanks and good luck !

Frank

tiany

unread,
Oct 19, 2011, 6:20:25 AM10/19/11
to android-...@googlegroups.com
the stack error will not log to dmesg, you can see the source code in system/core/debuggerd
crashes will log to logcat and tombstones but not dmesg.


--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.




--
Best Regards,

Tiany

Reply all
Reply to author
Forward
0 new messages