Author Topic: Problems debugging android app - debugger keeps disconnecting  (Read 4389 times)

louisg

  • Community Member
  • Posts: 8
  • Hero Points: 0
Problems debugging android app - debugger keeps disconnecting
« on: February 03, 2014, 08:47:52 pm »
I'm running SE 18.0.1.2 x64.  I have an Android app that I built and would like to debug using the debugger in SE.  I start the DDM and then connect to the right port in the Java Virtual Machine debugger.  Things seem to go fine for a bit - I can set a breakpoint, step around, but that doesn't seem to last long (a few minutes?).

What happens is I notice the debug icon in the DDM disappear, and then when I try to do something with the SE debugger it says, for example: "Error stepping: Connection aborted"  I can reconnect and it does reconnect, but soon the same thing happens again.

Seems like the debugger is getting disconnected, but I'm not sure why.  Any thoughts on how I might figure out what's going on?

Thanks!

louisg

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #1 on: February 03, 2014, 09:28:33 pm »
More info:

See this in the DDM log right before it disconnects:

02-03 13:16:42.766: E/jdwp(7913): REQ: UNSUPPORTED (cmd=1/15 dataLen=0 id=0x000f34)
02-03 13:16:42.806: E/jdwp(7913): REQ: UNSUPPORTED (cmd=1/16 dataLen=0 id=0x000f54)
02-03 13:16:42.806: E/jdwp(7913): REQ: UNSUPPORTED (cmd=1/15 dataLen=0 id=0x000f56)
02-03 13:16:42.846: E/jdwp(7913): REQ: UNSUPPORTED (cmd=1/16 dataLen=0 id=0x000f76)

Then right after that I see:

Fatal signal 11 (SIGSEGV) at 0x00000008 (code=1), thread 7918 (JDWP )

Is the SE debugger using commands that Dalvik doesn't support?

From the JDWP docs this looks like the commands: HoldEvents / ReleaseEvents.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 917
  • Hero Points: 62
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #2 on: February 03, 2014, 10:13:48 pm »
Curious.  Looks like Dalvik doesn't implement those.  I wouldn't have thought from our code that it would have been a problem, but I'll see if I can reproduce it.

If I can't reproduce it, I'll have you try to reproduce the problem with core dumps enabled, so we can hopefully catch a useful dump of the crash.

louisg

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #3 on: February 03, 2014, 10:50:11 pm »
Thanks - just let me know and I'll be happy to grab whatever you need.

Oh, and in case it wasn't clear, the SIGSEGV isn't from SE; that's happening on the android target device.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 917
  • Hero Points: 62
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #4 on: February 04, 2014, 04:00:43 pm »
I did miss that.

I haven't gotten it to happen with my phone using just some simple example apps, and DDM 22.3, platform tools v19.  I see the same log entries with the unhandled HoldEvents and ReleaseEvents commands, but no crashes. 

Looked at the dalvik JdwpHandler.cpp really quickly, those methods are commented out in the handler table.  All it does it send back a response with a "not implemented" error code, which we seem to be receiving on our end. If there's anything that can screw it up on that end, it's not obvious to me.

One thing we can try is turning on SlickEdit's logging of the JDWP commands, to see if there's anything odd or common to the commands we're sending just before the target goes down.  In slickedit, before the debugger is attached, go to the command line and type: set-var def_debug_logging 1  Then attach to DDM as you normally would, and reproduce the problem a couple of times.  Then detach from the debugger.  The log file is $SLICKEDITCONFIG/18.0.1/logs/debug.log (where SLICKEDITCONFIG is probably $HOME/.slickedit on your system).  It's will probably be big, so compress it, and then go to http://support.slickedit.com to upload it, just enter the case as android_ddm.  And then post to let me know it's there.

louisg

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #5 on: February 04, 2014, 04:10:18 pm »
OK, will do when I get to work shortly.  For reference, I was able to debug the same app with Eclipse and it worked fine - no debugger disconnect (I'll check today if there is still a SIGSEGV with Eclipse debugging).

But, I've been using SE for 17 years now for everything from drivers in C to PHP code for websites.  I'm a confirmed SE addict.  Eclipse gives me a rash. ;)

louisg

  • Community Member
  • Posts: 8
  • Hero Points: 0
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #6 on: February 04, 2014, 08:10:08 pm »
Debug log sent - I repro'ed it three times.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 917
  • Hero Points: 62
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #7 on: February 05, 2014, 02:15:04 pm »
I received them, looking at them more this morning.  There does seem to be some sort of pattern, so that's hopeful.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 917
  • Hero Points: 62
Re: Problems debugging android app - debugger keeps disconnecting
« Reply #8 on: February 05, 2014, 05:11:56 pm »
Reproduced it.  I've got a test fix; if you want to try it out and see if there are any further problems, PM me with an email address to send the executable to.