├── .gitignore ├── LICENSE.txt ├── README.md ├── build.gradle ├── example ├── build.gradle └── src │ └── main │ └── java │ └── org │ └── jdiscript │ └── example │ ├── ConnectorInspector.java │ ├── ConstructorWatchExample.java │ ├── ContentionPrinter.java │ ├── ContentionReporter.java │ ├── HelloWorld.java │ ├── HelloWorldExample.java │ ├── JustIterators.java │ ├── StacktraceHistogram.java │ └── StringReporter.java ├── generator ├── build.gradle └── src │ └── main │ └── java │ └── org │ └── jdiscript │ └── generator │ └── ChainingRequestGenerator.java ├── gradle.properties ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jdiscript ├── build.gradle └── src │ └── main │ └── java │ └── org │ └── jdiscript │ ├── JDIScript.java │ ├── events │ ├── DebugEventDispatcher.java │ ├── EventThread.java │ └── UnhandledEventException.java │ ├── handlers │ ├── BaseEventHandler.java │ ├── DebugEventHandler.java │ ├── DebugLocatableHandler.java │ ├── DebugWatchpointHandler.java │ ├── OnAccessWatchpoint.java │ ├── OnBreakpoint.java │ ├── OnClassPrepare.java │ ├── OnClassUnload.java │ ├── OnEvent.java │ ├── OnException.java │ ├── OnLocatable.java │ ├── OnMethodEntry.java │ ├── OnMethodExit.java │ ├── OnModificationWatchpoint.java │ ├── OnMonitorContendedEnter.java │ ├── OnMonitorContendedEntered.java │ ├── OnMonitorWait.java │ ├── OnMonitorWaited.java │ ├── OnStep.java │ ├── OnThreadDeath.java │ ├── OnThreadStart.java │ ├── OnVMDeath.java │ ├── OnVMDisconnect.java │ ├── OnVMStart.java │ ├── OnWatchpoint.java │ └── Once.java │ ├── requests │ ├── ChainingAccessWatchpointRequest.java │ ├── ChainingBreakpointRequest.java │ ├── ChainingClassPrepareRequest.java │ ├── ChainingClassUnloadRequest.java │ ├── ChainingExceptionRequest.java │ ├── ChainingMethodEntryRequest.java │ ├── ChainingMethodExitRequest.java │ ├── ChainingModificationWatchpointRequest.java │ ├── ChainingMonitorContendedEnterRequest.java │ ├── ChainingMonitorContendedEnteredRequest.java │ ├── ChainingMonitorWaitRequest.java │ ├── ChainingMonitorWaitedRequest.java │ ├── ChainingStepRequest.java │ ├── ChainingThreadDeathRequest.java │ ├── ChainingThreadStartRequest.java │ ├── ChainingVMDeathRequest.java │ └── ChainingWatchpointRequest.java │ └── util │ ├── StreamRedirectThread.java │ ├── Utils.java │ ├── VMLauncher.java │ ├── VMListener.java │ ├── VMProcessAttacher.java │ └── VMSocketAttacher.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | **/target 2 | **/build 3 | build.properties 4 | *.class 5 | .gradle 6 | *.iml 7 | **/src/generated 8 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | jdiscript is an elegant wrapper for a more civilized Java Debugger Interface. It allows you 2 | to write scripts that use the JDI to control and inspect almost anything happening inside a 3 | running JVM. Think of it as similar to [DTrace](http://dtrace.org/blogs/about/), but with 4 | more Java-specific flexibility and the ability to use a JVM language for scripting. 5 | 6 | Here's how you'd print out a stack trace any time a thread tried to enter a 7 | monitor already owned by another thread: 8 | 9 | ```java 10 | VirtualMachine vm = new VMSocketAttacher(12345).attach(); 11 | JDIScript j = new JDIScript(vm); 12 | 13 | j.monitorContendedEnterRequest(e -> { 14 | j.printTrace(e, "ContendedEnter for "+e.monitor()); 15 | }).enable(); 16 | 17 | j.run(); 18 | ``` 19 | 20 | For more, see the included [examples](src/example/java/org/jdiscript/example). 21 | 22 | jdiscript provides 23 | 24 | - An event loop that frees you from the details of managing [EventSets](http://download.java.net/jdk8/docs/jdk/api/jpda/jdi/index.html?com/sun/jdi/event/EventSet.html). 25 | 26 | - A set of [FunctionalInterfaces](http://download.java.net/jdk8/docs/api/java/lang/FunctionalInterface.html) 27 | so you can use lambdas. 28 | 29 | - Classes that handle the boilerplate of [launching](src/main/java/org/jdiscript/util/VMLauncher.java) or [attaching to](src/main/java/org/jdiscript/util/VMSocketAttacher.java) a [VirtualMachine](http://download.java.net/jdk8/docs/jdk/api/jpda/jdi/index.html?com/sun/jdi/VirtualMachine.html). 30 | 31 | - A [JDIScript class](src/main/java/org/jdiscript/JDIScript.java) that ties it all together and provides convenience methods for common script patterns. 32 | 33 | jdiscript was originally focused on providing an API that you would use from languages like 34 | Groovy, JRuby, or Clojure, under the belief that Java itself was too verbose for a nice 35 | scripting experience. With Java 8, this has changed, and straight Java is now compact enough 36 | that it might not be worth the overhead of switching to another language. All examples that 37 | ship with jdiscript have been converted to Java 8. 38 | 39 | Note: you need to have the jdk's tools.jar on your classpath in order to use the JDI. 40 | 41 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | apply plugin: 'java' 3 | 4 | sourceCompatibility = 1.8 5 | 6 | repositories { 7 | mavenCentral() 8 | } 9 | } 10 | 11 | 12 | -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':jdiscript') 3 | } 4 | 5 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/ConnectorInspector.java: -------------------------------------------------------------------------------- 1 | // Quick script to print out the Connector details for your JVM. 2 | package org.jdiscript.example; 3 | 4 | import com.sun.jdi.Bootstrap; 5 | import com.sun.jdi.VirtualMachineManager; 6 | 7 | class ConnectorInspector { 8 | public static void println(String s) { 9 | System.out.println(s); 10 | } 11 | 12 | public static void main(String[] args) { 13 | VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); 14 | 15 | vmm.allConnectors().forEach(c -> { 16 | println(c.name()+":"); 17 | println(" "+c.description()); 18 | c.defaultArguments().forEach((k, v) -> { 19 | println(" "+v.name()); 20 | println(" label: "+v.label()); 21 | println(" required: "+v.mustSpecify()); 22 | println(" default: "+v.value()); 23 | println(" desc: "+v.description()); 24 | }); 25 | println(""); 26 | }); 27 | 28 | println("Default Connector: "+vmm.defaultConnector().name()); 29 | } 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/ConstructorWatchExample.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | import static org.jdiscript.util.Utils.println; 4 | import static org.jdiscript.util.Utils.repeat; 5 | import static org.jdiscript.util.Utils.unchecked; 6 | 7 | import java.util.Stack; 8 | import java.util.function.Consumer; 9 | 10 | import org.jdiscript.JDIScript; 11 | import org.jdiscript.handlers.OnBreakpoint; 12 | import org.jdiscript.handlers.OnVMStart; 13 | import org.jdiscript.util.VMLauncher; 14 | 15 | import com.sun.jdi.Method; 16 | import com.sun.jdi.ReferenceType; 17 | 18 | class ConstructorWatchExample { 19 | 20 | String OPTIONS = "-cp ./build/classes/java/example/"; 21 | String MAIN = "org.jdiscript.example.HelloWorld"; 22 | 23 | JDIScript j = new JDIScript(new VMLauncher(OPTIONS, MAIN).start()); 24 | 25 | Stack stack = new Stack<>(); 26 | 27 | //This references itself and so the compiler complains "Cannot 28 | //reference a field before it is defined" if we try to initialize directly. 29 | OnBreakpoint breakpoint; { breakpoint = be -> { 30 | println(repeat(" ", stack.size()) + "new " + be.location().declaringType().name()); 31 | stack.push(be.location().method()); 32 | 33 | //We set breakpoints on every constructor but initially only 34 | //enabled them for ones we care about (those in the org.jdiscript 35 | //package), so we're somewhere inside the constructor call chain 36 | //of a constructor we care about. If we're in that initial constructor, 37 | //ensure that all of the other constructor breakpoints are enabled for 38 | //the current thread, and then disabled when the original method call exits. 39 | //Otherwise, just pop the constructor call off the stack when its done. 40 | if(stack.size() == 1) { 41 | j.breakpointRequests(breakpoint).stream() 42 | .filter(bpr -> !bpr.isEnabled()) 43 | .forEach(bpr -> { 44 | bpr.addThreadFilter(be.thread()); 45 | bpr.enable(); 46 | }); 47 | 48 | //Make sure that when we leave the interesting method call, we turn 49 | //all of the constructor breakpoints back off. 50 | unchecked(() -> j.onCurrentMethodExit(be.thread(), e -> { 51 | stack.pop(); 52 | if(stack.size() == 0) { 53 | j.breakpointRequests(breakpoint).forEach(bp -> 54 | bp.setEnabled(bp.location().declaringType().name().startsWith("org.jdiscript")) 55 | ); 56 | } 57 | })); 58 | } else { 59 | unchecked(() -> j.onCurrentMethodExit(be.thread(), e -> stack.pop())); 60 | } 61 | };} 62 | 63 | OnVMStart start = se -> { 64 | Consumer setConstructBrks = rt -> rt.methodsByName("").stream() 65 | .filter(m -> !m.location().declaringType().name().equals("java.lang.Object")) 66 | .forEach(m -> j.breakpointRequest(m.location(), breakpoint) 67 | .setEnabled(rt.name().startsWith("org.jdiscript"))); 68 | 69 | j.vm().allClasses().forEach(setConstructBrks); 70 | j.onClassPrep(cp -> setConstructBrks.accept(cp.referenceType())); 71 | }; 72 | 73 | public static void main(String[] args) { 74 | ConstructorWatchExample c = new ConstructorWatchExample(); 75 | c.j.run(c.start); 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/ContentionPrinter.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | import static org.jdiscript.util.Utils.println; 4 | 5 | import org.jdiscript.JDIScript; 6 | import org.jdiscript.handlers.OnVMStart; 7 | import org.jdiscript.util.VMSocketAttacher; 8 | 9 | import com.sun.jdi.VirtualMachine; 10 | 11 | class ContentionPrinter { 12 | public static void main(String[] args) { 13 | VirtualMachine vm = new VMSocketAttacher(12345).attach(); 14 | JDIScript j = new JDIScript(vm); 15 | 16 | j.monitorContendedEnterRequest(e -> j.printTrace(e, "ContendedEnter for "+e.monitor())).enable(); 17 | 18 | j.monitorContendedEnteredRequest(e -> { 19 | long timestamp = System.currentTimeMillis(); 20 | println(timestamp+": "+e.thread()+": ContendedEntered for "+e.monitor()); 21 | }).enable(); 22 | 23 | j.run((OnVMStart) e -> println("Got StartEvent")); 24 | 25 | println("Shutting down"); 26 | } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/ContentionReporter.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | import static org.jdiscript.util.Utils.println; 4 | import static org.jdiscript.util.Utils.unchecked; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | import java.util.function.BiFunction; 9 | 10 | import org.jdiscript.JDIScript; 11 | import org.jdiscript.handlers.OnMonitorContendedEnter; 12 | import org.jdiscript.util.VMSocketAttacher; 13 | 14 | import com.sun.jdi.ObjectReference; 15 | import com.sun.jdi.ThreadReference; 16 | import com.sun.jdi.VirtualMachine; 17 | 18 | class ContentionReporter { 19 | 20 | public static void main(String[] args) { 21 | VirtualMachine vm = new VMSocketAttacher(12345).attach(); 22 | JDIScript j = new JDIScript(vm); 23 | BiFunction add = (v1,v2) -> v1+v2; 24 | 25 | class ContentionTracker { 26 | int counter = 0; 27 | Map monitorIds = new HashMap<>(); 28 | Map callers = new HashMap<>(); 29 | Map threads = new HashMap<>(); 30 | } 31 | 32 | Map contended = new HashMap<>(); 33 | 34 | OnMonitorContendedEnter monitorContendedEnter = e -> { 35 | ThreadReference tref = e.thread(); 36 | ObjectReference mref = e.monitor(); 37 | 38 | ContentionTracker t = contended.computeIfAbsent(e.location().toString(), 39 | k -> new ContentionTracker()); 40 | 41 | unchecked(() -> { 42 | t.counter += 1; 43 | t.monitorIds.merge(mref.uniqueID(), 1, add); 44 | t.callers.merge(tref.frame(1).location().toString(), 1, add); 45 | t.threads.merge(tref.name() + tref.uniqueID(), 1, add); 46 | }); 47 | }; 48 | 49 | j.monitorContendedEnterRequest().addHandler(monitorContendedEnter).enable(); 50 | j.run(); 51 | 52 | println("Contention info:"); 53 | contended.forEach((k,v) -> { 54 | println("Location: "+k+", Hits: "+v.counter); 55 | println("\tCallers: "+v.callers); 56 | println("\tThreads: "+v.threads); 57 | println("\tMonitorIds: "+v.monitorIds); 58 | }); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | //A test class you can use for simple debugging scripts. 4 | public class HelloWorld { 5 | private String helloTo; 6 | 7 | public HelloWorld() { 8 | this("World"); 9 | } 10 | 11 | public HelloWorld(String helloTo) { 12 | this.helloTo = helloTo; 13 | } 14 | 15 | public HelloWorld(String helloTo, String helloAnd) { 16 | this(helloTo + " and " + helloAnd); 17 | } 18 | 19 | public String sayHello() { 20 | return "Hello, " + helloTo; 21 | } 22 | 23 | public void setHelloTo(String helloTo) { 24 | this.helloTo = helloTo; 25 | } 26 | 27 | public static void main(String[] args) { 28 | HelloWorld hello; 29 | 30 | hello = new HelloWorld(); 31 | System.out.println(hello.sayHello()); 32 | System.out.println(hello.sayHello()); 33 | hello.setHelloTo("Barney"); 34 | System.out.println(hello.sayHello()); 35 | System.out.println(hello.sayHello()); 36 | 37 | hello = new HelloWorld("Fred", "Wilma"); 38 | System.out.println(hello.sayHello()); 39 | System.out.println(hello.sayHello()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/HelloWorldExample.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | import static org.jdiscript.util.Utils.unchecked; 4 | 5 | import org.jdiscript.JDIScript; 6 | import org.jdiscript.util.VMLauncher; 7 | 8 | public class HelloWorldExample { 9 | 10 | public static void main(final String[] args) { 11 | String OPTIONS = "-cp ./build/classes/java/example"; 12 | String MAIN = "org.jdiscript.example.HelloWorld"; 13 | 14 | JDIScript j = new JDIScript(new VMLauncher(OPTIONS, MAIN).start()); 15 | 16 | j.onFieldAccess("org.jdiscript.example.HelloWorld", "helloTo", e -> { 17 | j.onStepInto(e.thread(), j.once(se -> { 18 | unchecked(() -> e.object().setValue(e.field(), j.vm().mirrorOf("JDIScript!"))); 19 | })); 20 | }); 21 | 22 | j.run(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/JustIterators.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | import static org.jdiscript.util.Utils.println; 4 | 5 | import java.util.List; 6 | import org.jdiscript.JDIScript; 7 | import org.jdiscript.handlers.OnVMStart; 8 | import org.jdiscript.util.VMLauncher; 9 | 10 | import com.sun.jdi.ReferenceType; 11 | 12 | class JustIterators { 13 | 14 | static String OPTIONS = "-cp ./build/classes/java/example"; 15 | static String MAIN = "org.jdiscript.example.HelloWorld"; 16 | 17 | public static void main(String[] args) { 18 | JDIScript j = new JDIScript(new VMLauncher(OPTIONS, MAIN).start()); 19 | 20 | OnVMStart start = se -> { 21 | List rts = j.vm().classesByName("java.util.Iterator"); 22 | j.methodEntryRequest(me -> { 23 | println("Found Iterator: " + me.location().method().name() + " line " + me.location().lineNumber()); 24 | }).addClassFilter(rts.get(0)) 25 | .enable(); 26 | }; 27 | 28 | j.run(start); 29 | } 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/StacktraceHistogram.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | import static org.jdiscript.util.Utils.println; 4 | import static org.jdiscript.util.Utils.unchecked; 5 | 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | import java.util.concurrent.atomic.AtomicLong; 10 | 11 | import org.jdiscript.JDIScript; 12 | import org.jdiscript.handlers.OnBreakpoint; 13 | import org.jdiscript.handlers.OnVMStart; 14 | import org.jdiscript.util.VMLauncher; 15 | 16 | import com.sun.jdi.IncompatibleThreadStateException; 17 | import com.sun.jdi.Location; 18 | import com.sun.jdi.StackFrame; 19 | import com.sun.jdi.ThreadReference; 20 | 21 | public class StacktraceHistogram { 22 | 23 | String OPTIONS = "-cp ./build/classes/java/example"; 24 | String MAIN = "org.jdiscript.example.HelloWorld"; 25 | 26 | JDIScript j = new JDIScript(new VMLauncher(OPTIONS, MAIN).start()); 27 | 28 | public String stacktraceKey(ThreadReference t) 29 | throws IncompatibleThreadStateException { 30 | StringBuilder sb = new StringBuilder(); 31 | for(StackFrame f: t.frames()) { 32 | Location loc = f.location(); 33 | sb.append(loc.declaringType().name()) 34 | .append(".").append(loc.method().name()) 35 | .append(loc.lineNumber()) 36 | .append(":"); 37 | } 38 | return sb.substring(0, sb.length() - 1); 39 | } 40 | 41 | final Map stacktraces = new HashMap<>(); 42 | 43 | OnBreakpoint breakpoint = be -> { 44 | ThreadReference tref = be.thread(); 45 | unchecked(() -> { 46 | String trace = stacktraceKey(tref); 47 | stacktraces.computeIfAbsent(trace, k -> new AtomicLong(0)) 48 | .incrementAndGet(); 49 | }); 50 | }; 51 | 52 | OnVMStart start = se -> { 53 | j.onClassPrep(p -> { 54 | if(p.referenceType().name().equals("org.jdiscript.example.HelloWorld")) { 55 | p.referenceType().methodsByName("sayHello").forEach(m -> { 56 | j.breakpointRequest(m.location(), breakpoint).enable(); 57 | }); 58 | } 59 | }); 60 | }; 61 | 62 | public static void main(String[] args) { 63 | StacktraceHistogram s = new StacktraceHistogram(); 64 | s.j.run(s.start); 65 | 66 | println("Histogram:"); 67 | s.stacktraces.entrySet().stream() 68 | .sorted((e1, e2) -> Long.compare(e2.getValue().get(), e1.getValue().get())) 69 | .forEach(e -> { 70 | println("Count: " + e.getValue() + ", Stacktrace: " + e.getKey()); 71 | }); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /example/src/main/java/org/jdiscript/example/StringReporter.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.example; 2 | 3 | import static org.jdiscript.util.Utils.println; 4 | import static org.jdiscript.util.Utils.unchecked; 5 | 6 | import java.util.HashMap; 7 | import java.util.HashSet; 8 | import java.util.Map; 9 | import java.util.Set; 10 | import java.util.function.BiFunction; 11 | 12 | import org.jdiscript.JDIScript; 13 | import org.jdiscript.handlers.OnBreakpoint; 14 | import org.jdiscript.handlers.OnVMStart; 15 | import org.jdiscript.util.VMLauncher; 16 | 17 | import com.sun.jdi.IncompatibleThreadStateException; 18 | import com.sun.jdi.Location; 19 | import com.sun.jdi.ObjectReference; 20 | import com.sun.jdi.StackFrame; 21 | import com.sun.jdi.ThreadReference; 22 | 23 | /** 24 | * One of the easiest ways to leech performance is by creating Strings 25 | * inefficiently. One example of this is creating multiple instances of the 26 | * same String, which you might do either because you're dealing with the 27 | * same input frequently (so caching might make sense) or because you're 28 | * creating a larger String from parts that get generated repeatedly (so 29 | * switching to StringBuilder might make sense). 30 | * 31 | * A profiler can easily show you that you're spending a lot of time building 32 | * Strings, but it can't show you what those Strings are. A heap dump can show 33 | * you Strings that are resident in memory, but it's only a snapshot and may 34 | * miss Strings that are created and then quickly garbage collected, plus you 35 | * still have to write a script to analyze the heap dump. 36 | * 37 | * This example demonstrates how you can use jdiscript to track the counts 38 | * and partial call path for all the distinct Strings your program creates. 39 | * It also demonstrates a technique for limiting tracking scope to calls 40 | * from packages you control. 41 | */ 42 | class StringReporter { 43 | 44 | String OPTIONS = "-cp ./build/classes/java/example"; 45 | String MAIN = "org.jdiscript.example.HelloWorld"; 46 | 47 | JDIScript j = new JDIScript(new VMLauncher(OPTIONS, MAIN).start()); 48 | BiFunction add = (v1,v2) -> v1+v2; 49 | 50 | public Location nearestCaller(String pkg, ThreadReference t) 51 | throws IncompatibleThreadStateException { 52 | for(StackFrame f: t.frames()) { 53 | Location loc = f.location(); 54 | if(loc.declaringType().name().startsWith(pkg)) { 55 | return loc; 56 | } 57 | } 58 | return null; 59 | } 60 | 61 | class StringStats { 62 | int counter = 0; 63 | Map callers = new HashMap<>(); 64 | } 65 | 66 | final Map strings = new HashMap<>(); 67 | final Set seenIds = new HashSet<>(); 68 | 69 | OnBreakpoint breakpoint; { breakpoint = be -> { 70 | ThreadReference tref = be.thread(); 71 | unchecked(() -> { 72 | Location pkgCaller = nearestCaller("org.jdiscript", tref); 73 | if(pkgCaller == null) { 74 | return; 75 | } 76 | final ObjectReference oref = tref.frame(0).thisObject(); 77 | //Some String constructors just delegate to another constructor. We don't 78 | //want to count that as two separate instances of the same String, so we 79 | //check that the ObjectRef's unique id hasn't been seen yet. 80 | if(seenIds.add(oref.uniqueID())) { 81 | //We broke on the String constructor, so the actual contents of 82 | //the String aren't set yet (if we called oref.toString() right now 83 | //we'd just get ""). We defer the stat collecting to the 84 | //constructor's exit so that we'll get the right value. 85 | // 86 | //A more efficient alternative might be to just set the initial 87 | //breakpoint on the constructor's exit, but in the case of delegating 88 | //constructors, that means the inner constructor would be the one 89 | //that 'wins', making the stack trace less informative. Trade-offs. 90 | j.onCurrentMethodExit(tref, ee -> { 91 | StringStats stats = strings.computeIfAbsent(oref.toString(), 92 | k -> new StringStats()); 93 | unchecked(() -> { 94 | stats.counter += 1; 95 | stats.callers.merge( 96 | pkgCaller.method()+"..."+tref.frame(1).location().method(), 97 | 1, add); 98 | }); 99 | }); 100 | } 101 | }); 102 | };} 103 | 104 | OnVMStart start = se -> { 105 | j.vm().classesByName("java.lang.String").forEach(rt -> 106 | rt.methodsByName("").forEach(m -> 107 | j.breakpointRequest(m.location(), breakpoint).enable() 108 | ) 109 | ); 110 | }; 111 | 112 | public static void main(String[] args) { 113 | StringReporter c = new StringReporter(); 114 | c.j.run(c.start); 115 | 116 | println("Strings:"); 117 | c.strings.forEach((k,v) -> { 118 | println("String: "+k+", Times created: "+v.counter); 119 | println("\tCallers: "+v.callers); 120 | }); 121 | } 122 | } 123 | 124 | -------------------------------------------------------------------------------- /generator/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile files("${System.properties['java.home']}/../lib/tools.jar") 3 | 4 | compile 'com.squareup:javapoet:1.11.1' 5 | compile 'io.github.classgraph:classgraph:4.8.58' 6 | } -------------------------------------------------------------------------------- /generator/src/main/java/org/jdiscript/generator/ChainingRequestGenerator.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.generator; 2 | 3 | import com.squareup.javapoet.ClassName; 4 | import com.squareup.javapoet.JavaFile; 5 | import com.squareup.javapoet.MethodSpec; 6 | import com.squareup.javapoet.TypeSpec; 7 | import io.github.classgraph.ClassGraph; 8 | import io.github.classgraph.ClassInfo; 9 | import io.github.classgraph.ScanResult; 10 | 11 | 12 | import javax.lang.model.element.Modifier; 13 | import java.io.File; 14 | import java.io.IOException; 15 | import java.lang.reflect.Method; 16 | import java.lang.reflect.Parameter; 17 | import java.util.StringJoiner; 18 | 19 | /** 20 | * Generates wrapper classes for EventRequests that allow for chainable method invocations. 21 | */ 22 | public class ChainingRequestGenerator { 23 | 24 | static final String JDI_REQUEST_PACKAGE = "com.sun.jdi.request"; 25 | static final String JDI_EVENT_REQUEST = JDI_REQUEST_PACKAGE + ".EventRequest"; 26 | 27 | static final String REQUESTS_PACKAGE = "org.jdiscript.requests"; 28 | static final String HANDLERS_PACKAGE = "org.jdiscript.handlers"; 29 | static final String EVENTS_PACKAGE = "org.jdiscript.events"; 30 | 31 | static final ClassName DEBUG_EVENT_DISPATCHER = ClassName.get(EVENTS_PACKAGE, "DebugEventDispatcher"); 32 | 33 | static final String WRAPPED = "wrapped"; 34 | static final String HANDLER = "handler"; 35 | 36 | static final File OUT_DIR = new File("./generator/src/generated/java"); 37 | 38 | void run() throws IOException { 39 | try (ScanResult scanResult = scanForJDIRequests()) { 40 | ClassInfo eventRequestInfo = scanResult.getClassInfo(JDI_EVENT_REQUEST); 41 | for (ClassInfo classInfo : scanResult.getAllInterfaces()) { 42 | if (!classInfo.equals(eventRequestInfo) && classInfo.getInterfaces().contains(eventRequestInfo)) { 43 | TypeSpec chainingRequestSpec = buildChainingRequest(classInfo.loadClass()); 44 | writeTypeSpecToDirectory(OUT_DIR, chainingRequestSpec); 45 | } 46 | } 47 | } 48 | } 49 | 50 | ScanResult scanForJDIRequests() { 51 | return new ClassGraph() 52 | .enableSystemJarsAndModules() 53 | //.verbose() 54 | .enableAllInfo() 55 | .whitelistPackages(JDI_REQUEST_PACKAGE) 56 | .scan(); 57 | } 58 | 59 | TypeSpec buildChainingRequest(Class classInfo) { 60 | String requestClass = classInfo.getSimpleName(); 61 | String eventClass = requestClass.substring(0, requestClass.lastIndexOf("Request")); 62 | ClassName eventHandlerClassName = ClassName.get(HANDLERS_PACKAGE, "On" + eventClass); 63 | ClassName chainingRequestClassName = ClassName.get(REQUESTS_PACKAGE, "Chaining" + requestClass); 64 | 65 | TypeSpec.Builder typeSpec = TypeSpec.classBuilder(chainingRequestClassName) 66 | .addModifiers(Modifier.PUBLIC) 67 | .addJavadoc("Generated chainable wrapper class for {@link $L}\n", classInfo.getCanonicalName()) 68 | .addField(classInfo, WRAPPED, Modifier.PRIVATE, Modifier.FINAL) 69 | .addMethod(MethodSpec.constructorBuilder() 70 | .addModifiers(Modifier.PUBLIC) 71 | .addParameter(classInfo, WRAPPED) 72 | .addStatement("this.$N = $N", WRAPPED, WRAPPED) 73 | .build()) 74 | .addMethod(MethodSpec.methodBuilder("addHandler") 75 | .returns(chainingRequestClassName) 76 | .addModifiers(Modifier.PUBLIC) 77 | .addParameter(eventHandlerClassName, HANDLER) 78 | .beginControlFlow("if ($N != null)", HANDLER) 79 | .addStatement("$T.addHandler($N, $N)", DEBUG_EVENT_DISPATCHER, WRAPPED, HANDLER) 80 | .endControlFlow() 81 | .addStatement("return this") 82 | .build()); 83 | 84 | for (Method method : classInfo.getMethods()) { 85 | typeSpec.addMethod(buildMethodSpec(method, chainingRequestClassName)); 86 | } 87 | 88 | return typeSpec.build(); 89 | } 90 | 91 | // If the method is void, return the ChainingRequest instead. 92 | // Otherwise, just delegate to the method. 93 | MethodSpec buildMethodSpec(Method method, ClassName chainingRequestClassName) { 94 | MethodSpec.Builder methodSpec = MethodSpec.methodBuilder(method.getName()) 95 | .addModifiers(Modifier.PUBLIC); 96 | 97 | StringJoiner callParams = new StringJoiner(", ", "(", ")"); 98 | StringJoiner javaDocParams = new StringJoiner(", ", "(", ")"); 99 | for (Parameter param: method.getParameters()) { 100 | methodSpec.addParameter(param.getParameterizedType(), param.getName()); 101 | callParams.add(param.getName()); 102 | String typeName = param.getParameterizedType().getTypeName(); 103 | javaDocParams.add(typeName); 104 | } 105 | 106 | methodSpec.addJavadoc("@see $T#$N$L\n", method.getDeclaringClass(), method.getName(), javaDocParams.toString()); 107 | 108 | for (Parameter param: method.getParameters()) { 109 | methodSpec.addJavadoc("@param $L Unable to match param name, positionally same as wrapped class.\n", param.getName()); 110 | } 111 | 112 | Class returnType = method.getReturnType(); 113 | if (void.class.equals(returnType)) { 114 | methodSpec.returns(chainingRequestClassName) 115 | .addJavadoc("@return This $T for chainable method calls\n", chainingRequestClassName) 116 | .addStatement("$N.$N$L", WRAPPED, method.getName(), callParams.toString()) 117 | .addStatement("return this"); 118 | 119 | } else { 120 | methodSpec.returns(returnType) 121 | .addJavadoc("@return The $T returned by the wrapped $T\n", returnType, method.getDeclaringClass()) 122 | .addStatement("return $N.$N$L", WRAPPED, method.getName(), callParams.toString()); 123 | } 124 | 125 | return methodSpec.build(); 126 | } 127 | 128 | void writeTypeSpecToDirectory(File outDir, TypeSpec typeSpec) throws IOException { 129 | JavaFile javaFile = JavaFile.builder(REQUESTS_PACKAGE, typeSpec).build(); 130 | javaFile.writeTo(outDir); 131 | } 132 | 133 | public static void main(String[] args) { 134 | ChainingRequestGenerator generator = new ChainingRequestGenerator(); 135 | try { 136 | generator.run(); 137 | } catch (IOException e) { 138 | throw new RuntimeException(e); 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | group=org.jdiscript 2 | archivesBaseName=jdiscript 3 | version=0.9.0 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Dec 20 13:15:45 CST 2019 2 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 3 | distributionBase=GRADLE_USER_HOME 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /jdiscript/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'maven' 2 | apply plugin: 'signing' 3 | 4 | dependencies { 5 | compile files("${System.properties['java.home']}/../lib/tools.jar") 6 | } 7 | 8 | task sourcesJar(type: Jar) { 9 | classifier = 'sources' 10 | from sourceSets.main.allSource 11 | } 12 | 13 | task javadocJar(type: Jar) { 14 | classifier = 'javadoc' 15 | from javadoc 16 | } 17 | 18 | artifacts { 19 | archives sourcesJar, javadocJar 20 | } 21 | 22 | signing { 23 | sign configurations.archives 24 | } 25 | 26 | uploadArchives { 27 | repositories { 28 | mavenDeployer { 29 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 30 | 31 | repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { 32 | authentication(userName: ossrhUsername, password: ossrhPassword) 33 | } 34 | 35 | snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { 36 | authentication(userName: ossrhUsername, password: ossrhPassword) 37 | } 38 | 39 | pom.project { 40 | name 'jdiscript' 41 | packaging 'jar' 42 | // optionally artifactId can be defined here 43 | description 'A scripting wrapper for the Java Debugger Interface' 44 | url 'https://github.com/jfager/jdiscript' 45 | 46 | scm { 47 | connection 'scm:git:git://github.com/jfager/jdiscript.git' 48 | developerConnection 'scm:git:ssh://github.com:jfager/jdiscript.git' 49 | url 'https://github.com/jfager/jdiscript/tree/master' 50 | } 51 | 52 | licenses { 53 | license { 54 | name 'The Apache License, Version 2.0' 55 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 56 | } 57 | } 58 | 59 | developers { 60 | developer { 61 | id 'jfager' 62 | name 'Jason Fager' 63 | email 'jfager@gmail.com' 64 | } 65 | } 66 | } 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/events/DebugEventDispatcher.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.events; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | import java.util.HashSet; 7 | import java.util.List; 8 | import java.util.Set; 9 | 10 | import org.jdiscript.handlers.DebugEventHandler; 11 | import org.jdiscript.handlers.OnAccessWatchpoint; 12 | import org.jdiscript.handlers.OnBreakpoint; 13 | import org.jdiscript.handlers.OnClassPrepare; 14 | import org.jdiscript.handlers.OnClassUnload; 15 | import org.jdiscript.handlers.OnEvent; 16 | import org.jdiscript.handlers.OnException; 17 | import org.jdiscript.handlers.OnLocatable; 18 | import org.jdiscript.handlers.OnMethodEntry; 19 | import org.jdiscript.handlers.OnMethodExit; 20 | import org.jdiscript.handlers.OnModificationWatchpoint; 21 | import org.jdiscript.handlers.OnMonitorContendedEnter; 22 | import org.jdiscript.handlers.OnMonitorContendedEntered; 23 | import org.jdiscript.handlers.OnMonitorWait; 24 | import org.jdiscript.handlers.OnMonitorWaited; 25 | import org.jdiscript.handlers.OnStep; 26 | import org.jdiscript.handlers.OnThreadDeath; 27 | import org.jdiscript.handlers.OnThreadStart; 28 | import org.jdiscript.handlers.OnVMDeath; 29 | import org.jdiscript.handlers.OnVMDisconnect; 30 | import org.jdiscript.handlers.OnVMStart; 31 | import org.jdiscript.handlers.OnWatchpoint; 32 | 33 | import com.sun.jdi.event.AccessWatchpointEvent; 34 | import com.sun.jdi.event.BreakpointEvent; 35 | import com.sun.jdi.event.ClassPrepareEvent; 36 | import com.sun.jdi.event.ClassUnloadEvent; 37 | import com.sun.jdi.event.Event; 38 | import com.sun.jdi.event.ExceptionEvent; 39 | import com.sun.jdi.event.LocatableEvent; 40 | import com.sun.jdi.event.MethodEntryEvent; 41 | import com.sun.jdi.event.MethodExitEvent; 42 | import com.sun.jdi.event.ModificationWatchpointEvent; 43 | import com.sun.jdi.event.MonitorContendedEnterEvent; 44 | import com.sun.jdi.event.MonitorContendedEnteredEvent; 45 | import com.sun.jdi.event.MonitorWaitEvent; 46 | import com.sun.jdi.event.MonitorWaitedEvent; 47 | import com.sun.jdi.event.StepEvent; 48 | import com.sun.jdi.event.ThreadDeathEvent; 49 | import com.sun.jdi.event.ThreadStartEvent; 50 | import com.sun.jdi.event.VMDeathEvent; 51 | import com.sun.jdi.event.VMDisconnectEvent; 52 | import com.sun.jdi.event.VMStartEvent; 53 | import com.sun.jdi.event.WatchpointEvent; 54 | import com.sun.jdi.request.EventRequest; 55 | 56 | 57 | public class DebugEventDispatcher { 58 | 59 | private static final String PROP_KEY = "JDISCRIPT_HANDLER"; 60 | 61 | @SuppressWarnings("unchecked") 62 | public static Set getHandlers(EventRequest er) { 63 | Set out = (Set)(er.getProperty(PROP_KEY)); 64 | return (out == null) ? Collections.emptySet() : out; 65 | } 66 | 67 | public static boolean addHandler(EventRequest er, DebugEventHandler handler) { 68 | Set handlers = getHandlers(er); 69 | if(handlers.isEmpty()) { 70 | handlers = new HashSet<>(); 71 | er.putProperty(PROP_KEY, handlers); 72 | } 73 | return handlers.add(handler); 74 | } 75 | 76 | private List handlers = new ArrayList<>(); 77 | 78 | public void addHandler(DebugEventHandler handler) { 79 | handlers.add(handler); 80 | } 81 | 82 | public void addHandlers(Collection handlers) { 83 | this.handlers.addAll(handlers); 84 | } 85 | 86 | public void dispatch(final Event event) { 87 | final EventRequest request = event.request(); 88 | if (request == null) { 89 | handlers.forEach(handler -> doVMEventDispatch(event, handler)); 90 | return; 91 | } 92 | 93 | final Set requestHandlers = getHandlers(request); 94 | 95 | if(requestHandlers == null) { 96 | throw new RuntimeException("No request handlers specified for event " 97 | + event); 98 | } 99 | 100 | requestHandlers.forEach(handler -> doFullDispatch(event, handler)); 101 | } 102 | 103 | // Events that have no corresponding request must be one of a smaller set 104 | // of VM events, handled here. 105 | private void doVMEventDispatch(Event event, DebugEventHandler handler) { 106 | if(event instanceof VMStartEvent && 107 | handler instanceof OnVMStart) { 108 | ((OnVMStart)handler).vmStart((VMStartEvent)event); 109 | } else if(event instanceof VMDisconnectEvent && 110 | handler instanceof OnVMDisconnect) { 111 | ((OnVMDisconnect)handler).vmDisconnect((VMDisconnectEvent)event); 112 | } else if(event instanceof VMDeathEvent && 113 | handler instanceof OnVMDeath) { 114 | ((OnVMDeath)handler).vmDeath((VMDeathEvent)event); 115 | } 116 | } 117 | 118 | public static void doFullDispatch(Event event, DebugEventHandler handler) { 119 | if(event instanceof BreakpointEvent && 120 | handler instanceof OnBreakpoint) { 121 | ((OnBreakpoint)handler).breakpoint((BreakpointEvent)event); 122 | } 123 | 124 | else if(event instanceof StepEvent && 125 | handler instanceof OnStep) { 126 | ((OnStep)handler).step((StepEvent)event); 127 | } 128 | 129 | else if(event instanceof ExceptionEvent && 130 | handler instanceof OnException) { 131 | ((OnException)handler).exception((ExceptionEvent)event); 132 | } 133 | 134 | //Method Events 135 | else if(event instanceof MethodEntryEvent && 136 | handler instanceof OnMethodEntry) { 137 | ((OnMethodEntry)handler).methodEntry((MethodEntryEvent)event); 138 | } else if(event instanceof MethodExitEvent && 139 | handler instanceof OnMethodExit) { 140 | ((OnMethodExit)handler).methodExit((MethodExitEvent)event); 141 | } 142 | 143 | //Monitor Events 144 | else if(event instanceof MonitorWaitEvent && 145 | handler instanceof OnMonitorWait) { 146 | ((OnMonitorWait)handler).monitorWait((MonitorWaitEvent)event); 147 | } else if(event instanceof MonitorWaitedEvent && 148 | handler instanceof OnMonitorWaited) { 149 | ((OnMonitorWaited)handler).monitorWaited((MonitorWaitedEvent)event); 150 | } else if(event instanceof MonitorContendedEnterEvent && 151 | handler instanceof OnMonitorContendedEnter) { 152 | ((OnMonitorContendedEnter)handler).monitorContendedEnter( 153 | (MonitorContendedEnterEvent)event); 154 | } else if(event instanceof MonitorContendedEnteredEvent && 155 | handler instanceof OnMonitorContendedEntered) { 156 | ((OnMonitorContendedEntered)handler).monitorContendedEntered( 157 | (MonitorContendedEnteredEvent)event); 158 | } 159 | 160 | //Watchpoint Events 161 | else if(event instanceof AccessWatchpointEvent && 162 | handler instanceof OnAccessWatchpoint) { 163 | ((OnAccessWatchpoint)handler).accessWatchpoint( 164 | (AccessWatchpointEvent)event); 165 | } else if(event instanceof ModificationWatchpointEvent && 166 | handler instanceof OnModificationWatchpoint) { 167 | ((OnModificationWatchpoint)handler).modificationWatchpoint( 168 | (ModificationWatchpointEvent)event); 169 | } 170 | 171 | //Threading Events 172 | else if(event instanceof ThreadStartEvent && 173 | handler instanceof OnThreadStart) { 174 | ((OnThreadStart)handler).threadStart((ThreadStartEvent)event); 175 | } else if(event instanceof ThreadDeathEvent && 176 | handler instanceof OnThreadDeath) { 177 | ((OnThreadDeath)handler).threadDeath((ThreadDeathEvent)event); 178 | } 179 | 180 | //Class Events 181 | else if(event instanceof ClassPrepareEvent && 182 | handler instanceof OnClassPrepare) { 183 | ((OnClassPrepare)handler).classPrepare((ClassPrepareEvent)event); 184 | } else if(event instanceof ClassUnloadEvent && 185 | handler instanceof OnClassUnload) { 186 | ((OnClassUnload)handler).classUnload((ClassUnloadEvent)event); 187 | } 188 | 189 | //VM Events 190 | else if(event instanceof VMStartEvent && 191 | handler instanceof OnVMStart) { 192 | ((OnVMStart)handler).vmStart((VMStartEvent)event); 193 | } else if(event instanceof VMDisconnectEvent && 194 | handler instanceof OnVMDisconnect) { 195 | ((OnVMDisconnect)handler).vmDisconnect((VMDisconnectEvent)event); 196 | } else if(event instanceof VMDeathEvent && 197 | handler instanceof OnVMDeath) { 198 | ((OnVMDeath)handler).vmDeath((VMDeathEvent)event); 199 | } 200 | 201 | //Catchalls 202 | else if(event instanceof WatchpointEvent && 203 | handler instanceof OnWatchpoint) { 204 | ((OnWatchpoint)handler).watchpoint((WatchpointEvent)event); 205 | } else if(event instanceof LocatableEvent && 206 | handler instanceof OnLocatable) { 207 | ((OnLocatable)handler).locatable((LocatableEvent)event); 208 | } else { 209 | ((OnEvent)handler).event(event); 210 | } 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/events/EventThread.java: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)EventThread.java 1.6 05/11/17 3 | * 4 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 5 | * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | /* 8 | * Copyright (c) 1997-2001 by Sun Microsystems, Inc. All Rights Reserved. 9 | * 10 | * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, 11 | * modify and redistribute this software in source and binary code form, 12 | * provided that i) this copyright notice and license appear on all copies of 13 | * the software; and ii) Licensee does not utilize the software in a manner 14 | * which is disparaging to Sun. 15 | * 16 | * This software is provided "AS IS," without a warranty of any kind. ALL 17 | * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY 18 | * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR 19 | * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE 20 | * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING 21 | * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS 22 | * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, 23 | * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER 24 | * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF 25 | * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGES. 27 | * 28 | * This software is not designed or intended for use in on-line control of 29 | * aircraft, air traffic, aircraft navigation or aircraft communications; or in 30 | * the design, construction, operation or maintenance of any nuclear 31 | * facility. Licensee represents and warrants that it will not use or 32 | * redistribute the Software for such purposes. 33 | */ 34 | 35 | package org.jdiscript.events; 36 | 37 | import com.sun.jdi.VMDisconnectedException; 38 | import com.sun.jdi.VirtualMachine; 39 | import com.sun.jdi.event.Event; 40 | import com.sun.jdi.event.EventIterator; 41 | import com.sun.jdi.event.EventQueue; 42 | import com.sun.jdi.event.EventSet; 43 | import com.sun.jdi.event.VMDeathEvent; 44 | import com.sun.jdi.event.VMDisconnectEvent; 45 | 46 | /** 47 | * This class processes incoming JDI events 48 | * 49 | * @version EventThread.java 1.6 05/11/17 04:47:11 50 | * @author Robert Field 51 | * @author Jason Fager 52 | */ 53 | public class EventThread extends Thread { 54 | 55 | private final VirtualMachine vm; // Running VM 56 | private final DebugEventDispatcher dispatcher; 57 | 58 | public EventThread( VirtualMachine vm, 59 | DebugEventDispatcher dispatcher ) 60 | { 61 | super("jdiscript-event-thread"); 62 | this.vm = vm; 63 | this.dispatcher = dispatcher; 64 | } 65 | 66 | /** 67 | * Run the event handling thread. As long as we are connected, get event 68 | * sets off the queue and dispatch the events within them. 69 | */ 70 | @Override 71 | public void run() { 72 | EventQueue queue = vm.eventQueue(); 73 | while (true) { 74 | try { 75 | EventSet eventSet = queue.remove(); 76 | EventIterator it = eventSet.eventIterator(); 77 | while (it.hasNext()) { 78 | dispatcher.dispatch(it.nextEvent()); 79 | } 80 | eventSet.resume(); 81 | } catch (InterruptedException exc) { 82 | vm.dispose(); 83 | break; 84 | } catch (VMDisconnectedException discExc) { 85 | handleDisconnectedException(); 86 | break; 87 | } 88 | } 89 | } 90 | 91 | 92 | // A VMDisconnectedException has happened while dealing with another event. 93 | // We need to flush the event queue, dealing only with exit events (VMDeath, 94 | // VMDisconnect) so that we terminate correctly. 95 | private void handleDisconnectedException() { 96 | EventQueue queue = vm.eventQueue(); 97 | boolean connected = true; 98 | while (connected) { 99 | try { 100 | EventSet eventSet = queue.remove(); 101 | EventIterator iter = eventSet.eventIterator(); 102 | while (iter.hasNext()) { 103 | Event event = iter.nextEvent(); 104 | if (event instanceof VMDeathEvent) { 105 | dispatcher.dispatch(event); 106 | } else if (event instanceof VMDisconnectEvent) { 107 | dispatcher.dispatch(event); 108 | connected = false; 109 | } 110 | } 111 | eventSet.resume(); // Resume the VM 112 | } catch (InterruptedException e) { 113 | vm.dispose(); 114 | break; 115 | } catch (VMDisconnectedException e) { 116 | break; 117 | } 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/events/UnhandledEventException.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.events; 2 | 3 | import com.sun.jdi.event.Event; 4 | 5 | public class UnhandledEventException extends RuntimeException { 6 | private static final long serialVersionUID = 20091001L; 7 | 8 | private final Event e; 9 | 10 | public UnhandledEventException(Event e) { 11 | super(); 12 | this.e = e; 13 | } 14 | 15 | public Event getEvent() { 16 | return this.e; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/BaseEventHandler.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import org.jdiscript.events.UnhandledEventException; 4 | 5 | import com.sun.jdi.VirtualMachine; 6 | import com.sun.jdi.event.*; 7 | 8 | /** 9 | * Each handler method for requested events delegates to unhandledEvent(), 10 | * which throws an UnhandledEventException. Handler methods for unrequested 11 | * events do nothing. 12 | * 13 | * This class is intended to be subclassed. 14 | * 15 | * @author jfager 16 | */ 17 | public class BaseEventHandler 18 | implements OnAccessWatchpoint, OnBreakpoint, OnClassPrepare, 19 | OnClassUnload, OnEvent, OnException, OnLocatable, 20 | OnMethodEntry, OnMethodExit, OnModificationWatchpoint, 21 | OnMonitorContendedEnter, OnMonitorContendedEntered, 22 | OnMonitorWait, OnMonitorWaited, OnStep, OnThreadDeath, 23 | OnThreadStart, OnVMDeath, OnVMDisconnect, OnVMStart, 24 | OnWatchpoint 25 | { 26 | 27 | private VirtualMachine vm; 28 | 29 | public void setVM(VirtualMachine vm) { 30 | this.vm = vm; 31 | } 32 | 33 | public VirtualMachine vm() { 34 | return vm; 35 | } 36 | 37 | public void notifySuspendPolicy(int suspendPolicy) { 38 | // do nothing 39 | } 40 | 41 | public void accessWatchpoint(AccessWatchpointEvent e) { 42 | unhandledEvent(e); 43 | } 44 | 45 | public void breakpoint(BreakpointEvent e) { 46 | unhandledEvent(e); 47 | } 48 | 49 | public void classPrepare(ClassPrepareEvent e) { 50 | unhandledEvent(e); 51 | } 52 | 53 | public void classUnload(ClassUnloadEvent e) { 54 | unhandledEvent(e); 55 | } 56 | 57 | public void event(Event e) { 58 | unhandledEvent(e); 59 | } 60 | 61 | public void exception(ExceptionEvent e) { 62 | unhandledEvent(e); 63 | } 64 | 65 | public void locatable(LocatableEvent e) { 66 | unhandledEvent(e); 67 | } 68 | 69 | public void methodEntry(MethodEntryEvent e) { 70 | unhandledEvent(e); 71 | } 72 | 73 | public void methodExit(MethodExitEvent e) { 74 | unhandledEvent(e); 75 | } 76 | 77 | public void modificationWatchpoint(ModificationWatchpointEvent e) { 78 | unhandledEvent(e); 79 | } 80 | 81 | public void monitorContendedEnter(MonitorContendedEnterEvent e) { 82 | unhandledEvent(e); 83 | } 84 | 85 | public void monitorContendedEntered(MonitorContendedEnteredEvent e){ 86 | unhandledEvent(e); 87 | } 88 | 89 | public void monitorWait(MonitorWaitEvent e) { 90 | unhandledEvent(e); 91 | } 92 | 93 | public void monitorWaited(MonitorWaitedEvent e) { 94 | unhandledEvent(e); 95 | } 96 | 97 | public void step(StepEvent e) { 98 | unhandledEvent(e); 99 | } 100 | 101 | public void threadDeath(ThreadDeathEvent e) { 102 | unhandledEvent(e); 103 | } 104 | 105 | public void threadStart(ThreadStartEvent e) { 106 | unhandledEvent(e); 107 | } 108 | 109 | public void vmDeath(VMDeathEvent e) { 110 | //do nothing 111 | } 112 | 113 | public void vmDisconnect(VMDisconnectEvent e) { 114 | //do nothing 115 | } 116 | 117 | public void vmStart(VMStartEvent e) { 118 | //do nothing 119 | } 120 | 121 | public void watchpoint(WatchpointEvent e) { 122 | unhandledEvent(e); 123 | } 124 | 125 | public void unhandledEvent( Event e ) { 126 | throw new UnhandledEventException(e); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/DebugEventHandler.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | public interface DebugEventHandler {} 4 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/DebugLocatableHandler.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | public interface DebugLocatableHandler extends DebugEventHandler {} 4 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/DebugWatchpointHandler.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | public interface DebugWatchpointHandler extends DebugLocatableHandler {} 4 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnAccessWatchpoint.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.AccessWatchpointEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnAccessWatchpoint extends DebugWatchpointHandler 7 | { 8 | void accessWatchpoint(AccessWatchpointEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnBreakpoint.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.BreakpointEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnBreakpoint extends DebugLocatableHandler 7 | { 8 | void breakpoint(BreakpointEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnClassPrepare.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.ClassPrepareEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnClassPrepare extends DebugEventHandler 7 | { 8 | void classPrepare(ClassPrepareEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnClassUnload.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.ClassUnloadEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnClassUnload extends DebugEventHandler 7 | { 8 | void classUnload(ClassUnloadEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnEvent.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.Event; 4 | 5 | @FunctionalInterface 6 | public interface OnEvent extends DebugEventHandler 7 | { 8 | void event(Event event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnException.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.ExceptionEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnException extends DebugLocatableHandler 7 | { 8 | void exception(ExceptionEvent e); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnLocatable.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.LocatableEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnLocatable extends DebugLocatableHandler 7 | { 8 | void locatable(LocatableEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnMethodEntry.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.MethodEntryEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnMethodEntry extends DebugLocatableHandler 7 | { 8 | void methodEntry(MethodEntryEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnMethodExit.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.MethodExitEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnMethodExit extends DebugLocatableHandler 7 | { 8 | void methodExit(MethodExitEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnModificationWatchpoint.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.ModificationWatchpointEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnModificationWatchpoint extends DebugWatchpointHandler 7 | { 8 | void modificationWatchpoint(ModificationWatchpointEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnMonitorContendedEnter.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.MonitorContendedEnterEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnMonitorContendedEnter extends DebugLocatableHandler 7 | { 8 | void monitorContendedEnter(MonitorContendedEnterEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnMonitorContendedEntered.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.MonitorContendedEnteredEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnMonitorContendedEntered extends DebugLocatableHandler 7 | { 8 | void monitorContendedEntered(MonitorContendedEnteredEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnMonitorWait.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.MonitorWaitEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnMonitorWait extends DebugLocatableHandler 7 | { 8 | void monitorWait(MonitorWaitEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnMonitorWaited.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.MonitorWaitedEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnMonitorWaited extends DebugLocatableHandler 7 | { 8 | void monitorWaited(MonitorWaitedEvent event); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnStep.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.StepEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnStep extends DebugLocatableHandler 7 | { 8 | void step(StepEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnThreadDeath.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.ThreadDeathEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnThreadDeath extends DebugEventHandler 7 | { 8 | void threadDeath(ThreadDeathEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnThreadStart.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.ThreadStartEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnThreadStart extends DebugEventHandler 7 | { 8 | void threadStart(ThreadStartEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnVMDeath.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.VMDeathEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnVMDeath extends DebugEventHandler 7 | { 8 | void vmDeath(VMDeathEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnVMDisconnect.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.VMDisconnectEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnVMDisconnect extends DebugEventHandler 7 | { 8 | void vmDisconnect(VMDisconnectEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnVMStart.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.VMStartEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnVMStart extends DebugEventHandler 7 | { 8 | void vmStart(VMStartEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/OnWatchpoint.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import com.sun.jdi.event.WatchpointEvent; 4 | 5 | @FunctionalInterface 6 | public interface OnWatchpoint extends DebugWatchpointHandler 7 | { 8 | void watchpoint(WatchpointEvent event); 9 | } 10 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/handlers/Once.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.handlers; 2 | 3 | import org.jdiscript.events.DebugEventDispatcher; 4 | 5 | import com.sun.jdi.event.Event; 6 | 7 | public class Once extends BaseEventHandler { 8 | private DebugEventHandler handler; 9 | public Once(DebugEventHandler handler) { 10 | this.handler = handler; 11 | } 12 | @Override 13 | public void unhandledEvent( Event e ) { 14 | DebugEventDispatcher.doFullDispatch(e, handler); 15 | e.request().disable(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingAccessWatchpointRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.Field; 4 | import com.sun.jdi.ObjectReference; 5 | import com.sun.jdi.ReferenceType; 6 | import com.sun.jdi.ThreadReference; 7 | import com.sun.jdi.VirtualMachine; 8 | import com.sun.jdi.request.AccessWatchpointRequest; 9 | import java.lang.Object; 10 | import java.lang.String; 11 | import org.jdiscript.events.DebugEventDispatcher; 12 | import org.jdiscript.handlers.OnAccessWatchpoint; 13 | 14 | /** 15 | * Generated chainable wrapper class for {@link AccessWatchpointRequest} 16 | */ 17 | public class ChainingAccessWatchpointRequest { 18 | private final AccessWatchpointRequest wrapped; 19 | 20 | public ChainingAccessWatchpointRequest(AccessWatchpointRequest wrapped) { 21 | this.wrapped = wrapped; 22 | } 23 | 24 | public ChainingAccessWatchpointRequest addHandler(OnAccessWatchpoint handler) { 25 | if (handler != null) { 26 | DebugEventDispatcher.addHandler(wrapped, handler); 27 | } 28 | return this; 29 | } 30 | 31 | /** 32 | * @see com.sun.jdi.request.WatchpointRequest#field() 33 | * @return The Field returned by the wrapped com.sun.jdi.request.WatchpointRequest 34 | */ 35 | public Field field() { 36 | return wrapped.field(); 37 | } 38 | 39 | /** 40 | * @see com.sun.jdi.request.WatchpointRequest#addThreadFilter(ThreadReference) 41 | * @param arg0 Unable to match param name, positionally same as wrapped class. 42 | * @return This ChainingAccessWatchpointRequest for chainable method calls 43 | */ 44 | public ChainingAccessWatchpointRequest addThreadFilter(ThreadReference arg0) { 45 | wrapped.addThreadFilter(arg0); 46 | return this; 47 | } 48 | 49 | /** 50 | * @see com.sun.jdi.request.WatchpointRequest#addClassFilter(String) 51 | * @param arg0 Unable to match param name, positionally same as wrapped class. 52 | * @return This ChainingAccessWatchpointRequest for chainable method calls 53 | */ 54 | public ChainingAccessWatchpointRequest addClassFilter(String arg0) { 55 | wrapped.addClassFilter(arg0); 56 | return this; 57 | } 58 | 59 | /** 60 | * @see com.sun.jdi.request.WatchpointRequest#addClassFilter(ReferenceType) 61 | * @param arg0 Unable to match param name, positionally same as wrapped class. 62 | * @return This ChainingAccessWatchpointRequest for chainable method calls 63 | */ 64 | public ChainingAccessWatchpointRequest addClassFilter(ReferenceType arg0) { 65 | wrapped.addClassFilter(arg0); 66 | return this; 67 | } 68 | 69 | /** 70 | * @see com.sun.jdi.request.WatchpointRequest#addClassExclusionFilter(String) 71 | * @param arg0 Unable to match param name, positionally same as wrapped class. 72 | * @return This ChainingAccessWatchpointRequest for chainable method calls 73 | */ 74 | public ChainingAccessWatchpointRequest addClassExclusionFilter(String arg0) { 75 | wrapped.addClassExclusionFilter(arg0); 76 | return this; 77 | } 78 | 79 | /** 80 | * @see com.sun.jdi.request.WatchpointRequest#addInstanceFilter(ObjectReference) 81 | * @param arg0 Unable to match param name, positionally same as wrapped class. 82 | * @return This ChainingAccessWatchpointRequest for chainable method calls 83 | */ 84 | public ChainingAccessWatchpointRequest addInstanceFilter(ObjectReference arg0) { 85 | wrapped.addInstanceFilter(arg0); 86 | return this; 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 93 | */ 94 | public Object getProperty(Object arg0) { 95 | return wrapped.getProperty(arg0); 96 | } 97 | 98 | /** 99 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 100 | * @param arg0 Unable to match param name, positionally same as wrapped class. 101 | * @return This ChainingAccessWatchpointRequest for chainable method calls 102 | */ 103 | public ChainingAccessWatchpointRequest addCountFilter(int arg0) { 104 | wrapped.addCountFilter(arg0); 105 | return this; 106 | } 107 | 108 | /** 109 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 110 | * @param arg0 Unable to match param name, positionally same as wrapped class. 111 | * @return This ChainingAccessWatchpointRequest for chainable method calls 112 | */ 113 | public ChainingAccessWatchpointRequest setSuspendPolicy(int arg0) { 114 | wrapped.setSuspendPolicy(arg0); 115 | return this; 116 | } 117 | 118 | /** 119 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 120 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 121 | */ 122 | public int suspendPolicy() { 123 | return wrapped.suspendPolicy(); 124 | } 125 | 126 | /** 127 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 128 | * @param arg0 Unable to match param name, positionally same as wrapped class. 129 | * @param arg1 Unable to match param name, positionally same as wrapped class. 130 | * @return This ChainingAccessWatchpointRequest for chainable method calls 131 | */ 132 | public ChainingAccessWatchpointRequest putProperty(Object arg0, Object arg1) { 133 | wrapped.putProperty(arg0, arg1); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#disable() 139 | * @return This ChainingAccessWatchpointRequest for chainable method calls 140 | */ 141 | public ChainingAccessWatchpointRequest disable() { 142 | wrapped.disable(); 143 | return this; 144 | } 145 | 146 | /** 147 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 148 | * @param arg0 Unable to match param name, positionally same as wrapped class. 149 | * @return This ChainingAccessWatchpointRequest for chainable method calls 150 | */ 151 | public ChainingAccessWatchpointRequest setEnabled(boolean arg0) { 152 | wrapped.setEnabled(arg0); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#enable() 158 | * @return This ChainingAccessWatchpointRequest for chainable method calls 159 | */ 160 | public ChainingAccessWatchpointRequest enable() { 161 | wrapped.enable(); 162 | return this; 163 | } 164 | 165 | /** 166 | * @see com.sun.jdi.request.EventRequest#isEnabled() 167 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 168 | */ 169 | public boolean isEnabled() { 170 | return wrapped.isEnabled(); 171 | } 172 | 173 | /** 174 | * @see com.sun.jdi.Mirror#toString() 175 | * @return The String returned by the wrapped com.sun.jdi.Mirror 176 | */ 177 | public String toString() { 178 | return wrapped.toString(); 179 | } 180 | 181 | /** 182 | * @see com.sun.jdi.Mirror#virtualMachine() 183 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 184 | */ 185 | public VirtualMachine virtualMachine() { 186 | return wrapped.virtualMachine(); 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingBreakpointRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.Location; 4 | import com.sun.jdi.ObjectReference; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.BreakpointRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnBreakpoint; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link BreakpointRequest} 15 | */ 16 | public class ChainingBreakpointRequest { 17 | private final BreakpointRequest wrapped; 18 | 19 | public ChainingBreakpointRequest(BreakpointRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingBreakpointRequest addHandler(OnBreakpoint handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see BreakpointRequest#location() 32 | * @return The Location returned by the wrapped BreakpointRequest 33 | */ 34 | public Location location() { 35 | return wrapped.location(); 36 | } 37 | 38 | /** 39 | * @see BreakpointRequest#addThreadFilter(ThreadReference) 40 | * @param arg0 Unable to match param name, positionally same as wrapped class. 41 | * @return This ChainingBreakpointRequest for chainable method calls 42 | */ 43 | public ChainingBreakpointRequest addThreadFilter(ThreadReference arg0) { 44 | wrapped.addThreadFilter(arg0); 45 | return this; 46 | } 47 | 48 | /** 49 | * @see BreakpointRequest#addInstanceFilter(ObjectReference) 50 | * @param arg0 Unable to match param name, positionally same as wrapped class. 51 | * @return This ChainingBreakpointRequest for chainable method calls 52 | */ 53 | public ChainingBreakpointRequest addInstanceFilter(ObjectReference arg0) { 54 | wrapped.addInstanceFilter(arg0); 55 | return this; 56 | } 57 | 58 | /** 59 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 60 | * @param arg0 Unable to match param name, positionally same as wrapped class. 61 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 62 | */ 63 | public Object getProperty(Object arg0) { 64 | return wrapped.getProperty(arg0); 65 | } 66 | 67 | /** 68 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 69 | * @param arg0 Unable to match param name, positionally same as wrapped class. 70 | * @return This ChainingBreakpointRequest for chainable method calls 71 | */ 72 | public ChainingBreakpointRequest addCountFilter(int arg0) { 73 | wrapped.addCountFilter(arg0); 74 | return this; 75 | } 76 | 77 | /** 78 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 79 | * @param arg0 Unable to match param name, positionally same as wrapped class. 80 | * @return This ChainingBreakpointRequest for chainable method calls 81 | */ 82 | public ChainingBreakpointRequest setSuspendPolicy(int arg0) { 83 | wrapped.setSuspendPolicy(arg0); 84 | return this; 85 | } 86 | 87 | /** 88 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 89 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 90 | */ 91 | public int suspendPolicy() { 92 | return wrapped.suspendPolicy(); 93 | } 94 | 95 | /** 96 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 97 | * @param arg0 Unable to match param name, positionally same as wrapped class. 98 | * @param arg1 Unable to match param name, positionally same as wrapped class. 99 | * @return This ChainingBreakpointRequest for chainable method calls 100 | */ 101 | public ChainingBreakpointRequest putProperty(Object arg0, Object arg1) { 102 | wrapped.putProperty(arg0, arg1); 103 | return this; 104 | } 105 | 106 | /** 107 | * @see com.sun.jdi.request.EventRequest#disable() 108 | * @return This ChainingBreakpointRequest for chainable method calls 109 | */ 110 | public ChainingBreakpointRequest disable() { 111 | wrapped.disable(); 112 | return this; 113 | } 114 | 115 | /** 116 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 117 | * @param arg0 Unable to match param name, positionally same as wrapped class. 118 | * @return This ChainingBreakpointRequest for chainable method calls 119 | */ 120 | public ChainingBreakpointRequest setEnabled(boolean arg0) { 121 | wrapped.setEnabled(arg0); 122 | return this; 123 | } 124 | 125 | /** 126 | * @see com.sun.jdi.request.EventRequest#enable() 127 | * @return This ChainingBreakpointRequest for chainable method calls 128 | */ 129 | public ChainingBreakpointRequest enable() { 130 | wrapped.enable(); 131 | return this; 132 | } 133 | 134 | /** 135 | * @see com.sun.jdi.request.EventRequest#isEnabled() 136 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 137 | */ 138 | public boolean isEnabled() { 139 | return wrapped.isEnabled(); 140 | } 141 | 142 | /** 143 | * @see com.sun.jdi.Mirror#toString() 144 | * @return The String returned by the wrapped com.sun.jdi.Mirror 145 | */ 146 | public String toString() { 147 | return wrapped.toString(); 148 | } 149 | 150 | /** 151 | * @see com.sun.jdi.Mirror#virtualMachine() 152 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 153 | */ 154 | public VirtualMachine virtualMachine() { 155 | return wrapped.virtualMachine(); 156 | } 157 | } 158 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingClassPrepareRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ReferenceType; 4 | import com.sun.jdi.VirtualMachine; 5 | import com.sun.jdi.request.ClassPrepareRequest; 6 | import java.lang.Object; 7 | import java.lang.String; 8 | import org.jdiscript.events.DebugEventDispatcher; 9 | import org.jdiscript.handlers.OnClassPrepare; 10 | 11 | /** 12 | * Generated chainable wrapper class for {@link ClassPrepareRequest} 13 | */ 14 | public class ChainingClassPrepareRequest { 15 | private final ClassPrepareRequest wrapped; 16 | 17 | public ChainingClassPrepareRequest(ClassPrepareRequest wrapped) { 18 | this.wrapped = wrapped; 19 | } 20 | 21 | public ChainingClassPrepareRequest addHandler(OnClassPrepare handler) { 22 | if (handler != null) { 23 | DebugEventDispatcher.addHandler(wrapped, handler); 24 | } 25 | return this; 26 | } 27 | 28 | /** 29 | * @see ClassPrepareRequest#addClassFilter(ReferenceType) 30 | * @param arg0 Unable to match param name, positionally same as wrapped class. 31 | * @return This ChainingClassPrepareRequest for chainable method calls 32 | */ 33 | public ChainingClassPrepareRequest addClassFilter(ReferenceType arg0) { 34 | wrapped.addClassFilter(arg0); 35 | return this; 36 | } 37 | 38 | /** 39 | * @see ClassPrepareRequest#addClassFilter(String) 40 | * @param arg0 Unable to match param name, positionally same as wrapped class. 41 | * @return This ChainingClassPrepareRequest for chainable method calls 42 | */ 43 | public ChainingClassPrepareRequest addClassFilter(String arg0) { 44 | wrapped.addClassFilter(arg0); 45 | return this; 46 | } 47 | 48 | /** 49 | * @see ClassPrepareRequest#addClassExclusionFilter(String) 50 | * @param arg0 Unable to match param name, positionally same as wrapped class. 51 | * @return This ChainingClassPrepareRequest for chainable method calls 52 | */ 53 | public ChainingClassPrepareRequest addClassExclusionFilter(String arg0) { 54 | wrapped.addClassExclusionFilter(arg0); 55 | return this; 56 | } 57 | 58 | /** 59 | * @see ClassPrepareRequest#addSourceNameFilter(String) 60 | * @param arg0 Unable to match param name, positionally same as wrapped class. 61 | * @return This ChainingClassPrepareRequest for chainable method calls 62 | */ 63 | public ChainingClassPrepareRequest addSourceNameFilter(String arg0) { 64 | wrapped.addSourceNameFilter(arg0); 65 | return this; 66 | } 67 | 68 | /** 69 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 70 | * @param arg0 Unable to match param name, positionally same as wrapped class. 71 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 72 | */ 73 | public Object getProperty(Object arg0) { 74 | return wrapped.getProperty(arg0); 75 | } 76 | 77 | /** 78 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 79 | * @param arg0 Unable to match param name, positionally same as wrapped class. 80 | * @return This ChainingClassPrepareRequest for chainable method calls 81 | */ 82 | public ChainingClassPrepareRequest addCountFilter(int arg0) { 83 | wrapped.addCountFilter(arg0); 84 | return this; 85 | } 86 | 87 | /** 88 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 89 | * @param arg0 Unable to match param name, positionally same as wrapped class. 90 | * @return This ChainingClassPrepareRequest for chainable method calls 91 | */ 92 | public ChainingClassPrepareRequest setSuspendPolicy(int arg0) { 93 | wrapped.setSuspendPolicy(arg0); 94 | return this; 95 | } 96 | 97 | /** 98 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 99 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 100 | */ 101 | public int suspendPolicy() { 102 | return wrapped.suspendPolicy(); 103 | } 104 | 105 | /** 106 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 107 | * @param arg0 Unable to match param name, positionally same as wrapped class. 108 | * @param arg1 Unable to match param name, positionally same as wrapped class. 109 | * @return This ChainingClassPrepareRequest for chainable method calls 110 | */ 111 | public ChainingClassPrepareRequest putProperty(Object arg0, Object arg1) { 112 | wrapped.putProperty(arg0, arg1); 113 | return this; 114 | } 115 | 116 | /** 117 | * @see com.sun.jdi.request.EventRequest#disable() 118 | * @return This ChainingClassPrepareRequest for chainable method calls 119 | */ 120 | public ChainingClassPrepareRequest disable() { 121 | wrapped.disable(); 122 | return this; 123 | } 124 | 125 | /** 126 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 127 | * @param arg0 Unable to match param name, positionally same as wrapped class. 128 | * @return This ChainingClassPrepareRequest for chainable method calls 129 | */ 130 | public ChainingClassPrepareRequest setEnabled(boolean arg0) { 131 | wrapped.setEnabled(arg0); 132 | return this; 133 | } 134 | 135 | /** 136 | * @see com.sun.jdi.request.EventRequest#enable() 137 | * @return This ChainingClassPrepareRequest for chainable method calls 138 | */ 139 | public ChainingClassPrepareRequest enable() { 140 | wrapped.enable(); 141 | return this; 142 | } 143 | 144 | /** 145 | * @see com.sun.jdi.request.EventRequest#isEnabled() 146 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 147 | */ 148 | public boolean isEnabled() { 149 | return wrapped.isEnabled(); 150 | } 151 | 152 | /** 153 | * @see com.sun.jdi.Mirror#toString() 154 | * @return The String returned by the wrapped com.sun.jdi.Mirror 155 | */ 156 | public String toString() { 157 | return wrapped.toString(); 158 | } 159 | 160 | /** 161 | * @see com.sun.jdi.Mirror#virtualMachine() 162 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 163 | */ 164 | public VirtualMachine virtualMachine() { 165 | return wrapped.virtualMachine(); 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingClassUnloadRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.VirtualMachine; 4 | import com.sun.jdi.request.ClassUnloadRequest; 5 | import java.lang.Object; 6 | import java.lang.String; 7 | import org.jdiscript.events.DebugEventDispatcher; 8 | import org.jdiscript.handlers.OnClassUnload; 9 | 10 | /** 11 | * Generated chainable wrapper class for {@link ClassUnloadRequest} 12 | */ 13 | public class ChainingClassUnloadRequest { 14 | private final ClassUnloadRequest wrapped; 15 | 16 | public ChainingClassUnloadRequest(ClassUnloadRequest wrapped) { 17 | this.wrapped = wrapped; 18 | } 19 | 20 | public ChainingClassUnloadRequest addHandler(OnClassUnload handler) { 21 | if (handler != null) { 22 | DebugEventDispatcher.addHandler(wrapped, handler); 23 | } 24 | return this; 25 | } 26 | 27 | /** 28 | * @see ClassUnloadRequest#addClassFilter(String) 29 | * @param arg0 Unable to match param name, positionally same as wrapped class. 30 | * @return This ChainingClassUnloadRequest for chainable method calls 31 | */ 32 | public ChainingClassUnloadRequest addClassFilter(String arg0) { 33 | wrapped.addClassFilter(arg0); 34 | return this; 35 | } 36 | 37 | /** 38 | * @see ClassUnloadRequest#addClassExclusionFilter(String) 39 | * @param arg0 Unable to match param name, positionally same as wrapped class. 40 | * @return This ChainingClassUnloadRequest for chainable method calls 41 | */ 42 | public ChainingClassUnloadRequest addClassExclusionFilter(String arg0) { 43 | wrapped.addClassExclusionFilter(arg0); 44 | return this; 45 | } 46 | 47 | /** 48 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 49 | * @param arg0 Unable to match param name, positionally same as wrapped class. 50 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 51 | */ 52 | public Object getProperty(Object arg0) { 53 | return wrapped.getProperty(arg0); 54 | } 55 | 56 | /** 57 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 58 | * @param arg0 Unable to match param name, positionally same as wrapped class. 59 | * @return This ChainingClassUnloadRequest for chainable method calls 60 | */ 61 | public ChainingClassUnloadRequest addCountFilter(int arg0) { 62 | wrapped.addCountFilter(arg0); 63 | return this; 64 | } 65 | 66 | /** 67 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 68 | * @param arg0 Unable to match param name, positionally same as wrapped class. 69 | * @return This ChainingClassUnloadRequest for chainable method calls 70 | */ 71 | public ChainingClassUnloadRequest setSuspendPolicy(int arg0) { 72 | wrapped.setSuspendPolicy(arg0); 73 | return this; 74 | } 75 | 76 | /** 77 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 78 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 79 | */ 80 | public int suspendPolicy() { 81 | return wrapped.suspendPolicy(); 82 | } 83 | 84 | /** 85 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 86 | * @param arg0 Unable to match param name, positionally same as wrapped class. 87 | * @param arg1 Unable to match param name, positionally same as wrapped class. 88 | * @return This ChainingClassUnloadRequest for chainable method calls 89 | */ 90 | public ChainingClassUnloadRequest putProperty(Object arg0, Object arg1) { 91 | wrapped.putProperty(arg0, arg1); 92 | return this; 93 | } 94 | 95 | /** 96 | * @see com.sun.jdi.request.EventRequest#disable() 97 | * @return This ChainingClassUnloadRequest for chainable method calls 98 | */ 99 | public ChainingClassUnloadRequest disable() { 100 | wrapped.disable(); 101 | return this; 102 | } 103 | 104 | /** 105 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 106 | * @param arg0 Unable to match param name, positionally same as wrapped class. 107 | * @return This ChainingClassUnloadRequest for chainable method calls 108 | */ 109 | public ChainingClassUnloadRequest setEnabled(boolean arg0) { 110 | wrapped.setEnabled(arg0); 111 | return this; 112 | } 113 | 114 | /** 115 | * @see com.sun.jdi.request.EventRequest#enable() 116 | * @return This ChainingClassUnloadRequest for chainable method calls 117 | */ 118 | public ChainingClassUnloadRequest enable() { 119 | wrapped.enable(); 120 | return this; 121 | } 122 | 123 | /** 124 | * @see com.sun.jdi.request.EventRequest#isEnabled() 125 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 126 | */ 127 | public boolean isEnabled() { 128 | return wrapped.isEnabled(); 129 | } 130 | 131 | /** 132 | * @see com.sun.jdi.Mirror#toString() 133 | * @return The String returned by the wrapped com.sun.jdi.Mirror 134 | */ 135 | public String toString() { 136 | return wrapped.toString(); 137 | } 138 | 139 | /** 140 | * @see com.sun.jdi.Mirror#virtualMachine() 141 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 142 | */ 143 | public VirtualMachine virtualMachine() { 144 | return wrapped.virtualMachine(); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingExceptionRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.ExceptionRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnException; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link ExceptionRequest} 15 | */ 16 | public class ChainingExceptionRequest { 17 | private final ExceptionRequest wrapped; 18 | 19 | public ChainingExceptionRequest(ExceptionRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingExceptionRequest addHandler(OnException handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see ExceptionRequest#exception() 32 | * @return The ReferenceType returned by the wrapped ExceptionRequest 33 | */ 34 | public ReferenceType exception() { 35 | return wrapped.exception(); 36 | } 37 | 38 | /** 39 | * @see ExceptionRequest#notifyCaught() 40 | * @return The boolean returned by the wrapped ExceptionRequest 41 | */ 42 | public boolean notifyCaught() { 43 | return wrapped.notifyCaught(); 44 | } 45 | 46 | /** 47 | * @see ExceptionRequest#notifyUncaught() 48 | * @return The boolean returned by the wrapped ExceptionRequest 49 | */ 50 | public boolean notifyUncaught() { 51 | return wrapped.notifyUncaught(); 52 | } 53 | 54 | /** 55 | * @see ExceptionRequest#addThreadFilter(ThreadReference) 56 | * @param arg0 Unable to match param name, positionally same as wrapped class. 57 | * @return This ChainingExceptionRequest for chainable method calls 58 | */ 59 | public ChainingExceptionRequest addThreadFilter(ThreadReference arg0) { 60 | wrapped.addThreadFilter(arg0); 61 | return this; 62 | } 63 | 64 | /** 65 | * @see ExceptionRequest#addClassFilter(String) 66 | * @param arg0 Unable to match param name, positionally same as wrapped class. 67 | * @return This ChainingExceptionRequest for chainable method calls 68 | */ 69 | public ChainingExceptionRequest addClassFilter(String arg0) { 70 | wrapped.addClassFilter(arg0); 71 | return this; 72 | } 73 | 74 | /** 75 | * @see ExceptionRequest#addClassFilter(ReferenceType) 76 | * @param arg0 Unable to match param name, positionally same as wrapped class. 77 | * @return This ChainingExceptionRequest for chainable method calls 78 | */ 79 | public ChainingExceptionRequest addClassFilter(ReferenceType arg0) { 80 | wrapped.addClassFilter(arg0); 81 | return this; 82 | } 83 | 84 | /** 85 | * @see ExceptionRequest#addClassExclusionFilter(String) 86 | * @param arg0 Unable to match param name, positionally same as wrapped class. 87 | * @return This ChainingExceptionRequest for chainable method calls 88 | */ 89 | public ChainingExceptionRequest addClassExclusionFilter(String arg0) { 90 | wrapped.addClassExclusionFilter(arg0); 91 | return this; 92 | } 93 | 94 | /** 95 | * @see ExceptionRequest#addInstanceFilter(ObjectReference) 96 | * @param arg0 Unable to match param name, positionally same as wrapped class. 97 | * @return This ChainingExceptionRequest for chainable method calls 98 | */ 99 | public ChainingExceptionRequest addInstanceFilter(ObjectReference arg0) { 100 | wrapped.addInstanceFilter(arg0); 101 | return this; 102 | } 103 | 104 | /** 105 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 106 | * @param arg0 Unable to match param name, positionally same as wrapped class. 107 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 108 | */ 109 | public Object getProperty(Object arg0) { 110 | return wrapped.getProperty(arg0); 111 | } 112 | 113 | /** 114 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 115 | * @param arg0 Unable to match param name, positionally same as wrapped class. 116 | * @return This ChainingExceptionRequest for chainable method calls 117 | */ 118 | public ChainingExceptionRequest addCountFilter(int arg0) { 119 | wrapped.addCountFilter(arg0); 120 | return this; 121 | } 122 | 123 | /** 124 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 125 | * @param arg0 Unable to match param name, positionally same as wrapped class. 126 | * @return This ChainingExceptionRequest for chainable method calls 127 | */ 128 | public ChainingExceptionRequest setSuspendPolicy(int arg0) { 129 | wrapped.setSuspendPolicy(arg0); 130 | return this; 131 | } 132 | 133 | /** 134 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 135 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 136 | */ 137 | public int suspendPolicy() { 138 | return wrapped.suspendPolicy(); 139 | } 140 | 141 | /** 142 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 143 | * @param arg0 Unable to match param name, positionally same as wrapped class. 144 | * @param arg1 Unable to match param name, positionally same as wrapped class. 145 | * @return This ChainingExceptionRequest for chainable method calls 146 | */ 147 | public ChainingExceptionRequest putProperty(Object arg0, Object arg1) { 148 | wrapped.putProperty(arg0, arg1); 149 | return this; 150 | } 151 | 152 | /** 153 | * @see com.sun.jdi.request.EventRequest#disable() 154 | * @return This ChainingExceptionRequest for chainable method calls 155 | */ 156 | public ChainingExceptionRequest disable() { 157 | wrapped.disable(); 158 | return this; 159 | } 160 | 161 | /** 162 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 163 | * @param arg0 Unable to match param name, positionally same as wrapped class. 164 | * @return This ChainingExceptionRequest for chainable method calls 165 | */ 166 | public ChainingExceptionRequest setEnabled(boolean arg0) { 167 | wrapped.setEnabled(arg0); 168 | return this; 169 | } 170 | 171 | /** 172 | * @see com.sun.jdi.request.EventRequest#enable() 173 | * @return This ChainingExceptionRequest for chainable method calls 174 | */ 175 | public ChainingExceptionRequest enable() { 176 | wrapped.enable(); 177 | return this; 178 | } 179 | 180 | /** 181 | * @see com.sun.jdi.request.EventRequest#isEnabled() 182 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 183 | */ 184 | public boolean isEnabled() { 185 | return wrapped.isEnabled(); 186 | } 187 | 188 | /** 189 | * @see com.sun.jdi.Mirror#toString() 190 | * @return The String returned by the wrapped com.sun.jdi.Mirror 191 | */ 192 | public String toString() { 193 | return wrapped.toString(); 194 | } 195 | 196 | /** 197 | * @see com.sun.jdi.Mirror#virtualMachine() 198 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 199 | */ 200 | public VirtualMachine virtualMachine() { 201 | return wrapped.virtualMachine(); 202 | } 203 | } 204 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingMethodEntryRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.MethodEntryRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnMethodEntry; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link MethodEntryRequest} 15 | */ 16 | public class ChainingMethodEntryRequest { 17 | private final MethodEntryRequest wrapped; 18 | 19 | public ChainingMethodEntryRequest(MethodEntryRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingMethodEntryRequest addHandler(OnMethodEntry handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see MethodEntryRequest#addThreadFilter(ThreadReference) 32 | * @param arg0 Unable to match param name, positionally same as wrapped class. 33 | * @return This ChainingMethodEntryRequest for chainable method calls 34 | */ 35 | public ChainingMethodEntryRequest addThreadFilter(ThreadReference arg0) { 36 | wrapped.addThreadFilter(arg0); 37 | return this; 38 | } 39 | 40 | /** 41 | * @see MethodEntryRequest#addClassFilter(String) 42 | * @param arg0 Unable to match param name, positionally same as wrapped class. 43 | * @return This ChainingMethodEntryRequest for chainable method calls 44 | */ 45 | public ChainingMethodEntryRequest addClassFilter(String arg0) { 46 | wrapped.addClassFilter(arg0); 47 | return this; 48 | } 49 | 50 | /** 51 | * @see MethodEntryRequest#addClassFilter(ReferenceType) 52 | * @param arg0 Unable to match param name, positionally same as wrapped class. 53 | * @return This ChainingMethodEntryRequest for chainable method calls 54 | */ 55 | public ChainingMethodEntryRequest addClassFilter(ReferenceType arg0) { 56 | wrapped.addClassFilter(arg0); 57 | return this; 58 | } 59 | 60 | /** 61 | * @see MethodEntryRequest#addClassExclusionFilter(String) 62 | * @param arg0 Unable to match param name, positionally same as wrapped class. 63 | * @return This ChainingMethodEntryRequest for chainable method calls 64 | */ 65 | public ChainingMethodEntryRequest addClassExclusionFilter(String arg0) { 66 | wrapped.addClassExclusionFilter(arg0); 67 | return this; 68 | } 69 | 70 | /** 71 | * @see MethodEntryRequest#addInstanceFilter(ObjectReference) 72 | * @param arg0 Unable to match param name, positionally same as wrapped class. 73 | * @return This ChainingMethodEntryRequest for chainable method calls 74 | */ 75 | public ChainingMethodEntryRequest addInstanceFilter(ObjectReference arg0) { 76 | wrapped.addInstanceFilter(arg0); 77 | return this; 78 | } 79 | 80 | /** 81 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 82 | * @param arg0 Unable to match param name, positionally same as wrapped class. 83 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 84 | */ 85 | public Object getProperty(Object arg0) { 86 | return wrapped.getProperty(arg0); 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return This ChainingMethodEntryRequest for chainable method calls 93 | */ 94 | public ChainingMethodEntryRequest addCountFilter(int arg0) { 95 | wrapped.addCountFilter(arg0); 96 | return this; 97 | } 98 | 99 | /** 100 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 101 | * @param arg0 Unable to match param name, positionally same as wrapped class. 102 | * @return This ChainingMethodEntryRequest for chainable method calls 103 | */ 104 | public ChainingMethodEntryRequest setSuspendPolicy(int arg0) { 105 | wrapped.setSuspendPolicy(arg0); 106 | return this; 107 | } 108 | 109 | /** 110 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 111 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 112 | */ 113 | public int suspendPolicy() { 114 | return wrapped.suspendPolicy(); 115 | } 116 | 117 | /** 118 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 119 | * @param arg0 Unable to match param name, positionally same as wrapped class. 120 | * @param arg1 Unable to match param name, positionally same as wrapped class. 121 | * @return This ChainingMethodEntryRequest for chainable method calls 122 | */ 123 | public ChainingMethodEntryRequest putProperty(Object arg0, Object arg1) { 124 | wrapped.putProperty(arg0, arg1); 125 | return this; 126 | } 127 | 128 | /** 129 | * @see com.sun.jdi.request.EventRequest#disable() 130 | * @return This ChainingMethodEntryRequest for chainable method calls 131 | */ 132 | public ChainingMethodEntryRequest disable() { 133 | wrapped.disable(); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 139 | * @param arg0 Unable to match param name, positionally same as wrapped class. 140 | * @return This ChainingMethodEntryRequest for chainable method calls 141 | */ 142 | public ChainingMethodEntryRequest setEnabled(boolean arg0) { 143 | wrapped.setEnabled(arg0); 144 | return this; 145 | } 146 | 147 | /** 148 | * @see com.sun.jdi.request.EventRequest#enable() 149 | * @return This ChainingMethodEntryRequest for chainable method calls 150 | */ 151 | public ChainingMethodEntryRequest enable() { 152 | wrapped.enable(); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#isEnabled() 158 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 159 | */ 160 | public boolean isEnabled() { 161 | return wrapped.isEnabled(); 162 | } 163 | 164 | /** 165 | * @see com.sun.jdi.Mirror#toString() 166 | * @return The String returned by the wrapped com.sun.jdi.Mirror 167 | */ 168 | public String toString() { 169 | return wrapped.toString(); 170 | } 171 | 172 | /** 173 | * @see com.sun.jdi.Mirror#virtualMachine() 174 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 175 | */ 176 | public VirtualMachine virtualMachine() { 177 | return wrapped.virtualMachine(); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingMethodExitRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.MethodExitRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnMethodExit; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link MethodExitRequest} 15 | */ 16 | public class ChainingMethodExitRequest { 17 | private final MethodExitRequest wrapped; 18 | 19 | public ChainingMethodExitRequest(MethodExitRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingMethodExitRequest addHandler(OnMethodExit handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see MethodExitRequest#addThreadFilter(ThreadReference) 32 | * @param arg0 Unable to match param name, positionally same as wrapped class. 33 | * @return This ChainingMethodExitRequest for chainable method calls 34 | */ 35 | public ChainingMethodExitRequest addThreadFilter(ThreadReference arg0) { 36 | wrapped.addThreadFilter(arg0); 37 | return this; 38 | } 39 | 40 | /** 41 | * @see MethodExitRequest#addClassFilter(String) 42 | * @param arg0 Unable to match param name, positionally same as wrapped class. 43 | * @return This ChainingMethodExitRequest for chainable method calls 44 | */ 45 | public ChainingMethodExitRequest addClassFilter(String arg0) { 46 | wrapped.addClassFilter(arg0); 47 | return this; 48 | } 49 | 50 | /** 51 | * @see MethodExitRequest#addClassFilter(ReferenceType) 52 | * @param arg0 Unable to match param name, positionally same as wrapped class. 53 | * @return This ChainingMethodExitRequest for chainable method calls 54 | */ 55 | public ChainingMethodExitRequest addClassFilter(ReferenceType arg0) { 56 | wrapped.addClassFilter(arg0); 57 | return this; 58 | } 59 | 60 | /** 61 | * @see MethodExitRequest#addClassExclusionFilter(String) 62 | * @param arg0 Unable to match param name, positionally same as wrapped class. 63 | * @return This ChainingMethodExitRequest for chainable method calls 64 | */ 65 | public ChainingMethodExitRequest addClassExclusionFilter(String arg0) { 66 | wrapped.addClassExclusionFilter(arg0); 67 | return this; 68 | } 69 | 70 | /** 71 | * @see MethodExitRequest#addInstanceFilter(ObjectReference) 72 | * @param arg0 Unable to match param name, positionally same as wrapped class. 73 | * @return This ChainingMethodExitRequest for chainable method calls 74 | */ 75 | public ChainingMethodExitRequest addInstanceFilter(ObjectReference arg0) { 76 | wrapped.addInstanceFilter(arg0); 77 | return this; 78 | } 79 | 80 | /** 81 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 82 | * @param arg0 Unable to match param name, positionally same as wrapped class. 83 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 84 | */ 85 | public Object getProperty(Object arg0) { 86 | return wrapped.getProperty(arg0); 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return This ChainingMethodExitRequest for chainable method calls 93 | */ 94 | public ChainingMethodExitRequest addCountFilter(int arg0) { 95 | wrapped.addCountFilter(arg0); 96 | return this; 97 | } 98 | 99 | /** 100 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 101 | * @param arg0 Unable to match param name, positionally same as wrapped class. 102 | * @return This ChainingMethodExitRequest for chainable method calls 103 | */ 104 | public ChainingMethodExitRequest setSuspendPolicy(int arg0) { 105 | wrapped.setSuspendPolicy(arg0); 106 | return this; 107 | } 108 | 109 | /** 110 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 111 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 112 | */ 113 | public int suspendPolicy() { 114 | return wrapped.suspendPolicy(); 115 | } 116 | 117 | /** 118 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 119 | * @param arg0 Unable to match param name, positionally same as wrapped class. 120 | * @param arg1 Unable to match param name, positionally same as wrapped class. 121 | * @return This ChainingMethodExitRequest for chainable method calls 122 | */ 123 | public ChainingMethodExitRequest putProperty(Object arg0, Object arg1) { 124 | wrapped.putProperty(arg0, arg1); 125 | return this; 126 | } 127 | 128 | /** 129 | * @see com.sun.jdi.request.EventRequest#disable() 130 | * @return This ChainingMethodExitRequest for chainable method calls 131 | */ 132 | public ChainingMethodExitRequest disable() { 133 | wrapped.disable(); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 139 | * @param arg0 Unable to match param name, positionally same as wrapped class. 140 | * @return This ChainingMethodExitRequest for chainable method calls 141 | */ 142 | public ChainingMethodExitRequest setEnabled(boolean arg0) { 143 | wrapped.setEnabled(arg0); 144 | return this; 145 | } 146 | 147 | /** 148 | * @see com.sun.jdi.request.EventRequest#enable() 149 | * @return This ChainingMethodExitRequest for chainable method calls 150 | */ 151 | public ChainingMethodExitRequest enable() { 152 | wrapped.enable(); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#isEnabled() 158 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 159 | */ 160 | public boolean isEnabled() { 161 | return wrapped.isEnabled(); 162 | } 163 | 164 | /** 165 | * @see com.sun.jdi.Mirror#toString() 166 | * @return The String returned by the wrapped com.sun.jdi.Mirror 167 | */ 168 | public String toString() { 169 | return wrapped.toString(); 170 | } 171 | 172 | /** 173 | * @see com.sun.jdi.Mirror#virtualMachine() 174 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 175 | */ 176 | public VirtualMachine virtualMachine() { 177 | return wrapped.virtualMachine(); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingModificationWatchpointRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.Field; 4 | import com.sun.jdi.ObjectReference; 5 | import com.sun.jdi.ReferenceType; 6 | import com.sun.jdi.ThreadReference; 7 | import com.sun.jdi.VirtualMachine; 8 | import com.sun.jdi.request.ModificationWatchpointRequest; 9 | import java.lang.Object; 10 | import java.lang.String; 11 | import org.jdiscript.events.DebugEventDispatcher; 12 | import org.jdiscript.handlers.OnModificationWatchpoint; 13 | 14 | /** 15 | * Generated chainable wrapper class for {@link ModificationWatchpointRequest} 16 | */ 17 | public class ChainingModificationWatchpointRequest { 18 | private final ModificationWatchpointRequest wrapped; 19 | 20 | public ChainingModificationWatchpointRequest(ModificationWatchpointRequest wrapped) { 21 | this.wrapped = wrapped; 22 | } 23 | 24 | public ChainingModificationWatchpointRequest addHandler(OnModificationWatchpoint handler) { 25 | if (handler != null) { 26 | DebugEventDispatcher.addHandler(wrapped, handler); 27 | } 28 | return this; 29 | } 30 | 31 | /** 32 | * @see com.sun.jdi.request.WatchpointRequest#field() 33 | * @return The Field returned by the wrapped com.sun.jdi.request.WatchpointRequest 34 | */ 35 | public Field field() { 36 | return wrapped.field(); 37 | } 38 | 39 | /** 40 | * @see com.sun.jdi.request.WatchpointRequest#addThreadFilter(ThreadReference) 41 | * @param arg0 Unable to match param name, positionally same as wrapped class. 42 | * @return This ChainingModificationWatchpointRequest for chainable method calls 43 | */ 44 | public ChainingModificationWatchpointRequest addThreadFilter(ThreadReference arg0) { 45 | wrapped.addThreadFilter(arg0); 46 | return this; 47 | } 48 | 49 | /** 50 | * @see com.sun.jdi.request.WatchpointRequest#addClassFilter(String) 51 | * @param arg0 Unable to match param name, positionally same as wrapped class. 52 | * @return This ChainingModificationWatchpointRequest for chainable method calls 53 | */ 54 | public ChainingModificationWatchpointRequest addClassFilter(String arg0) { 55 | wrapped.addClassFilter(arg0); 56 | return this; 57 | } 58 | 59 | /** 60 | * @see com.sun.jdi.request.WatchpointRequest#addClassFilter(ReferenceType) 61 | * @param arg0 Unable to match param name, positionally same as wrapped class. 62 | * @return This ChainingModificationWatchpointRequest for chainable method calls 63 | */ 64 | public ChainingModificationWatchpointRequest addClassFilter(ReferenceType arg0) { 65 | wrapped.addClassFilter(arg0); 66 | return this; 67 | } 68 | 69 | /** 70 | * @see com.sun.jdi.request.WatchpointRequest#addClassExclusionFilter(String) 71 | * @param arg0 Unable to match param name, positionally same as wrapped class. 72 | * @return This ChainingModificationWatchpointRequest for chainable method calls 73 | */ 74 | public ChainingModificationWatchpointRequest addClassExclusionFilter(String arg0) { 75 | wrapped.addClassExclusionFilter(arg0); 76 | return this; 77 | } 78 | 79 | /** 80 | * @see com.sun.jdi.request.WatchpointRequest#addInstanceFilter(ObjectReference) 81 | * @param arg0 Unable to match param name, positionally same as wrapped class. 82 | * @return This ChainingModificationWatchpointRequest for chainable method calls 83 | */ 84 | public ChainingModificationWatchpointRequest addInstanceFilter(ObjectReference arg0) { 85 | wrapped.addInstanceFilter(arg0); 86 | return this; 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 93 | */ 94 | public Object getProperty(Object arg0) { 95 | return wrapped.getProperty(arg0); 96 | } 97 | 98 | /** 99 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 100 | * @param arg0 Unable to match param name, positionally same as wrapped class. 101 | * @return This ChainingModificationWatchpointRequest for chainable method calls 102 | */ 103 | public ChainingModificationWatchpointRequest addCountFilter(int arg0) { 104 | wrapped.addCountFilter(arg0); 105 | return this; 106 | } 107 | 108 | /** 109 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 110 | * @param arg0 Unable to match param name, positionally same as wrapped class. 111 | * @return This ChainingModificationWatchpointRequest for chainable method calls 112 | */ 113 | public ChainingModificationWatchpointRequest setSuspendPolicy(int arg0) { 114 | wrapped.setSuspendPolicy(arg0); 115 | return this; 116 | } 117 | 118 | /** 119 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 120 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 121 | */ 122 | public int suspendPolicy() { 123 | return wrapped.suspendPolicy(); 124 | } 125 | 126 | /** 127 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 128 | * @param arg0 Unable to match param name, positionally same as wrapped class. 129 | * @param arg1 Unable to match param name, positionally same as wrapped class. 130 | * @return This ChainingModificationWatchpointRequest for chainable method calls 131 | */ 132 | public ChainingModificationWatchpointRequest putProperty(Object arg0, Object arg1) { 133 | wrapped.putProperty(arg0, arg1); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#disable() 139 | * @return This ChainingModificationWatchpointRequest for chainable method calls 140 | */ 141 | public ChainingModificationWatchpointRequest disable() { 142 | wrapped.disable(); 143 | return this; 144 | } 145 | 146 | /** 147 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 148 | * @param arg0 Unable to match param name, positionally same as wrapped class. 149 | * @return This ChainingModificationWatchpointRequest for chainable method calls 150 | */ 151 | public ChainingModificationWatchpointRequest setEnabled(boolean arg0) { 152 | wrapped.setEnabled(arg0); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#enable() 158 | * @return This ChainingModificationWatchpointRequest for chainable method calls 159 | */ 160 | public ChainingModificationWatchpointRequest enable() { 161 | wrapped.enable(); 162 | return this; 163 | } 164 | 165 | /** 166 | * @see com.sun.jdi.request.EventRequest#isEnabled() 167 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 168 | */ 169 | public boolean isEnabled() { 170 | return wrapped.isEnabled(); 171 | } 172 | 173 | /** 174 | * @see com.sun.jdi.Mirror#toString() 175 | * @return The String returned by the wrapped com.sun.jdi.Mirror 176 | */ 177 | public String toString() { 178 | return wrapped.toString(); 179 | } 180 | 181 | /** 182 | * @see com.sun.jdi.Mirror#virtualMachine() 183 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 184 | */ 185 | public VirtualMachine virtualMachine() { 186 | return wrapped.virtualMachine(); 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingMonitorContendedEnterRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.MonitorContendedEnterRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnMonitorContendedEnter; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link MonitorContendedEnterRequest} 15 | */ 16 | public class ChainingMonitorContendedEnterRequest { 17 | private final MonitorContendedEnterRequest wrapped; 18 | 19 | public ChainingMonitorContendedEnterRequest(MonitorContendedEnterRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingMonitorContendedEnterRequest addHandler(OnMonitorContendedEnter handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see MonitorContendedEnterRequest#addThreadFilter(ThreadReference) 32 | * @param arg0 Unable to match param name, positionally same as wrapped class. 33 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 34 | */ 35 | public ChainingMonitorContendedEnterRequest addThreadFilter(ThreadReference arg0) { 36 | wrapped.addThreadFilter(arg0); 37 | return this; 38 | } 39 | 40 | /** 41 | * @see MonitorContendedEnterRequest#addClassFilter(String) 42 | * @param arg0 Unable to match param name, positionally same as wrapped class. 43 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 44 | */ 45 | public ChainingMonitorContendedEnterRequest addClassFilter(String arg0) { 46 | wrapped.addClassFilter(arg0); 47 | return this; 48 | } 49 | 50 | /** 51 | * @see MonitorContendedEnterRequest#addClassFilter(ReferenceType) 52 | * @param arg0 Unable to match param name, positionally same as wrapped class. 53 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 54 | */ 55 | public ChainingMonitorContendedEnterRequest addClassFilter(ReferenceType arg0) { 56 | wrapped.addClassFilter(arg0); 57 | return this; 58 | } 59 | 60 | /** 61 | * @see MonitorContendedEnterRequest#addClassExclusionFilter(String) 62 | * @param arg0 Unable to match param name, positionally same as wrapped class. 63 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 64 | */ 65 | public ChainingMonitorContendedEnterRequest addClassExclusionFilter(String arg0) { 66 | wrapped.addClassExclusionFilter(arg0); 67 | return this; 68 | } 69 | 70 | /** 71 | * @see MonitorContendedEnterRequest#addInstanceFilter(ObjectReference) 72 | * @param arg0 Unable to match param name, positionally same as wrapped class. 73 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 74 | */ 75 | public ChainingMonitorContendedEnterRequest addInstanceFilter(ObjectReference arg0) { 76 | wrapped.addInstanceFilter(arg0); 77 | return this; 78 | } 79 | 80 | /** 81 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 82 | * @param arg0 Unable to match param name, positionally same as wrapped class. 83 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 84 | */ 85 | public Object getProperty(Object arg0) { 86 | return wrapped.getProperty(arg0); 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 93 | */ 94 | public ChainingMonitorContendedEnterRequest addCountFilter(int arg0) { 95 | wrapped.addCountFilter(arg0); 96 | return this; 97 | } 98 | 99 | /** 100 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 101 | * @param arg0 Unable to match param name, positionally same as wrapped class. 102 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 103 | */ 104 | public ChainingMonitorContendedEnterRequest setSuspendPolicy(int arg0) { 105 | wrapped.setSuspendPolicy(arg0); 106 | return this; 107 | } 108 | 109 | /** 110 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 111 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 112 | */ 113 | public int suspendPolicy() { 114 | return wrapped.suspendPolicy(); 115 | } 116 | 117 | /** 118 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 119 | * @param arg0 Unable to match param name, positionally same as wrapped class. 120 | * @param arg1 Unable to match param name, positionally same as wrapped class. 121 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 122 | */ 123 | public ChainingMonitorContendedEnterRequest putProperty(Object arg0, Object arg1) { 124 | wrapped.putProperty(arg0, arg1); 125 | return this; 126 | } 127 | 128 | /** 129 | * @see com.sun.jdi.request.EventRequest#disable() 130 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 131 | */ 132 | public ChainingMonitorContendedEnterRequest disable() { 133 | wrapped.disable(); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 139 | * @param arg0 Unable to match param name, positionally same as wrapped class. 140 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 141 | */ 142 | public ChainingMonitorContendedEnterRequest setEnabled(boolean arg0) { 143 | wrapped.setEnabled(arg0); 144 | return this; 145 | } 146 | 147 | /** 148 | * @see com.sun.jdi.request.EventRequest#enable() 149 | * @return This ChainingMonitorContendedEnterRequest for chainable method calls 150 | */ 151 | public ChainingMonitorContendedEnterRequest enable() { 152 | wrapped.enable(); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#isEnabled() 158 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 159 | */ 160 | public boolean isEnabled() { 161 | return wrapped.isEnabled(); 162 | } 163 | 164 | /** 165 | * @see com.sun.jdi.Mirror#toString() 166 | * @return The String returned by the wrapped com.sun.jdi.Mirror 167 | */ 168 | public String toString() { 169 | return wrapped.toString(); 170 | } 171 | 172 | /** 173 | * @see com.sun.jdi.Mirror#virtualMachine() 174 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 175 | */ 176 | public VirtualMachine virtualMachine() { 177 | return wrapped.virtualMachine(); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingMonitorContendedEnteredRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.MonitorContendedEnteredRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnMonitorContendedEntered; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link MonitorContendedEnteredRequest} 15 | */ 16 | public class ChainingMonitorContendedEnteredRequest { 17 | private final MonitorContendedEnteredRequest wrapped; 18 | 19 | public ChainingMonitorContendedEnteredRequest(MonitorContendedEnteredRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingMonitorContendedEnteredRequest addHandler(OnMonitorContendedEntered handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see MonitorContendedEnteredRequest#addThreadFilter(ThreadReference) 32 | * @param arg0 Unable to match param name, positionally same as wrapped class. 33 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 34 | */ 35 | public ChainingMonitorContendedEnteredRequest addThreadFilter(ThreadReference arg0) { 36 | wrapped.addThreadFilter(arg0); 37 | return this; 38 | } 39 | 40 | /** 41 | * @see MonitorContendedEnteredRequest#addClassFilter(String) 42 | * @param arg0 Unable to match param name, positionally same as wrapped class. 43 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 44 | */ 45 | public ChainingMonitorContendedEnteredRequest addClassFilter(String arg0) { 46 | wrapped.addClassFilter(arg0); 47 | return this; 48 | } 49 | 50 | /** 51 | * @see MonitorContendedEnteredRequest#addClassFilter(ReferenceType) 52 | * @param arg0 Unable to match param name, positionally same as wrapped class. 53 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 54 | */ 55 | public ChainingMonitorContendedEnteredRequest addClassFilter(ReferenceType arg0) { 56 | wrapped.addClassFilter(arg0); 57 | return this; 58 | } 59 | 60 | /** 61 | * @see MonitorContendedEnteredRequest#addClassExclusionFilter(String) 62 | * @param arg0 Unable to match param name, positionally same as wrapped class. 63 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 64 | */ 65 | public ChainingMonitorContendedEnteredRequest addClassExclusionFilter(String arg0) { 66 | wrapped.addClassExclusionFilter(arg0); 67 | return this; 68 | } 69 | 70 | /** 71 | * @see MonitorContendedEnteredRequest#addInstanceFilter(ObjectReference) 72 | * @param arg0 Unable to match param name, positionally same as wrapped class. 73 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 74 | */ 75 | public ChainingMonitorContendedEnteredRequest addInstanceFilter(ObjectReference arg0) { 76 | wrapped.addInstanceFilter(arg0); 77 | return this; 78 | } 79 | 80 | /** 81 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 82 | * @param arg0 Unable to match param name, positionally same as wrapped class. 83 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 84 | */ 85 | public Object getProperty(Object arg0) { 86 | return wrapped.getProperty(arg0); 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 93 | */ 94 | public ChainingMonitorContendedEnteredRequest addCountFilter(int arg0) { 95 | wrapped.addCountFilter(arg0); 96 | return this; 97 | } 98 | 99 | /** 100 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 101 | * @param arg0 Unable to match param name, positionally same as wrapped class. 102 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 103 | */ 104 | public ChainingMonitorContendedEnteredRequest setSuspendPolicy(int arg0) { 105 | wrapped.setSuspendPolicy(arg0); 106 | return this; 107 | } 108 | 109 | /** 110 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 111 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 112 | */ 113 | public int suspendPolicy() { 114 | return wrapped.suspendPolicy(); 115 | } 116 | 117 | /** 118 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 119 | * @param arg0 Unable to match param name, positionally same as wrapped class. 120 | * @param arg1 Unable to match param name, positionally same as wrapped class. 121 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 122 | */ 123 | public ChainingMonitorContendedEnteredRequest putProperty(Object arg0, Object arg1) { 124 | wrapped.putProperty(arg0, arg1); 125 | return this; 126 | } 127 | 128 | /** 129 | * @see com.sun.jdi.request.EventRequest#disable() 130 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 131 | */ 132 | public ChainingMonitorContendedEnteredRequest disable() { 133 | wrapped.disable(); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 139 | * @param arg0 Unable to match param name, positionally same as wrapped class. 140 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 141 | */ 142 | public ChainingMonitorContendedEnteredRequest setEnabled(boolean arg0) { 143 | wrapped.setEnabled(arg0); 144 | return this; 145 | } 146 | 147 | /** 148 | * @see com.sun.jdi.request.EventRequest#enable() 149 | * @return This ChainingMonitorContendedEnteredRequest for chainable method calls 150 | */ 151 | public ChainingMonitorContendedEnteredRequest enable() { 152 | wrapped.enable(); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#isEnabled() 158 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 159 | */ 160 | public boolean isEnabled() { 161 | return wrapped.isEnabled(); 162 | } 163 | 164 | /** 165 | * @see com.sun.jdi.Mirror#toString() 166 | * @return The String returned by the wrapped com.sun.jdi.Mirror 167 | */ 168 | public String toString() { 169 | return wrapped.toString(); 170 | } 171 | 172 | /** 173 | * @see com.sun.jdi.Mirror#virtualMachine() 174 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 175 | */ 176 | public VirtualMachine virtualMachine() { 177 | return wrapped.virtualMachine(); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingMonitorWaitRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.MonitorWaitRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnMonitorWait; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link MonitorWaitRequest} 15 | */ 16 | public class ChainingMonitorWaitRequest { 17 | private final MonitorWaitRequest wrapped; 18 | 19 | public ChainingMonitorWaitRequest(MonitorWaitRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingMonitorWaitRequest addHandler(OnMonitorWait handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see MonitorWaitRequest#addThreadFilter(ThreadReference) 32 | * @param arg0 Unable to match param name, positionally same as wrapped class. 33 | * @return This ChainingMonitorWaitRequest for chainable method calls 34 | */ 35 | public ChainingMonitorWaitRequest addThreadFilter(ThreadReference arg0) { 36 | wrapped.addThreadFilter(arg0); 37 | return this; 38 | } 39 | 40 | /** 41 | * @see MonitorWaitRequest#addClassFilter(String) 42 | * @param arg0 Unable to match param name, positionally same as wrapped class. 43 | * @return This ChainingMonitorWaitRequest for chainable method calls 44 | */ 45 | public ChainingMonitorWaitRequest addClassFilter(String arg0) { 46 | wrapped.addClassFilter(arg0); 47 | return this; 48 | } 49 | 50 | /** 51 | * @see MonitorWaitRequest#addClassFilter(ReferenceType) 52 | * @param arg0 Unable to match param name, positionally same as wrapped class. 53 | * @return This ChainingMonitorWaitRequest for chainable method calls 54 | */ 55 | public ChainingMonitorWaitRequest addClassFilter(ReferenceType arg0) { 56 | wrapped.addClassFilter(arg0); 57 | return this; 58 | } 59 | 60 | /** 61 | * @see MonitorWaitRequest#addClassExclusionFilter(String) 62 | * @param arg0 Unable to match param name, positionally same as wrapped class. 63 | * @return This ChainingMonitorWaitRequest for chainable method calls 64 | */ 65 | public ChainingMonitorWaitRequest addClassExclusionFilter(String arg0) { 66 | wrapped.addClassExclusionFilter(arg0); 67 | return this; 68 | } 69 | 70 | /** 71 | * @see MonitorWaitRequest#addInstanceFilter(ObjectReference) 72 | * @param arg0 Unable to match param name, positionally same as wrapped class. 73 | * @return This ChainingMonitorWaitRequest for chainable method calls 74 | */ 75 | public ChainingMonitorWaitRequest addInstanceFilter(ObjectReference arg0) { 76 | wrapped.addInstanceFilter(arg0); 77 | return this; 78 | } 79 | 80 | /** 81 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 82 | * @param arg0 Unable to match param name, positionally same as wrapped class. 83 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 84 | */ 85 | public Object getProperty(Object arg0) { 86 | return wrapped.getProperty(arg0); 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return This ChainingMonitorWaitRequest for chainable method calls 93 | */ 94 | public ChainingMonitorWaitRequest addCountFilter(int arg0) { 95 | wrapped.addCountFilter(arg0); 96 | return this; 97 | } 98 | 99 | /** 100 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 101 | * @param arg0 Unable to match param name, positionally same as wrapped class. 102 | * @return This ChainingMonitorWaitRequest for chainable method calls 103 | */ 104 | public ChainingMonitorWaitRequest setSuspendPolicy(int arg0) { 105 | wrapped.setSuspendPolicy(arg0); 106 | return this; 107 | } 108 | 109 | /** 110 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 111 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 112 | */ 113 | public int suspendPolicy() { 114 | return wrapped.suspendPolicy(); 115 | } 116 | 117 | /** 118 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 119 | * @param arg0 Unable to match param name, positionally same as wrapped class. 120 | * @param arg1 Unable to match param name, positionally same as wrapped class. 121 | * @return This ChainingMonitorWaitRequest for chainable method calls 122 | */ 123 | public ChainingMonitorWaitRequest putProperty(Object arg0, Object arg1) { 124 | wrapped.putProperty(arg0, arg1); 125 | return this; 126 | } 127 | 128 | /** 129 | * @see com.sun.jdi.request.EventRequest#disable() 130 | * @return This ChainingMonitorWaitRequest for chainable method calls 131 | */ 132 | public ChainingMonitorWaitRequest disable() { 133 | wrapped.disable(); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 139 | * @param arg0 Unable to match param name, positionally same as wrapped class. 140 | * @return This ChainingMonitorWaitRequest for chainable method calls 141 | */ 142 | public ChainingMonitorWaitRequest setEnabled(boolean arg0) { 143 | wrapped.setEnabled(arg0); 144 | return this; 145 | } 146 | 147 | /** 148 | * @see com.sun.jdi.request.EventRequest#enable() 149 | * @return This ChainingMonitorWaitRequest for chainable method calls 150 | */ 151 | public ChainingMonitorWaitRequest enable() { 152 | wrapped.enable(); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#isEnabled() 158 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 159 | */ 160 | public boolean isEnabled() { 161 | return wrapped.isEnabled(); 162 | } 163 | 164 | /** 165 | * @see com.sun.jdi.Mirror#toString() 166 | * @return The String returned by the wrapped com.sun.jdi.Mirror 167 | */ 168 | public String toString() { 169 | return wrapped.toString(); 170 | } 171 | 172 | /** 173 | * @see com.sun.jdi.Mirror#virtualMachine() 174 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 175 | */ 176 | public VirtualMachine virtualMachine() { 177 | return wrapped.virtualMachine(); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingMonitorWaitedRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.MonitorWaitedRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnMonitorWaited; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link MonitorWaitedRequest} 15 | */ 16 | public class ChainingMonitorWaitedRequest { 17 | private final MonitorWaitedRequest wrapped; 18 | 19 | public ChainingMonitorWaitedRequest(MonitorWaitedRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingMonitorWaitedRequest addHandler(OnMonitorWaited handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see MonitorWaitedRequest#addThreadFilter(ThreadReference) 32 | * @param arg0 Unable to match param name, positionally same as wrapped class. 33 | * @return This ChainingMonitorWaitedRequest for chainable method calls 34 | */ 35 | public ChainingMonitorWaitedRequest addThreadFilter(ThreadReference arg0) { 36 | wrapped.addThreadFilter(arg0); 37 | return this; 38 | } 39 | 40 | /** 41 | * @see MonitorWaitedRequest#addClassFilter(String) 42 | * @param arg0 Unable to match param name, positionally same as wrapped class. 43 | * @return This ChainingMonitorWaitedRequest for chainable method calls 44 | */ 45 | public ChainingMonitorWaitedRequest addClassFilter(String arg0) { 46 | wrapped.addClassFilter(arg0); 47 | return this; 48 | } 49 | 50 | /** 51 | * @see MonitorWaitedRequest#addClassFilter(ReferenceType) 52 | * @param arg0 Unable to match param name, positionally same as wrapped class. 53 | * @return This ChainingMonitorWaitedRequest for chainable method calls 54 | */ 55 | public ChainingMonitorWaitedRequest addClassFilter(ReferenceType arg0) { 56 | wrapped.addClassFilter(arg0); 57 | return this; 58 | } 59 | 60 | /** 61 | * @see MonitorWaitedRequest#addClassExclusionFilter(String) 62 | * @param arg0 Unable to match param name, positionally same as wrapped class. 63 | * @return This ChainingMonitorWaitedRequest for chainable method calls 64 | */ 65 | public ChainingMonitorWaitedRequest addClassExclusionFilter(String arg0) { 66 | wrapped.addClassExclusionFilter(arg0); 67 | return this; 68 | } 69 | 70 | /** 71 | * @see MonitorWaitedRequest#addInstanceFilter(ObjectReference) 72 | * @param arg0 Unable to match param name, positionally same as wrapped class. 73 | * @return This ChainingMonitorWaitedRequest for chainable method calls 74 | */ 75 | public ChainingMonitorWaitedRequest addInstanceFilter(ObjectReference arg0) { 76 | wrapped.addInstanceFilter(arg0); 77 | return this; 78 | } 79 | 80 | /** 81 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 82 | * @param arg0 Unable to match param name, positionally same as wrapped class. 83 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 84 | */ 85 | public Object getProperty(Object arg0) { 86 | return wrapped.getProperty(arg0); 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return This ChainingMonitorWaitedRequest for chainable method calls 93 | */ 94 | public ChainingMonitorWaitedRequest addCountFilter(int arg0) { 95 | wrapped.addCountFilter(arg0); 96 | return this; 97 | } 98 | 99 | /** 100 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 101 | * @param arg0 Unable to match param name, positionally same as wrapped class. 102 | * @return This ChainingMonitorWaitedRequest for chainable method calls 103 | */ 104 | public ChainingMonitorWaitedRequest setSuspendPolicy(int arg0) { 105 | wrapped.setSuspendPolicy(arg0); 106 | return this; 107 | } 108 | 109 | /** 110 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 111 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 112 | */ 113 | public int suspendPolicy() { 114 | return wrapped.suspendPolicy(); 115 | } 116 | 117 | /** 118 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 119 | * @param arg0 Unable to match param name, positionally same as wrapped class. 120 | * @param arg1 Unable to match param name, positionally same as wrapped class. 121 | * @return This ChainingMonitorWaitedRequest for chainable method calls 122 | */ 123 | public ChainingMonitorWaitedRequest putProperty(Object arg0, Object arg1) { 124 | wrapped.putProperty(arg0, arg1); 125 | return this; 126 | } 127 | 128 | /** 129 | * @see com.sun.jdi.request.EventRequest#disable() 130 | * @return This ChainingMonitorWaitedRequest for chainable method calls 131 | */ 132 | public ChainingMonitorWaitedRequest disable() { 133 | wrapped.disable(); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 139 | * @param arg0 Unable to match param name, positionally same as wrapped class. 140 | * @return This ChainingMonitorWaitedRequest for chainable method calls 141 | */ 142 | public ChainingMonitorWaitedRequest setEnabled(boolean arg0) { 143 | wrapped.setEnabled(arg0); 144 | return this; 145 | } 146 | 147 | /** 148 | * @see com.sun.jdi.request.EventRequest#enable() 149 | * @return This ChainingMonitorWaitedRequest for chainable method calls 150 | */ 151 | public ChainingMonitorWaitedRequest enable() { 152 | wrapped.enable(); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#isEnabled() 158 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 159 | */ 160 | public boolean isEnabled() { 161 | return wrapped.isEnabled(); 162 | } 163 | 164 | /** 165 | * @see com.sun.jdi.Mirror#toString() 166 | * @return The String returned by the wrapped com.sun.jdi.Mirror 167 | */ 168 | public String toString() { 169 | return wrapped.toString(); 170 | } 171 | 172 | /** 173 | * @see com.sun.jdi.Mirror#virtualMachine() 174 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 175 | */ 176 | public VirtualMachine virtualMachine() { 177 | return wrapped.virtualMachine(); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingStepRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ObjectReference; 4 | import com.sun.jdi.ReferenceType; 5 | import com.sun.jdi.ThreadReference; 6 | import com.sun.jdi.VirtualMachine; 7 | import com.sun.jdi.request.StepRequest; 8 | import java.lang.Object; 9 | import java.lang.String; 10 | import org.jdiscript.events.DebugEventDispatcher; 11 | import org.jdiscript.handlers.OnStep; 12 | 13 | /** 14 | * Generated chainable wrapper class for {@link StepRequest} 15 | */ 16 | public class ChainingStepRequest { 17 | private final StepRequest wrapped; 18 | 19 | public ChainingStepRequest(StepRequest wrapped) { 20 | this.wrapped = wrapped; 21 | } 22 | 23 | public ChainingStepRequest addHandler(OnStep handler) { 24 | if (handler != null) { 25 | DebugEventDispatcher.addHandler(wrapped, handler); 26 | } 27 | return this; 28 | } 29 | 30 | /** 31 | * @see StepRequest#depth() 32 | * @return The int returned by the wrapped StepRequest 33 | */ 34 | public int depth() { 35 | return wrapped.depth(); 36 | } 37 | 38 | /** 39 | * @see StepRequest#size() 40 | * @return The int returned by the wrapped StepRequest 41 | */ 42 | public int size() { 43 | return wrapped.size(); 44 | } 45 | 46 | /** 47 | * @see StepRequest#thread() 48 | * @return The ThreadReference returned by the wrapped StepRequest 49 | */ 50 | public ThreadReference thread() { 51 | return wrapped.thread(); 52 | } 53 | 54 | /** 55 | * @see StepRequest#addClassFilter(String) 56 | * @param arg0 Unable to match param name, positionally same as wrapped class. 57 | * @return This ChainingStepRequest for chainable method calls 58 | */ 59 | public ChainingStepRequest addClassFilter(String arg0) { 60 | wrapped.addClassFilter(arg0); 61 | return this; 62 | } 63 | 64 | /** 65 | * @see StepRequest#addClassFilter(ReferenceType) 66 | * @param arg0 Unable to match param name, positionally same as wrapped class. 67 | * @return This ChainingStepRequest for chainable method calls 68 | */ 69 | public ChainingStepRequest addClassFilter(ReferenceType arg0) { 70 | wrapped.addClassFilter(arg0); 71 | return this; 72 | } 73 | 74 | /** 75 | * @see StepRequest#addClassExclusionFilter(String) 76 | * @param arg0 Unable to match param name, positionally same as wrapped class. 77 | * @return This ChainingStepRequest for chainable method calls 78 | */ 79 | public ChainingStepRequest addClassExclusionFilter(String arg0) { 80 | wrapped.addClassExclusionFilter(arg0); 81 | return this; 82 | } 83 | 84 | /** 85 | * @see StepRequest#addInstanceFilter(ObjectReference) 86 | * @param arg0 Unable to match param name, positionally same as wrapped class. 87 | * @return This ChainingStepRequest for chainable method calls 88 | */ 89 | public ChainingStepRequest addInstanceFilter(ObjectReference arg0) { 90 | wrapped.addInstanceFilter(arg0); 91 | return this; 92 | } 93 | 94 | /** 95 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 96 | * @param arg0 Unable to match param name, positionally same as wrapped class. 97 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 98 | */ 99 | public Object getProperty(Object arg0) { 100 | return wrapped.getProperty(arg0); 101 | } 102 | 103 | /** 104 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 105 | * @param arg0 Unable to match param name, positionally same as wrapped class. 106 | * @return This ChainingStepRequest for chainable method calls 107 | */ 108 | public ChainingStepRequest addCountFilter(int arg0) { 109 | wrapped.addCountFilter(arg0); 110 | return this; 111 | } 112 | 113 | /** 114 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 115 | * @param arg0 Unable to match param name, positionally same as wrapped class. 116 | * @return This ChainingStepRequest for chainable method calls 117 | */ 118 | public ChainingStepRequest setSuspendPolicy(int arg0) { 119 | wrapped.setSuspendPolicy(arg0); 120 | return this; 121 | } 122 | 123 | /** 124 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 125 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 126 | */ 127 | public int suspendPolicy() { 128 | return wrapped.suspendPolicy(); 129 | } 130 | 131 | /** 132 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 133 | * @param arg0 Unable to match param name, positionally same as wrapped class. 134 | * @param arg1 Unable to match param name, positionally same as wrapped class. 135 | * @return This ChainingStepRequest for chainable method calls 136 | */ 137 | public ChainingStepRequest putProperty(Object arg0, Object arg1) { 138 | wrapped.putProperty(arg0, arg1); 139 | return this; 140 | } 141 | 142 | /** 143 | * @see com.sun.jdi.request.EventRequest#disable() 144 | * @return This ChainingStepRequest for chainable method calls 145 | */ 146 | public ChainingStepRequest disable() { 147 | wrapped.disable(); 148 | return this; 149 | } 150 | 151 | /** 152 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 153 | * @param arg0 Unable to match param name, positionally same as wrapped class. 154 | * @return This ChainingStepRequest for chainable method calls 155 | */ 156 | public ChainingStepRequest setEnabled(boolean arg0) { 157 | wrapped.setEnabled(arg0); 158 | return this; 159 | } 160 | 161 | /** 162 | * @see com.sun.jdi.request.EventRequest#enable() 163 | * @return This ChainingStepRequest for chainable method calls 164 | */ 165 | public ChainingStepRequest enable() { 166 | wrapped.enable(); 167 | return this; 168 | } 169 | 170 | /** 171 | * @see com.sun.jdi.request.EventRequest#isEnabled() 172 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 173 | */ 174 | public boolean isEnabled() { 175 | return wrapped.isEnabled(); 176 | } 177 | 178 | /** 179 | * @see com.sun.jdi.Mirror#toString() 180 | * @return The String returned by the wrapped com.sun.jdi.Mirror 181 | */ 182 | public String toString() { 183 | return wrapped.toString(); 184 | } 185 | 186 | /** 187 | * @see com.sun.jdi.Mirror#virtualMachine() 188 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 189 | */ 190 | public VirtualMachine virtualMachine() { 191 | return wrapped.virtualMachine(); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingThreadDeathRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ThreadReference; 4 | import com.sun.jdi.VirtualMachine; 5 | import com.sun.jdi.request.ThreadDeathRequest; 6 | import java.lang.Object; 7 | import java.lang.String; 8 | import org.jdiscript.events.DebugEventDispatcher; 9 | import org.jdiscript.handlers.OnThreadDeath; 10 | 11 | /** 12 | * Generated chainable wrapper class for {@link ThreadDeathRequest} 13 | */ 14 | public class ChainingThreadDeathRequest { 15 | private final ThreadDeathRequest wrapped; 16 | 17 | public ChainingThreadDeathRequest(ThreadDeathRequest wrapped) { 18 | this.wrapped = wrapped; 19 | } 20 | 21 | public ChainingThreadDeathRequest addHandler(OnThreadDeath handler) { 22 | if (handler != null) { 23 | DebugEventDispatcher.addHandler(wrapped, handler); 24 | } 25 | return this; 26 | } 27 | 28 | /** 29 | * @see ThreadDeathRequest#addThreadFilter(ThreadReference) 30 | * @param arg0 Unable to match param name, positionally same as wrapped class. 31 | * @return This ChainingThreadDeathRequest for chainable method calls 32 | */ 33 | public ChainingThreadDeathRequest addThreadFilter(ThreadReference arg0) { 34 | wrapped.addThreadFilter(arg0); 35 | return this; 36 | } 37 | 38 | /** 39 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 40 | * @param arg0 Unable to match param name, positionally same as wrapped class. 41 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 42 | */ 43 | public Object getProperty(Object arg0) { 44 | return wrapped.getProperty(arg0); 45 | } 46 | 47 | /** 48 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 49 | * @param arg0 Unable to match param name, positionally same as wrapped class. 50 | * @return This ChainingThreadDeathRequest for chainable method calls 51 | */ 52 | public ChainingThreadDeathRequest addCountFilter(int arg0) { 53 | wrapped.addCountFilter(arg0); 54 | return this; 55 | } 56 | 57 | /** 58 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 59 | * @param arg0 Unable to match param name, positionally same as wrapped class. 60 | * @return This ChainingThreadDeathRequest for chainable method calls 61 | */ 62 | public ChainingThreadDeathRequest setSuspendPolicy(int arg0) { 63 | wrapped.setSuspendPolicy(arg0); 64 | return this; 65 | } 66 | 67 | /** 68 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 69 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 70 | */ 71 | public int suspendPolicy() { 72 | return wrapped.suspendPolicy(); 73 | } 74 | 75 | /** 76 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 77 | * @param arg0 Unable to match param name, positionally same as wrapped class. 78 | * @param arg1 Unable to match param name, positionally same as wrapped class. 79 | * @return This ChainingThreadDeathRequest for chainable method calls 80 | */ 81 | public ChainingThreadDeathRequest putProperty(Object arg0, Object arg1) { 82 | wrapped.putProperty(arg0, arg1); 83 | return this; 84 | } 85 | 86 | /** 87 | * @see com.sun.jdi.request.EventRequest#disable() 88 | * @return This ChainingThreadDeathRequest for chainable method calls 89 | */ 90 | public ChainingThreadDeathRequest disable() { 91 | wrapped.disable(); 92 | return this; 93 | } 94 | 95 | /** 96 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 97 | * @param arg0 Unable to match param name, positionally same as wrapped class. 98 | * @return This ChainingThreadDeathRequest for chainable method calls 99 | */ 100 | public ChainingThreadDeathRequest setEnabled(boolean arg0) { 101 | wrapped.setEnabled(arg0); 102 | return this; 103 | } 104 | 105 | /** 106 | * @see com.sun.jdi.request.EventRequest#enable() 107 | * @return This ChainingThreadDeathRequest for chainable method calls 108 | */ 109 | public ChainingThreadDeathRequest enable() { 110 | wrapped.enable(); 111 | return this; 112 | } 113 | 114 | /** 115 | * @see com.sun.jdi.request.EventRequest#isEnabled() 116 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 117 | */ 118 | public boolean isEnabled() { 119 | return wrapped.isEnabled(); 120 | } 121 | 122 | /** 123 | * @see com.sun.jdi.Mirror#toString() 124 | * @return The String returned by the wrapped com.sun.jdi.Mirror 125 | */ 126 | public String toString() { 127 | return wrapped.toString(); 128 | } 129 | 130 | /** 131 | * @see com.sun.jdi.Mirror#virtualMachine() 132 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 133 | */ 134 | public VirtualMachine virtualMachine() { 135 | return wrapped.virtualMachine(); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingThreadStartRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.ThreadReference; 4 | import com.sun.jdi.VirtualMachine; 5 | import com.sun.jdi.request.ThreadStartRequest; 6 | import java.lang.Object; 7 | import java.lang.String; 8 | import org.jdiscript.events.DebugEventDispatcher; 9 | import org.jdiscript.handlers.OnThreadStart; 10 | 11 | /** 12 | * Generated chainable wrapper class for {@link ThreadStartRequest} 13 | */ 14 | public class ChainingThreadStartRequest { 15 | private final ThreadStartRequest wrapped; 16 | 17 | public ChainingThreadStartRequest(ThreadStartRequest wrapped) { 18 | this.wrapped = wrapped; 19 | } 20 | 21 | public ChainingThreadStartRequest addHandler(OnThreadStart handler) { 22 | if (handler != null) { 23 | DebugEventDispatcher.addHandler(wrapped, handler); 24 | } 25 | return this; 26 | } 27 | 28 | /** 29 | * @see ThreadStartRequest#addThreadFilter(ThreadReference) 30 | * @param arg0 Unable to match param name, positionally same as wrapped class. 31 | * @return This ChainingThreadStartRequest for chainable method calls 32 | */ 33 | public ChainingThreadStartRequest addThreadFilter(ThreadReference arg0) { 34 | wrapped.addThreadFilter(arg0); 35 | return this; 36 | } 37 | 38 | /** 39 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 40 | * @param arg0 Unable to match param name, positionally same as wrapped class. 41 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 42 | */ 43 | public Object getProperty(Object arg0) { 44 | return wrapped.getProperty(arg0); 45 | } 46 | 47 | /** 48 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 49 | * @param arg0 Unable to match param name, positionally same as wrapped class. 50 | * @return This ChainingThreadStartRequest for chainable method calls 51 | */ 52 | public ChainingThreadStartRequest addCountFilter(int arg0) { 53 | wrapped.addCountFilter(arg0); 54 | return this; 55 | } 56 | 57 | /** 58 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 59 | * @param arg0 Unable to match param name, positionally same as wrapped class. 60 | * @return This ChainingThreadStartRequest for chainable method calls 61 | */ 62 | public ChainingThreadStartRequest setSuspendPolicy(int arg0) { 63 | wrapped.setSuspendPolicy(arg0); 64 | return this; 65 | } 66 | 67 | /** 68 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 69 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 70 | */ 71 | public int suspendPolicy() { 72 | return wrapped.suspendPolicy(); 73 | } 74 | 75 | /** 76 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 77 | * @param arg0 Unable to match param name, positionally same as wrapped class. 78 | * @param arg1 Unable to match param name, positionally same as wrapped class. 79 | * @return This ChainingThreadStartRequest for chainable method calls 80 | */ 81 | public ChainingThreadStartRequest putProperty(Object arg0, Object arg1) { 82 | wrapped.putProperty(arg0, arg1); 83 | return this; 84 | } 85 | 86 | /** 87 | * @see com.sun.jdi.request.EventRequest#disable() 88 | * @return This ChainingThreadStartRequest for chainable method calls 89 | */ 90 | public ChainingThreadStartRequest disable() { 91 | wrapped.disable(); 92 | return this; 93 | } 94 | 95 | /** 96 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 97 | * @param arg0 Unable to match param name, positionally same as wrapped class. 98 | * @return This ChainingThreadStartRequest for chainable method calls 99 | */ 100 | public ChainingThreadStartRequest setEnabled(boolean arg0) { 101 | wrapped.setEnabled(arg0); 102 | return this; 103 | } 104 | 105 | /** 106 | * @see com.sun.jdi.request.EventRequest#enable() 107 | * @return This ChainingThreadStartRequest for chainable method calls 108 | */ 109 | public ChainingThreadStartRequest enable() { 110 | wrapped.enable(); 111 | return this; 112 | } 113 | 114 | /** 115 | * @see com.sun.jdi.request.EventRequest#isEnabled() 116 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 117 | */ 118 | public boolean isEnabled() { 119 | return wrapped.isEnabled(); 120 | } 121 | 122 | /** 123 | * @see com.sun.jdi.Mirror#toString() 124 | * @return The String returned by the wrapped com.sun.jdi.Mirror 125 | */ 126 | public String toString() { 127 | return wrapped.toString(); 128 | } 129 | 130 | /** 131 | * @see com.sun.jdi.Mirror#virtualMachine() 132 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 133 | */ 134 | public VirtualMachine virtualMachine() { 135 | return wrapped.virtualMachine(); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingVMDeathRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.VirtualMachine; 4 | import com.sun.jdi.request.VMDeathRequest; 5 | import java.lang.Object; 6 | import java.lang.String; 7 | import org.jdiscript.events.DebugEventDispatcher; 8 | import org.jdiscript.handlers.OnVMDeath; 9 | 10 | /** 11 | * Generated chainable wrapper class for {@link VMDeathRequest} 12 | */ 13 | public class ChainingVMDeathRequest { 14 | private final VMDeathRequest wrapped; 15 | 16 | public ChainingVMDeathRequest(VMDeathRequest wrapped) { 17 | this.wrapped = wrapped; 18 | } 19 | 20 | public ChainingVMDeathRequest addHandler(OnVMDeath handler) { 21 | if (handler != null) { 22 | DebugEventDispatcher.addHandler(wrapped, handler); 23 | } 24 | return this; 25 | } 26 | 27 | /** 28 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 29 | * @param arg0 Unable to match param name, positionally same as wrapped class. 30 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 31 | */ 32 | public Object getProperty(Object arg0) { 33 | return wrapped.getProperty(arg0); 34 | } 35 | 36 | /** 37 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 38 | * @param arg0 Unable to match param name, positionally same as wrapped class. 39 | * @return This ChainingVMDeathRequest for chainable method calls 40 | */ 41 | public ChainingVMDeathRequest addCountFilter(int arg0) { 42 | wrapped.addCountFilter(arg0); 43 | return this; 44 | } 45 | 46 | /** 47 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 48 | * @param arg0 Unable to match param name, positionally same as wrapped class. 49 | * @return This ChainingVMDeathRequest for chainable method calls 50 | */ 51 | public ChainingVMDeathRequest setSuspendPolicy(int arg0) { 52 | wrapped.setSuspendPolicy(arg0); 53 | return this; 54 | } 55 | 56 | /** 57 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 58 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 59 | */ 60 | public int suspendPolicy() { 61 | return wrapped.suspendPolicy(); 62 | } 63 | 64 | /** 65 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 66 | * @param arg0 Unable to match param name, positionally same as wrapped class. 67 | * @param arg1 Unable to match param name, positionally same as wrapped class. 68 | * @return This ChainingVMDeathRequest for chainable method calls 69 | */ 70 | public ChainingVMDeathRequest putProperty(Object arg0, Object arg1) { 71 | wrapped.putProperty(arg0, arg1); 72 | return this; 73 | } 74 | 75 | /** 76 | * @see com.sun.jdi.request.EventRequest#disable() 77 | * @return This ChainingVMDeathRequest for chainable method calls 78 | */ 79 | public ChainingVMDeathRequest disable() { 80 | wrapped.disable(); 81 | return this; 82 | } 83 | 84 | /** 85 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 86 | * @param arg0 Unable to match param name, positionally same as wrapped class. 87 | * @return This ChainingVMDeathRequest for chainable method calls 88 | */ 89 | public ChainingVMDeathRequest setEnabled(boolean arg0) { 90 | wrapped.setEnabled(arg0); 91 | return this; 92 | } 93 | 94 | /** 95 | * @see com.sun.jdi.request.EventRequest#enable() 96 | * @return This ChainingVMDeathRequest for chainable method calls 97 | */ 98 | public ChainingVMDeathRequest enable() { 99 | wrapped.enable(); 100 | return this; 101 | } 102 | 103 | /** 104 | * @see com.sun.jdi.request.EventRequest#isEnabled() 105 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 106 | */ 107 | public boolean isEnabled() { 108 | return wrapped.isEnabled(); 109 | } 110 | 111 | /** 112 | * @see com.sun.jdi.Mirror#toString() 113 | * @return The String returned by the wrapped com.sun.jdi.Mirror 114 | */ 115 | public String toString() { 116 | return wrapped.toString(); 117 | } 118 | 119 | /** 120 | * @see com.sun.jdi.Mirror#virtualMachine() 121 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 122 | */ 123 | public VirtualMachine virtualMachine() { 124 | return wrapped.virtualMachine(); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/requests/ChainingWatchpointRequest.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.requests; 2 | 3 | import com.sun.jdi.Field; 4 | import com.sun.jdi.ObjectReference; 5 | import com.sun.jdi.ReferenceType; 6 | import com.sun.jdi.ThreadReference; 7 | import com.sun.jdi.VirtualMachine; 8 | import com.sun.jdi.request.WatchpointRequest; 9 | import java.lang.Object; 10 | import java.lang.String; 11 | import org.jdiscript.events.DebugEventDispatcher; 12 | import org.jdiscript.handlers.OnWatchpoint; 13 | 14 | /** 15 | * Generated chainable wrapper class for {@link WatchpointRequest} 16 | */ 17 | public class ChainingWatchpointRequest { 18 | private final WatchpointRequest wrapped; 19 | 20 | public ChainingWatchpointRequest(WatchpointRequest wrapped) { 21 | this.wrapped = wrapped; 22 | } 23 | 24 | public ChainingWatchpointRequest addHandler(OnWatchpoint handler) { 25 | if (handler != null) { 26 | DebugEventDispatcher.addHandler(wrapped, handler); 27 | } 28 | return this; 29 | } 30 | 31 | /** 32 | * @see WatchpointRequest#field() 33 | * @return The Field returned by the wrapped WatchpointRequest 34 | */ 35 | public Field field() { 36 | return wrapped.field(); 37 | } 38 | 39 | /** 40 | * @see WatchpointRequest#addThreadFilter(ThreadReference) 41 | * @param arg0 Unable to match param name, positionally same as wrapped class. 42 | * @return This ChainingWatchpointRequest for chainable method calls 43 | */ 44 | public ChainingWatchpointRequest addThreadFilter(ThreadReference arg0) { 45 | wrapped.addThreadFilter(arg0); 46 | return this; 47 | } 48 | 49 | /** 50 | * @see WatchpointRequest#addClassFilter(String) 51 | * @param arg0 Unable to match param name, positionally same as wrapped class. 52 | * @return This ChainingWatchpointRequest for chainable method calls 53 | */ 54 | public ChainingWatchpointRequest addClassFilter(String arg0) { 55 | wrapped.addClassFilter(arg0); 56 | return this; 57 | } 58 | 59 | /** 60 | * @see WatchpointRequest#addClassFilter(ReferenceType) 61 | * @param arg0 Unable to match param name, positionally same as wrapped class. 62 | * @return This ChainingWatchpointRequest for chainable method calls 63 | */ 64 | public ChainingWatchpointRequest addClassFilter(ReferenceType arg0) { 65 | wrapped.addClassFilter(arg0); 66 | return this; 67 | } 68 | 69 | /** 70 | * @see WatchpointRequest#addClassExclusionFilter(String) 71 | * @param arg0 Unable to match param name, positionally same as wrapped class. 72 | * @return This ChainingWatchpointRequest for chainable method calls 73 | */ 74 | public ChainingWatchpointRequest addClassExclusionFilter(String arg0) { 75 | wrapped.addClassExclusionFilter(arg0); 76 | return this; 77 | } 78 | 79 | /** 80 | * @see WatchpointRequest#addInstanceFilter(ObjectReference) 81 | * @param arg0 Unable to match param name, positionally same as wrapped class. 82 | * @return This ChainingWatchpointRequest for chainable method calls 83 | */ 84 | public ChainingWatchpointRequest addInstanceFilter(ObjectReference arg0) { 85 | wrapped.addInstanceFilter(arg0); 86 | return this; 87 | } 88 | 89 | /** 90 | * @see com.sun.jdi.request.EventRequest#getProperty(Object) 91 | * @param arg0 Unable to match param name, positionally same as wrapped class. 92 | * @return The Object returned by the wrapped com.sun.jdi.request.EventRequest 93 | */ 94 | public Object getProperty(Object arg0) { 95 | return wrapped.getProperty(arg0); 96 | } 97 | 98 | /** 99 | * @see com.sun.jdi.request.EventRequest#addCountFilter(int) 100 | * @param arg0 Unable to match param name, positionally same as wrapped class. 101 | * @return This ChainingWatchpointRequest for chainable method calls 102 | */ 103 | public ChainingWatchpointRequest addCountFilter(int arg0) { 104 | wrapped.addCountFilter(arg0); 105 | return this; 106 | } 107 | 108 | /** 109 | * @see com.sun.jdi.request.EventRequest#setSuspendPolicy(int) 110 | * @param arg0 Unable to match param name, positionally same as wrapped class. 111 | * @return This ChainingWatchpointRequest for chainable method calls 112 | */ 113 | public ChainingWatchpointRequest setSuspendPolicy(int arg0) { 114 | wrapped.setSuspendPolicy(arg0); 115 | return this; 116 | } 117 | 118 | /** 119 | * @see com.sun.jdi.request.EventRequest#suspendPolicy() 120 | * @return The int returned by the wrapped com.sun.jdi.request.EventRequest 121 | */ 122 | public int suspendPolicy() { 123 | return wrapped.suspendPolicy(); 124 | } 125 | 126 | /** 127 | * @see com.sun.jdi.request.EventRequest#putProperty(Object, Object) 128 | * @param arg0 Unable to match param name, positionally same as wrapped class. 129 | * @param arg1 Unable to match param name, positionally same as wrapped class. 130 | * @return This ChainingWatchpointRequest for chainable method calls 131 | */ 132 | public ChainingWatchpointRequest putProperty(Object arg0, Object arg1) { 133 | wrapped.putProperty(arg0, arg1); 134 | return this; 135 | } 136 | 137 | /** 138 | * @see com.sun.jdi.request.EventRequest#disable() 139 | * @return This ChainingWatchpointRequest for chainable method calls 140 | */ 141 | public ChainingWatchpointRequest disable() { 142 | wrapped.disable(); 143 | return this; 144 | } 145 | 146 | /** 147 | * @see com.sun.jdi.request.EventRequest#setEnabled(boolean) 148 | * @param arg0 Unable to match param name, positionally same as wrapped class. 149 | * @return This ChainingWatchpointRequest for chainable method calls 150 | */ 151 | public ChainingWatchpointRequest setEnabled(boolean arg0) { 152 | wrapped.setEnabled(arg0); 153 | return this; 154 | } 155 | 156 | /** 157 | * @see com.sun.jdi.request.EventRequest#enable() 158 | * @return This ChainingWatchpointRequest for chainable method calls 159 | */ 160 | public ChainingWatchpointRequest enable() { 161 | wrapped.enable(); 162 | return this; 163 | } 164 | 165 | /** 166 | * @see com.sun.jdi.request.EventRequest#isEnabled() 167 | * @return The boolean returned by the wrapped com.sun.jdi.request.EventRequest 168 | */ 169 | public boolean isEnabled() { 170 | return wrapped.isEnabled(); 171 | } 172 | 173 | /** 174 | * @see com.sun.jdi.Mirror#toString() 175 | * @return The String returned by the wrapped com.sun.jdi.Mirror 176 | */ 177 | public String toString() { 178 | return wrapped.toString(); 179 | } 180 | 181 | /** 182 | * @see com.sun.jdi.Mirror#virtualMachine() 183 | * @return The VirtualMachine returned by the wrapped com.sun.jdi.Mirror 184 | */ 185 | public VirtualMachine virtualMachine() { 186 | return wrapped.virtualMachine(); 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/util/StreamRedirectThread.java: -------------------------------------------------------------------------------- 1 | /* 2 | * @(#)StreamRedirectThread.java 1.6 05/11/17 3 | * 4 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 5 | * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 | */ 7 | /* 8 | * Copyright (c) 1997-2001 by Sun Microsystems, Inc. All Rights Reserved. 9 | * 10 | * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, 11 | * modify and redistribute this software in source and binary code form, 12 | * provided that i) this copyright notice and license appear on all copies of 13 | * the software; and ii) Licensee does not utilize the software in a manner 14 | * which is disparaging to Sun. 15 | * 16 | * This software is provided "AS IS," without a warranty of any kind. ALL 17 | * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY 18 | * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR 19 | * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE 20 | * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING 21 | * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS 22 | * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, 23 | * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER 24 | * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF 25 | * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGES. 27 | * 28 | * This software is not designed or intended for use in on-line control of 29 | * aircraft, air traffic, aircraft navigation or aircraft communications; or in 30 | * the design, construction, operation or maintenance of any nuclear 31 | * facility. Licensee represents and warrants that it will not use or 32 | * redistribute the Software for such purposes. 33 | */ 34 | package org.jdiscript.util; 35 | 36 | import java.io.BufferedReader; 37 | import java.io.IOException; 38 | import java.io.InputStream; 39 | import java.io.InputStreamReader; 40 | import java.io.OutputStream; 41 | import java.io.PrintStream; 42 | 43 | /** 44 | * StreamRedirectThread is a thread which copies its input to its output and 45 | * terminates when it completes. 46 | * 47 | * @version @(#) StreamRedirectThread.java 1.6 05/11/17 04:47:11 48 | * @author Robert Field 49 | */ 50 | class StreamRedirectThread extends Thread { 51 | private final BufferedReader in; 52 | private final PrintStream out; 53 | 54 | /** 55 | * Set up for copy. 56 | * 57 | * @param name 58 | * Name of the thread 59 | * @param in 60 | * Stream to copy from 61 | * @param out 62 | * Stream to copy to 63 | */ 64 | StreamRedirectThread(String name, InputStream in, OutputStream out) { 65 | this(name, in, new PrintStream(out)); 66 | } 67 | 68 | private StreamRedirectThread(String name, InputStream in, PrintStream out) { 69 | super(name); 70 | this.in = new BufferedReader(new InputStreamReader(in)); 71 | this.out = out; 72 | setPriority(Thread.MAX_PRIORITY - 1); 73 | } 74 | 75 | /** 76 | * Copy. 77 | */ 78 | @Override 79 | public void run() { 80 | try { 81 | String str = ""; 82 | while (str != null && !isInterrupted()) { 83 | str = in.readLine(); 84 | if(str != null) { 85 | out.println(str); 86 | } 87 | } 88 | } catch (IOException exc) { 89 | if(!isInterrupted()) { 90 | exc.printStackTrace(); 91 | } 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/util/Utils.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.util; 2 | 3 | 4 | public class Utils { 5 | 6 | public static String repeat(String s, int times) { 7 | StringBuilder out = new StringBuilder(); 8 | for(int i=0; i { 23 | T go() throws Exception; 24 | } 25 | 26 | public static void unchecked(Block t) { 27 | try { 28 | t.go(); 29 | } catch(Exception e) { 30 | throw new RuntimeException(e); 31 | } 32 | } 33 | 34 | public static T unchecked(NoArgFn f) { 35 | try { 36 | return f.go(); 37 | } catch(Exception e) { 38 | throw new RuntimeException(e); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/util/VMLauncher.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.util; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | import java.util.Map; 7 | 8 | import com.sun.jdi.Bootstrap; 9 | import com.sun.jdi.VirtualMachine; 10 | import com.sun.jdi.VirtualMachineManager; 11 | import com.sun.jdi.connect.Connector.Argument; 12 | import com.sun.jdi.connect.IllegalConnectorArgumentsException; 13 | import com.sun.jdi.connect.LaunchingConnector; 14 | import com.sun.jdi.connect.VMStartException; 15 | 16 | public class VMLauncher { 17 | private final String options, main; 18 | private final boolean killOnShutdown; 19 | private final OutputStream out, err; 20 | 21 | /** 22 | * Create a VMStarter that uses the given options and main class to launch 23 | * a process for debugging. By default, this initializes a shutdown hook 24 | * that attempts to kill the created VM when the debugging VM dies. 25 | * To override this behavior, use the alternate constructor. This pumps VM 26 | * output to {@link System#out} and {@link System#err} by default. 27 | * 28 | * @param options Options to pass to VM on launch. 29 | * @param main Name of main class to run. 30 | */ 31 | public VMLauncher(String options, String main) { 32 | this(options, main, true, System.out, System.err); 33 | } 34 | 35 | /** 36 | * Alternate constructor giving control over the initialization of a 37 | * shutdown hook that attempts to kill the created VM when the debugging 38 | * VM dies. 39 | * 40 | * @param options Options to pass to VM on launch. 41 | * @param main Name of main class to run. 42 | * @param killOnShutdown True to attempt to kill created VM when debugging VM dies. 43 | * @param out Sink for the launched VM's stdout output. 44 | * @param err Sink for the launched VM's stderr output. 45 | */ 46 | public VMLauncher(String options, String main, boolean killOnShutdown, 47 | OutputStream out, OutputStream err) 48 | { 49 | this.options = options; 50 | this.main = main; 51 | this.killOnShutdown = killOnShutdown; 52 | this.out = out; 53 | this.err = err; 54 | } 55 | 56 | /** 57 | * Start the VirtualMachine w/ exceptions you can catch. 58 | * 59 | * @throws java.io.IOException when unable to launch. 60 | * Specific exceptions are dependent on the Connector implementation 61 | * in use. 62 | * @throws IllegalConnectorArgumentsException when one of the 63 | * connector arguments is invalid. 64 | * @throws VMStartException when the VM was successfully launched, but 65 | * terminated with an error before a connection could be established. 66 | * @return The started VirtualMachine 67 | */ 68 | public VirtualMachine safeStart() 69 | throws IOException, 70 | IllegalConnectorArgumentsException, 71 | VMStartException 72 | { 73 | VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); 74 | LaunchingConnector connector = vmm.defaultConnector(); 75 | Map cArgs = connector.defaultArguments(); 76 | cArgs.get("options").setValue(options); 77 | cArgs.get("main").setValue(main); 78 | final VirtualMachine vm = connector.launch(cArgs); 79 | 80 | final Thread outThread = redirect("Subproc stdout", 81 | vm.process().getInputStream(), 82 | out); 83 | final Thread errThread = redirect("Subproc stderr", 84 | vm.process().getErrorStream(), 85 | err); 86 | if(killOnShutdown) { 87 | Runtime.getRuntime().addShutdownHook(new Thread(() -> { 88 | outThread.interrupt(); 89 | errThread.interrupt(); 90 | vm.process().destroy(); 91 | })); 92 | } 93 | 94 | return vm; 95 | } 96 | 97 | /** 98 | * {@link #safeStart} wrapped to throw RuntimeException. 99 | * 100 | * @throws RuntimeException If underlying {@link #safeStart} call throws a checked exception. 101 | * @return The started VirtualMachine. 102 | */ 103 | public VirtualMachine start() { 104 | try { 105 | return safeStart(); 106 | } catch(Exception e) { 107 | throw new RuntimeException(e); 108 | } 109 | } 110 | 111 | private Thread redirect(String name, InputStream in, OutputStream out) { 112 | Thread t = new StreamRedirectThread(name, in, out); 113 | t.setDaemon(true); 114 | t.start(); 115 | return t; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/util/VMListener.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.util; 2 | 3 | import java.io.IOException; 4 | import java.util.Map; 5 | 6 | import com.sun.jdi.Bootstrap; 7 | import com.sun.jdi.VirtualMachine; 8 | import com.sun.jdi.VirtualMachineManager; 9 | import com.sun.jdi.connect.Connector; 10 | import com.sun.jdi.connect.IllegalConnectorArgumentsException; 11 | import com.sun.jdi.connect.ListeningConnector; 12 | 13 | public class VMListener { 14 | 15 | private Map args; 16 | private ListeningConnector lc; 17 | 18 | public VMListener(int port) { 19 | VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); 20 | this.lc = vmm.listeningConnectors().get(0); 21 | this.args = lc.defaultArguments(); 22 | args.get("port").setValue(Integer.toString(port)); 23 | } 24 | 25 | public String start() 26 | throws IOException, 27 | IllegalConnectorArgumentsException 28 | { 29 | return lc.startListening(args); 30 | } 31 | 32 | public VirtualMachine next() 33 | throws IOException, 34 | IllegalConnectorArgumentsException 35 | { 36 | return lc.accept(args); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/util/VMProcessAttacher.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.util; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.sun.jdi.Bootstrap; 8 | import com.sun.jdi.VirtualMachine; 9 | import com.sun.jdi.VirtualMachineManager; 10 | import com.sun.jdi.connect.AttachingConnector; 11 | import com.sun.jdi.connect.Connector.Argument; 12 | import com.sun.jdi.connect.IllegalConnectorArgumentsException; 13 | 14 | public class VMProcessAttacher { 15 | private final int pid; 16 | private final int timeout; 17 | 18 | public VMProcessAttacher(int pid) { 19 | this(pid, 0); 20 | } 21 | 22 | public VMProcessAttacher(int pid, int timeout) { 23 | this.pid = pid; 24 | this.timeout = timeout; 25 | } 26 | 27 | public VirtualMachine attach() 28 | throws IOException, IllegalConnectorArgumentsException 29 | { 30 | VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); 31 | List connectors = vmm.attachingConnectors(); 32 | AttachingConnector connector = null; 33 | for(AttachingConnector c: connectors) { 34 | if(c.defaultArguments().get("pid") != null) { 35 | connector = c; 36 | } 37 | } 38 | Map cArgs = connector.defaultArguments(); 39 | cArgs.get("pid").setValue(Integer.toString(pid)); 40 | cArgs.get("timeout").setValue(Integer.toString(timeout)); 41 | return connector.attach(cArgs); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /jdiscript/src/main/java/org/jdiscript/util/VMSocketAttacher.java: -------------------------------------------------------------------------------- 1 | package org.jdiscript.util; 2 | 3 | import java.io.IOException; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.sun.jdi.Bootstrap; 8 | import com.sun.jdi.VirtualMachine; 9 | import com.sun.jdi.VirtualMachineManager; 10 | import com.sun.jdi.connect.AttachingConnector; 11 | import com.sun.jdi.connect.Connector.Argument; 12 | import com.sun.jdi.connect.IllegalConnectorArgumentsException; 13 | 14 | public class VMSocketAttacher { 15 | private final String host; 16 | private final int port; 17 | private final int timeout; 18 | 19 | public VMSocketAttacher(int port) { 20 | this(null, port); 21 | } 22 | 23 | public VMSocketAttacher(int port, int timeout) { 24 | this(null, port, timeout); 25 | } 26 | 27 | public VMSocketAttacher(String host, int port) { 28 | this(host, port, 0); 29 | } 30 | 31 | public VMSocketAttacher(String host, int port, int timeout) { 32 | this.host = host; 33 | this.port = port; 34 | this.timeout = timeout; 35 | } 36 | 37 | public VirtualMachine safeAttach() 38 | throws IOException, IllegalConnectorArgumentsException 39 | { 40 | VirtualMachineManager vmm = Bootstrap.virtualMachineManager(); 41 | List connectors = vmm.attachingConnectors(); 42 | AttachingConnector connector = null; 43 | for(AttachingConnector c: connectors) { 44 | if(c.defaultArguments().get("hostname") != null) { 45 | connector = c; 46 | } 47 | } 48 | Map cArgs = connector.defaultArguments(); 49 | cArgs.get("port").setValue(Integer.toString(port)); 50 | cArgs.get("timeout").setValue(Integer.toString(timeout)); 51 | if(host != null) { 52 | cArgs.get("hostname").setValue(host); 53 | } 54 | return connector.attach(cArgs); 55 | } 56 | 57 | /** 58 | * Like safeAttach but wraps any checked exceptions in a RuntimeException. 59 | * 60 | * @return The attached VirtualMachine. 61 | */ 62 | public VirtualMachine attach() { 63 | try { 64 | return safeAttach(); 65 | } catch(Exception e) { 66 | throw new RuntimeException(e); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'jdiscript' 2 | 3 | include 'jdiscript' 4 | include 'generator' 5 | include 'example' --------------------------------------------------------------------------------