jdb test
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
| Notes: | |
| devel/libs/android/jdk is the 32-bit JDK | |
| devel/libs/android/jdk64 is 64-bit. | |
| I modified my local ndk-gdb script to do everything but run jdb / gdb; | |
| instead, it justs prints the respective command lines. I get this: | |
| ---- | |
| $ ndk-gdb --start | |
| /cygdrive/c/devel/libs/android/jdk/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=65534 | |
| /cygdrive/c/devel/libs/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gdb -x obj/local/armeabi-v7a/gdb.setup | |
| ---- | |
| At this point, I have the following forwarding setup: | |
| ---- | |
| $ adb forward --list | |
| 015DAA2E0D02A02A tcp:5039 localfilesystem:/data/data/com.radgametools.examandroid/debug-socket | |
| 015DAA2E0D02A02A tcp:65534 jdwp:2475 | |
| ---- | |
| When I start jdb manually, I get this: | |
| ---- | |
| $ /cygdrive/c/devel/libs/android/jdk/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=65534 | |
| Set uncaught java.lang.Throwable | |
| Set deferred uncaught java.lang.Throwable | |
| Initializing jdb ... | |
| > | |
| ---- | |
| It seems to be successfully attached: | |
| ---- | |
| > threads | |
| Group system: | |
| (java.lang.Thread)0xc140512680 <6> Compiler cond. waiting | |
| (java.lang.Thread)0xc140512510 <4> Signal Catcher cond. waiting | |
| (java.lang.Thread)0xc140512468 <3> GC cond. waiting | |
| (java.lang.Thread)0xc1405123b0 <2> HeapWorker cond. waiting | |
| Group main: | |
| (java.lang.Thread)0xc140022258 <1> main sleeping | |
| (java.lang.Thread)0xc140517260 <8> Binder Thread #2 running | |
| (java.lang.Thread)0xc1405165f8 <7> Binder Thread #1 running | |
| > where all | |
| <1> main: | |
| Current thread isn't suspended. | |
| <8> Binder Thread #2: | |
| Current thread isn't suspended. | |
| <7> Binder Thread #1: | |
| Current thread isn't suspended. | |
| <6> Compiler: | |
| Current thread isn't suspended. | |
| <4> Signal Catcher: | |
| Current thread isn't suspended. | |
| <3> GC: | |
| Current thread isn't suspended. | |
| <2> HeapWorker: | |
| Current thread isn't suspended. | |
| ---- | |
| But the phone is still stuck on the "Waiting for Debugger" prompt. | |
| UPDATE: If I do suspend the threads, I get the following stack traces: | |
| ---- | |
| > suspend | |
| All threads suspended. | |
| > where all | |
| <1> main: | |
| [1] java.lang.VMThread.sleep (native method) | |
| [2] java.lang.Thread.sleep (Thread.java:1,213) | |
| [3] java.lang.Thread.sleep (Thread.java:1,195) | |
| [4] android.os.Debug.waitForDebugger (Debug.java:219) | |
| [5] android.app.ActivityThread.handleBindApplication (ActivityThread.java:3,305) | |
| [6] android.app.ActivityThread.access$2200 (ActivityThread.java:124) | |
| [7] android.app.ActivityThread$H.handleMessage (ActivityThread.java:1,006) | |
| [8] android.os.Handler.dispatchMessage (Handler.java:99) | |
| [9] android.os.Looper.loop (Looper.java:130) | |
| [10] android.app.ActivityThread.main (ActivityThread.java:3,806) | |
| [11] java.lang.reflect.Method.invokeNative (native method) | |
| [12] java.lang.reflect.Method.invoke (Method.java:507) | |
| [13] com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:839) | |
| [14] com.android.internal.os.ZygoteInit.main (ZygoteInit.java:597) | |
| [15] dalvik.system.NativeStart.main (native method) | |
| <8> Binder Thread #2: | |
| [1] dalvik.system.NativeStart.run (native method) | |
| <7> Binder Thread #1: | |
| [1] dalvik.system.NativeStart.run (native method) | |
| <6> Compiler: | |
| [1] dalvik.system.NativeStart.run (native method) | |
| <4> Signal Catcher: | |
| [1] dalvik.system.NativeStart.run (native method) | |
| <3> GC: | |
| [1] dalvik.system.NativeStart.run (native method) | |
| <2> HeapWorker: | |
| [1] dalvik.system.NativeStart.run (native method) | |
| ---- |
I get:
Fabian@Fabian-PC ~
$ adb logcat -c
Fabian@Fabian-PC ~
$ adb logcat
--------- beginning of /dev/log/system
I/ActivityManager( 437): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.radgametools.examandroid/android.app.NativeActivity bnds=[173,34][290,151]} from pid 3032
--------- beginning of /dev/log/main
D/dalvikvm( 437): GC_FOR_ALLOC freed 359K, 27% free 16324K/22336K, paused 77ms, total 78ms
D/dalvikvm( 437): GC_FOR_ALLOC freed 314K, 28% free 16256K/22336K, paused 53ms, total 53ms
D/dalvikvm( 6188): Late-enabling CheckJNI
I/ActivityManager( 437): Start proc com.radgametools.examandroid for activity com.radgametools.examandroid/android.app.NativeActivity: pid=6188 uid=10069 gids={50069, 1028}
I/dalvikvm( 6188): Turning on JNI app bug workarounds for target SDK version 9...
W/ActivityThread( 6188): Application com.radgametools.examandroid is waiting for the debugger on port 8100...
I/System.out( 6188): Sending WAIT chunk
W/ActivityManager( 437): Launch timeout has expired, giving up wake lock!
W/ActivityManager( 437): Activity idle timeout for ActivityRecord{4216f2e8 u0 com.radgametools.examandroid/android.app.NativeActivity}
W/ActivityManager( 437): Force finishing activity com.radgametools.examandroid/android.app.NativeActivity
I/WindowManager( 437): Screenshot max retries 4 of Token{421e90e8 ActivityRecord{4216f2e8 u0 com.radgametools.examandroid/android.app.NativeActivity}} appWin=Window{42644ad8 u0 Starting com.radgametools.examandroid} drawState=4
W/WindowManager( 437): Screenshot failure taking screenshot for (1280x800) to layer 21020
I/ActivityManager( 437): Killing ProcessRecord{4261b998 6188:com.radgametools.examandroid/u0a10069}: user's request
I/ActivityManager( 437): Process com.radgametools.examandroid (pid 6188) has died.
W/InputMethodManagerService( 437): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@426e0420 attribute=null, token = android.os.BinderProxy@425b68f8
In the middle (where I inserted the blank lines), I did this in another terminal:
Fabian@Fabian-PC /cygdrive/c/devel/projects/bink/src/examples/android
$ /cygdrive/c/devel/libs/android/jdk/bin/jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8100
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at com.sun.tools.jdi.SocketTransportService.attach(SocketTransportService.java:222)
at com.sun.tools.jdi.GenericAttachingConnector.attach(GenericAttachingConnector.java:116)
at com.sun.tools.jdi.SocketAttachingConnector.attach(SocketAttachingConnector.java:90)
at com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:519)
at com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:328)
at com.sun.tools.example.debug.tty.Env.init(Env.java:63)
at com.sun.tools.example.debug.tty.TTY.main(TTY.java:1066)
Fatal error:
Unable to attach to target VM.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this:
09-24 20:15:26.378: W/ActivityThread(4799): Application com.example.nativemedia is waiting for the debugger on port 8100...