About Iris Shoor
With this post we’ll explore how Java / Scala debuggers are written and work. Native debuggers such WinDbg for Windows or gdb for Linux/Unix get their power from hooks provided to them directly by the OS to monitor and manipulate the state of an external process. The JVM, acting as an abstraction layer on top of the OS, provides its own independent architecture for debugging bytecode.
This framework and its APIs are completely open, documented and extensible, which means you can write you own debugger fairly easily. The framework’s current design is built out of two main parts – the JDWP protocol and the JVMTI API layer. Each has its own set of benefits and use-cases for which it works best.
The JDWP protocol
The Java Debugger Wire Protocol is used to pass requests and receive events (such as changes in thread states or exceptions) between the debugger and debuggee process using binary messages, usually over the network. The concept behind this architecture is to create as much separation as possible between the two. This is meant to reduce the Heisenberg effect (Werner the physicist that is, not your friendly Meth cooking
Source : http://www.javacodegeeks.com/2013/09/how-to-write-your-own-java-scala-debugger.html