Jdivisitor
Java library for building custom debugger applications using the Java Debug Interface (JDI) and the visitor design pattern
Install / Use
/learn @adrianherrera/JdivisitorREADME
JDIVisitor
JDIVisitor is a Java library for building custom debugger applications using the Java Debug Interface (JDI) and the visitor design pattern. It draws inspiration from jfager's jdiscript project. However, JDIVisitor eschews jdiscript's script-like design in favour of a more Java-esque library. An advantage of using the visitor pattern is that the visitor object can encapsulate and maintain state as it handles JDI events, allowing for complex debugger applications to be constructed.
License
GNU GPL v2.0
Usage
The following steps can be used to create your custom debugger application:
- Implement an
EventRequestorclass that requests specific JDI events that will be handled by your debugger - Implement an
EventVisitorclass that describes how to handle the JDI events enabled in Step 1 - Connect to the target virtual machine using either the
LocalVMLauncherclass (creates and starts a local virtual machine in debug mode) or theRemoteVMConnectorclass (attach to a virtual machine already running in debug mode over a network). Note that using theRemoteVMConnectorand an appropriately-configured sandbox is the safer choice if you are working with malicious Java applications - Instantiate a
Debuggerobject using theVirtualMachineobject returned from Step 3 - Call the debugger's
requestEventsmethod with theEventRequestorimplemented in Step 1 - Call the debugger's
runmethod with theEventVisitorimplemented in Step 2
Examples
See https://github.com/adrianherrera/jdivisitor-examples.
