0

The Eclipse debugger still works for Android applications. This makes me wonder how this debugger is actually implemented. Is it implemented separately for DVM and JVM, or is there some common interface where people can get heap and stack information? I'm trying to find a programmable interface for me to get a heap snapshot of an Android application.

trincot
  • 317,000
  • 35
  • 244
  • 286
Wei Yang
  • 895
  • 3
  • 15
  • 26
  • Functionality like this is provided in the android.os.Debug class (http://developer.android.com/reference/android/os/Debug.html). – dacongy Jan 28 '13 at 06:49

1 Answers1

0

Eclipse supports a debugging architecture called "Java Platform Developer Architecture" (JPDA) and as part of that supports a remote debugging infrastructure like JDWP (Java Debug Wire Protocol). Refer to http://www.ibm.com/developerworks/java/library/os-eclipse-javadebug/index.html for more details about this.

Android implements the JDWP (apps started with debug on Android have a JDWP thread instantiated, which listens on a particular port) protocol and thats what Eclipse is able to use to debug Android apps.

Not sure if you can use the JDWP protocol To take heapdumps, but you can use the 'am' command to 'programmatically' trigger a heapdump.

Here is an example of using the command from the adb shell

$ adb shell am

or an app could exec 'am' and trigger a heap-dump.

Hope this helps.