jdb hanging problem

665 views
Skip to first unread message

Alexander Petukhov

unread,
Nov 30, 2011, 6:09:13 AM11/30/11
to android-platform
Hi,

I'm trying to attach jdb to adb on a device, manually from a command line,
actually I'm writing an IDE extension that does it.

Whats going on is calling "adb shell am start -D ...", looking for a
debug port, port redirecting with "adb forward ..."
and then - attaching jdb.

Breakpoints for now are taken from ".jdbrc".

And what is happening is jdb stops doing anything after giving messages
about deferred breaks,
right before the messages that say the breaks are set, that appear
afterwards when all is going in a right way.

calling "adb kill-server" before seems to elliminate a problem, but I'm
not sure.

Is that problem well-known, or it's kind of my interaction with jdb
related bug?

By the way, does anybody know, is it possible not to start debugging
instantly after attaching to be able to set breaks manually and
not to use ".jdbrc".

System I'm on is Debian stable.


Thank you,
Alexander Petukhov

freakingtux

unread,
Dec 2, 2011, 4:08:15 PM12/2/11
to android-...@googlegroups.com
Hi,


On Wednesday, November 30, 2011 12:09:13 PM UTC+1, Alexander Petukhov wrote:
Hi,

I'm trying to attach jdb to adb on a device, manually from a command line,
actually I'm writing an IDE extension that does it.

Whats going on is calling "adb shell am start -D ...", looking for a
debug port, port redirecting with "adb forward ..."
and then -  attaching jdb.

I regularly use
adb shell ps (to get the process I  want to debug)
adb forward tcp:5005 jdwp:$pid
jdb  -attach localhost:5005 (or or actually I use my ide) so I am quite sure this all works pretty well.

For the system server this looks like this

kejo@kejo-fakedistro:~/projects/android-gingerbread$ jdb  -attach localhost:5005
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
>  threads
Group system:
  (java.lang.Thread)0xc14050a4b8                                                          <6> Compiler                              cond. waiting
  (java.lang.Thread)0xc14050a348                                                          <4> Signal Catcher                        cond. waiting
  (java.lang.Thread)0xc14050a2a0                                                          <3> GC                                    cond. waiting
  (java.lang.Thread)0xc14050a1e8                                                          <2> HeapWorker                            cond. waiting
Group main:
....
...
...

Perhaps you can start by reading this blog post.
http://asantoso.wordpress.com/2009/09/26/using-jdb-with-adb-to-debugging-of-android-app-on-a-real-device/


Breakpoints for now are taken from ".jdbrc".

And what is happening is jdb stops doing anything after giving messages
about deferred breaks,

I am just guessing here but perhaps that due to the -D flag you application gets started suspended (to make it possible to perform early debug) and you therefore need to call resume in the debugger to start the application.

Greetings

Alexander Petukhov

unread,
Dec 8, 2011, 2:41:11 AM12/8/11
to android-...@googlegroups.com
30.11.2011 15:09, Alexander Petukhov пишет:
Can anybody please point where I can find Dalvik JDWP protocol
specification?
There is one on oracle.com but it seems too general, I've read it and
didn't get clear how to work with stepping
through code and some other stuff.
If there are sources of any kind where JDWP interaction is happenning, I
would also be thankfull for such links.

Regards, Alexander

Glenn Kasten

unread,
Dec 9, 2011, 10:45:08 AM12/9/11
to android-platform
dalvik/docs/debug*
dalvik/vm/jdwp/
Reply all
Reply to author
Forward
0 new messages