top of page
Search

GSoC'18 Week 1

Writer: Manav JainManav Jain

Updated: Jul 19, 2018



This week my goal was to develop a prototype debugger that establishes a connection with the running android device and watch a variable.


The java mode of the PDE already has a debugger built for it that uses the JDI (Java Debugger Interface) package present in the ECJ (Eclipse Compiler for Java). After having a read and understanding the code for the debugger I came to a conclusion that this code can be reused for the android-mode Debugger with the changes being in the code to connect to the running device. Android devices are also Java Virtual Machines (JVM) so I could achieve this by using JPDA.


Steps followed to establish a connection :

  1. Run a debuggable application on android device

  2. Connect it using Android Debug Bridge (ADB)

  3. Forward the application to a specific TCP port using its JDWP port

  4. Connect to this port using the JDI classes and connectors (Socket Attaching)'

Once the connection was established I proceeded to the next goal -> Adding a watch i.e. listening to changes in the value of any variable in the debuggable code.


Steps for adding a watch :

  1. Use EventRequestManager class to add a ClassWatch and a FieldWatch

  2. Check for useful events in a thread. If a WatchPoint event is encountered a log is displayed

With this the prototype debugger is complete and running.


Github link : https://github.com/manav-mj/DebuggerTest


Reference :

~ http://illegalargumentexception.blogspot.com/2009/03/java-using-jpda-to-write-debugger.html

~ http://www2.sys-con.com/itsg/virtualcd/java/archives/0603/loton/index.html#s1



Comments


bottom of page