Created
January 17, 2012 02:52
-
-
Save tetsu-koba/1624254 to your computer and use it in GitHub Desktop.
Chasing adb server process by gdb with setting follow-fork-mode child
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
koba@koba-linux2:/opt/koba/android-ics.kzm/system/core/adb$ adb kill-server | |
koba@koba-linux2:/opt/koba/android-ics.kzm/system/core/adb$ ps ax |grep adb | |
14130 pts/5 S+ 0:00 grep --color=auto adb | |
koba@koba-linux2:/opt/koba/android-ics.kzm/system/core/adb$ gdb --args adb start-server | |
GNU gdb (GDB) 7.1-ubuntu | |
Copyright (C) 2010 Free Software Foundation, Inc. | |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. Type "show copying" | |
and "show warranty" for details. | |
This GDB was configured as "x86_64-linux-gnu". | |
For bug reporting instructions, please see: | |
<http://www.gnu.org/software/gdb/bugs/>... | |
Reading symbols from /opt/koba/android-ics.kzm/out/host/linux-x86/bin/adb...done. | |
(gdb) set follow-fork-mode child | |
(gdb) b execl | |
Breakpoint 1 at 0x8049b38 | |
(gdb) r | |
Starting program: /opt/koba/android-ics.kzm/out/host/linux-x86/bin/adb start-server | |
warning: the debug information found in "/lib/ld-2.11.1.so" does not match "/lib/ld-linux.so.2" (CRC mismatch). | |
[Thread debugging using libthread_db enabled] | |
* daemon not running. starting it now on port 5037 * | |
[New process 14136] | |
[Thread debugging using libthread_db enabled] | |
[Switching to Thread 0xf7cd06d0 (LWP 14136)] | |
Breakpoint 1, 0xf7d6b6e0 in execl () from /lib32/libc.so.6 | |
(gdb) bt | |
#0 0xf7d6b6e0 in execl () from /lib32/libc.so.6 | |
#1 0x0804a960 in launch_server (server_port=5037) at system/core/adb/adb.c:796 | |
#2 0x080566eb in adb_connect (service=0x8068bca "host:start-server") | |
at system/core/adb/adb_client.c:219 | |
#3 0x08054c4a in adb_commandline (argc=1, argv=0xffffcfa8) | |
at system/core/adb/commandline.c:1237 | |
#4 0x0804b28f in main (argc=2, argv=0xffffcfa4) at system/core/adb/adb.c:1279 | |
(gdb) b pthread_create | |
Breakpoint 2 at 0x8049e08 | |
(gdb) c | |
Continuing. | |
process 14136 is executing new program: /opt/koba/android-ics.kzm/out/host/linux-x86/bin/adb | |
warning: the debug information found in "/lib/ld-2.11.1.so" does not match "/lib/ld-linux.so.2" (CRC mismatch). | |
[Thread debugging using libthread_db enabled] | |
Breakpoint 2, 0x08049e08 in pthread_create@plt () | |
(gdb) bt | |
#0 0x08049e08 in pthread_create@plt () | |
#1 0x0805ca5c in adb_thread_create () at system/core/adb/sysdeps.h:425 | |
#2 usb_init () at system/core/adb/usb_linux.c:687 | |
#3 0x0804c28f in adb_main (is_daemon=1, server_port=5037) | |
at system/core/adb/adb.c:860 | |
#4 0x080538b2 in adb_commandline (argc=0, argv=0xffffcfc8) | |
at system/core/adb/commandline.c:915 | |
#5 0x0804b28f in main (argc=3, argv=0xffffcfc4) at system/core/adb/adb.c:1279 | |
(gdb) frame 1 | |
#1 0x0805ca5c in adb_thread_create () at system/core/adb/sysdeps.h:425 | |
425 return pthread_create( pthread, &attr, start, arg ); | |
(gdb) p start | |
$1 = <value optimized out> | |
(gdb) c | |
Continuing. | |
[New Thread 0xf7ccfb70 (LWP 14138)] | |
Breakpoint 2, 0x08049e08 in pthread_create@plt () | |
(gdb) btt | |
Undefined command: "btt". Try "help". | |
(gdb) bt | |
#0 0x08049e08 in pthread_create@plt () | |
#1 0x08051054 in adb_thread_create (port=5555) | |
at system/core/adb/sysdeps.h:425 | |
#2 local_init (port=5555) at system/core/adb/transport_local.c:201 | |
#3 0x0804c29b in adb_main (is_daemon=1, server_port=5037) | |
at system/core/adb/adb.c:861 | |
#4 0x080538b2 in adb_commandline (argc=0, argv=0xffffcfc8) | |
(gdb) b client_socket_thread | |
Breakpoint 3 at 0x8051784: file system/core/adb/transport_local.c, line 142. (2 locations) | |
(gdb) c | |
Continuing. | |
[New Thread 0xf74ceb70 (LWP 14139)] | |
[Switching to Thread 0xf74ceb70 (LWP 14139)] | |
Breakpoint 3, client_socket_thread (x=0x15b3) | |
at system/core/adb/transport_local.c:142 | |
142 D("transport: client_socket_thread() starting\n"); | |
(gdb) info thread | |
* 4 Thread 0xf74ceb70 (LWP 14139) client_socket_thread (x=0x15b3) | |
at system/core/adb/transport_local.c:142 | |
3 Thread 0xf7ccfb70 (LWP 14138) 0xf7fdf430 in ?? () | |
2 Thread 0xf7cd06d0 (LWP 14136) 0xf7fdf430 in ?? () | |
(gdb) list | |
142 D("transport: client_socket_thread() starting\n"); | |
143 | |
144 /* try to connect to any number of running emulator instances */ | |
145 /* this is only done when ADB starts up. later, each new emulator */ | |
146 /* will send a message to ADB to indicate that is is starting up */ | |
147 for ( ; count > 0; count--, port += 2 ) { | |
148 (void) local_connect(port); | |
149 } | |
150 #endif | |
151 return 0; | |
(gdb) n | |
148 (void) local_connect(port); | |
(gdb) n | |
147 for ( ; count > 0; count--, port += 2 ) { | |
(gdb) n | |
148 (void) local_connect(port); | |
(gdb) n | |
* daemon started successfully * | |
147 for ( ; count > 0; count--, port += 2 ) { | |
(gdb) n | |
148 (void) local_connect(port); | |
(gdb) n | |
147 for ( ; count > 0; count--, port += 2 ) { | |
(gdb) n | |
148 (void) local_connect(port); | |
(gdb) n | |
147 for ( ; count > 0; count--, port += 2 ) { | |
(gdb) n | |
148 (void) local_connect(port); | |
(gdb) n | |
147 for ( ; count > 0; count--, port += 2 ) { | |
(gdb) b 151 | |
Breakpoint 4 at 0x80517ab: file system/core/adb/transport_local.c, line 151. | |
(gdb) c | |
Continuing. | |
Breakpoint 4, client_socket_thread (x=0x15b3) | |
at system/core/adb/transport_local.c:152 | |
152 } | |
(gdb) n | |
0xf7f6c96e in start_thread () from /lib32/libpthread.so.0 | |
(gdb) bt | |
#0 0xf7f6c96e in start_thread () from /lib32/libpthread.so.0 | |
#1 0xf7da1b5e in clone () from /lib32/libc.so.6 | |
(gdb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment