diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f83e8cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +target +*.iml diff --git a/README.md b/README.md index b092564..b54d925 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,10 @@ ## USE Monitor The USE monitor allows for monitoring running applications and to verify the applications behave as defined in a USE model. + +### Requirements + +Add the following vm argument to the `use` start script: + +``` +--add-exports=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED +``` diff --git a/adapter/Python/README.md b/adapter/Python/README.md new file mode 100644 index 0000000..25986f7 --- /dev/null +++ b/adapter/Python/README.md @@ -0,0 +1,32 @@ +# USE Monitor Python Adapter + +USE monitor plugin that adds support for the monitoring of Python programs. + +## Adapter Settings +- Host: Hostname of the machine, where the debuggee program is located. +- Port: Port on which the Debugpy server running the Python program is listening to. +- Workspace: Absolute path to the root directory of the Python program to monitor. +- Max. Instances: Maximum number of instances that USE should map and display. + +## How to use the plugin +1. In the USE project under `use/use-core/target` create the following folder structure: +`mkdir -p lib/plugins/monitor_adapter` +2. Run `mvn clean package` +3. Copy the `MonitorAdapter_Python-1.0-SNAPSHOT.jar` to `lib/plugins/monitor_adapter` +4. Copy the `monitor-1.0-SNAPSHOT.jar` to `lib/plugins` +5. Copy the `monitor/lib/lablib-checkboxtree-3.2.jar` to `lib` +6. Add an IntelliJ run configuration with the main class `org.tzi.use.main.Main`, VM option `--add-exports=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED` and class path `use-gui` +7. Modify the classpath with the `lib` folder addition + +## How to start the Debugpy server + +``` +#!/usr/bin/env bash + +mkdir -p logs + +debugpy \ + --listen 5678 \ + --log-to ./logs/ \ + ./.py +``` diff --git a/adapter/Python/dependency-reduced-pom.xml b/adapter/Python/dependency-reduced-pom.xml new file mode 100644 index 0000000..c9f71cd --- /dev/null +++ b/adapter/Python/dependency-reduced-pom.xml @@ -0,0 +1,58 @@ + + + + plugin_monitor + org.tzi.use + 1.0-SNAPSHOT + ../../pom.xml + + 4.0.0 + MonitorAdapter_Python + 1.0-SNAPSHOT + + + + maven-jar-plugin + 3.2.2 + + + maven-shade-plugin + 3.5.0 + + + package + + shade + + + + + + + + + org.tzi.use + use-core + 7.1.1 + provided + + + org.tzi.use + use-gui + 7.1.1 + provided + + + org.tzi.use + monitor + 1.0-SNAPSHOT + provided + + + lablib-checkboxtree + it.cnr.imaa.essi + + + + + diff --git a/adapter/Python/pom.xml b/adapter/Python/pom.xml new file mode 100644 index 0000000..4592842 --- /dev/null +++ b/adapter/Python/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + + org.tzi.use + plugin_monitor + 1.0-SNAPSHOT + ../../pom.xml + + + MonitorAdapter_Python + 1.0-SNAPSHOT + + + + org.tzi.use + use-core + + + org.tzi.use + use-gui + + + org.tzi.use + monitor + + + com.fasterxml.jackson.core + jackson-annotations + 2.19.0 + compile + + + com.fasterxml.jackson.core + jackson-databind + 2.19.0 + compile + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.0 + + + package + + shade + + + + + + + + diff --git a/adapter/Python/requirements.txt b/adapter/Python/requirements.txt new file mode 100644 index 0000000..09d32b5 --- /dev/null +++ b/adapter/Python/requirements.txt @@ -0,0 +1 @@ +debugpy==1.18.17 diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/BreakpointHandler.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/BreakpointHandler.java new file mode 100644 index 0000000..3cd69d6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/BreakpointHandler.java @@ -0,0 +1,199 @@ +package org.tzi.use.monitor.adapter.python; + +import org.tzi.use.monitor.adapter.python.dap.custom.DAPValue; +import org.tzi.use.monitor.adapter.python.dap.StackFrame; +import org.tzi.use.monitor.adapter.python.dap.StoppedEventClass; +import org.tzi.use.monitor.plugins.monitor.vm.mm.python.*; +import org.tzi.use.plugins.monitor.Monitor; +import org.tzi.use.uml.ocl.value.Value; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; + +/** + * This class is responsible for handling breakpoint events for + * constructor calls and method calls and exits, and informing + * the monitor of such events. + */ +public class BreakpointHandler implements Runnable { + + private final Monitor.Controller controller; + private final PythonAdapter adapter; + private final Messenger messenger; + private final DebugpyClient debugpyClient; + + public BreakpointHandler(DebugpyClient debugpyClient, PythonAdapter adapter, + Monitor.Controller controller, Messenger messenger) { + this.debugpyClient = debugpyClient; + this.adapter = adapter; + this.controller = controller; + this.messenger = messenger; + } + + @Override + public void run() { + while (debugpyClient.isConnected) { + try { + messenger.breakpointEventFuture = new CompletableFuture<>(); + StoppedEventClass breakpointEvent = messenger.breakpointEventFuture.get(); + if (!debugpyClient.isConnected) { + return; + } + StackFrame currFrame = messenger.getCurrentFrame(Math.toIntExact(breakpointEvent.getBody().getThreadID())); + int currLineNo = (int) currFrame.getLine(); + String file = currFrame.getSource().getPath(); + + Map lineToClass = debugpyClient.fileToClassNameMap.get(file); + if (lineToClass == null || !lineToClass.containsKey(currLineNo)) { + controller.newLogMessage(this, Level.WARNING, "No mapped class for " + file + ":" + currLineNo); + debugpyClient.resume(); + continue; + } + + Map lineToBP = debugpyClient.fileToBreakpointTypeMap.get(file); + if (lineToBP == null || !lineToBP.containsKey(currLineNo)) { + controller.newLogMessage(this, Level.WARNING, "No breakpoint type for " + file + ":" + currLineNo); + debugpyClient.resume(); + continue; + } + + String qualifiedClassName = lineToClass.get(currLineNo); + BreakpointType breakpointType = lineToBP.get(currLineNo); + + switch (breakpointType) { + case CONSTRUCTOR_CALL -> onConstructorCall(currFrame, qualifiedClassName); + case METHOD_CALL -> onMethodCall(currFrame, qualifiedClassName); + case METHOD_EXIT -> onMethodExit(currFrame, qualifiedClassName); + case MODIFICATION -> onAttrMod(currFrame, qualifiedClassName); + } + + debugpyClient.resume(); // Match monitor running state + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + return; + } catch (ExecutionException e) { + controller.newLogMessage(this, Level.SEVERE, "Failed to process breakpoint event: " + e.getMessage()); + } + } + } + + private void onConstructorCall(StackFrame currentFrame, String fullyQualifiedClassName) { + controller.newLogMessage(this, Level.FINE, "onConstructorCall: " + fullyQualifiedClassName + "." + currentFrame.getName()); + + PyType pyType = (PyType) controller.getVMType(fullyQualifiedClassName); + PyObject pyObject = new PyObject(adapter, messenger.getSelfId(currentFrame.getID()), pyType); + + controller.onNewVMObject(pyObject); + } + + private void onMethodCall(StackFrame stackFrame, String fullyQualifiedClassName) { + controller.newLogMessage(this, Level.FINE, String.format("onMethodCall: %s.%s", fullyQualifiedClassName, stackFrame.getName())); + + PyType pyType = (PyType) controller.getVMType(fullyQualifiedClassName); + + String methodId; + boolean isModuleMethod = pyType == null; + if (isModuleMethod) { + methodId = String.format("%s:%s.%s", fullyQualifiedClassName, fullyQualifiedClassName, stackFrame.getName()); + } else { + var methods = pyType.getMethodsByName(stackFrame.getName()); + if (methods.isEmpty()) { + controller.newLogMessage(this, Level.WARNING, + "No VM method found for " + fullyQualifiedClassName + "." + stackFrame.getName()); + return; + } + methodId = (String) methods.getFirst().getId(); + } + + PyMethod pyMethod = (PyMethod) controller.getVMMethod(methodId); + if (pyMethod == null) { + controller.newLogMessage(this, Level.WARNING, "VM method lookup returned null for id: " + methodId); + return; + } + + Long pyObjId = isModuleMethod + ? DebugpyClient.GLOBAL_MODULE_ID + : messenger.getSelfId(stackFrame.getID()); + PyObject pyObject = (PyObject) controller.getVMObject(pyObjId); + + List argValues = new ArrayList<>(); + for (String argName : pyMethod.getArgumentNames()) { + DAPValue argDAPValue = messenger.getMethodArgDAPValue(stackFrame.getID(), argName); + argValues.add(debugpyClient.getUSEValue(argDAPValue)); + } + + PyMethodCall pyMethodCall = new PyMethodCall(pyMethod, pyObject, argValues); + + controller.onMethodCall(pyMethodCall); + } + + private void onMethodExit(StackFrame stackFrame, String qualifiedClassName) { + PyType pyType = (PyType) controller.getVMType(qualifiedClassName); + + boolean isModuleMethod = pyType == null; + + String methodId; + if (isModuleMethod) { + methodId = String.format("%s:%s.%s", qualifiedClassName, qualifiedClassName, stackFrame.getName()); + } else { + var methods = pyType.getMethodsByName(stackFrame.getName()); + if (methods.isEmpty()) { + controller.newLogMessage(this, Level.WARNING, "No VM method found for exit of " + + qualifiedClassName + "." + stackFrame.getName()); + return; + } + methodId = (String) methods.getFirst().getId(); + } + + PyMethod pyMethod = (PyMethod) controller.getVMMethod(methodId); + controller.onMethodExit(pyMethod, pyMethod.getId()); + } + + private void onAttrMod(StackFrame stackFrame, String qualifiedClassName) { + controller.newLogMessage(this, Level.FINE, "onAttributeModification: " + qualifiedClassName + "." + stackFrame.getName()); + + boolean isSetter = stackFrame.getName().startsWith("set"); + if (!isSetter) { + controller.newLogMessage(this, Level.WARNING, "Wrongly stopped at non-setter method for attribute modification!"); + return; + } + + String attrName = stackFrame.getName().substring(4); + + Long pyObjId = messenger.getSelfId(stackFrame.getID()); + PyObject pyObject = (PyObject) controller.getVMObject(pyObjId); + + PyField pyField = (PyField) pyObject.getType().getFieldByName(attrName); + if (pyField == null) { + controller.newLogMessage(this, Level.WARNING, + "Cannot determine target attribute for setter: " + stackFrame.getName()); + return; + } + + var methods = pyObject.getType().getMethodsByName(stackFrame.getName()); + if (methods.isEmpty()) { + controller.newLogMessage(this, Level.WARNING, "No VM method found for attribute modification on " + + qualifiedClassName + "." + stackFrame.getName()); + return; + } + String methodId = (String) methods.getFirst().getId(); + + PyMethod m = (PyMethod) controller.getVMMethod(methodId); + + if (m != null) { + if (m.getArgumentNames().size() == 1) { + DAPValue argDAPValue = messenger.getMethodArgDAPValue(stackFrame.getID(), m.getArgumentNames().getFirst()); + Value useValue = debugpyClient.getUSEValue(argDAPValue); + controller.onUpdateAttribute(pyObjId, pyField.getId(), useValue); + } else { + controller.newLogMessage(this, Level.WARNING, + String.format("Could not resolve new value for attribute %s! Expected 1 setter method argument. Found: %d", + pyField.getName(), m.getArgumentNames().size())); + } + } + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/BreakpointType.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/BreakpointType.java new file mode 100644 index 0000000..aa3add9 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/BreakpointType.java @@ -0,0 +1,8 @@ +package org.tzi.use.monitor.adapter.python; + +public enum BreakpointType { + METHOD_CALL, + METHOD_EXIT, + CONSTRUCTOR_CALL, + MODIFICATION +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/DebugpyClient.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/DebugpyClient.java new file mode 100644 index 0000000..9c32075 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/DebugpyClient.java @@ -0,0 +1,449 @@ +package org.tzi.use.monitor.adapter.python; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPValue; +import org.tzi.use.monitor.adapter.python.dap.*; +import org.tzi.use.monitor.plugins.monitor.vm.mm.python.*; +import org.tzi.use.plugins.monitor.Monitor; +import org.tzi.use.plugins.monitor.vm.mm.VMField; +import org.tzi.use.plugins.monitor.vm.mm.VMMethod; +import org.tzi.use.plugins.monitor.vm.mm.VMObject; +import org.tzi.use.plugins.monitor.vm.mm.VMType; +import org.tzi.use.uml.ocl.type.TupleType; +import org.tzi.use.uml.ocl.type.Type; +import org.tzi.use.uml.ocl.type.TypeFactory; +import org.tzi.use.uml.ocl.value.*; + +import java.io.*; +import java.net.Socket; +import java.nio.file.Paths; +import java.util.*; +import java.util.logging.Level; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * The DebugpyClient encapsulates the core logic on which the PythonAdapter relies + * to provide the monitor with runtime information, bridging the gap between + * runtime and static representation of VM models. + * + * @author Sergio Jimenez + */ +public class DebugpyClient { + + private static final Pattern MEMORY_ADDR_PATTERN = Pattern.compile("0x[0-9a-fA-F]+"); + private static final ObjectMapper mapper = new ObjectMapper(); + static final long GLOBAL_MODULE_ID = 1L; + + public boolean running = false; + private final String workspace; + private final String host; + private final int port; + private final PythonAdapter adapter; + public boolean isConnected; + public final Map> fileToBreakpointTypeMap = new HashMap<>(); + public final Map> fileToClassNameMap = new HashMap<>(); + private java.lang.Thread breakpointHandler; + private final Monitor.Controller controller; + private final Messenger messenger; + + DebugpyClient(String host, int port, String workspace, + PythonAdapter adapter, Monitor.Controller controller) throws IOException { + this.workspace = workspace; + this.host = host; + this.port = port; + this.controller = controller; + this.messenger = new Messenger(new Socket(host, port), this); + this.adapter = adapter; + } + + boolean attach() { + var initResp = messenger.initialize(); + messenger.attach(host, port, workspace); + messenger.configurationDone(); + running = true; + breakpointHandler = new java.lang.Thread(new BreakpointHandler(this, adapter, controller, messenger), "BreakpointHandler"); + breakpointHandler.start(); + isConnected = true; + return initResp.getSuccess(); + } + + VMType getVMType(String fqcn) { + if (controller.existsVMType(fqcn)) { + return controller.getVMType(fqcn); + } + if (fqcn.equals("Global")) { + return new PyType(adapter, fqcn, false); + } + if (fqcn.equals("Mock")) { + return new PyType(adapter, fqcn, true); + } + + pause(); // Match monitor state + + try { + String ignore = messenger.evaluate(PyEvalExBuilder.getClass(fqcn)); + } catch (Exception e) { + System.err.printf("Error evaluating VM type '%s'. Cause: %s%n", fqcn, e.getMessage()); + return null; + } + + PyType pyType = new PyType(adapter, fqcn, true); + + controller.storeVMType(fqcn, pyType); + return pyType; + } + + protected VMMethod getVMMethod(String fqcn, String methodName, boolean isModule) { + String methodId = String.format("%s:%s", fqcn, methodName); + if (controller.existsVMMethod(methodId)) { + return controller.getVMMethod(methodId); + } + + String methodInfo; + try { + methodInfo = messenger.evaluate(PyEvalExBuilder.getMethodInfo(fqcn, methodName, isModule)); + } catch (Exception e) { + System.err.printf("Error evaluating VM method '%s'. Cause: %s%n", methodName, e.getMessage()); + return null; + } + + String json = methodInfo.replace("'", "\""); + JsonNode root; + try { + root = mapper.readTree(json); + } catch (JsonProcessingException e) { + return null; + } + + PyMethod pyMethod = new PyMethod(adapter, isModule ? fqcn + "." + methodName : methodName, fqcn); + + String methodArguments = root.get("args").asText(); + + List argNames = new ArrayList<>(); + List argTypes = new ArrayList<>(); + for (String argName : methodArguments.split(",")) { + if (argName.equals("self")) { + continue; + } + argNames.add(argName); + argTypes.add("Mock"); + } + pyMethod.setArgumentNames(argNames); + pyMethod.setArgumentTypes(argTypes); + + // Set line nos and filename + String fileRaw = root.get("file").asText(); + String normalizedFile = Paths.get(fileRaw).normalize().toString(); + pyMethod.setFile(normalizedFile); + pyMethod.setStartLineNo(root.get("start").asInt()); + pyMethod.setEndLineNo(root.get("end").asInt()); + List returnLines = new ArrayList<>(); + for (JsonNode r : root.get("returns")) { + returnLines.add(r.asInt()); + } + pyMethod.setReturnLines(returnLines); + + controller.storeVMMethod(pyMethod.getId(), pyMethod); + return pyMethod; + } + + protected VMField getVMField(String fqcn, String fieldName) { + String fId = String.format("%s:%s", fqcn, fieldName); + if (controller.existsVMField(fId)) { + return controller.getVMField(fId); + } + PyField pyField = new PyField(fieldName, fqcn); + controller.storeVMField(pyField.getId(), pyField); + return pyField; + } + + protected DAPValue getDAPValue(Long objectId, String fName) { + EvaluateResponseClass evalResp = messenger.evaluateRaw(PyEvalExBuilder.getDAPValue(objectId, fName)); + if (!evalResp.getSuccess()) { + return null; + } + EvaluateResponseBody body = evalResp.getBody(); + return new DAPValue(body.getResult(), body.getType(), body.getVariablesReference()); + } + + protected boolean setBreakpoints(String file) { + Set lines = fileToBreakpointTypeMap.get(file).keySet(); + return messenger.setBreakpoints(file, lines); + } + + protected boolean pause() { + if (!running) { + return true; + } + if (!messenger.pause()) { + controller.newLogMessage(this, Level.SEVERE, "Failed to pause debugpy!"); + return false; + } + running = false; + return true; + } + + protected boolean resume() { + if (running) { + return true; + } + boolean res = messenger.resume(); + if (!res) { + controller.newLogMessage(this, Level.SEVERE, "Failed to resume debugpy!"); + return false; + } + running = true; + return true; + } + + protected void stop() { + boolean res = messenger.stop(); + if (!res) { + controller.newLogMessage(this, Level.SEVERE, "Failed to stop debugpy!"); + } else { + isConnected = false; + } + } + + protected Set getInstances(PyType pyType, int maxInstances) { + controller.storeVMType(pyType.getName(), pyType); // Stores PyType with mapped MClass + if (pyType.isModule()) { + VMObject obj = controller.existsVMObject(GLOBAL_MODULE_ID) + ? controller.getVMObject(GLOBAL_MODULE_ID) + : new PyObject(adapter, GLOBAL_MODULE_ID, pyType); + return Set.of(obj); + } + + pause(); + + String instanceIds; + try { + instanceIds = messenger.evaluate(PyEvalExBuilder.getInstanceIds(pyType.getName(), maxInstances)); + } catch (Exception e) { + System.err.printf("Could not query instances for type '%s'. Cause: %s%n", pyType.getName(), e.getMessage()); + return Set.of(); + } + + Set objs = new HashSet<>(); + if (instanceIds == null || instanceIds.length() < 4 || !instanceIds.startsWith("'[") || !instanceIds.endsWith("]'")) { + return objs; + } + String[] ids = instanceIds.substring(2, instanceIds.length() - 2).split(","); + for (String id : ids) { + long objId = Long.parseLong(id.trim()); + PyObject pyObject = new PyObject(adapter, objId, pyType); + objs.add(pyObject); + } + return objs; + } + + public Value getUSEValue(DAPValue dapValue) { + if (dapValue == null) { + return UndefinedValue.instance; + } + + return switch (dapValue.getType()) { + case "int" -> IntegerValue.valueOf(Integer.parseInt(dapValue.getResult())); + case "float" -> new RealValue(Double.parseDouble(dapValue.getResult())); + case "bool" -> BooleanValue.get(Boolean.parseBoolean(dapValue.getResult())); + case "str" -> new StringValue(dapValue.getResult()); + case "list"-> { + List allChildren = fetchChildren(dapValue.getVariablesReference()); + + List items = allChildren.stream() + .filter(child -> child.getName().matches("\\d+")) + .sorted(Comparator.comparingInt(child -> Integer.parseInt(child.getName()))) + .toList(); + + Value[] sequence = new Value[items.size()]; + for (int i = 0; i < items.size(); i++) { + sequence[i] = getUSEValue(items.get(i)); + } + yield new SequenceValue(TypeFactory.mkVoidType(), sequence); + } + case "tuple" -> { + List allChildren = fetchChildren(dapValue.getVariablesReference()); + + List items = allChildren.stream() + .filter(child -> child.getName().matches("\\d+")) + .sorted(Comparator.comparingInt(child -> Integer.parseInt(child.getName()))) + .toList(); + + TupleType.Part[] typeParts = new TupleType.Part[items.size()]; + List valueParts = new ArrayList<>(); + + for (int i = 0; i < items.size(); i++) { + DAPValue item = items.get(i); + String name = "item" + i; + + Value value = getUSEValue(item); + Type type = value.type(); + + typeParts[i] = new TupleType.Part(i, name, type); + valueParts.add(new TupleValue.Part(i, name, value)); + } + + TupleType tupleType = TypeFactory.mkTuple(typeParts); + yield new TupleValue(tupleType, valueParts); + } + // TODO FIXME: custom debugpy call for type resolution of keys and values separately needed + case "dict" -> { + List dictEntries = fetchChildren(dapValue.getVariablesReference()); + + TupleType.Part[] p = new TupleType.Part[] { + new TupleType.Part(0, "key", TypeFactory.mkVoidType()), + new TupleType.Part(1, "value", TypeFactory.mkVoidType()) + }; + TupleType tupleType = TypeFactory.mkTuple(p); + + List tupleValues = new ArrayList<>(); + + for (DAPValue entry : dictEntries) { + if (entry.getVariablesReference() == 0) continue; // skip non-expandable entries + + List keyValueChildren = fetchChildren(entry.getVariablesReference()); + + DAPValue keyDap = keyValueChildren.stream() + .filter(child -> "key".equals(child.getName())) + .findFirst() + .orElse(null); + + DAPValue valueDap = keyValueChildren.stream() + .filter(child -> "value".equals(child.getName())) + .findFirst() + .orElse(null); + + if (keyDap != null && valueDap != null) { + Value useKey = getUSEValue(keyDap); + Value useValue = getUSEValue(valueDap); + + List parts = List.of( + new TupleValue.Part(0, "key", useKey), + new TupleValue.Part(1, "value", useValue) + ); + + tupleValues.add(new TupleValue(tupleType, parts)); + } + } + + yield new SetValue(TypeFactory.mkVoidType(), tupleValues); + } + case "set" -> { + List allChildren = fetchChildren(dapValue.getVariablesReference()); + + var items = allChildren.stream() + .filter(child -> child.getName().matches("\\d+")) + .toList(); + + List useValues = new ArrayList<>(); + + for (DAPValue item : items) { + Value v = getUSEValue(item); + useValues.add(v); + } + + yield new SetValue(TypeFactory.mkVoidType(), useValues); + } + + default -> { + // Object + if (dapValue.getResult().contains("object")) { + long objId = extractHexAndConvertToDecimal(dapValue.getResult()); + if (controller.existsVMObject(objId)) { + VMObject obj = controller.getVMObject(objId); + yield new ObjectValue(obj.getUSEObject().cls(), obj.getUSEObject()); + } + } + // Unknown + yield UndefinedValue.instance; + } + }; + } + + private long extractHexAndConvertToDecimal(String input) { + Matcher matcher = MEMORY_ADDR_PATTERN.matcher(input); + if (matcher.find()) { + String hexString = matcher.group(); + return Long.parseLong(hexString.substring(2), 16); + } + return 0L; + } + + private List fetchChildren(long variablesReference) { + List res = new ArrayList<>(); + Variable[] vars = messenger.getDAPChildren(variablesReference); + for (Variable var : vars) { + var dapVal = new DAPValue(var.getValue(), var.getType(), var.getVariablesReference()); + dapVal.setName(var.getName()); + res.add(dapVal); + } + return res; + } + + public boolean registerConstructorCallInterest(PyType pyType) { + if (pyType.isModule()) { + return true; + } + PyMethod method = ((PyMethod) pyType.getMethodsByName("__init__").getFirst()); + String file = method.getFile(); + int startLineNo = method.getStartLineNo(); + String className = method.getClassName(); + + updateInternalBreakpointMappings(file, className, List.of(startLineNo), BreakpointType.CONSTRUCTOR_CALL); + return setBreakpoints(file); + } + + public boolean registerOperationCallInterest(PyMethod pyMethod) { + if (!pyMethod.getName().equals("__init__")) { + String file = pyMethod.getFile(); + int startLine = pyMethod.getStartLineNo(); + String className = pyMethod.getClassName(); + List returnLines = pyMethod.getReturnLines().isEmpty() ? List.of(pyMethod.getEndLineNo()) : pyMethod.getReturnLines(); + + updateInternalBreakpointMappings(file, className, List.of(startLine), BreakpointType.METHOD_CALL); + updateInternalBreakpointMappings(file, className, returnLines, BreakpointType.METHOD_EXIT); + return setBreakpoints(file); + } + return true; + } + + public boolean registerFieldModificationInterest(PyField pyField) { + String fqcn = pyField.getClassName(); + String fName = pyField.getName(); + String setterName = String.format("set_%s", fName); + PyMethod pyMethod = (PyMethod) getVMMethod(fqcn, setterName, false); + if (pyMethod == null) { + return false; + } + String file = pyMethod.getFile(); + updateInternalBreakpointMappings(file, fqcn, List.of(pyMethod.getStartLineNo()), BreakpointType.MODIFICATION); + return setBreakpoints(file); + } + + private void updateInternalBreakpointMappings(String file, String className, List lineNos, BreakpointType breakpointType) { + if (!fileToBreakpointTypeMap.containsKey(file)) { + Map lineNoToBreakpointType = new HashMap<>(); + Map lineNoToClassName = new HashMap<>(); + + for (Integer lineNo : lineNos) { + lineNoToBreakpointType.put(lineNo, breakpointType); + lineNoToClassName.put(lineNo, className); + } + + fileToBreakpointTypeMap.put(file, lineNoToBreakpointType); + fileToClassNameMap.put(file, lineNoToClassName); + } else { + Map lineNoToBreakpointType = fileToBreakpointTypeMap.get(file); + Map lineNoToClassName = fileToClassNameMap.get(file); + + for (Integer lineNo : lineNos) { + lineNoToBreakpointType.put(lineNo, breakpointType); + lineNoToClassName.put(lineNo, className); + } + } + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/MessageMapper.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/MessageMapper.java new file mode 100644 index 0000000..ed5163a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/MessageMapper.java @@ -0,0 +1,76 @@ +package org.tzi.use.monitor.adapter.python; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPEvent; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPMessage; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPUnknown; +import org.tzi.use.monitor.adapter.python.dap.*; + +/** + * Maps a DAP json message to its respective POJO + */ +public class MessageMapper { + + private static final ObjectMapper mapper = new ObjectMapper(); + + public static DAPMessage parseMessage(String json) throws Exception { + JsonNode tree = mapper.readTree(json); + if (tree == null || !tree.has("type")) { + return new DAPUnknown(json, "Missing or invalid 'type' field"); + } + String type = tree.get("type").asText(null); + if (type == null) { + return new DAPUnknown(json, "Null 'type' field"); + } + return switch (type) { + case "response" -> parseResponse(tree, json); + case "event" -> parseEvent(tree, json); + default -> new DAPUnknown(json, "Unsupported type: " + type); + }; + } + + private static DAPResponse parseResponse(JsonNode tree, String json) throws JsonProcessingException { + if (!tree.has("command")) { + return new DAPUnknown(json, "Missing 'command' in response"); + } + String command = tree.get("command").asText(null); + if (command == null) { + return new DAPUnknown(json, "Null 'command' field"); + } + return switch (command) { + case "initialize" -> mapper.readValue(json, InitializeResponseClass.class); + case "attach" -> mapper.readValue(json, AttachResponseClass.class); + case "configurationDone" -> mapper.readValue(json, ConfigurationDoneResponseClass.class); + case "threads" -> mapper.readValue(json, ThreadsResponseClass.class); + case "evaluate" -> mapper.readValue(json, EvaluateResponseClass.class); + case "pause" -> mapper.readValue(json, PauseResponseClass.class); + case "stackTrace" -> mapper.readValue(json, StackTraceResponseClass.class); + case "continue" -> mapper.readValue(json, ContinueResponseClass.class); + case "disconnect" -> mapper.readValue(json, DisconnectResponseClass.class); + case "setBreakpoints" -> mapper.readValue(json, SetBreakpointsResponseClass.class); + case "variables" -> mapper.readValue(json, VariablesResponseClass.class); + default -> new DAPUnknown(json, "Unknown response command: " + command); + }; + } + + private static DAPEvent parseEvent(JsonNode tree, String json) throws JsonProcessingException { + if (!tree.has("event")) { + return new DAPUnknown(json, "Missing 'event' field in event"); + } + String event = tree.get("event").asText(null); + if (event == null) { + return new DAPUnknown(json, "Null 'event' field"); + } + return switch (event) { + case "initialized" -> mapper.readValue(json, InitializedEventClass.class); + case "stopped" -> mapper.readValue(json, StoppedEventClass.class); + case "terminated" -> mapper.readValue(json, TerminatedEventClass.class); + case "continued" -> mapper.readValue(json, ContinuedEventClass.class); + default -> new DAPUnknown(json, "Unknown event type: " + event); + }; + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/Messenger.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/Messenger.java new file mode 100644 index 0000000..487bda2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/Messenger.java @@ -0,0 +1,388 @@ +package org.tzi.use.monitor.adapter.python; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.tzi.use.monitor.adapter.python.dap.*; +import org.tzi.use.monitor.adapter.python.dap.Thread; +import org.tzi.use.monitor.adapter.python.dap.custom.*; + +import java.io.*; +import java.net.Socket; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; + +/** + * This class is responsible for sending and receiving messages to and from + * the debugpy socket. + */ +public class Messenger { + + private static int REQUEST_COUNTER = 1; + + private final ObjectMapper mapper = new ObjectMapper(); + + private final Socket socket; + private final BufferedReader in; + private final BufferedWriter out; + private final DebugpyClient client; + + private final ConcurrentHashMap> pendingRequests = new ConcurrentHashMap<>(); + private CompletableFuture initEventFuture = new CompletableFuture<>(); + private CompletableFuture pauseEventFuture = new CompletableFuture<>(); + private CompletableFuture continuedEventFuture = new CompletableFuture<>(); + public CompletableFuture breakpointEventFuture = new CompletableFuture<>(); + + public Messenger(Socket socket, DebugpyClient client) throws IOException { + this.socket = socket; + this.in = new BufferedReader(new InputStreamReader(socket.getInputStream())); + this.out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); + startReaderThread(); + this.client = client; + } + + public InitializeResponseClass initialize() { + initEventFuture = new CompletableFuture<>(); + var initArgs = new InitializeRequestArguments(); + initArgs.setAdapterID("USE"); + initArgs.setLinesStartAt1(true); + initArgs.setColumnsStartAt1(true); + initArgs.setPathFormat("path"); + var initReq = new InitializeRequestClass(); + initReq.setSeq(REQUEST_COUNTER++); + initReq.setArguments(initArgs); + return (InitializeResponseClass) sendRequestSync(initReq); + } + + public void attach(String host, int port, String workspace) { + var attachArgs = new AttachRequestArgumentsClass(); + attachArgs.setConnect(Map.of("host", host, "port", port)); + attachArgs.setPathMappings(List.of(Map.of("localRoot", workspace, "remoteRoot", "."))); + attachArgs.setClientOs(resolveClientOS()); + attachArgs.setDebugOptions(List.of("RedirectOutput", "ShowReturnValue")); + attachArgs.setShowReturnValue(true); + attachArgs.setJustMyCode(true); + attachArgs.setWorkspaceFolder(workspace); + attachArgs.setSessionId(UUID.randomUUID().toString()); + var attachReq = new AttachRequestClass(); + attachReq.setArguments(attachArgs); + attachReq.setSeq(REQUEST_COUNTER++); + sendRequestAsync(attachReq); + + try { + initEventFuture.get(); + } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) java.lang.Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + } + + private String resolveClientOS() { + return System.getProperty("os.name").toLowerCase().contains("win") + ? "WINDOWS" + : "UNIX"; + } + + public void configurationDone() { + var confDoneReq = new ConfigurationDoneRequestClass(); + confDoneReq.setSeq(REQUEST_COUNTER++); + // TODO Fix should not be async request + //Response confDoneResp = (Response) sendRequest(confDoneReq); + sendRequestAsync(confDoneReq); + + // Wait for attach async response + // TODO FIX! responseQueue instead of single slot + //Response attachResponse = (Response) waitForAsyncResponse(); + //return initResp.getSuccess() && attachResponse.getSuccess() && confDoneResp.getSuccess(); + try { + java.lang.Thread.sleep(1000); + } catch (InterruptedException e) { + java.lang.Thread.currentThread().interrupt(); + } + } + + public boolean pause() { + pauseEventFuture = new CompletableFuture<>(); + + var pauseArgs = new PauseRequestArguments(); + var threadId = getThreadId(); + pauseArgs.setThreadID(threadId); + var pauseReq = new PauseRequestClass(); + pauseReq.setSeq(REQUEST_COUNTER++); + pauseReq.setArguments(pauseArgs); + var pauseResp = (PauseResponseClass) sendRequestSync(pauseReq); + + if (!pauseResp.getSuccess()) { + return false; + } + + try { + pauseEventFuture.get(); + } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) java.lang.Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + return true; + } + + public boolean resume() { + continuedEventFuture = new CompletableFuture<>(); + + var continueArgs = new ContinueRequestArguments(); + continueArgs.setThreadID(getThreadId()); + var continueReq = new ContinueRequestClass(); + continueReq.setSeq(REQUEST_COUNTER++); + continueReq.setArguments(continueArgs); + if (!((ContinueResponseClass) sendRequestSync(continueReq)).getSuccess()) { + return false; + } + + try { + continuedEventFuture.get(); + } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) java.lang.Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + return true; + } + + + protected Long getSelfId(long frameId) { + var evalArgs = new EvaluateRequestArguments(); + evalArgs.setFrameID(frameId); + evalArgs.setContext("watch"); + evalArgs.setExpression(PyEvalExBuilder.getSelfIdAtCurrentFrame()); + var evalReq = new EvaluateRequestClass(); + evalReq.setSeq(REQUEST_COUNTER++); + evalReq.setArguments(evalArgs); + var evalResp = (EvaluateResponseClass) sendRequestSync(evalReq); + return Long.parseLong(evalResp.getBody().getResult()); + } + + + public Variable[] getDAPChildren(long variablesReference) { + var varArgs = new VariablesRequestArguments(); + varArgs.setVariablesReference(variablesReference); + var varReq = new VariablesRequestClass(); + varReq.setSeq(REQUEST_COUNTER++); + varReq.setArguments(varArgs); + var varResp = (VariablesResponseClass) sendRequestSync(varReq); + return varResp.getBody().getVariables(); + } + + + public boolean stop() { + var stopArgs = new DisconnectRequestArguments(); + stopArgs.setRestart(false); + stopArgs.setSuspendDebuggee(true); + stopArgs.setTerminateDebuggee(false); + var stopReq = new DisconnectRequestClass(); + stopReq.setSeq(REQUEST_COUNTER++); + stopReq.setArguments(stopArgs); + return ((DisconnectResponseClass) sendRequestSync(stopReq)).getSuccess(); + } + + public boolean setBreakpoints(String file, Set lines) { + var source = new Source(); + source.setName(file.substring(file.lastIndexOf("/") + 1)); + source.setPath(file); + var bpArgs = new SetBreakpointsRequestArguments(); + bpArgs.setSource(source); + SourceBreakpoint[] sourceBreakpoints = new SourceBreakpoint[lines.size()]; + Iterator linesIter = lines.iterator(); + for (int i = 0; i < sourceBreakpoints.length; i++) { + var srcBp = new SourceBreakpoint(); + srcBp.setLine(linesIter.next()); + sourceBreakpoints[i] = srcBp; + } + bpArgs.setBreakpoints(sourceBreakpoints); + bpArgs.setLines(lines.stream().mapToLong(Integer::longValue).toArray()); + bpArgs.setSourceModified(false); + var bpReq = new SetBreakpointsRequestClass(); + bpReq.setSeq(REQUEST_COUNTER++); + bpReq.setArguments(bpArgs); + var bpResp = (SetBreakpointsResponseClass) sendRequestSync(bpReq); + return bpResp.getSuccess(); + } + + public String evaluate(String expression) throws Exception { + EvaluateResponseClass raw = evaluateRaw(expression); + if (raw.getSuccess()) { + return raw.getBody().getResult(); + } + throw new Exception("Failed to evaluate expression: " + expression); + } + + protected DAPValue getMethodArgDAPValue(long frameId, String argName) { + var evalArgs = new EvaluateRequestArguments(); + evalArgs.setFrameID(frameId); + evalArgs.setContext("watch"); + evalArgs.setExpression(argName); + var evalReq = new EvaluateRequestClass(); + evalReq.setSeq(REQUEST_COUNTER++); + evalReq.setArguments(evalArgs); + var evalResp = (EvaluateResponseClass) sendRequestSync(evalReq); + return new DAPValue(evalResp.getBody().getResult(), evalResp.getBody().getType(), evalResp.getBody().getVariablesReference()); + } + + public EvaluateResponseClass evaluateRaw(String expression) { + StackFrame currStackFrame = getCurrentFrame(getThreadId()); + var evalArgs = new EvaluateRequestArguments(); + evalArgs.setContext("watch"); + evalArgs.setFrameID(currStackFrame.getID()); + evalArgs.setExpression(expression); + var evalReq = new EvaluateRequestClass(); + evalReq.setSeq(REQUEST_COUNTER++); + evalReq.setArguments(evalArgs); + return (EvaluateResponseClass) sendRequestSync(evalReq); + } + + public Long getThreadId() { + var threadsReq = new ThreadsRequestClass(); + threadsReq.setSeq(REQUEST_COUNTER++); + var threadsResp = (ThreadsResponseClass) sendRequestSync(threadsReq); + if (threadsResp.getSuccess()) { + for (Thread thread : threadsResp.getBody().getThreads()) { + if (thread.getName().equals("MainThread")) { + return thread.getID(); + } + } + } + throw new IllegalMonitorStateException("Could not get thread id from threads request!"); + } + + public StackFrame getCurrentFrame(long threadId) { + var stackTraceArgs = new StackTraceRequestArguments(); + stackTraceArgs.setThreadID(threadId); + var stackTraceReq = new StackTraceRequestClass(); + stackTraceReq.setSeq(REQUEST_COUNTER++); + stackTraceReq.setArguments(stackTraceArgs); + var stackTraceResp = (StackTraceResponseClass) sendRequestSync(stackTraceReq); + + if (stackTraceResp.getSuccess()) { + return stackTraceResp.getBody().getStackFrames()[0]; + } + throw new IllegalMonitorStateException(String.format("Could not get current stack frame for threadId: %d!", threadId)); + } + + private DAPResponse sendRequestSync(DAPRequest dapRequest) { + CompletableFuture futureResp = sendRequestAsync(dapRequest); + return waitForAsyncResponse(futureResp); + } + + private DAPResponse waitForAsyncResponse(CompletableFuture futureResp) { + DAPResponse res; + try { + res = futureResp.get(); + } catch (InterruptedException | ExecutionException e) { + if (e instanceof InterruptedException) java.lang.Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + return res; + } + + private CompletableFuture sendRequestAsync(DAPRequest request) { + long reqSeq = request.getSeq(); + CompletableFuture future = + pendingRequests.computeIfAbsent(reqSeq, ignored -> new CompletableFuture<>()); + + String json; + try { + json = mapper.writeValueAsString(request); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + + byte[] bytes = json.getBytes(StandardCharsets.UTF_8); + String header = "Content-Length: " + bytes.length + "\r\n\r\n"; + try { + out.write(header); + out.flush(); + out.write(json); + out.flush(); + } catch (IOException e) { + throw new RuntimeException(e); + } + return future; + } + + private void startReaderThread() { + var readerThread = new java.lang.Thread(() -> { + try { + while (true) { + String line; + int contentLength = 0; + while ((line = in.readLine()) != null && !line.isEmpty()) { + if (line.startsWith("Content-Length:")) { + String val = line.substring("Content-Length:".length()).trim(); + try { + contentLength = Integer.parseInt(val); + } catch (NumberFormatException ignored) { + } + } + } + + if (contentLength <= 0) { + continue; + } + + char[] body = new char[contentLength]; + int read = 0; + while (read < contentLength) { + int r = in.read(body, read, contentLength - read); + if (r == -1) return; + read += r; + } + String json = new String(body); + if (json.isBlank()) { + continue; + } + DAPMessage msg = MessageMapper.parseMessage(json); + if (msg == null) { + continue; + } + if (msg instanceof DAPResponse dapResp) { + long reqSeq = dapResp.getRequestSeq(); + CompletableFuture future = pendingRequests.remove(reqSeq); + if (future != null) { + future.complete(dapResp); + } + } + if (msg instanceof DAPEvent dapEvent) { + if (dapEvent instanceof InitializedEventClass initializedEvent) { + initEventFuture.complete(initializedEvent); + } + if (dapEvent instanceof ContinuedEventClass continuedEventClass) { + client.running = true; + continuedEventFuture.complete(continuedEventClass); + } + if (dapEvent instanceof StoppedEventClass stoppedEvent) { + client.running = false; + String reason = stoppedEvent.getBody().getReason(); + if (reason.equals("pause")) { + pauseEventFuture.complete(stoppedEvent); + } + if (reason.equals("breakpoint")) { + breakpointEventFuture.complete(stoppedEvent); + } + } + } + if (msg instanceof DAPUnknown dapUnknown) { + System.err.println(dapUnknown); + } + } + } catch (InterruptedIOException e) { + java.lang.Thread.currentThread().interrupt(); + } catch (IOException e) { + return; + } catch (Exception e) { + e.printStackTrace(); + } + }); + readerThread.setDaemon(true); + readerThread.start(); + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/PyEvalExBuilder.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/PyEvalExBuilder.java new file mode 100644 index 0000000..94aea22 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/PyEvalExBuilder.java @@ -0,0 +1,106 @@ +package org.tzi.use.monitor.adapter.python; + +public class PyEvalExBuilder { + + private static final int MODULE_NAME_IDX = 0; + private static final int SIMPLE_CLASS_NAME_IDX = 1; + + public static String getClass(String qualifiedClassName) { + String[] classNameParts = getClassNameParts(qualifiedClassName); + return String.format( + "getattr(__import__('sys').modules['%s'], '%s')", + classNameParts[MODULE_NAME_IDX], + classNameParts[SIMPLE_CLASS_NAME_IDX] + ); + } + + public static String getSelfIdAtCurrentFrame() { + return "id(self)"; + } + + public static String getInstanceIds(String qualifiedClassName, int maxInstances) { + String[] classNameParts = getClassNameParts(qualifiedClassName); + return String.format( + "repr([id(obj) for obj in __import__('gc').get_objects() if isinstance(obj, getattr(__import__('%s'), '%s'))][:%d])", + classNameParts[MODULE_NAME_IDX], + classNameParts[SIMPLE_CLASS_NAME_IDX], + maxInstances + ); + } + + public static String getMethodInfo(String qualifiedClassName, String methodName, boolean isModule) { + if (isModule) { + return String.format( + """ + ( + lambda fn: { + "args": ','.join([p.name for p in __import__('inspect').signature(fn).parameters.values()]), + "file": __import__('os').path.abspath(__import__('inspect').getsourcefile(fn)), + "start": fn.__code__.co_firstlineno + 1, + "end": fn.__code__.co_firstlineno + len(__import__('inspect').getsourcelines(fn)[0]) - 1, + "returns": [ + node.lineno + fn.__code__.co_firstlineno - 1 + for node in __import__('ast').walk( + __import__('ast').parse( + __import__('textwrap').dedent( + "".join(__import__('inspect').getsourcelines(fn)[0]) + ) + ) + ) + if isinstance(node, __import__('ast').Return) + ] + } + )(getattr(__import__('sys').modules['%s'], '%s')) + """, + qualifiedClassName, + methodName + ); + } + String[] classNameParts = getClassNameParts(qualifiedClassName); + return String.format( + """ + ( + lambda fn: { + "args": ','.join([p.name for p in __import__('inspect').signature(fn).parameters.values()]), + "file": __import__('os').path.abspath(__import__('inspect').getsourcefile(fn)), + "start": fn.__code__.co_firstlineno + 1, + "end": fn.__code__.co_firstlineno + len(__import__('inspect').getsourcelines(fn)[0]) - 1, + "returns": [ + node.lineno + fn.__code__.co_firstlineno - 1 + for node in __import__('ast').walk( + __import__('ast').parse( + __import__('textwrap').dedent( + "".join(__import__('inspect').getsourcelines(fn)[0]) + ) + ) + ) + if isinstance(node, __import__('ast').Return) + ] + } + )(getattr(getattr(__import__('sys').modules['%s'], '%s'), '%s')) + """, + classNameParts[MODULE_NAME_IDX], + classNameParts[SIMPLE_CLASS_NAME_IDX], + methodName + ); + } + + public static String getDAPValue(Long objectId, String fieldName) { + return String.format("(next(o for o in __import__('gc').get_objects() if id(o) == %s)).%s", + objectId, + fieldName + ); + } + + private static String[] getClassNameParts(String qualifiedClassName) { + int lastDotIdx = qualifiedClassName.lastIndexOf('.'); + if (lastDotIdx == -1) { + return new String[]{"__main__", qualifiedClassName}; + } + return new String[] { + qualifiedClassName.substring(0, lastDotIdx), + qualifiedClassName.substring(lastDotIdx + 1) + }; + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/PythonAdapter.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/PythonAdapter.java new file mode 100644 index 0000000..2182b34 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/PythonAdapter.java @@ -0,0 +1,206 @@ +package org.tzi.use.monitor.adapter.python; + +import org.tzi.use.monitor.adapter.python.dap.custom.DAPValue; +import org.tzi.use.monitor.plugins.monitor.vm.mm.python.*; +import org.tzi.use.plugins.monitor.MonitorException; +import org.tzi.use.plugins.monitor.vm.adapter.AbstractVMAdapter; +import org.tzi.use.plugins.monitor.vm.adapter.InvalidAdapterConfiguration; +import org.tzi.use.plugins.monitor.vm.adapter.VMAdapterSetting; +import org.tzi.use.plugins.monitor.vm.mm.*; +import org.tzi.use.uml.ocl.value.*; + +import java.util.*; +import java.util.logging.Level; + +/** + * The PythonAdapter is an implementation of the VMAdapter abstraction + * to support the monitoring of Python programs. + * + * @author Sergio Jimenez + */ +public class PythonAdapter extends AbstractVMAdapter { + + private static final int SETTING_HOST_IDX = 0; + private static final int SETTING_PORT_IDX = 1; + private static final int SETTING_WORKSPACE_IDX = 2; + private static final int SETTING_MAX_INSTANCES_IDX = 3; + + private String host; + private int port; + private String workspace; + private int maxInstances; + private DebugpyClient debugpyClient; + + // FIXME: More robust validation + @Override + protected void validateSettings() throws InvalidAdapterConfiguration { + List settings = getSettings(); + if (settings.size() < 4) { + throw new InvalidAdapterConfiguration("Adapter settings incomplete!"); + } + + String settingHostVal = settings.get(SETTING_HOST_IDX).value; + if (settingHostVal == null || settingHostVal.isBlank()) { + throw new InvalidAdapterConfiguration("Host is missing!"); + } + host = settingHostVal; + + try { + port = Integer.parseInt(settings.get(SETTING_PORT_IDX).value); + } catch (NumberFormatException e) { + throw new InvalidAdapterConfiguration("Port must be a number!"); + } + + String settingWorkspace = settings.get(SETTING_WORKSPACE_IDX).value; + if (settingWorkspace == null || settingWorkspace.isBlank()) { + throw new InvalidAdapterConfiguration("Workspace directory is missing!"); + } + workspace = settingWorkspace; + + try { + maxInstances = Integer.parseInt(settings.get(SETTING_MAX_INSTANCES_IDX).value); + } catch (NumberFormatException e) { + throw new InvalidAdapterConfiguration("Max. Instances must be an integer!"); + } + } + + @Override + protected void createSettings(List settings) { + settings.add(SETTING_HOST_IDX, new VMAdapterSetting("Host", "localhost")); + settings.add(SETTING_PORT_IDX, new VMAdapterSetting("Port", "5678")); + settings.add(SETTING_WORKSPACE_IDX, new VMAdapterSetting("SUM Directory Path", "")); + settings.add(SETTING_MAX_INSTANCES_IDX, new VMAdapterSetting("Max. Instances", "50")); + } + + @Override + public void attachToVM() throws MonitorException { + String errMsg = "Failed to attach to debugpy server!"; + try { + debugpyClient = new DebugpyClient(host, port, workspace, this, controller); + if (!debugpyClient.attach()) { + controller.newLogMessage(this, Level.SEVERE, errMsg); + throw new MonitorException(errMsg); + } + } catch (Exception e) { + throw new MonitorException(errMsg, e); + } + } + + @Override + public void resume() { + debugpyClient.resume(); + } + + @Override + public void suspend() { + debugpyClient.pause(); + } + + @Override + public void stop() { + debugpyClient.stop(); + } + + public Set readInstances(PyType pyType) { + return debugpyClient.getInstances(pyType, maxInstances); + } + + public Value getUSEValue(long objId, String fName) { + DAPValue dapValue = debugpyClient.getDAPValue(objId, fName); + return debugpyClient.getUSEValue(dapValue); + } + + @Override + public VMType getVMType(String fqcn) { + controller.newLogMessage(this, Level.FINE, String.format("Getting runtime type '%s'...", fqcn)); + VMType vmType = debugpyClient.getVMType(fqcn); + if (vmType == null) { + controller.newLogMessage(this, Level.WARNING, String.format("Could not find runtime type '%s'!", fqcn)); + } + return vmType; + } + + public VMMethod getVMMethod(String fqcn, String methodName, boolean isModule) { + controller.newLogMessage(this, Level.FINE, String.format("Getting runtime method '%s' for type '%s'...", methodName, fqcn)); + String classOrModuleName = fqcn; + String mName = methodName; + if (isModule) { + if (methodName.equals("__init__")) { + return null; + } + int lastDot = methodName.lastIndexOf('.'); + classOrModuleName = methodName.substring(0, lastDot); + mName = methodName.substring(lastDot + 1); + } + VMMethod vmMethod = debugpyClient.getVMMethod(classOrModuleName, mName, isModule); + if (vmMethod == null) { + controller.newLogMessage(this, Level.WARNING, String.format("Could not find runtime method '%s' for type '%s'!", mName, classOrModuleName)); + } + return vmMethod; + } + + public VMField getVMField(String fqcn, String fieldName) { + controller.newLogMessage(this, Level.FINE, String.format("Getting runtime field '%s' for type '%s'...", fieldName, fqcn)); + VMField vmField = debugpyClient.getVMField(fqcn, fieldName); + if (vmField == null) { + controller.newLogMessage(this, Level.WARNING, String.format("Could not get runtime field '%s' for type '%s'!", fieldName, fqcn)); + } + return vmField; + } + + @Override + public void registerConstructorCallInterest(VMType vmType) { + controller.newLogMessage(this, Level.FINE, String.format("Registering constructor call interest for type '%s'...", vmType)); + if (!debugpyClient.registerConstructorCallInterest((PyType) vmType)) { + controller.newLogMessage(this, Level.WARNING, String.format("Could not register constructor call interest for type '%s'!", vmType)); + } + } + + @Override + public void registerOperationCallInterest(VMMethod vmMethod) { + controller.newLogMessage(this, Level.FINE, String.format("Registering operation call interest for '%s'...", vmMethod)); + if (!debugpyClient.registerOperationCallInterest((PyMethod) vmMethod)) { + controller.newLogMessage(this, Level.WARNING, String.format("Could not register operation call interest for '%s'!", vmMethod)); + } + } + + @Override + public void registerFieldModificationInterest(VMField vmField) { + controller.newLogMessage(this, Level.FINE, String.format("Registering field modification interest for '%s'...", vmField)); + if (!debugpyClient.registerFieldModificationInterest((PyField) vmField)) { + controller.newLogMessage(this, Level.WARNING, String.format("Could not register field modification interest for '%s'!", vmField)); + } + } + + @Override + public boolean isVMTypeLoaded(String javaClassName) { + return controller.existsVMType(javaClassName); + } + + @Override + public void registerClassPrepareEvent(String javaClassName) { + } + + @Override + public void unregisterClassPrepareInterest(Object adapterEventInformation) { + } + + @Override + public void registerMethodExit(VMMethodCall call) { + } + + @Override + public void unregisterOperationeExit(Object adapterExitInformation) { + } + + @Override + public Value getMethodResultValue(Object adapterExitInformation) { + return null; + } + + @Override + public String toString() { + return "PythonAdapter"; + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ArgumentsClass.java new file mode 100644 index 0000000..c41e4b5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ArgumentsClass.java @@ -0,0 +1,20 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `attach` request. Additional attributes are implementation specific. + */ +public class ArgumentsClass { + private Restart restart; + + /** + * Arbitrary data from the previous, restarted session. + * The data is sent as the `restart` attribute of the `terminated` event. + * The client should leave the data intact. + */ + @JsonProperty("__restart") + public Restart getRestart() { return restart; } + @JsonProperty("__restart") + public void setRestart(Restart value) { this.restart = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestArgumentsClass.java new file mode 100644 index 0000000..35a8206 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestArgumentsClass.java @@ -0,0 +1,96 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * Arguments for `attach` request. Additional attributes are implementation specific. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AttachRequestArgumentsClass { + private Restart restart; + private boolean justMyCode; + private String sessionId; + private String clientOs; + private Map connect; + private List> pathMappings; + private List debugOptions; + private boolean showReturnValue; + private String workspaceFolder; + + /** + * Arbitrary data from the previous, restarted session. + * The data is sent as the `restart` attribute of the `terminated` event. + * The client should leave the data intact. + */ + @JsonProperty("__restart") + public Restart getRestart() { return restart; } + @JsonProperty("__restart") + public void setRestart(Restart value) { this.restart = value; } + @JsonProperty("justMyCode") + public boolean isJustMyCode() { + return justMyCode; + } + @JsonProperty("justMyCode") + public void setJustMyCode(boolean justMyCode) { + this.justMyCode = justMyCode; + } + @JsonProperty("__sessionId") + public String getSessionId() { + return sessionId; + } + @JsonProperty("__sessionId") + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + @JsonProperty("clientOS") + public String getClientOs() { + return clientOs; + } + @JsonProperty("clientOS") + public void setClientOs(String clientOs) { + this.clientOs = clientOs; + } + @JsonProperty("connect") + public Map getConnect() { + return connect; + } + @JsonProperty("connect") + public void setConnect(Map connect) { + this.connect = connect; + } + @JsonProperty("pathMappings") + public List> getPathMappings() { + return pathMappings; + } + @JsonProperty("pathMappings") + public void setPathMappings(List> pathMappings) { + this.pathMappings = pathMappings; + } + @JsonProperty("debugOptions") + public List getDebugOptions() { + return debugOptions; + } + @JsonProperty("debugOptions") + public void setDebugOptions(List debugOptions) { + this.debugOptions = debugOptions; + } + @JsonProperty("showReturnValue") + public boolean isShowReturnValue() { + return showReturnValue; + } + @JsonProperty("showReturnValue") + public void setShowReturnValue(boolean showReturnValue) { + this.showReturnValue = showReturnValue; + } + @JsonProperty("workspaceFolder") + public String getWorkspaceFolder() { + return workspaceFolder; + } + @JsonProperty("workspaceFolder") + public void setWorkspaceFolder(String workspaceFolder) { + this.workspaceFolder = workspaceFolder; + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestClass.java new file mode 100644 index 0000000..bf8b254 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The `attach` request is sent from the client to the debug adapter to attach to a debuggee + * that is already running. + * Since attaching is debugger/runtime specific, the arguments for this request are not part + * of this specification. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class AttachRequestClass implements DAPRequest { + private long seq; + private AttachRequestType type = AttachRequestType.REQUEST; + private AttachRequestArgumentsClass arguments; + private AttachRequestCommand command = AttachRequestCommand.ATTACH; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public AttachRequestArgumentsClass getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(AttachRequestArgumentsClass value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public AttachRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(AttachRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestCommand.java new file mode 100644 index 0000000..c84c183 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum AttachRequestCommand { + ATTACH; + + @JsonValue + public String toValue() { + switch (this) { + case ATTACH: return "attach"; + } + return null; + } + + @JsonCreator + public static AttachRequestCommand forValue(String value) throws IOException { + if (value.equals("attach")) return ATTACH; + throw new IOException("Cannot deserialize AttachRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestType.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestType.java new file mode 100644 index 0000000..65230b5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachRequestType.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum AttachRequestType { + REQUEST; + + @JsonValue + public String toValue() { + switch (this) { + case REQUEST: return "request"; + } + return null; + } + + @JsonCreator + public static AttachRequestType forValue(String value) throws IOException { + if (value.equals("request")) return REQUEST; + throw new IOException("Cannot deserialize AttachRequestType"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachResponseClass.java new file mode 100644 index 0000000..89a38c5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachResponseClass.java @@ -0,0 +1,89 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `attach` request. This is just an acknowledgement, so no body field is + * required. + */ +public class AttachResponseClass implements DAPResponse { + private long seq; + private String type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachResponseType.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachResponseType.java new file mode 100644 index 0000000..34683e2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/AttachResponseType.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum AttachResponseType { + RESPONSE; + + @JsonValue + public String toValue() { + switch (this) { + case RESPONSE: return "response"; + } + return null; + } + + @JsonCreator + public static AttachResponseType forValue(String value) throws IOException { + if (value.equals("response")) return RESPONSE; + throw new IOException("Cannot deserialize AttachResponseType"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BaseProtocol.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BaseProtocol.java new file mode 100644 index 0000000..c672fad --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BaseProtocol.java @@ -0,0 +1,32 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + */ +public class BaseProtocol { + private long seq; + private String type; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BodyClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BodyClass.java new file mode 100644 index 0000000..61f246d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BodyClass.java @@ -0,0 +1,399 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Information about the capabilities of a debug adapter. + * + * The set of updated capabilities. + * + * The capabilities of this debug adapter. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class BodyClass { + private ColumnDescriptor[] additionalModuleColumns; + private String[] completionTriggerCharacters; + private ExceptionBreakpointsFilter[] exceptionBreakpointFilters; + private ChecksumAlgorithm[] supportedChecksumAlgorithms; + private Boolean supportsBreakpointLocationsRequest; + private Boolean supportsCancelRequest; + private Boolean supportsClipboardContext; + private Boolean supportsCompletionsRequest; + private Boolean supportsConditionalBreakpoints; + private Boolean supportsConfigurationDoneRequest; + private Boolean supportsDataBreakpoints; + private Boolean supportsDelayedStackTraceLoading; + private Boolean supportsDisassembleRequest; + private Boolean supportsEvaluateForHovers; + private Boolean supportsExceptionFilterOptions; + private Boolean supportsExceptionInfoRequest; + private Boolean supportsExceptionOptions; + private Boolean supportsFunctionBreakpoints; + private Boolean supportsGotoTargetsRequest; + private Boolean supportsHitConditionalBreakpoints; + private Boolean supportsInstructionBreakpoints; + private Boolean supportsLoadedSourcesRequest; + private Boolean supportsLogPoints; + private Boolean supportsModulesRequest; + private Boolean supportsReadMemoryRequest; + private Boolean supportsRestartFrame; + private Boolean supportsRestartRequest; + private Boolean supportsSetExpression; + private Boolean supportsSetVariable; + private Boolean supportsSingleThreadExecutionRequests; + private Boolean supportsStepBack; + private Boolean supportsStepInTargetsRequest; + private Boolean supportsSteppingGranularity; + private Boolean supportsTerminateRequest; + private Boolean supportsTerminateThreadsRequest; + private Boolean supportSuspendDebuggee; + private Boolean supportsValueFormattingOptions; + private Boolean supportsWriteMemoryRequest; + private Boolean supportTerminateDebuggee; + private Boolean supportsDebuggerProperties; + private Boolean supportsTerminateDebuggee; + + /** + * The set of additional module information exposed by the debug adapter. + */ + @JsonProperty("additionalModuleColumns") + public ColumnDescriptor[] getAdditionalModuleColumns() { return additionalModuleColumns; } + @JsonProperty("additionalModuleColumns") + public void setAdditionalModuleColumns(ColumnDescriptor[] value) { this.additionalModuleColumns = value; } + + /** + * The set of characters that should trigger completion in a REPL. If not specified, the UI + * should assume the `.` character. + */ + @JsonProperty("completionTriggerCharacters") + public String[] getCompletionTriggerCharacters() { return completionTriggerCharacters; } + @JsonProperty("completionTriggerCharacters") + public void setCompletionTriggerCharacters(String[] value) { this.completionTriggerCharacters = value; } + + /** + * Available exception filter options for the `setExceptionBreakpoints` request. + */ + @JsonProperty("exceptionBreakpointFilters") + public ExceptionBreakpointsFilter[] getExceptionBreakpointFilters() { return exceptionBreakpointFilters; } + @JsonProperty("exceptionBreakpointFilters") + public void setExceptionBreakpointFilters(ExceptionBreakpointsFilter[] value) { this.exceptionBreakpointFilters = value; } + + /** + * Checksum algorithms supported by the debug adapter. + */ + @JsonProperty("supportedChecksumAlgorithms") + public ChecksumAlgorithm[] getSupportedChecksumAlgorithms() { return supportedChecksumAlgorithms; } + @JsonProperty("supportedChecksumAlgorithms") + public void setSupportedChecksumAlgorithms(ChecksumAlgorithm[] value) { this.supportedChecksumAlgorithms = value; } + + /** + * The debug adapter supports the `breakpointLocations` request. + */ + @JsonProperty("supportsBreakpointLocationsRequest") + public Boolean getSupportsBreakpointLocationsRequest() { return supportsBreakpointLocationsRequest; } + @JsonProperty("supportsBreakpointLocationsRequest") + public void setSupportsBreakpointLocationsRequest(Boolean value) { this.supportsBreakpointLocationsRequest = value; } + + /** + * The debug adapter supports the `cancel` request. + */ + @JsonProperty("supportsCancelRequest") + public Boolean getSupportsCancelRequest() { return supportsCancelRequest; } + @JsonProperty("supportsCancelRequest") + public void setSupportsCancelRequest(Boolean value) { this.supportsCancelRequest = value; } + + /** + * The debug adapter supports the `clipboard` context value in the `evaluate` request. + */ + @JsonProperty("supportsClipboardContext") + public Boolean getSupportsClipboardContext() { return supportsClipboardContext; } + @JsonProperty("supportsClipboardContext") + public void setSupportsClipboardContext(Boolean value) { this.supportsClipboardContext = value; } + + /** + * The debug adapter supports the `completions` request. + */ + @JsonProperty("supportsCompletionsRequest") + public Boolean getSupportsCompletionsRequest() { return supportsCompletionsRequest; } + @JsonProperty("supportsCompletionsRequest") + public void setSupportsCompletionsRequest(Boolean value) { this.supportsCompletionsRequest = value; } + + /** + * The debug adapter supports conditional breakpoints. + */ + @JsonProperty("supportsConditionalBreakpoints") + public Boolean getSupportsConditionalBreakpoints() { return supportsConditionalBreakpoints; } + @JsonProperty("supportsConditionalBreakpoints") + public void setSupportsConditionalBreakpoints(Boolean value) { this.supportsConditionalBreakpoints = value; } + + /** + * The debug adapter supports the `configurationDone` request. + */ + @JsonProperty("supportsConfigurationDoneRequest") + public Boolean getSupportsConfigurationDoneRequest() { return supportsConfigurationDoneRequest; } + @JsonProperty("supportsConfigurationDoneRequest") + public void setSupportsConfigurationDoneRequest(Boolean value) { this.supportsConfigurationDoneRequest = value; } + + /** + * The debug adapter supports data breakpoints. + */ + @JsonProperty("supportsDataBreakpoints") + public Boolean getSupportsDataBreakpoints() { return supportsDataBreakpoints; } + @JsonProperty("supportsDataBreakpoints") + public void setSupportsDataBreakpoints(Boolean value) { this.supportsDataBreakpoints = value; } + + /** + * The debug adapter supports the delayed loading of parts of the stack, which requires that + * both the `startFrame` and `levels` arguments and the `totalFrames` result of the + * `stackTrace` request are supported. + */ + @JsonProperty("supportsDelayedStackTraceLoading") + public Boolean getSupportsDelayedStackTraceLoading() { return supportsDelayedStackTraceLoading; } + @JsonProperty("supportsDelayedStackTraceLoading") + public void setSupportsDelayedStackTraceLoading(Boolean value) { this.supportsDelayedStackTraceLoading = value; } + + /** + * The debug adapter supports the `disassemble` request. + */ + @JsonProperty("supportsDisassembleRequest") + public Boolean getSupportsDisassembleRequest() { return supportsDisassembleRequest; } + @JsonProperty("supportsDisassembleRequest") + public void setSupportsDisassembleRequest(Boolean value) { this.supportsDisassembleRequest = value; } + + /** + * The debug adapter supports a (side effect free) `evaluate` request for data hovers. + */ + @JsonProperty("supportsEvaluateForHovers") + public Boolean getSupportsEvaluateForHovers() { return supportsEvaluateForHovers; } + @JsonProperty("supportsEvaluateForHovers") + public void setSupportsEvaluateForHovers(Boolean value) { this.supportsEvaluateForHovers = value; } + + /** + * The debug adapter supports `filterOptions` as an argument on the + * `setExceptionBreakpoints` request. + */ + @JsonProperty("supportsExceptionFilterOptions") + public Boolean getSupportsExceptionFilterOptions() { return supportsExceptionFilterOptions; } + @JsonProperty("supportsExceptionFilterOptions") + public void setSupportsExceptionFilterOptions(Boolean value) { this.supportsExceptionFilterOptions = value; } + + /** + * The debug adapter supports the `exceptionInfo` request. + */ + @JsonProperty("supportsExceptionInfoRequest") + public Boolean getSupportsExceptionInfoRequest() { return supportsExceptionInfoRequest; } + @JsonProperty("supportsExceptionInfoRequest") + public void setSupportsExceptionInfoRequest(Boolean value) { this.supportsExceptionInfoRequest = value; } + + /** + * The debug adapter supports `exceptionOptions` on the `setExceptionBreakpoints` request. + */ + @JsonProperty("supportsExceptionOptions") + public Boolean getSupportsExceptionOptions() { return supportsExceptionOptions; } + @JsonProperty("supportsExceptionOptions") + public void setSupportsExceptionOptions(Boolean value) { this.supportsExceptionOptions = value; } + + /** + * The debug adapter supports function breakpoints. + */ + @JsonProperty("supportsFunctionBreakpoints") + public Boolean getSupportsFunctionBreakpoints() { return supportsFunctionBreakpoints; } + @JsonProperty("supportsFunctionBreakpoints") + public void setSupportsFunctionBreakpoints(Boolean value) { this.supportsFunctionBreakpoints = value; } + + /** + * The debug adapter supports the `gotoTargets` request. + */ + @JsonProperty("supportsGotoTargetsRequest") + public Boolean getSupportsGotoTargetsRequest() { return supportsGotoTargetsRequest; } + @JsonProperty("supportsGotoTargetsRequest") + public void setSupportsGotoTargetsRequest(Boolean value) { this.supportsGotoTargetsRequest = value; } + + /** + * The debug adapter supports breakpoints that break execution after a specified number of + * hits. + */ + @JsonProperty("supportsHitConditionalBreakpoints") + public Boolean getSupportsHitConditionalBreakpoints() { return supportsHitConditionalBreakpoints; } + @JsonProperty("supportsHitConditionalBreakpoints") + public void setSupportsHitConditionalBreakpoints(Boolean value) { this.supportsHitConditionalBreakpoints = value; } + + /** + * The debug adapter supports adding breakpoints based on instruction references. + */ + @JsonProperty("supportsInstructionBreakpoints") + public Boolean getSupportsInstructionBreakpoints() { return supportsInstructionBreakpoints; } + @JsonProperty("supportsInstructionBreakpoints") + public void setSupportsInstructionBreakpoints(Boolean value) { this.supportsInstructionBreakpoints = value; } + + /** + * The debug adapter supports the `loadedSources` request. + */ + @JsonProperty("supportsLoadedSourcesRequest") + public Boolean getSupportsLoadedSourcesRequest() { return supportsLoadedSourcesRequest; } + @JsonProperty("supportsLoadedSourcesRequest") + public void setSupportsLoadedSourcesRequest(Boolean value) { this.supportsLoadedSourcesRequest = value; } + + /** + * The debug adapter supports log points by interpreting the `logMessage` attribute of the + * `SourceBreakpoint`. + */ + @JsonProperty("supportsLogPoints") + public Boolean getSupportsLogPoints() { return supportsLogPoints; } + @JsonProperty("supportsLogPoints") + public void setSupportsLogPoints(Boolean value) { this.supportsLogPoints = value; } + + /** + * The debug adapter supports the `modules` request. + */ + @JsonProperty("supportsModulesRequest") + public Boolean getSupportsModulesRequest() { return supportsModulesRequest; } + @JsonProperty("supportsModulesRequest") + public void setSupportsModulesRequest(Boolean value) { this.supportsModulesRequest = value; } + + /** + * The debug adapter supports the `readMemory` request. + */ + @JsonProperty("supportsReadMemoryRequest") + public Boolean getSupportsReadMemoryRequest() { return supportsReadMemoryRequest; } + @JsonProperty("supportsReadMemoryRequest") + public void setSupportsReadMemoryRequest(Boolean value) { this.supportsReadMemoryRequest = value; } + + /** + * The debug adapter supports restarting a frame. + */ + @JsonProperty("supportsRestartFrame") + public Boolean getSupportsRestartFrame() { return supportsRestartFrame; } + @JsonProperty("supportsRestartFrame") + public void setSupportsRestartFrame(Boolean value) { this.supportsRestartFrame = value; } + + /** + * The debug adapter supports the `restart` request. In this case a client should not + * implement `restart` by terminating and relaunching the adapter but by calling the + * `restart` request. + */ + @JsonProperty("supportsRestartRequest") + public Boolean getSupportsRestartRequest() { return supportsRestartRequest; } + @JsonProperty("supportsRestartRequest") + public void setSupportsRestartRequest(Boolean value) { this.supportsRestartRequest = value; } + + /** + * The debug adapter supports the `setExpression` request. + */ + @JsonProperty("supportsSetExpression") + public Boolean getSupportsSetExpression() { return supportsSetExpression; } + @JsonProperty("supportsSetExpression") + public void setSupportsSetExpression(Boolean value) { this.supportsSetExpression = value; } + + /** + * The debug adapter supports setting a variable to a value. + */ + @JsonProperty("supportsSetVariable") + public Boolean getSupportsSetVariable() { return supportsSetVariable; } + @JsonProperty("supportsSetVariable") + public void setSupportsSetVariable(Boolean value) { this.supportsSetVariable = value; } + + /** + * The debug adapter supports the `singleThread` property on the execution requests + * (`continue`, `next`, `stepIn`, `stepOut`, `reverseContinue`, `stepBack`). + */ + @JsonProperty("supportsSingleThreadExecutionRequests") + public Boolean getSupportsSingleThreadExecutionRequests() { return supportsSingleThreadExecutionRequests; } + @JsonProperty("supportsSingleThreadExecutionRequests") + public void setSupportsSingleThreadExecutionRequests(Boolean value) { this.supportsSingleThreadExecutionRequests = value; } + + /** + * The debug adapter supports stepping back via the `stepBack` and `reverseContinue` + * requests. + */ + @JsonProperty("supportsStepBack") + public Boolean getSupportsStepBack() { return supportsStepBack; } + @JsonProperty("supportsStepBack") + public void setSupportsStepBack(Boolean value) { this.supportsStepBack = value; } + + /** + * The debug adapter supports the `stepInTargets` request. + */ + @JsonProperty("supportsStepInTargetsRequest") + public Boolean getSupportsStepInTargetsRequest() { return supportsStepInTargetsRequest; } + @JsonProperty("supportsStepInTargetsRequest") + public void setSupportsStepInTargetsRequest(Boolean value) { this.supportsStepInTargetsRequest = value; } + + /** + * The debug adapter supports stepping granularities (argument `granularity`) for the + * stepping requests. + */ + @JsonProperty("supportsSteppingGranularity") + public Boolean getSupportsSteppingGranularity() { return supportsSteppingGranularity; } + @JsonProperty("supportsSteppingGranularity") + public void setSupportsSteppingGranularity(Boolean value) { this.supportsSteppingGranularity = value; } + + /** + * The debug adapter supports the `terminate` request. + */ + @JsonProperty("supportsTerminateRequest") + public Boolean getSupportsTerminateRequest() { return supportsTerminateRequest; } + @JsonProperty("supportsTerminateRequest") + public void setSupportsTerminateRequest(Boolean value) { this.supportsTerminateRequest = value; } + + /** + * The debug adapter supports the `terminateThreads` request. + */ + @JsonProperty("supportsTerminateThreadsRequest") + public Boolean getSupportsTerminateThreadsRequest() { return supportsTerminateThreadsRequest; } + @JsonProperty("supportsTerminateThreadsRequest") + public void setSupportsTerminateThreadsRequest(Boolean value) { this.supportsTerminateThreadsRequest = value; } + + /** + * The debug adapter supports the `suspendDebuggee` attribute on the `disconnect` request. + */ + @JsonProperty("supportSuspendDebuggee") + public Boolean getSupportSuspendDebuggee() { return supportSuspendDebuggee; } + @JsonProperty("supportSuspendDebuggee") + public void setSupportSuspendDebuggee(Boolean value) { this.supportSuspendDebuggee = value; } + + /** + * The debug adapter supports a `format` attribute on the `stackTrace`, `variables`, and + * `evaluate` requests. + */ + @JsonProperty("supportsValueFormattingOptions") + public Boolean getSupportsValueFormattingOptions() { return supportsValueFormattingOptions; } + @JsonProperty("supportsValueFormattingOptions") + public void setSupportsValueFormattingOptions(Boolean value) { this.supportsValueFormattingOptions = value; } + + /** + * The debug adapter supports the `writeMemory` request. + */ + @JsonProperty("supportsWriteMemoryRequest") + public Boolean getSupportsWriteMemoryRequest() { return supportsWriteMemoryRequest; } + @JsonProperty("supportsWriteMemoryRequest") + public void setSupportsWriteMemoryRequest(Boolean value) { this.supportsWriteMemoryRequest = value; } + + /** + * The debug adapter supports the `terminateDebuggee` attribute on the `disconnect` request. + */ + @JsonProperty("supportTerminateDebuggee") + public Boolean getSupportTerminateDebuggee() { return supportTerminateDebuggee; } + @JsonProperty("supportTerminateDebuggee") + public void setSupportTerminateDebuggee(Boolean value) { this.supportTerminateDebuggee = value; } + + @JsonProperty("supportsDebuggerProperties") + public Boolean getSupportsDebuggerProperties() { + return supportsDebuggerProperties; + } + + @JsonProperty("supportsDebuggerProperties") + public void setSupportsDebuggerProperties(Boolean supportsDebuggerProperties) { + this.supportsDebuggerProperties = supportsDebuggerProperties; + } + + @JsonProperty("supportsTerminateDebuggee") + public Boolean getSupportsTerminateDebuggee() { + return supportsTerminateDebuggee; + } + + @JsonProperty("supportsTerminateDebuggee") + public void setSupportsTerminateDebuggee(Boolean supportsTerminateDebuggee) { + this.supportsTerminateDebuggee = supportsTerminateDebuggee; + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BodyReason.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BodyReason.java new file mode 100644 index 0000000..411a2de --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BodyReason.java @@ -0,0 +1,29 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * The reason for the event. + */ +public enum BodyReason { + CHANGED, NEW, REMOVED; + + @JsonValue + public String toValue() { + switch (this) { + case CHANGED: return "changed"; + case NEW: return "new"; + case REMOVED: return "removed"; + } + return null; + } + + @JsonCreator + public static BodyReason forValue(String value) throws IOException { + if (value.equals("changed")) return CHANGED; + if (value.equals("new")) return NEW; + if (value.equals("removed")) return REMOVED; + throw new IOException("Cannot deserialize BodyReason"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Breakpoint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Breakpoint.java new file mode 100644 index 0000000..c4af574 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Breakpoint.java @@ -0,0 +1,127 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Information about a breakpoint created in `setBreakpoints`, `setFunctionBreakpoints`, + * `setInstructionBreakpoints`, or `setDataBreakpoints` requests. + * + * The `id` attribute is used to find the target breakpoint, the other attributes are used + * as the new values. + */ +public class Breakpoint { + private Long column; + private Long endColumn; + private Long endLine; + private Long id; + private String instructionReference; + private Long line; + private String message; + private Long offset; + private BreakpointReason reason; + private Source source; + private boolean verified; + + /** + * Start position of the source range covered by the breakpoint. It is measured in UTF-16 + * code units and the client capability `columnsStartAt1` determines whether it is 0- or + * 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * End position of the source range covered by the breakpoint. It is measured in UTF-16 code + * units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + * If no end line is given, then the end column is assumed to be in the start line. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * The end line of the actual range covered by the breakpoint. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * The identifier for the breakpoint. It is needed if breakpoint events are used to update + * or remove breakpoints. + */ + @JsonProperty("id") + public Long getID() { return id; } + @JsonProperty("id") + public void setID(Long value) { this.id = value; } + + /** + * A memory reference to where the breakpoint is set. + */ + @JsonProperty("instructionReference") + public String getInstructionReference() { return instructionReference; } + @JsonProperty("instructionReference") + public void setInstructionReference(String value) { this.instructionReference = value; } + + /** + * The start line of the actual range covered by the breakpoint. + */ + @JsonProperty("line") + public Long getLine() { return line; } + @JsonProperty("line") + public void setLine(Long value) { this.line = value; } + + /** + * A message about the state of the breakpoint. + * This is shown to the user and can be used to explain why a breakpoint could not be + * verified. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * The offset from the instruction reference. + * This can be negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } + + /** + * A machine-readable explanation of why a breakpoint may not be verified. If a breakpoint + * is verified or a specific reason is not known, the adapter should omit this property. + * Possible values include: + * + * - `pending`: Indicates a breakpoint might be verified in the future, but the adapter + * cannot verify it in the current state. + * - `failed`: Indicates a breakpoint was not able to be verified, and the adapter does not + * believe it can be verified without intervention. + */ + @JsonProperty("reason") + public BreakpointReason getReason() { return reason; } + @JsonProperty("reason") + public void setReason(BreakpointReason value) { this.reason = value; } + + /** + * The source where the breakpoint is located. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + /** + * If true, the breakpoint could be set (but not necessarily at the desired location). + */ + @JsonProperty("verified") + public boolean getVerified() { return verified; } + @JsonProperty("verified") + public void setVerified(boolean value) { this.verified = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventBody.java new file mode 100644 index 0000000..2f5187a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventBody.java @@ -0,0 +1,25 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class BreakpointEventBody { + private Breakpoint breakpoint; + private String reason; + + /** + * The `id` attribute is used to find the target breakpoint, the other attributes are used + * as the new values. + */ + @JsonProperty("breakpoint") + public Breakpoint getBreakpoint() { return breakpoint; } + @JsonProperty("breakpoint") + public void setBreakpoint(Breakpoint value) { this.breakpoint = value; } + + /** + * The reason for the event. + */ + @JsonProperty("reason") + public String getReason() { return reason; } + @JsonProperty("reason") + public void setReason(String value) { this.reason = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventClass.java new file mode 100644 index 0000000..81148a2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPEvent; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that some information about a breakpoint has changed. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class BreakpointEventClass implements DAPEvent { + private long seq; + private String type; + private BreakpointEventBody body; + private String event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public BreakpointEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(BreakpointEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public String getEvent() { return event; } + @JsonProperty("event") + public void setEvent(String value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventEvent.java new file mode 100644 index 0000000..f4a2b93 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum BreakpointEventEvent { + BREAKPOINT; + + @JsonValue + public String toValue() { + switch (this) { + case BREAKPOINT: return "breakpoint"; + } + return null; + } + + @JsonCreator + public static BreakpointEventEvent forValue(String value) throws IOException { + if (value.equals("breakpoint")) return BREAKPOINT; + throw new IOException("Cannot deserialize BreakpointEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventType.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventType.java new file mode 100644 index 0000000..b8ecb51 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointEventType.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum BreakpointEventType { + EVENT; + + @JsonValue + public String toValue() { + switch (this) { + case EVENT: return "event"; + } + return null; + } + + @JsonCreator + public static BreakpointEventType forValue(String value) throws IOException { + if (value.equals("event")) return EVENT; + throw new IOException("Cannot deserialize BreakpointEventType"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocation.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocation.java new file mode 100644 index 0000000..b5a1dac --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocation.java @@ -0,0 +1,48 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Properties of a breakpoint location returned from the `breakpointLocations` request. + */ +public class BreakpointLocation { + private Long column; + private Long endColumn; + private Long endLine; + private long line; + + /** + * The start position of a breakpoint location. Position is measured in UTF-16 code units + * and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * The end position of a breakpoint location (if the location covers a range). Position is + * measured in UTF-16 code units and the client capability `columnsStartAt1` determines + * whether it is 0- or 1-based. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * The end line of breakpoint location if the location covers a range. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * Start line of breakpoint location. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsArgumentsClass.java new file mode 100644 index 0000000..2addb42 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsArgumentsClass.java @@ -0,0 +1,61 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `breakpointLocations` request. + */ +public class BreakpointLocationsArgumentsClass { + private Long column; + private Long endColumn; + private Long endLine; + private long line; + private Source source; + + /** + * Start position within `line` to search possible breakpoint locations in. It is measured + * in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is + * 0- or 1-based. If no column is given, the first position in the start line is assumed. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * End position within `endLine` to search possible breakpoint locations in. It is measured + * in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is + * 0- or 1-based. If no end column is given, the last position in the end line is assumed. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * End line of range to search possible breakpoint locations in. If no end line is given, + * then the end line is assumed to be the start line. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * Start line of range to search possible breakpoint locations in. If only the line is + * specified, the request returns all possible locations in that line. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } + + /** + * The source location of the breakpoints; either `source.path` or `source.sourceReference` + * must be specified. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestArguments.java new file mode 100644 index 0000000..20296a1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestArguments.java @@ -0,0 +1,61 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `breakpointLocations` request. + */ +public class BreakpointLocationsRequestArguments { + private Long column; + private Long endColumn; + private Long endLine; + private long line; + private Source source; + + /** + * Start position within `line` to search possible breakpoint locations in. It is measured + * in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is + * 0- or 1-based. If no column is given, the first position in the start line is assumed. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * End position within `endLine` to search possible breakpoint locations in. It is measured + * in UTF-16 code units and the client capability `columnsStartAt1` determines whether it is + * 0- or 1-based. If no end column is given, the last position in the end line is assumed. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * End line of range to search possible breakpoint locations in. If no end line is given, + * then the end line is assumed to be the start line. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * Start line of range to search possible breakpoint locations in. If only the line is + * specified, the request returns all possible locations in that line. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } + + /** + * The source location of the breakpoints; either `source.path` or `source.sourceReference` + * must be specified. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestClass.java new file mode 100644 index 0000000..41e6431 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The `breakpointLocations` request returns all possible locations for source breakpoints + * in a given range. + * Clients should only call this request if the corresponding capability + * `supportsBreakpointLocationsRequest` is true. + */ +public class BreakpointLocationsRequestClass { + private long seq; + private AttachRequestType type; + private BreakpointLocationsRequestArguments arguments; + private BreakpointLocationsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public BreakpointLocationsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(BreakpointLocationsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public BreakpointLocationsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(BreakpointLocationsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestCommand.java new file mode 100644 index 0000000..ec3e727 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum BreakpointLocationsRequestCommand { + BREAKPOINT_LOCATIONS; + + @JsonValue + public String toValue() { + switch (this) { + case BREAKPOINT_LOCATIONS: return "breakpointLocations"; + } + return null; + } + + @JsonCreator + public static BreakpointLocationsRequestCommand forValue(String value) throws IOException { + if (value.equals("breakpointLocations")) return BREAKPOINT_LOCATIONS; + throw new IOException("Cannot deserialize BreakpointLocationsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsResponseBody.java new file mode 100644 index 0000000..dc50377 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class BreakpointLocationsResponseBody { + private BreakpointLocation[] breakpoints; + + /** + * Sorted set of possible breakpoint locations. + */ + @JsonProperty("breakpoints") + public BreakpointLocation[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(BreakpointLocation[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsResponseClass.java new file mode 100644 index 0000000..54587d2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointLocationsResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `breakpointLocations` request. + * Contains possible locations for source breakpoints. + */ +public class BreakpointLocationsResponseClass { + private long seq; + private AttachResponseType type; + private BreakpointLocationsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public BreakpointLocationsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(BreakpointLocationsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointReason.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointReason.java new file mode 100644 index 0000000..f348cfa --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/BreakpointReason.java @@ -0,0 +1,34 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * A machine-readable explanation of why a breakpoint may not be verified. If a breakpoint + * is verified or a specific reason is not known, the adapter should omit this property. + * Possible values include: + * + * - `pending`: Indicates a breakpoint might be verified in the future, but the adapter + * cannot verify it in the current state. + * - `failed`: Indicates a breakpoint was not able to be verified, and the adapter does not + * believe it can be verified without intervention. + */ +public enum BreakpointReason { + FAILED, PENDING; + + @JsonValue + public String toValue() { + switch (this) { + case FAILED: return "failed"; + case PENDING: return "pending"; + } + return null; + } + + @JsonCreator + public static BreakpointReason forValue(String value) throws IOException { + if (value.equals("failed")) return FAILED; + if (value.equals("pending")) return PENDING; + throw new IOException("Cannot deserialize BreakpointReason"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelArgumentsClass.java new file mode 100644 index 0000000..eff18b3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelArgumentsClass.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `cancel` request. + */ +public class CancelArgumentsClass { + private String progressID; + private Long requestID; + + /** + * The ID (attribute `progressId`) of the progress to cancel. If missing no progress is + * cancelled. + * Both a `requestId` and a `progressId` can be specified in one request. + */ + @JsonProperty("progressId") + public String getProgressID() { return progressID; } + @JsonProperty("progressId") + public void setProgressID(String value) { this.progressID = value; } + + /** + * The ID (attribute `seq`) of the request to cancel. If missing no request is cancelled. + * Both a `requestId` and a `progressId` can be specified in one request. + */ + @JsonProperty("requestId") + public Long getRequestID() { return requestID; } + @JsonProperty("requestId") + public void setRequestID(Long value) { this.requestID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestArguments.java new file mode 100644 index 0000000..8d4c7fc --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestArguments.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `cancel` request. + */ +public class CancelRequestArguments { + private String progressID; + private Long requestID; + + /** + * The ID (attribute `progressId`) of the progress to cancel. If missing no progress is + * cancelled. + * Both a `requestId` and a `progressId` can be specified in one request. + */ + @JsonProperty("progressId") + public String getProgressID() { return progressID; } + @JsonProperty("progressId") + public void setProgressID(String value) { this.progressID = value; } + + /** + * The ID (attribute `seq`) of the request to cancel. If missing no request is cancelled. + * Both a `requestId` and a `progressId` can be specified in one request. + */ + @JsonProperty("requestId") + public Long getRequestID() { return requestID; } + @JsonProperty("requestId") + public void setRequestID(Long value) { this.requestID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestClass.java new file mode 100644 index 0000000..54427c0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestClass.java @@ -0,0 +1,71 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The `cancel` request is used by the client in two situations: + * - to indicate that it is no longer interested in the result produced by a specific + * request issued earlier + * - to cancel a progress sequence. + * Clients should only call this request if the corresponding capability + * `supportsCancelRequest` is true. + * This request has a hint characteristic: a debug adapter can only be expected to make a + * 'best effort' in honoring this request but there are no guarantees. + * The `cancel` request may return an error if it could not cancel an operation but a client + * should refrain from presenting this error to end users. + * The request that got cancelled still needs to send a response back. This can either be a + * normal result (`success` attribute true) or an error response (`success` attribute false + * and the `message` set to `cancelled`). + * Returning partial results from a cancelled request is possible but please note that a + * client has no generic way for detecting that a response is partial or not. + * The progress that got cancelled still needs to send a `progressEnd` event back. + * A client should not assume that progress just got cancelled after sending the `cancel` + * request. + */ +public class CancelRequestClass { + private long seq; + private AttachRequestType type; + private CancelRequestArguments arguments; + private CancelRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public CancelRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(CancelRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public CancelRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(CancelRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestCommand.java new file mode 100644 index 0000000..6335d23 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum CancelRequestCommand { + CANCEL; + + @JsonValue + public String toValue() { + switch (this) { + case CANCEL: return "cancel"; + } + return null; + } + + @JsonCreator + public static CancelRequestCommand forValue(String value) throws IOException { + if (value.equals("cancel")) return CANCEL; + throw new IOException("Cannot deserialize CancelRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelResponseClass.java new file mode 100644 index 0000000..331b99c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CancelResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `cancel` request. This is just an acknowledgement, so no body field is + * required. + */ +public class CancelResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesClass.java new file mode 100644 index 0000000..f9a1344 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesClass.java @@ -0,0 +1,376 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Information about the capabilities of a debug adapter. + * + * The set of updated capabilities. + * + * The capabilities of this debug adapter. + */ +public class CapabilitiesClass { + private ColumnDescriptor[] additionalModuleColumns; + private String[] completionTriggerCharacters; + private ExceptionBreakpointsFilter[] exceptionBreakpointFilters; + private ChecksumAlgorithm[] supportedChecksumAlgorithms; + private Boolean supportsBreakpointLocationsRequest; + private Boolean supportsCancelRequest; + private Boolean supportsClipboardContext; + private Boolean supportsCompletionsRequest; + private Boolean supportsConditionalBreakpoints; + private Boolean supportsConfigurationDoneRequest; + private Boolean supportsDataBreakpoints; + private Boolean supportsDelayedStackTraceLoading; + private Boolean supportsDisassembleRequest; + private Boolean supportsEvaluateForHovers; + private Boolean supportsExceptionFilterOptions; + private Boolean supportsExceptionInfoRequest; + private Boolean supportsExceptionOptions; + private Boolean supportsFunctionBreakpoints; + private Boolean supportsGotoTargetsRequest; + private Boolean supportsHitConditionalBreakpoints; + private Boolean supportsInstructionBreakpoints; + private Boolean supportsLoadedSourcesRequest; + private Boolean supportsLogPoints; + private Boolean supportsModulesRequest; + private Boolean supportsReadMemoryRequest; + private Boolean supportsRestartFrame; + private Boolean supportsRestartRequest; + private Boolean supportsSetExpression; + private Boolean supportsSetVariable; + private Boolean supportsSingleThreadExecutionRequests; + private Boolean supportsStepBack; + private Boolean supportsStepInTargetsRequest; + private Boolean supportsSteppingGranularity; + private Boolean supportsTerminateRequest; + private Boolean supportsTerminateThreadsRequest; + private Boolean supportSuspendDebuggee; + private Boolean supportsValueFormattingOptions; + private Boolean supportsWriteMemoryRequest; + private Boolean supportTerminateDebuggee; + + /** + * The set of additional module information exposed by the debug adapter. + */ + @JsonProperty("additionalModuleColumns") + public ColumnDescriptor[] getAdditionalModuleColumns() { return additionalModuleColumns; } + @JsonProperty("additionalModuleColumns") + public void setAdditionalModuleColumns(ColumnDescriptor[] value) { this.additionalModuleColumns = value; } + + /** + * The set of characters that should trigger completion in a REPL. If not specified, the UI + * should assume the `.` character. + */ + @JsonProperty("completionTriggerCharacters") + public String[] getCompletionTriggerCharacters() { return completionTriggerCharacters; } + @JsonProperty("completionTriggerCharacters") + public void setCompletionTriggerCharacters(String[] value) { this.completionTriggerCharacters = value; } + + /** + * Available exception filter options for the `setExceptionBreakpoints` request. + */ + @JsonProperty("exceptionBreakpointFilters") + public ExceptionBreakpointsFilter[] getExceptionBreakpointFilters() { return exceptionBreakpointFilters; } + @JsonProperty("exceptionBreakpointFilters") + public void setExceptionBreakpointFilters(ExceptionBreakpointsFilter[] value) { this.exceptionBreakpointFilters = value; } + + /** + * Checksum algorithms supported by the debug adapter. + */ + @JsonProperty("supportedChecksumAlgorithms") + public ChecksumAlgorithm[] getSupportedChecksumAlgorithms() { return supportedChecksumAlgorithms; } + @JsonProperty("supportedChecksumAlgorithms") + public void setSupportedChecksumAlgorithms(ChecksumAlgorithm[] value) { this.supportedChecksumAlgorithms = value; } + + /** + * The debug adapter supports the `breakpointLocations` request. + */ + @JsonProperty("supportsBreakpointLocationsRequest") + public Boolean getSupportsBreakpointLocationsRequest() { return supportsBreakpointLocationsRequest; } + @JsonProperty("supportsBreakpointLocationsRequest") + public void setSupportsBreakpointLocationsRequest(Boolean value) { this.supportsBreakpointLocationsRequest = value; } + + /** + * The debug adapter supports the `cancel` request. + */ + @JsonProperty("supportsCancelRequest") + public Boolean getSupportsCancelRequest() { return supportsCancelRequest; } + @JsonProperty("supportsCancelRequest") + public void setSupportsCancelRequest(Boolean value) { this.supportsCancelRequest = value; } + + /** + * The debug adapter supports the `clipboard` context value in the `evaluate` request. + */ + @JsonProperty("supportsClipboardContext") + public Boolean getSupportsClipboardContext() { return supportsClipboardContext; } + @JsonProperty("supportsClipboardContext") + public void setSupportsClipboardContext(Boolean value) { this.supportsClipboardContext = value; } + + /** + * The debug adapter supports the `completions` request. + */ + @JsonProperty("supportsCompletionsRequest") + public Boolean getSupportsCompletionsRequest() { return supportsCompletionsRequest; } + @JsonProperty("supportsCompletionsRequest") + public void setSupportsCompletionsRequest(Boolean value) { this.supportsCompletionsRequest = value; } + + /** + * The debug adapter supports conditional breakpoints. + */ + @JsonProperty("supportsConditionalBreakpoints") + public Boolean getSupportsConditionalBreakpoints() { return supportsConditionalBreakpoints; } + @JsonProperty("supportsConditionalBreakpoints") + public void setSupportsConditionalBreakpoints(Boolean value) { this.supportsConditionalBreakpoints = value; } + + /** + * The debug adapter supports the `configurationDone` request. + */ + @JsonProperty("supportsConfigurationDoneRequest") + public Boolean getSupportsConfigurationDoneRequest() { return supportsConfigurationDoneRequest; } + @JsonProperty("supportsConfigurationDoneRequest") + public void setSupportsConfigurationDoneRequest(Boolean value) { this.supportsConfigurationDoneRequest = value; } + + /** + * The debug adapter supports data breakpoints. + */ + @JsonProperty("supportsDataBreakpoints") + public Boolean getSupportsDataBreakpoints() { return supportsDataBreakpoints; } + @JsonProperty("supportsDataBreakpoints") + public void setSupportsDataBreakpoints(Boolean value) { this.supportsDataBreakpoints = value; } + + /** + * The debug adapter supports the delayed loading of parts of the stack, which requires that + * both the `startFrame` and `levels` arguments and the `totalFrames` result of the + * `stackTrace` request are supported. + */ + @JsonProperty("supportsDelayedStackTraceLoading") + public Boolean getSupportsDelayedStackTraceLoading() { return supportsDelayedStackTraceLoading; } + @JsonProperty("supportsDelayedStackTraceLoading") + public void setSupportsDelayedStackTraceLoading(Boolean value) { this.supportsDelayedStackTraceLoading = value; } + + /** + * The debug adapter supports the `disassemble` request. + */ + @JsonProperty("supportsDisassembleRequest") + public Boolean getSupportsDisassembleRequest() { return supportsDisassembleRequest; } + @JsonProperty("supportsDisassembleRequest") + public void setSupportsDisassembleRequest(Boolean value) { this.supportsDisassembleRequest = value; } + + /** + * The debug adapter supports a (side effect free) `evaluate` request for data hovers. + */ + @JsonProperty("supportsEvaluateForHovers") + public Boolean getSupportsEvaluateForHovers() { return supportsEvaluateForHovers; } + @JsonProperty("supportsEvaluateForHovers") + public void setSupportsEvaluateForHovers(Boolean value) { this.supportsEvaluateForHovers = value; } + + /** + * The debug adapter supports `filterOptions` as an argument on the + * `setExceptionBreakpoints` request. + */ + @JsonProperty("supportsExceptionFilterOptions") + public Boolean getSupportsExceptionFilterOptions() { return supportsExceptionFilterOptions; } + @JsonProperty("supportsExceptionFilterOptions") + public void setSupportsExceptionFilterOptions(Boolean value) { this.supportsExceptionFilterOptions = value; } + + /** + * The debug adapter supports the `exceptionInfo` request. + */ + @JsonProperty("supportsExceptionInfoRequest") + public Boolean getSupportsExceptionInfoRequest() { return supportsExceptionInfoRequest; } + @JsonProperty("supportsExceptionInfoRequest") + public void setSupportsExceptionInfoRequest(Boolean value) { this.supportsExceptionInfoRequest = value; } + + /** + * The debug adapter supports `exceptionOptions` on the `setExceptionBreakpoints` request. + */ + @JsonProperty("supportsExceptionOptions") + public Boolean getSupportsExceptionOptions() { return supportsExceptionOptions; } + @JsonProperty("supportsExceptionOptions") + public void setSupportsExceptionOptions(Boolean value) { this.supportsExceptionOptions = value; } + + /** + * The debug adapter supports function breakpoints. + */ + @JsonProperty("supportsFunctionBreakpoints") + public Boolean getSupportsFunctionBreakpoints() { return supportsFunctionBreakpoints; } + @JsonProperty("supportsFunctionBreakpoints") + public void setSupportsFunctionBreakpoints(Boolean value) { this.supportsFunctionBreakpoints = value; } + + /** + * The debug adapter supports the `gotoTargets` request. + */ + @JsonProperty("supportsGotoTargetsRequest") + public Boolean getSupportsGotoTargetsRequest() { return supportsGotoTargetsRequest; } + @JsonProperty("supportsGotoTargetsRequest") + public void setSupportsGotoTargetsRequest(Boolean value) { this.supportsGotoTargetsRequest = value; } + + /** + * The debug adapter supports breakpoints that break execution after a specified number of + * hits. + */ + @JsonProperty("supportsHitConditionalBreakpoints") + public Boolean getSupportsHitConditionalBreakpoints() { return supportsHitConditionalBreakpoints; } + @JsonProperty("supportsHitConditionalBreakpoints") + public void setSupportsHitConditionalBreakpoints(Boolean value) { this.supportsHitConditionalBreakpoints = value; } + + /** + * The debug adapter supports adding breakpoints based on instruction references. + */ + @JsonProperty("supportsInstructionBreakpoints") + public Boolean getSupportsInstructionBreakpoints() { return supportsInstructionBreakpoints; } + @JsonProperty("supportsInstructionBreakpoints") + public void setSupportsInstructionBreakpoints(Boolean value) { this.supportsInstructionBreakpoints = value; } + + /** + * The debug adapter supports the `loadedSources` request. + */ + @JsonProperty("supportsLoadedSourcesRequest") + public Boolean getSupportsLoadedSourcesRequest() { return supportsLoadedSourcesRequest; } + @JsonProperty("supportsLoadedSourcesRequest") + public void setSupportsLoadedSourcesRequest(Boolean value) { this.supportsLoadedSourcesRequest = value; } + + /** + * The debug adapter supports log points by interpreting the `logMessage` attribute of the + * `SourceBreakpoint`. + */ + @JsonProperty("supportsLogPoints") + public Boolean getSupportsLogPoints() { return supportsLogPoints; } + @JsonProperty("supportsLogPoints") + public void setSupportsLogPoints(Boolean value) { this.supportsLogPoints = value; } + + /** + * The debug adapter supports the `modules` request. + */ + @JsonProperty("supportsModulesRequest") + public Boolean getSupportsModulesRequest() { return supportsModulesRequest; } + @JsonProperty("supportsModulesRequest") + public void setSupportsModulesRequest(Boolean value) { this.supportsModulesRequest = value; } + + /** + * The debug adapter supports the `readMemory` request. + */ + @JsonProperty("supportsReadMemoryRequest") + public Boolean getSupportsReadMemoryRequest() { return supportsReadMemoryRequest; } + @JsonProperty("supportsReadMemoryRequest") + public void setSupportsReadMemoryRequest(Boolean value) { this.supportsReadMemoryRequest = value; } + + /** + * The debug adapter supports restarting a frame. + */ + @JsonProperty("supportsRestartFrame") + public Boolean getSupportsRestartFrame() { return supportsRestartFrame; } + @JsonProperty("supportsRestartFrame") + public void setSupportsRestartFrame(Boolean value) { this.supportsRestartFrame = value; } + + /** + * The debug adapter supports the `restart` request. In this case a client should not + * implement `restart` by terminating and relaunching the adapter but by calling the + * `restart` request. + */ + @JsonProperty("supportsRestartRequest") + public Boolean getSupportsRestartRequest() { return supportsRestartRequest; } + @JsonProperty("supportsRestartRequest") + public void setSupportsRestartRequest(Boolean value) { this.supportsRestartRequest = value; } + + /** + * The debug adapter supports the `setExpression` request. + */ + @JsonProperty("supportsSetExpression") + public Boolean getSupportsSetExpression() { return supportsSetExpression; } + @JsonProperty("supportsSetExpression") + public void setSupportsSetExpression(Boolean value) { this.supportsSetExpression = value; } + + /** + * The debug adapter supports setting a variable to a value. + */ + @JsonProperty("supportsSetVariable") + public Boolean getSupportsSetVariable() { return supportsSetVariable; } + @JsonProperty("supportsSetVariable") + public void setSupportsSetVariable(Boolean value) { this.supportsSetVariable = value; } + + /** + * The debug adapter supports the `singleThread` property on the execution requests + * (`continue`, `next`, `stepIn`, `stepOut`, `reverseContinue`, `stepBack`). + */ + @JsonProperty("supportsSingleThreadExecutionRequests") + public Boolean getSupportsSingleThreadExecutionRequests() { return supportsSingleThreadExecutionRequests; } + @JsonProperty("supportsSingleThreadExecutionRequests") + public void setSupportsSingleThreadExecutionRequests(Boolean value) { this.supportsSingleThreadExecutionRequests = value; } + + /** + * The debug adapter supports stepping back via the `stepBack` and `reverseContinue` + * requests. + */ + @JsonProperty("supportsStepBack") + public Boolean getSupportsStepBack() { return supportsStepBack; } + @JsonProperty("supportsStepBack") + public void setSupportsStepBack(Boolean value) { this.supportsStepBack = value; } + + /** + * The debug adapter supports the `stepInTargets` request. + */ + @JsonProperty("supportsStepInTargetsRequest") + public Boolean getSupportsStepInTargetsRequest() { return supportsStepInTargetsRequest; } + @JsonProperty("supportsStepInTargetsRequest") + public void setSupportsStepInTargetsRequest(Boolean value) { this.supportsStepInTargetsRequest = value; } + + /** + * The debug adapter supports stepping granularities (argument `granularity`) for the + * stepping requests. + */ + @JsonProperty("supportsSteppingGranularity") + public Boolean getSupportsSteppingGranularity() { return supportsSteppingGranularity; } + @JsonProperty("supportsSteppingGranularity") + public void setSupportsSteppingGranularity(Boolean value) { this.supportsSteppingGranularity = value; } + + /** + * The debug adapter supports the `terminate` request. + */ + @JsonProperty("supportsTerminateRequest") + public Boolean getSupportsTerminateRequest() { return supportsTerminateRequest; } + @JsonProperty("supportsTerminateRequest") + public void setSupportsTerminateRequest(Boolean value) { this.supportsTerminateRequest = value; } + + /** + * The debug adapter supports the `terminateThreads` request. + */ + @JsonProperty("supportsTerminateThreadsRequest") + public Boolean getSupportsTerminateThreadsRequest() { return supportsTerminateThreadsRequest; } + @JsonProperty("supportsTerminateThreadsRequest") + public void setSupportsTerminateThreadsRequest(Boolean value) { this.supportsTerminateThreadsRequest = value; } + + /** + * The debug adapter supports the `suspendDebuggee` attribute on the `disconnect` request. + */ + @JsonProperty("supportSuspendDebuggee") + public Boolean getSupportSuspendDebuggee() { return supportSuspendDebuggee; } + @JsonProperty("supportSuspendDebuggee") + public void setSupportSuspendDebuggee(Boolean value) { this.supportSuspendDebuggee = value; } + + /** + * The debug adapter supports a `format` attribute on the `stackTrace`, `variables`, and + * `evaluate` requests. + */ + @JsonProperty("supportsValueFormattingOptions") + public Boolean getSupportsValueFormattingOptions() { return supportsValueFormattingOptions; } + @JsonProperty("supportsValueFormattingOptions") + public void setSupportsValueFormattingOptions(Boolean value) { this.supportsValueFormattingOptions = value; } + + /** + * The debug adapter supports the `writeMemory` request. + */ + @JsonProperty("supportsWriteMemoryRequest") + public Boolean getSupportsWriteMemoryRequest() { return supportsWriteMemoryRequest; } + @JsonProperty("supportsWriteMemoryRequest") + public void setSupportsWriteMemoryRequest(Boolean value) { this.supportsWriteMemoryRequest = value; } + + /** + * The debug adapter supports the `terminateDebuggee` attribute on the `disconnect` request. + */ + @JsonProperty("supportTerminateDebuggee") + public Boolean getSupportTerminateDebuggee() { return supportTerminateDebuggee; } + @JsonProperty("supportTerminateDebuggee") + public void setSupportTerminateDebuggee(Boolean value) { this.supportTerminateDebuggee = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventBody.java new file mode 100644 index 0000000..85158f1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class CapabilitiesEventBody { + private CapabilitiesClass capabilities; + + /** + * The set of updated capabilities. + */ + @JsonProperty("capabilities") + public CapabilitiesClass getCapabilities() { return capabilities; } + @JsonProperty("capabilities") + public void setCapabilities(CapabilitiesClass value) { this.capabilities = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventClass.java new file mode 100644 index 0000000..f40dada --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that one or more capabilities have changed. + * Since the capabilities are dependent on the client and its UI, it might not be possible + * to change that at random times (or too late). + * Consequently this event has a hint characteristic: a client can only be expected to make + * a 'best effort' in honoring individual capabilities but there are no guarantees. + * Only changed capabilities need to be included, all other capabilities keep their values. + */ +public class CapabilitiesEventClass { + private long seq; + private BreakpointEventType type; + private CapabilitiesEventBody body; + private CapabilitiesEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public CapabilitiesEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(CapabilitiesEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public CapabilitiesEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(CapabilitiesEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventEvent.java new file mode 100644 index 0000000..2337872 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CapabilitiesEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum CapabilitiesEventEvent { + CAPABILITIES; + + @JsonValue + public String toValue() { + switch (this) { + case CAPABILITIES: return "capabilities"; + } + return null; + } + + @JsonCreator + public static CapabilitiesEventEvent forValue(String value) throws IOException { + if (value.equals("capabilities")) return CAPABILITIES; + throw new IOException("Cannot deserialize CapabilitiesEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ChRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ChRequestArguments.java new file mode 100644 index 0000000..754320a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ChRequestArguments.java @@ -0,0 +1,33 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * The latest version of the `launch` or `attach` configuration. + * + * Arguments for `launch` request. Additional attributes are implementation specific. + * + * Arguments for `attach` request. Additional attributes are implementation specific. + */ +public class ChRequestArguments { + private Restart restart; + private Boolean noDebug; + + /** + * Arbitrary data from the previous, restarted session. + * The data is sent as the `restart` attribute of the `terminated` event. + * The client should leave the data intact. + */ + @JsonProperty("__restart") + public Restart getRestart() { return restart; } + @JsonProperty("__restart") + public void setRestart(Restart value) { this.restart = value; } + + /** + * If true, the launch request should launch the program without enabling debugging. + */ + @JsonProperty("noDebug") + public Boolean getNoDebug() { return noDebug; } + @JsonProperty("noDebug") + public void setNoDebug(Boolean value) { this.noDebug = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Checksum.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Checksum.java new file mode 100644 index 0000000..eeeadab --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Checksum.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * The checksum of an item calculated by the specified algorithm. + */ +public class Checksum { + private ChecksumAlgorithm algorithm; + private String checksum; + + /** + * The algorithm used to calculate this checksum. + */ + @JsonProperty("algorithm") + public ChecksumAlgorithm getAlgorithm() { return algorithm; } + @JsonProperty("algorithm") + public void setAlgorithm(ChecksumAlgorithm value) { this.algorithm = value; } + + /** + * Value of the checksum, encoded as a hexadecimal value. + */ + @JsonProperty("checksum") + public String getChecksum() { return checksum; } + @JsonProperty("checksum") + public void setChecksum(String value) { this.checksum = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ChecksumAlgorithm.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ChecksumAlgorithm.java new file mode 100644 index 0000000..bc18dc5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ChecksumAlgorithm.java @@ -0,0 +1,33 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * The algorithm used to calculate this checksum. + * + * Names of checksum algorithms that may be supported by a debug adapter. + */ +public enum ChecksumAlgorithm { + MD5, SHA1, SHA256, TIMESTAMP; + + @JsonValue + public String toValue() { + switch (this) { + case MD5: return "MD5"; + case SHA1: return "SHA1"; + case SHA256: return "SHA256"; + case TIMESTAMP: return "timestamp"; + } + return null; + } + + @JsonCreator + public static ChecksumAlgorithm forValue(String value) throws IOException { + if (value.equals("MD5")) return MD5; + if (value.equals("SHA1")) return SHA1; + if (value.equals("SHA256")) return SHA256; + if (value.equals("timestamp")) return TIMESTAMP; + throw new IOException("Cannot deserialize ChecksumAlgorithm"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ColumnDescriptor.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ColumnDescriptor.java new file mode 100644 index 0000000..fd2495a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ColumnDescriptor.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A `ColumnDescriptor` specifies what module attribute to show in a column of the modules + * view, how to format it, + * and what the column's label should be. + * It is only used if the underlying UI actually supports this level of customization. + */ +public class ColumnDescriptor { + private String attributeName; + private String format; + private String label; + private Type type; + private Long width; + + /** + * Name of the attribute rendered in this column. + */ + @JsonProperty("attributeName") + public String getAttributeName() { return attributeName; } + @JsonProperty("attributeName") + public void setAttributeName(String value) { this.attributeName = value; } + + /** + * Format to use for the rendered values in this column. TBD how the format strings looks + * like. + */ + @JsonProperty("format") + public String getFormat() { return format; } + @JsonProperty("format") + public void setFormat(String value) { this.format = value; } + + /** + * Header UI label of column. + */ + @JsonProperty("label") + public String getLabel() { return label; } + @JsonProperty("label") + public void setLabel(String value) { this.label = value; } + + /** + * Datatype of values in this column. Defaults to `string` if not specified. + */ + @JsonProperty("type") + public Type getType() { return type; } + @JsonProperty("type") + public void setType(Type value) { this.type = value; } + + /** + * Width of this column in characters (hint only). + */ + @JsonProperty("width") + public Long getWidth() { return width; } + @JsonProperty("width") + public void setWidth(Long value) { this.width = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionItem.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionItem.java new file mode 100644 index 0000000..6522131 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionItem.java @@ -0,0 +1,104 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * `CompletionItems` are the suggestions returned from the `completions` request. + */ +public class CompletionItem { + private String detail; + private String label; + private Long length; + private Long selectionLength; + private Long selectionStart; + private String sortText; + private Long start; + private String text; + private CompletionItemType type; + + /** + * A human-readable string with additional information about this item, like type or symbol + * information. + */ + @JsonProperty("detail") + public String getDetail() { return detail; } + @JsonProperty("detail") + public void setDetail(String value) { this.detail = value; } + + /** + * The label of this completion item. By default this is also the text that is inserted when + * selecting this completion. + */ + @JsonProperty("label") + public String getLabel() { return label; } + @JsonProperty("label") + public void setLabel(String value) { this.label = value; } + + /** + * Length determines how many characters are overwritten by the completion text and it is + * measured in UTF-16 code units. If missing the value 0 is assumed which results in the + * completion text being inserted. + */ + @JsonProperty("length") + public Long getLength() { return length; } + @JsonProperty("length") + public void setLength(Long value) { this.length = value; } + + /** + * Determines the length of the new selection after the text has been inserted (or replaced) + * and it is measured in UTF-16 code units. The selection can not extend beyond the bounds + * of the completion text. If omitted the length is assumed to be 0. + */ + @JsonProperty("selectionLength") + public Long getSelectionLength() { return selectionLength; } + @JsonProperty("selectionLength") + public void setSelectionLength(Long value) { this.selectionLength = value; } + + /** + * Determines the start of the new selection after the text has been inserted (or replaced). + * `selectionStart` is measured in UTF-16 code units and must be in the range 0 and length + * of the completion text. If omitted the selection starts at the end of the completion text. + */ + @JsonProperty("selectionStart") + public Long getSelectionStart() { return selectionStart; } + @JsonProperty("selectionStart") + public void setSelectionStart(Long value) { this.selectionStart = value; } + + /** + * A string that should be used when comparing this item with other items. If not returned + * or an empty string, the `label` is used instead. + */ + @JsonProperty("sortText") + public String getSortText() { return sortText; } + @JsonProperty("sortText") + public void setSortText(String value) { this.sortText = value; } + + /** + * Start position (within the `text` attribute of the `completions` request) where the + * completion text is added. The position is measured in UTF-16 code units and the client + * capability `columnsStartAt1` determines whether it is 0- or 1-based. If the start + * position is omitted the text is added at the location specified by the `column` attribute + * of the `completions` request. + */ + @JsonProperty("start") + public Long getStart() { return start; } + @JsonProperty("start") + public void setStart(Long value) { this.start = value; } + + /** + * If text is returned and not an empty string, then it is inserted instead of the label. + */ + @JsonProperty("text") + public String getText() { return text; } + @JsonProperty("text") + public void setText(String value) { this.text = value; } + + /** + * The item's type. Typically the client uses this information to render the item in the UI + * with an icon. + */ + @JsonProperty("type") + public CompletionItemType getType() { return type; } + @JsonProperty("type") + public void setType(CompletionItemType value) { this.type = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionItemType.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionItemType.java new file mode 100644 index 0000000..17c9119 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionItemType.java @@ -0,0 +1,65 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * The item's type. Typically the client uses this information to render the item in the UI + * with an icon. + * + * Some predefined types for the CompletionItem. Please note that not all clients have + * specific icons for all of them. + */ +public enum CompletionItemType { + CLASS, COLOR, CONSTRUCTOR, CUSTOMCOLOR, ENUM, FIELD, FILE, FUNCTION, INTERFACE, KEYWORD, METHOD, MODULE, PROPERTY, REFERENCE, SNIPPET, TEXT, UNIT, VALUE, VARIABLE; + + @JsonValue + public String toValue() { + switch (this) { + case CLASS: return "class"; + case COLOR: return "color"; + case CONSTRUCTOR: return "constructor"; + case CUSTOMCOLOR: return "customcolor"; + case ENUM: return "enum"; + case FIELD: return "field"; + case FILE: return "file"; + case FUNCTION: return "function"; + case INTERFACE: return "interface"; + case KEYWORD: return "keyword"; + case METHOD: return "method"; + case MODULE: return "module"; + case PROPERTY: return "property"; + case REFERENCE: return "reference"; + case SNIPPET: return "snippet"; + case TEXT: return "text"; + case UNIT: return "unit"; + case VALUE: return "value"; + case VARIABLE: return "variable"; + } + return null; + } + + @JsonCreator + public static CompletionItemType forValue(String value) throws IOException { + if (value.equals("class")) return CLASS; + if (value.equals("color")) return COLOR; + if (value.equals("constructor")) return CONSTRUCTOR; + if (value.equals("customcolor")) return CUSTOMCOLOR; + if (value.equals("enum")) return ENUM; + if (value.equals("field")) return FIELD; + if (value.equals("file")) return FILE; + if (value.equals("function")) return FUNCTION; + if (value.equals("interface")) return INTERFACE; + if (value.equals("keyword")) return KEYWORD; + if (value.equals("method")) return METHOD; + if (value.equals("module")) return MODULE; + if (value.equals("property")) return PROPERTY; + if (value.equals("reference")) return REFERENCE; + if (value.equals("snippet")) return SNIPPET; + if (value.equals("text")) return TEXT; + if (value.equals("unit")) return UNIT; + if (value.equals("value")) return VALUE; + if (value.equals("variable")) return VARIABLE; + throw new IOException("Cannot deserialize CompletionItemType"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsArgumentsClass.java new file mode 100644 index 0000000..4b2ee1e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsArgumentsClass.java @@ -0,0 +1,50 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `completions` request. + */ +public class CompletionsArgumentsClass { + private long column; + private Long frameID; + private Long line; + private String text; + + /** + * The position within `text` for which to determine the completion proposals. It is + * measured in UTF-16 code units and the client capability `columnsStartAt1` determines + * whether it is 0- or 1-based. + */ + @JsonProperty("column") + public long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(long value) { this.column = value; } + + /** + * Returns completions in the scope of this stack frame. If not specified, the completions + * are returned for the global scope. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } + + /** + * A line for which to determine the completion proposals. If missing the first line of the + * text is assumed. + */ + @JsonProperty("line") + public Long getLine() { return line; } + @JsonProperty("line") + public void setLine(Long value) { this.line = value; } + + /** + * One or more source lines. Typically this is the text users have typed into the debug + * console before they asked for completion. + */ + @JsonProperty("text") + public String getText() { return text; } + @JsonProperty("text") + public void setText(String value) { this.text = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestArguments.java new file mode 100644 index 0000000..cf5fcab --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestArguments.java @@ -0,0 +1,50 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `completions` request. + */ +public class CompletionsRequestArguments { + private long column; + private Long frameID; + private Long line; + private String text; + + /** + * The position within `text` for which to determine the completion proposals. It is + * measured in UTF-16 code units and the client capability `columnsStartAt1` determines + * whether it is 0- or 1-based. + */ + @JsonProperty("column") + public long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(long value) { this.column = value; } + + /** + * Returns completions in the scope of this stack frame. If not specified, the completions + * are returned for the global scope. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } + + /** + * A line for which to determine the completion proposals. If missing the first line of the + * text is assumed. + */ + @JsonProperty("line") + public Long getLine() { return line; } + @JsonProperty("line") + public void setLine(Long value) { this.line = value; } + + /** + * One or more source lines. Typically this is the text users have typed into the debug + * console before they asked for completion. + */ + @JsonProperty("text") + public String getText() { return text; } + @JsonProperty("text") + public void setText(String value) { this.text = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestClass.java new file mode 100644 index 0000000..fc6447f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Returns a list of possible completions for a given caret position and text. + * Clients should only call this request if the corresponding capability + * `supportsCompletionsRequest` is true. + */ +public class CompletionsRequestClass { + private long seq; + private AttachRequestType type; + private CompletionsRequestArguments arguments; + private CompletionsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public CompletionsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(CompletionsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public CompletionsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(CompletionsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestCommand.java new file mode 100644 index 0000000..7b5bdb5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum CompletionsRequestCommand { + COMPLETIONS; + + @JsonValue + public String toValue() { + switch (this) { + case COMPLETIONS: return "completions"; + } + return null; + } + + @JsonCreator + public static CompletionsRequestCommand forValue(String value) throws IOException { + if (value.equals("completions")) return COMPLETIONS; + throw new IOException("Cannot deserialize CompletionsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsResponseBody.java new file mode 100644 index 0000000..c3fd1db --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class CompletionsResponseBody { + private CompletionItem[] targets; + + /** + * The possible completions for . + */ + @JsonProperty("targets") + public CompletionItem[] getTargets() { return targets; } + @JsonProperty("targets") + public void setTargets(CompletionItem[] value) { this.targets = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsResponseClass.java new file mode 100644 index 0000000..12e7a15 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/CompletionsResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `completions` request. + */ +public class CompletionsResponseClass { + private long seq; + private AttachResponseType type; + private CompletionsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public CompletionsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(CompletionsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneRequestClass.java new file mode 100644 index 0000000..005bafe --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneRequestClass.java @@ -0,0 +1,62 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +import java.util.Map; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * This request indicates that the client has finished initialization of the debug adapter. + * So it is the last request in the sequence of configuration requests (which was started by + * the `initialized` event). + * Clients should only call this request if the corresponding capability + * `supportsConfigurationDoneRequest` is true. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ConfigurationDoneRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private Map arguments; + private String command = "configurationDone"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public Map getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(Map value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneRequestCommand.java new file mode 100644 index 0000000..0fbdf2b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ConfigurationDoneRequestCommand { + CONFIGURATION_DONE; + + @JsonValue + public String toValue() { + switch (this) { + case CONFIGURATION_DONE: return "configurationDone"; + } + return null; + } + + @JsonCreator + public static ConfigurationDoneRequestCommand forValue(String value) throws IOException { + if (value.equals("configurationDone")) return CONFIGURATION_DONE; + throw new IOException("Cannot deserialize ConfigurationDoneRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneResponseClass.java new file mode 100644 index 0000000..ce41eab --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ConfigurationDoneResponseClass.java @@ -0,0 +1,89 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `configurationDone` request. This is just an acknowledgement, so no body + * field is required. + */ +public class ConfigurationDoneResponseClass implements DAPResponse { + private long seq; + private String type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueArgumentsClass.java new file mode 100644 index 0000000..30dc693 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueArgumentsClass.java @@ -0,0 +1,29 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `continue` request. + */ +public class ContinueArgumentsClass { + private Boolean singleThread; + private long threadID; + + /** + * If this flag is true, execution is resumed only for the thread with given `threadId`. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the active thread. If the debug adapter supports single thread execution (see + * `supportsSingleThreadExecutionRequests`) and the argument `singleThread` is true, only + * the thread with this ID is resumed. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestArguments.java new file mode 100644 index 0000000..89279cc --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestArguments.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `continue` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ContinueRequestArguments { + private Boolean singleThread; + private long threadID; + + /** + * If this flag is true, execution is resumed only for the thread with given `threadId`. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the active thread. If the debug adapter supports single thread execution (see + * `supportsSingleThreadExecutionRequests`) and the argument `singleThread` is true, only + * the thread with this ID is resumed. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestClass.java new file mode 100644 index 0000000..7b3e1dc --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestClass.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request resumes execution of all threads. If the debug adapter supports single thread + * execution (see capability `supportsSingleThreadExecutionRequests`), setting the + * `singleThread` argument to true resumes only the specified thread. If not all threads + * were resumed, the `allThreadsContinued` attribute of the response should be set to false. + */ +public class ContinueRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private ContinueRequestArguments arguments; + private String command = "continue"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public ContinueRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ContinueRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestCommand.java new file mode 100644 index 0000000..8efdf0c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ContinueRequestCommand { + CONTINUE; + + @JsonValue + public String toValue() { + switch (this) { + case CONTINUE: return "continue"; + } + return null; + } + + @JsonCreator + public static ContinueRequestCommand forValue(String value) throws IOException { + if (value.equals("continue")) return CONTINUE; + throw new IOException("Cannot deserialize ContinueRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueResponseBody.java new file mode 100644 index 0000000..fcbeccb --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueResponseBody.java @@ -0,0 +1,17 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ContinueResponseBody { + private Boolean allThreadsContinued; + + /** + * The value true (or a missing property) signals to the client that all threads have been + * resumed. The value false indicates that not all threads were resumed. + */ + @JsonProperty("allThreadsContinued") + public Boolean getAllThreadsContinued() { return allThreadsContinued; } + @JsonProperty("allThreadsContinued") + public void setAllThreadsContinued(Boolean value) { this.allThreadsContinued = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueResponseClass.java new file mode 100644 index 0000000..7c9e85b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinueResponseClass.java @@ -0,0 +1,89 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `continue` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ContinueResponseClass implements DAPResponse { + private long seq; + private String type; + private ContinueResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public ContinueResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ContinueResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventBody.java new file mode 100644 index 0000000..102e544 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventBody.java @@ -0,0 +1,25 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ContinuedEventBody { + private Boolean allThreadsContinued; + private long threadID; + + /** + * If `allThreadsContinued` is true, a debug adapter can announce that all threads have + * continued. + */ + @JsonProperty("allThreadsContinued") + public Boolean getAllThreadsContinued() { return allThreadsContinued; } + @JsonProperty("allThreadsContinued") + public void setAllThreadsContinued(Boolean value) { this.allThreadsContinued = value; } + + /** + * The thread which was continued. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventClass.java new file mode 100644 index 0000000..af9d501 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventClass.java @@ -0,0 +1,60 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPEvent; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that the execution of the debuggee has continued. + * Please note: a debug adapter is not expected to send this event in response to a request + * that implies that execution continues, e.g. `launch` or `continue`. + * It is only necessary to send a `continued` event if there was no previous request that + * implied this. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ContinuedEventClass implements DAPEvent { + private long seq; + private String type; + private ContinuedEventBody body; + private String event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ContinuedEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ContinuedEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public String getEvent() { return event; } + @JsonProperty("event") + public void setEvent(String value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventEvent.java new file mode 100644 index 0000000..3681211 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ContinuedEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ContinuedEventEvent { + CONTINUED; + + @JsonValue + public String toValue() { + switch (this) { + case CONTINUED: return "continued"; + } + return null; + } + + @JsonCreator + public static ContinuedEventEvent forValue(String value) throws IOException { + if (value.equals("continued")) return CONTINUED; + throw new IOException("Cannot deserialize ContinuedEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Converter.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Converter.java new file mode 100644 index 0000000..c5e349b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Converter.java @@ -0,0 +1,100 @@ +// To use this code, add the following Maven dependency to your project: +// +// +// com.fasterxml.jackson.core : jackson-databind : 2.9.0 +// com.fasterxml.jackson.datatype : jackson-datatype-jsr310 : 2.9.0 +// +// Import this package: +// +// import org.tzi.use.monitor.adapter.python.dap.Converter; +// +// Then you can deserialize a JSON string with +// +// WrapperRoot data = Converter.fromJsonString(jsonString); + +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; + +import java.time.OffsetDateTime; +import java.time.OffsetTime; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeFormatterBuilder; +import java.time.temporal.ChronoField; + +public class Converter { + // Date-time helpers + + private static final DateTimeFormatter DATE_TIME_FORMATTER = new DateTimeFormatterBuilder() + .appendOptional(DateTimeFormatter.ISO_DATE_TIME) + .appendOptional(DateTimeFormatter.ISO_OFFSET_DATE_TIME) + .appendOptional(DateTimeFormatter.ISO_INSTANT) + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SX")) + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssX")) + .appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + .toFormatter() + .withZone(ZoneOffset.UTC); + + public static OffsetDateTime parseDateTimeString(String str) { + return ZonedDateTime.from(Converter.DATE_TIME_FORMATTER.parse(str)).toOffsetDateTime(); + } + + private static final DateTimeFormatter TIME_FORMATTER = new DateTimeFormatterBuilder() + .appendOptional(DateTimeFormatter.ISO_TIME) + .appendOptional(DateTimeFormatter.ISO_OFFSET_TIME) + .parseDefaulting(ChronoField.YEAR, 2020) + .parseDefaulting(ChronoField.MONTH_OF_YEAR, 1) + .parseDefaulting(ChronoField.DAY_OF_MONTH, 1) + .toFormatter() + .withZone(ZoneOffset.UTC); + + public static OffsetTime parseTimeString(String str) { + return ZonedDateTime.from(Converter.TIME_FORMATTER.parse(str)).toOffsetDateTime().toOffsetTime(); + } + // Serialize/deserialize helpers + + public static WrapperRoot fromJsonString(String json) throws IOException { + return getObjectReader().readValue(json); + } + + public static String toJsonString(WrapperRoot obj) throws JsonProcessingException { + return getObjectWriter().writeValueAsString(obj); + } + + private static ObjectReader reader; + private static ObjectWriter writer; + + private static void instantiateMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.findAndRegisterModules(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + SimpleModule module = new SimpleModule(); + module.addDeserializer(OffsetDateTime.class, new JsonDeserializer() { + @Override + public OffsetDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { + String value = jsonParser.getText(); + return Converter.parseDateTimeString(value); + } + }); + mapper.registerModule(module); + reader = mapper.readerFor(WrapperRoot.class); + writer = mapper.writerFor(WrapperRoot.class); + } + + private static ObjectReader getObjectReader() { + if (reader == null) instantiateMapper(); + return reader; + } + + private static ObjectWriter getObjectWriter() { + if (writer == null) instantiateMapper(); + return writer; + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpoint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpoint.java new file mode 100644 index 0000000..648d4d6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpoint.java @@ -0,0 +1,46 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Properties of a data breakpoint passed to the `setDataBreakpoints` request. + */ +public class DataBreakpoint { + private DataBreakpointAccessType accessType; + private String condition; + private String dataID; + private String hitCondition; + + /** + * The access type of the data. + */ + @JsonProperty("accessType") + public DataBreakpointAccessType getAccessType() { return accessType; } + @JsonProperty("accessType") + public void setAccessType(DataBreakpointAccessType value) { this.accessType = value; } + + /** + * An expression for conditional breakpoints. + */ + @JsonProperty("condition") + public String getCondition() { return condition; } + @JsonProperty("condition") + public void setCondition(String value) { this.condition = value; } + + /** + * An id representing the data. This id is returned from the `dataBreakpointInfo` request. + */ + @JsonProperty("dataId") + public String getDataID() { return dataID; } + @JsonProperty("dataId") + public void setDataID(String value) { this.dataID = value; } + + /** + * An expression that controls how many hits of the breakpoint are ignored. + * The debug adapter is expected to interpret the expression as needed. + */ + @JsonProperty("hitCondition") + public String getHitCondition() { return hitCondition; } + @JsonProperty("hitCondition") + public void setHitCondition(String value) { this.hitCondition = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointAccessType.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointAccessType.java new file mode 100644 index 0000000..b925d9d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointAccessType.java @@ -0,0 +1,31 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * The access type of the data. + * + * This enumeration defines all possible access types for data breakpoints. + */ +public enum DataBreakpointAccessType { + READ, READ_WRITE, WRITE; + + @JsonValue + public String toValue() { + switch (this) { + case READ: return "read"; + case READ_WRITE: return "readWrite"; + case WRITE: return "write"; + } + return null; + } + + @JsonCreator + public static DataBreakpointAccessType forValue(String value) throws IOException { + if (value.equals("read")) return READ; + if (value.equals("readWrite")) return READ_WRITE; + if (value.equals("write")) return WRITE; + throw new IOException("Cannot deserialize DataBreakpointAccessType"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoArgumentsClass.java new file mode 100644 index 0000000..903d663 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoArgumentsClass.java @@ -0,0 +1,41 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `dataBreakpointInfo` request. + */ +public class DataBreakpointInfoArgumentsClass { + private Long frameID; + private String name; + private Long variablesReference; + + /** + * When `name` is an expression, evaluate it in the scope of this stack frame. If not + * specified, the expression is evaluated in the global scope. When `variablesReference` is + * specified, this property has no effect. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } + + /** + * The name of the variable's child to obtain data breakpoint information for. + * If `variablesReference` isn't specified, this can be an expression. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * Reference to the variable container if the data breakpoint is requested for a child of + * the container. The `variablesReference` must have been obtained in the current suspended + * state. See 'Lifetime of Object References' in the Overview section for details. + */ + @JsonProperty("variablesReference") + public Long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(Long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestArguments.java new file mode 100644 index 0000000..183fb66 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestArguments.java @@ -0,0 +1,41 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `dataBreakpointInfo` request. + */ +public class DataBreakpointInfoRequestArguments { + private Long frameID; + private String name; + private Long variablesReference; + + /** + * When `name` is an expression, evaluate it in the scope of this stack frame. If not + * specified, the expression is evaluated in the global scope. When `variablesReference` is + * specified, this property has no effect. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } + + /** + * The name of the variable's child to obtain data breakpoint information for. + * If `variablesReference` isn't specified, this can be an expression. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * Reference to the variable container if the data breakpoint is requested for a child of + * the container. The `variablesReference` must have been obtained in the current suspended + * state. See 'Lifetime of Object References' in the Overview section for details. + */ + @JsonProperty("variablesReference") + public Long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(Long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestClass.java new file mode 100644 index 0000000..263966b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Obtains information on a possible data breakpoint that could be set on an expression or + * variable. + * Clients should only call this request if the corresponding capability + * `supportsDataBreakpoints` is true. + */ +public class DataBreakpointInfoRequestClass { + private long seq; + private AttachRequestType type; + private DataBreakpointInfoRequestArguments arguments; + private DataBreakpointInfoRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public DataBreakpointInfoRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(DataBreakpointInfoRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public DataBreakpointInfoRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(DataBreakpointInfoRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestCommand.java new file mode 100644 index 0000000..4198d8e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum DataBreakpointInfoRequestCommand { + DATA_BREAKPOINT_INFO; + + @JsonValue + public String toValue() { + switch (this) { + case DATA_BREAKPOINT_INFO: return "dataBreakpointInfo"; + } + return null; + } + + @JsonCreator + public static DataBreakpointInfoRequestCommand forValue(String value) throws IOException { + if (value.equals("dataBreakpointInfo")) return DATA_BREAKPOINT_INFO; + throw new IOException("Cannot deserialize DataBreakpointInfoRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoResponseBody.java new file mode 100644 index 0000000..9abda2f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoResponseBody.java @@ -0,0 +1,49 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class DataBreakpointInfoResponseBody { + private DataBreakpointAccessType[] accessTypes; + private Boolean canPersist; + private String dataID; + private String description; + + /** + * Attribute lists the available access types for a potential data breakpoint. A UI client + * could surface this information. + */ + @JsonProperty("accessTypes") + public DataBreakpointAccessType[] getAccessTypes() { return accessTypes; } + @JsonProperty("accessTypes") + public void setAccessTypes(DataBreakpointAccessType[] value) { this.accessTypes = value; } + + /** + * Attribute indicates that a potential data breakpoint could be persisted across sessions. + */ + @JsonProperty("canPersist") + public Boolean getCanPersist() { return canPersist; } + @JsonProperty("canPersist") + public void setCanPersist(Boolean value) { this.canPersist = value; } + + /** + * An identifier for the data on which a data breakpoint can be registered with the + * `setDataBreakpoints` request or null if no data breakpoint is available. If a + * `variablesReference` or `frameId` is passed, the `dataId` is valid in the current + * suspended state, otherwise it's valid indefinitely. See 'Lifetime of Object References' + * in the Overview section for details. Breakpoints set using the `dataId` in the + * `setDataBreakpoints` request may outlive the lifetime of the associated `dataId`. + */ + @JsonProperty("dataId") + public String getDataID() { return dataID; } + @JsonProperty("dataId") + public void setDataID(String value) { this.dataID = value; } + + /** + * UI string that describes on what data the breakpoint is set on or why a data breakpoint + * is not available. + */ + @JsonProperty("description") + public String getDescription() { return description; } + @JsonProperty("description") + public void setDescription(String value) { this.description = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoResponseClass.java new file mode 100644 index 0000000..166c87c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DataBreakpointInfoResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `dataBreakpointInfo` request. + */ +public class DataBreakpointInfoResponseClass { + private long seq; + private AttachResponseType type; + private DataBreakpointInfoResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public DataBreakpointInfoResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(DataBreakpointInfoResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleArgumentsClass.java new file mode 100644 index 0000000..d19127d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleArgumentsClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `disassemble` request. + */ +public class DisassembleArgumentsClass { + private long instructionCount; + private Long instructionOffset; + private String memoryReference; + private Long offset; + private Boolean resolveSymbols; + + /** + * Number of instructions to disassemble starting at the specified location and offset. + * An adapter must return exactly this number of instructions - any unavailable instructions + * should be replaced with an implementation-defined 'invalid instruction' value. + */ + @JsonProperty("instructionCount") + public long getInstructionCount() { return instructionCount; } + @JsonProperty("instructionCount") + public void setInstructionCount(long value) { this.instructionCount = value; } + + /** + * Offset (in instructions) to be applied after the byte offset (if any) before + * disassembling. Can be negative. + */ + @JsonProperty("instructionOffset") + public Long getInstructionOffset() { return instructionOffset; } + @JsonProperty("instructionOffset") + public void setInstructionOffset(Long value) { this.instructionOffset = value; } + + /** + * Memory reference to the base location containing the instructions to disassemble. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * Offset (in bytes) to be applied to the reference location before disassembling. Can be + * negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } + + /** + * If true, the adapter should attempt to resolve memory addresses and other values to + * symbolic names. + */ + @JsonProperty("resolveSymbols") + public Boolean getResolveSymbols() { return resolveSymbols; } + @JsonProperty("resolveSymbols") + public void setResolveSymbols(Boolean value) { this.resolveSymbols = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestArguments.java new file mode 100644 index 0000000..25b9b51 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestArguments.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `disassemble` request. + */ +public class DisassembleRequestArguments { + private long instructionCount; + private Long instructionOffset; + private String memoryReference; + private Long offset; + private Boolean resolveSymbols; + + /** + * Number of instructions to disassemble starting at the specified location and offset. + * An adapter must return exactly this number of instructions - any unavailable instructions + * should be replaced with an implementation-defined 'invalid instruction' value. + */ + @JsonProperty("instructionCount") + public long getInstructionCount() { return instructionCount; } + @JsonProperty("instructionCount") + public void setInstructionCount(long value) { this.instructionCount = value; } + + /** + * Offset (in instructions) to be applied after the byte offset (if any) before + * disassembling. Can be negative. + */ + @JsonProperty("instructionOffset") + public Long getInstructionOffset() { return instructionOffset; } + @JsonProperty("instructionOffset") + public void setInstructionOffset(Long value) { this.instructionOffset = value; } + + /** + * Memory reference to the base location containing the instructions to disassemble. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * Offset (in bytes) to be applied to the reference location before disassembling. Can be + * negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } + + /** + * If true, the adapter should attempt to resolve memory addresses and other values to + * symbolic names. + */ + @JsonProperty("resolveSymbols") + public Boolean getResolveSymbols() { return resolveSymbols; } + @JsonProperty("resolveSymbols") + public void setResolveSymbols(Boolean value) { this.resolveSymbols = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestClass.java new file mode 100644 index 0000000..ea1031b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Disassembles code stored at the provided location. + * Clients should only call this request if the corresponding capability + * `supportsDisassembleRequest` is true. + */ +public class DisassembleRequestClass { + private long seq; + private AttachRequestType type; + private DisassembleRequestArguments arguments; + private DisassembleRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public DisassembleRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(DisassembleRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public DisassembleRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(DisassembleRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestCommand.java new file mode 100644 index 0000000..7b5c3d7 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum DisassembleRequestCommand { + DISASSEMBLE; + + @JsonValue + public String toValue() { + switch (this) { + case DISASSEMBLE: return "disassemble"; + } + return null; + } + + @JsonCreator + public static DisassembleRequestCommand forValue(String value) throws IOException { + if (value.equals("disassemble")) return DISASSEMBLE; + throw new IOException("Cannot deserialize DisassembleRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleResponseBody.java new file mode 100644 index 0000000..7b2ad67 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class DisassembleResponseBody { + private DisassembledInstruction[] instructions; + + /** + * The list of disassembled instructions. + */ + @JsonProperty("instructions") + public DisassembledInstruction[] getInstructions() { return instructions; } + @JsonProperty("instructions") + public void setInstructions(DisassembledInstruction[] value) { this.instructions = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleResponseClass.java new file mode 100644 index 0000000..8610d88 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembleResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `disassemble` request. + */ +public class DisassembleResponseClass { + private long seq; + private AttachResponseType type; + private DisassembleResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public DisassembleResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(DisassembleResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembledInstruction.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembledInstruction.java new file mode 100644 index 0000000..eb7087b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembledInstruction.java @@ -0,0 +1,108 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Represents a single disassembled instruction. + */ +public class DisassembledInstruction { + private String address; + private Long column; + private Long endColumn; + private Long endLine; + private String instruction; + private String instructionBytes; + private Long line; + private Source location; + private DisassembledInstructionPresentationHint presentationHint; + private String symbol; + + /** + * The address of the instruction. Treated as a hex value if prefixed with `0x`, or as a + * decimal value otherwise. + */ + @JsonProperty("address") + public String getAddress() { return address; } + @JsonProperty("address") + public void setAddress(String value) { this.address = value; } + + /** + * The column within the line that corresponds to this instruction, if any. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * The end column of the range that corresponds to this instruction, if any. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * The end line of the range that corresponds to this instruction, if any. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * Text representing the instruction and its operands, in an implementation-defined format. + */ + @JsonProperty("instruction") + public String getInstruction() { return instruction; } + @JsonProperty("instruction") + public void setInstruction(String value) { this.instruction = value; } + + /** + * Raw bytes representing the instruction and its operands, in an implementation-defined + * format. + */ + @JsonProperty("instructionBytes") + public String getInstructionBytes() { return instructionBytes; } + @JsonProperty("instructionBytes") + public void setInstructionBytes(String value) { this.instructionBytes = value; } + + /** + * The line within the source location that corresponds to this instruction, if any. + */ + @JsonProperty("line") + public Long getLine() { return line; } + @JsonProperty("line") + public void setLine(Long value) { this.line = value; } + + /** + * Source location that corresponds to this instruction, if any. + * Should always be set (if available) on the first instruction returned, + * but can be omitted afterwards if this instruction maps to the same source file as the + * previous instruction. + */ + @JsonProperty("location") + public Source getLocation() { return location; } + @JsonProperty("location") + public void setLocation(Source value) { this.location = value; } + + /** + * A hint for how to present the instruction in the UI. + * + * A value of `invalid` may be used to indicate this instruction is 'filler' and cannot be + * reached by the program. For example, unreadable memory addresses may be presented is + * 'invalid.' + */ + @JsonProperty("presentationHint") + public DisassembledInstructionPresentationHint getPresentationHint() { return presentationHint; } + @JsonProperty("presentationHint") + public void setPresentationHint(DisassembledInstructionPresentationHint value) { this.presentationHint = value; } + + /** + * Name of the symbol that corresponds with the location of this instruction, if any. + */ + @JsonProperty("symbol") + public String getSymbol() { return symbol; } + @JsonProperty("symbol") + public void setSymbol(String value) { this.symbol = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembledInstructionPresentationHint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembledInstructionPresentationHint.java new file mode 100644 index 0000000..5850542 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisassembledInstructionPresentationHint.java @@ -0,0 +1,31 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * A hint for how to present the instruction in the UI. + * + * A value of `invalid` may be used to indicate this instruction is 'filler' and cannot be + * reached by the program. For example, unreadable memory addresses may be presented is + * 'invalid.' + */ +public enum DisassembledInstructionPresentationHint { + INVALID, NORMAL; + + @JsonValue + public String toValue() { + switch (this) { + case INVALID: return "invalid"; + case NORMAL: return "normal"; + } + return null; + } + + @JsonCreator + public static DisassembledInstructionPresentationHint forValue(String value) throws IOException { + if (value.equals("invalid")) return INVALID; + if (value.equals("normal")) return NORMAL; + throw new IOException("Cannot deserialize DisassembledInstructionPresentationHint"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectArgumentsClass.java new file mode 100644 index 0000000..82280a0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectArgumentsClass.java @@ -0,0 +1,42 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `disconnect` request. + */ +public class DisconnectArgumentsClass { + private Boolean restart; + private Boolean suspendDebuggee; + private Boolean terminateDebuggee; + + /** + * A value of true indicates that this `disconnect` request is part of a restart sequence. + */ + @JsonProperty("restart") + public Boolean getRestart() { return restart; } + @JsonProperty("restart") + public void setRestart(Boolean value) { this.restart = value; } + + /** + * Indicates whether the debuggee should stay suspended when the debugger is disconnected. + * If unspecified, the debuggee should resume execution. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportSuspendDebuggee` is true. + */ + @JsonProperty("suspendDebuggee") + public Boolean getSuspendDebuggee() { return suspendDebuggee; } + @JsonProperty("suspendDebuggee") + public void setSuspendDebuggee(Boolean value) { this.suspendDebuggee = value; } + + /** + * Indicates whether the debuggee should be terminated when the debugger is disconnected. + * If unspecified, the debug adapter is free to do whatever it thinks is best. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportTerminateDebuggee` is true. + */ + @JsonProperty("terminateDebuggee") + public Boolean getTerminateDebuggee() { return terminateDebuggee; } + @JsonProperty("terminateDebuggee") + public void setTerminateDebuggee(Boolean value) { this.terminateDebuggee = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestArguments.java new file mode 100644 index 0000000..dcfae08 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestArguments.java @@ -0,0 +1,42 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `disconnect` request. + */ +public class DisconnectRequestArguments { + private Boolean restart; + private Boolean suspendDebuggee; + private Boolean terminateDebuggee; + + /** + * A value of true indicates that this `disconnect` request is part of a restart sequence. + */ + @JsonProperty("restart") + public Boolean getRestart() { return restart; } + @JsonProperty("restart") + public void setRestart(Boolean value) { this.restart = value; } + + /** + * Indicates whether the debuggee should stay suspended when the debugger is disconnected. + * If unspecified, the debuggee should resume execution. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportSuspendDebuggee` is true. + */ + @JsonProperty("suspendDebuggee") + public Boolean getSuspendDebuggee() { return suspendDebuggee; } + @JsonProperty("suspendDebuggee") + public void setSuspendDebuggee(Boolean value) { this.suspendDebuggee = value; } + + /** + * Indicates whether the debuggee should be terminated when the debugger is disconnected. + * If unspecified, the debug adapter is free to do whatever it thinks is best. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportTerminateDebuggee` is true. + */ + @JsonProperty("terminateDebuggee") + public Boolean getTerminateDebuggee() { return terminateDebuggee; } + @JsonProperty("terminateDebuggee") + public void setTerminateDebuggee(Boolean value) { this.terminateDebuggee = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestClass.java new file mode 100644 index 0000000..bfed32e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestClass.java @@ -0,0 +1,63 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The `disconnect` request asks the debug adapter to disconnect from the debuggee (thus + * ending the debug session) and then to shut down itself (the debug adapter). + * In addition, the debug adapter must terminate the debuggee if it was started with the + * `launch` request. If an `attach` request was used to connect to the debuggee, then the + * debug adapter must not terminate the debuggee. + * This implicit behavior of when to terminate the debuggee can be overridden with the + * `terminateDebuggee` argument (which is only supported by a debug adapter if the + * corresponding capability `supportTerminateDebuggee` is true). + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DisconnectRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private DisconnectRequestArguments arguments; + private String command = "disconnect"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public DisconnectRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(DisconnectRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestCommand.java new file mode 100644 index 0000000..6b74ae3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum DisconnectRequestCommand { + DISCONNECT; + + @JsonValue + public String toValue() { + switch (this) { + case DISCONNECT: return "disconnect"; + } + return null; + } + + @JsonCreator + public static DisconnectRequestCommand forValue(String value) throws IOException { + if (value.equals("disconnect")) return DISCONNECT; + throw new IOException("Cannot deserialize DisconnectRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectResponseClass.java new file mode 100644 index 0000000..e6f5fc6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/DisconnectResponseClass.java @@ -0,0 +1,90 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `disconnect` request. This is just an acknowledgement, so no body field is + * required. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class DisconnectResponseClass implements DAPResponse { + private long seq; + private String type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ErrorResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ErrorResponseBody.java new file mode 100644 index 0000000..f8ff21b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ErrorResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ErrorResponseBody { + private Message error; + + /** + * A structured error message. + */ + @JsonProperty("error") + public Message getError() { return error; } + @JsonProperty("error") + public void setError(Message value) { this.error = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ErrorResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ErrorResponseClass.java new file mode 100644 index 0000000..d5ad76e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ErrorResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * On error (whenever `success` is false), the body can provide more details. + */ +public class ErrorResponseClass { + private long seq; + private AttachResponseType type; + private ErrorResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public ErrorResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ErrorResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateArgumentsClass.java new file mode 100644 index 0000000..146ffdf --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateArgumentsClass.java @@ -0,0 +1,48 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `evaluate` request. + */ +public class EvaluateArgumentsClass { + private String context; + private String expression; + private ValueFormat format; + private Long frameID; + + /** + * The context in which the evaluate request is used. + */ + @JsonProperty("context") + public String getContext() { return context; } + @JsonProperty("context") + public void setContext(String value) { this.context = value; } + + /** + * The expression to evaluate. + */ + @JsonProperty("expression") + public String getExpression() { return expression; } + @JsonProperty("expression") + public void setExpression(String value) { this.expression = value; } + + /** + * Specifies details on how to format the result. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * Evaluate the expression in the scope of this stack frame. If not specified, the + * expression is evaluated in the global scope. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestArguments.java new file mode 100644 index 0000000..1d81bd5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestArguments.java @@ -0,0 +1,48 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `evaluate` request. + */ +public class EvaluateRequestArguments { + private String context; + private String expression; + private ValueFormat format; + private Long frameID; + + /** + * The context in which the evaluate request is used. + */ + @JsonProperty("context") + public String getContext() { return context; } + @JsonProperty("context") + public void setContext(String value) { this.context = value; } + + /** + * The expression to evaluate. + */ + @JsonProperty("expression") + public String getExpression() { return expression; } + @JsonProperty("expression") + public void setExpression(String value) { this.expression = value; } + + /** + * Specifies details on how to format the result. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * Evaluate the expression in the scope of this stack frame. If not specified, the + * expression is evaluated in the global scope. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestClass.java new file mode 100644 index 0000000..8d27c85 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Evaluates the given expression in the context of the topmost stack frame. + * The expression has access to any variables and arguments that are in scope. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EvaluateRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private EvaluateRequestArguments arguments; + private String command = "evaluate"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public EvaluateRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(EvaluateRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestCommand.java new file mode 100644 index 0000000..df80a08 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum EvaluateRequestCommand { + EVALUATE; + + @JsonValue + public String toValue() { + switch (this) { + case EVALUATE: return "evaluate"; + } + return null; + } + + @JsonCreator + public static EvaluateRequestCommand forValue(String value) throws IOException { + if (value.equals("evaluate")) return EVALUATE; + throw new IOException("Cannot deserialize EvaluateRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateResponseBody.java new file mode 100644 index 0000000..36428b2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateResponseBody.java @@ -0,0 +1,86 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EvaluateResponseBody { + private Long indexedVariables; + private String memoryReference; + private Long namedVariables; + private VariablePresentationHint presentationHint; + private String result; + private String type; + private long variablesReference; + + /** + * The number of indexed child variables. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + * The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("indexedVariables") + public Long getIndexedVariables() { return indexedVariables; } + @JsonProperty("indexedVariables") + public void setIndexedVariables(Long value) { this.indexedVariables = value; } + + /** + * A memory reference to a location appropriate for this result. + * For pointer type eval results, this is generally a reference to the memory address + * contained in the pointer. + * This attribute may be returned by a debug adapter if corresponding capability + * `supportsMemoryReferences` is true. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * The number of named child variables. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + * The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("namedVariables") + public Long getNamedVariables() { return namedVariables; } + @JsonProperty("namedVariables") + public void setNamedVariables(Long value) { this.namedVariables = value; } + + /** + * Properties of an evaluate result that can be used to determine how to render the result + * in the UI. + */ + @JsonProperty("presentationHint") + public VariablePresentationHint getPresentationHint() { return presentationHint; } + @JsonProperty("presentationHint") + public void setPresentationHint(VariablePresentationHint value) { this.presentationHint = value; } + + /** + * The result of the evaluate request. + */ + @JsonProperty("result") + public String getResult() { return result; } + @JsonProperty("result") + public void setResult(String value) { this.result = value; } + + /** + * The type of the evaluate result. + * This attribute should only be returned by a debug adapter if the corresponding capability + * `supportsVariableType` is true. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * If `variablesReference` is > 0, the evaluate result is structured and its children can be + * retrieved by passing `variablesReference` to the `variables` request as long as execution + * remains suspended. See 'Lifetime of Object References' in the Overview section for + * details. + */ + @JsonProperty("variablesReference") + public long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateResponseClass.java new file mode 100644 index 0000000..1ee9f0b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/EvaluateResponseClass.java @@ -0,0 +1,89 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `evaluate` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class EvaluateResponseClass implements DAPResponse { + private long seq; + private String type; + private EvaluateResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public EvaluateResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(EvaluateResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Event.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Event.java new file mode 100644 index 0000000..90a658f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Event.java @@ -0,0 +1,53 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Event { + private long seq; + private String type; + private Restart body; + private String event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public String getEvent() { return event; } + @JsonProperty("event") + public void setEvent(String value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionBreakMode.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionBreakMode.java new file mode 100644 index 0000000..32bf985 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionBreakMode.java @@ -0,0 +1,40 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * This enumeration defines all possible conditions when a thrown exception should result in + * a break. + * never: never breaks, + * always: always breaks, + * unhandled: breaks when exception unhandled, + * userUnhandled: breaks if the exception is not handled by user code. + * + * Mode that caused the exception notification to be raised. + * + * Condition when a thrown exception should result in a break. + */ +public enum ExceptionBreakMode { + ALWAYS, NEVER, UNHANDLED, USER_UNHANDLED; + + @JsonValue + public String toValue() { + switch (this) { + case ALWAYS: return "always"; + case NEVER: return "never"; + case UNHANDLED: return "unhandled"; + case USER_UNHANDLED: return "userUnhandled"; + } + return null; + } + + @JsonCreator + public static ExceptionBreakMode forValue(String value) throws IOException { + if (value.equals("always")) return ALWAYS; + if (value.equals("never")) return NEVER; + if (value.equals("unhandled")) return UNHANDLED; + if (value.equals("userUnhandled")) return USER_UNHANDLED; + throw new IOException("Cannot deserialize ExceptionBreakMode"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionBreakpointsFilter.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionBreakpointsFilter.java new file mode 100644 index 0000000..adbb3da --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionBreakpointsFilter.java @@ -0,0 +1,68 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * An `ExceptionBreakpointsFilter` is shown in the UI as an filter option for configuring + * how exceptions are dealt with. + */ +public class ExceptionBreakpointsFilter { + private String conditionDescription; + private Boolean exceptionBreakpointsFilterDefault; + private String description; + private String filter; + private String label; + private Boolean supportsCondition; + + /** + * A help text providing information about the condition. This string is shown as the + * placeholder text for a text box and can be translated. + */ + @JsonProperty("conditionDescription") + public String getConditionDescription() { return conditionDescription; } + @JsonProperty("conditionDescription") + public void setConditionDescription(String value) { this.conditionDescription = value; } + + /** + * Initial value of the filter option. If not specified a value false is assumed. + */ + @JsonProperty("default") + public Boolean getExceptionBreakpointsFilterDefault() { return exceptionBreakpointsFilterDefault; } + @JsonProperty("default") + public void setExceptionBreakpointsFilterDefault(Boolean value) { this.exceptionBreakpointsFilterDefault = value; } + + /** + * A help text providing additional information about the exception filter. This string is + * typically shown as a hover and can be translated. + */ + @JsonProperty("description") + public String getDescription() { return description; } + @JsonProperty("description") + public void setDescription(String value) { this.description = value; } + + /** + * The internal ID of the filter option. This value is passed to the + * `setExceptionBreakpoints` request. + */ + @JsonProperty("filter") + public String getFilter() { return filter; } + @JsonProperty("filter") + public void setFilter(String value) { this.filter = value; } + + /** + * The name of the filter option. This is shown in the UI. + */ + @JsonProperty("label") + public String getLabel() { return label; } + @JsonProperty("label") + public void setLabel(String value) { this.label = value; } + + /** + * Controls whether a condition can be specified for this filter option. If false or + * missing, a condition can not be set. + */ + @JsonProperty("supportsCondition") + public Boolean getSupportsCondition() { return supportsCondition; } + @JsonProperty("supportsCondition") + public void setSupportsCondition(Boolean value) { this.supportsCondition = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionDetails.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionDetails.java new file mode 100644 index 0000000..108e655 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionDetails.java @@ -0,0 +1,65 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Detailed information about an exception that has occurred. + * + * Detailed information about the exception. + */ +public class ExceptionDetails { + private String evaluateName; + private String fullTypeName; + private ExceptionDetails[] innerException; + private String message; + private String stackTrace; + private String typeName; + + /** + * An expression that can be evaluated in the current scope to obtain the exception object. + */ + @JsonProperty("evaluateName") + public String getEvaluateName() { return evaluateName; } + @JsonProperty("evaluateName") + public void setEvaluateName(String value) { this.evaluateName = value; } + + /** + * Fully-qualified type name of the exception object. + */ + @JsonProperty("fullTypeName") + public String getFullTypeName() { return fullTypeName; } + @JsonProperty("fullTypeName") + public void setFullTypeName(String value) { this.fullTypeName = value; } + + /** + * Details of the exception contained by this exception, if any. + */ + @JsonProperty("innerException") + public ExceptionDetails[] getInnerException() { return innerException; } + @JsonProperty("innerException") + public void setInnerException(ExceptionDetails[] value) { this.innerException = value; } + + /** + * Message contained in the exception. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Stack trace at the time the exception was thrown. + */ + @JsonProperty("stackTrace") + public String getStackTrace() { return stackTrace; } + @JsonProperty("stackTrace") + public void setStackTrace(String value) { this.stackTrace = value; } + + /** + * Short type name of the exception object. + */ + @JsonProperty("typeName") + public String getTypeName() { return typeName; } + @JsonProperty("typeName") + public void setTypeName(String value) { this.typeName = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionFilterOptions.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionFilterOptions.java new file mode 100644 index 0000000..aade121 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionFilterOptions.java @@ -0,0 +1,29 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * An `ExceptionFilterOptions` is used to specify an exception filter together with a + * condition for the `setExceptionBreakpoints` request. + */ +public class ExceptionFilterOptions { + private String condition; + private String filterID; + + /** + * An expression for conditional exceptions. + * The exception breaks into the debugger if the result of the condition is true. + */ + @JsonProperty("condition") + public String getCondition() { return condition; } + @JsonProperty("condition") + public void setCondition(String value) { this.condition = value; } + + /** + * ID of an exception filter returned by the `exceptionBreakpointFilters` capability. + */ + @JsonProperty("filterId") + public String getFilterID() { return filterID; } + @JsonProperty("filterId") + public void setFilterID(String value) { this.filterID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoArgumentsClass.java new file mode 100644 index 0000000..3b60ef5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `exceptionInfo` request. + */ +public class ExceptionInfoArgumentsClass { + private long threadID; + + /** + * Thread for which exception information should be retrieved. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestArguments.java new file mode 100644 index 0000000..af571c2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `exceptionInfo` request. + */ +public class ExceptionInfoRequestArguments { + private long threadID; + + /** + * Thread for which exception information should be retrieved. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestClass.java new file mode 100644 index 0000000..b5b509f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Retrieves the details of the exception that caused this event to be raised. + * Clients should only call this request if the corresponding capability + * `supportsExceptionInfoRequest` is true. + */ +public class ExceptionInfoRequestClass { + private long seq; + private AttachRequestType type; + private ExceptionInfoRequestArguments arguments; + private ExceptionInfoRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public ExceptionInfoRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ExceptionInfoRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public ExceptionInfoRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(ExceptionInfoRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestCommand.java new file mode 100644 index 0000000..548e9c9 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ExceptionInfoRequestCommand { + EXCEPTION_INFO; + + @JsonValue + public String toValue() { + switch (this) { + case EXCEPTION_INFO: return "exceptionInfo"; + } + return null; + } + + @JsonCreator + public static ExceptionInfoRequestCommand forValue(String value) throws IOException { + if (value.equals("exceptionInfo")) return EXCEPTION_INFO; + throw new IOException("Cannot deserialize ExceptionInfoRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoResponseBody.java new file mode 100644 index 0000000..01b9f0b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoResponseBody.java @@ -0,0 +1,42 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ExceptionInfoResponseBody { + private ExceptionBreakMode breakMode; + private String description; + private ExceptionDetails details; + private String exceptionID; + + /** + * Mode that caused the exception notification to be raised. + */ + @JsonProperty("breakMode") + public ExceptionBreakMode getBreakMode() { return breakMode; } + @JsonProperty("breakMode") + public void setBreakMode(ExceptionBreakMode value) { this.breakMode = value; } + + /** + * Descriptive text for the exception. + */ + @JsonProperty("description") + public String getDescription() { return description; } + @JsonProperty("description") + public void setDescription(String value) { this.description = value; } + + /** + * Detailed information about the exception. + */ + @JsonProperty("details") + public ExceptionDetails getDetails() { return details; } + @JsonProperty("details") + public void setDetails(ExceptionDetails value) { this.details = value; } + + /** + * ID of the exception that was thrown. + */ + @JsonProperty("exceptionId") + public String getExceptionID() { return exceptionID; } + @JsonProperty("exceptionId") + public void setExceptionID(String value) { this.exceptionID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoResponseClass.java new file mode 100644 index 0000000..5872fc0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionInfoResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `exceptionInfo` request. + */ +public class ExceptionInfoResponseClass { + private long seq; + private AttachResponseType type; + private ExceptionInfoResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public ExceptionInfoResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ExceptionInfoResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionOptions.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionOptions.java new file mode 100644 index 0000000..c00114e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionOptions.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * An `ExceptionOptions` assigns configuration options to a set of exceptions. + */ +public class ExceptionOptions { + private ExceptionBreakMode breakMode; + private ExceptionPathSegment[] path; + + /** + * Condition when a thrown exception should result in a break. + */ + @JsonProperty("breakMode") + public ExceptionBreakMode getBreakMode() { return breakMode; } + @JsonProperty("breakMode") + public void setBreakMode(ExceptionBreakMode value) { this.breakMode = value; } + + /** + * A path that selects a single or multiple exceptions in a tree. If `path` is missing, the + * whole tree is selected. + * By convention the first segment of the path is a category that is used to group + * exceptions in the UI. + */ + @JsonProperty("path") + public ExceptionPathSegment[] getPath() { return path; } + @JsonProperty("path") + public void setPath(ExceptionPathSegment[] value) { this.path = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionPathSegment.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionPathSegment.java new file mode 100644 index 0000000..88c6c87 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExceptionPathSegment.java @@ -0,0 +1,31 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * An `ExceptionPathSegment` represents a segment in a path that is used to match leafs or + * nodes in a tree of exceptions. + * If a segment consists of more than one name, it matches the names provided if `negate` is + * false or missing, or it matches anything except the names provided if `negate` is true. + */ +public class ExceptionPathSegment { + private String[] names; + private Boolean negate; + + /** + * Depending on the value of `negate` the names that should match or not match. + */ + @JsonProperty("names") + public String[] getNames() { return names; } + @JsonProperty("names") + public void setNames(String[] value) { this.names = value; } + + /** + * If false or missing this segment matches the names provided, otherwise it matches + * anything except the names provided. + */ + @JsonProperty("negate") + public Boolean getNegate() { return negate; } + @JsonProperty("negate") + public void setNegate(Boolean value) { this.negate = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventBody.java new file mode 100644 index 0000000..bb30527 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ExitedEventBody { + private long exitCode; + + /** + * The exit code returned from the debuggee. + */ + @JsonProperty("exitCode") + public long getExitCode() { return exitCode; } + @JsonProperty("exitCode") + public void setExitCode(long value) { this.exitCode = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventClass.java new file mode 100644 index 0000000..11ef36b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventClass.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that the debuggee has exited and returns its exit code. + */ +public class ExitedEventClass { + private long seq; + private BreakpointEventType type; + private ExitedEventBody body; + private ExitedEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ExitedEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ExitedEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public ExitedEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(ExitedEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventEvent.java new file mode 100644 index 0000000..9406e78 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ExitedEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ExitedEventEvent { + EXITED; + + @JsonValue + public String toValue() { + switch (this) { + case EXITED: return "exited"; + } + return null; + } + + @JsonCreator + public static ExitedEventEvent forValue(String value) throws IOException { + if (value.equals("exited")) return EXITED; + throw new IOException("Cannot deserialize ExitedEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Filter.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Filter.java new file mode 100644 index 0000000..7197ac4 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Filter.java @@ -0,0 +1,28 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * Filter to limit the child variables to either named or indexed. If omitted, both types + * are fetched. + */ +public enum Filter { + INDEXED, NAMED; + + @JsonValue + public String toValue() { + switch (this) { + case INDEXED: return "indexed"; + case NAMED: return "named"; + } + return null; + } + + @JsonCreator + public static Filter forValue(String value) throws IOException { + if (value.equals("indexed")) return INDEXED; + if (value.equals("named")) return NAMED; + throw new IOException("Cannot deserialize Filter"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/FunctionBreakpoint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/FunctionBreakpoint.java new file mode 100644 index 0000000..3a65664 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/FunctionBreakpoint.java @@ -0,0 +1,41 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Properties of a breakpoint passed to the `setFunctionBreakpoints` request. + */ +public class FunctionBreakpoint { + private String condition; + private String hitCondition; + private String name; + + /** + * An expression for conditional breakpoints. + * It is only honored by a debug adapter if the corresponding capability + * `supportsConditionalBreakpoints` is true. + */ + @JsonProperty("condition") + public String getCondition() { return condition; } + @JsonProperty("condition") + public void setCondition(String value) { this.condition = value; } + + /** + * An expression that controls how many hits of the breakpoint are ignored. + * The debug adapter is expected to interpret the expression as needed. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsHitConditionalBreakpoints` is true. + */ + @JsonProperty("hitCondition") + public String getHitCondition() { return hitCondition; } + @JsonProperty("hitCondition") + public void setHitCondition(String value) { this.hitCondition = value; } + + /** + * The name of the function. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoArgumentsClass.java new file mode 100644 index 0000000..f222550 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoArgumentsClass.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `goto` request. + */ +public class GotoArgumentsClass { + private long targetID; + private long threadID; + + /** + * The location where the debuggee will continue to run. + */ + @JsonProperty("targetId") + public long getTargetID() { return targetID; } + @JsonProperty("targetId") + public void setTargetID(long value) { this.targetID = value; } + + /** + * Set the goto target for this thread. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestArguments.java new file mode 100644 index 0000000..0265f95 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestArguments.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `goto` request. + */ +public class GotoRequestArguments { + private long targetID; + private long threadID; + + /** + * The location where the debuggee will continue to run. + */ + @JsonProperty("targetId") + public long getTargetID() { return targetID; } + @JsonProperty("targetId") + public void setTargetID(long value) { this.targetID = value; } + + /** + * Set the goto target for this thread. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestClass.java new file mode 100644 index 0000000..cbbc6c5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestClass.java @@ -0,0 +1,60 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request sets the location where the debuggee will continue to run. + * This makes it possible to skip the execution of code or to execute code again. + * The code between the current location and the goto target is not executed but skipped. + * The debug adapter first sends the response and then a `stopped` event with reason `goto`. + * Clients should only call this request if the corresponding capability + * `supportsGotoTargetsRequest` is true (because only then goto targets exist that can be + * passed as arguments). + */ +public class GotoRequestClass { + private long seq; + private AttachRequestType type; + private GotoRequestArguments arguments; + private GotoRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public GotoRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(GotoRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public GotoRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(GotoRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestCommand.java new file mode 100644 index 0000000..500224c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum GotoRequestCommand { + GOTO; + + @JsonValue + public String toValue() { + switch (this) { + case GOTO: return "goto"; + } + return null; + } + + @JsonCreator + public static GotoRequestCommand forValue(String value) throws IOException { + if (value.equals("goto")) return GOTO; + throw new IOException("Cannot deserialize GotoRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoResponseClass.java new file mode 100644 index 0000000..cecba40 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `goto` request. This is just an acknowledgement, so no body field is required. + */ +public class GotoResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTarget.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTarget.java new file mode 100644 index 0000000..a37542c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTarget.java @@ -0,0 +1,74 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A `GotoTarget` describes a code location that can be used as a target in the `goto` + * request. + * The possible goto targets can be determined via the `gotoTargets` request. + */ +public class GotoTarget { + private Long column; + private Long endColumn; + private Long endLine; + private long id; + private String instructionPointerReference; + private String label; + private long line; + + /** + * The column of the goto target. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * The end column of the range covered by the goto target. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * The end line of the range covered by the goto target. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * Unique identifier for a goto target. This is used in the `goto` request. + */ + @JsonProperty("id") + public long getID() { return id; } + @JsonProperty("id") + public void setID(long value) { this.id = value; } + + /** + * A memory reference for the instruction pointer value represented by this target. + */ + @JsonProperty("instructionPointerReference") + public String getInstructionPointerReference() { return instructionPointerReference; } + @JsonProperty("instructionPointerReference") + public void setInstructionPointerReference(String value) { this.instructionPointerReference = value; } + + /** + * The name of the goto target (shown in the UI). + */ + @JsonProperty("label") + public String getLabel() { return label; } + @JsonProperty("label") + public void setLabel(String value) { this.label = value; } + + /** + * The line of the goto target. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsArgumentsClass.java new file mode 100644 index 0000000..0876998 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsArgumentsClass.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `gotoTargets` request. + */ +public class GotoTargetsArgumentsClass { + private Long column; + private long line; + private Source source; + + /** + * The position within `line` for which the goto targets are determined. It is measured in + * UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- + * or 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * The line location for which the goto targets are determined. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } + + /** + * The source location for which the goto targets are determined. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestArguments.java new file mode 100644 index 0000000..ff865c2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestArguments.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `gotoTargets` request. + */ +public class GotoTargetsRequestArguments { + private Long column; + private long line; + private Source source; + + /** + * The position within `line` for which the goto targets are determined. It is measured in + * UTF-16 code units and the client capability `columnsStartAt1` determines whether it is 0- + * or 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * The line location for which the goto targets are determined. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } + + /** + * The source location for which the goto targets are determined. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestClass.java new file mode 100644 index 0000000..e5f1bcf --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * This request retrieves the possible goto targets for the specified source location. + * These targets can be used in the `goto` request. + * Clients should only call this request if the corresponding capability + * `supportsGotoTargetsRequest` is true. + */ +public class GotoTargetsRequestClass { + private long seq; + private AttachRequestType type; + private GotoTargetsRequestArguments arguments; + private GotoTargetsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public GotoTargetsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(GotoTargetsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public GotoTargetsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(GotoTargetsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestCommand.java new file mode 100644 index 0000000..bbe4579 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum GotoTargetsRequestCommand { + GOTO_TARGETS; + + @JsonValue + public String toValue() { + switch (this) { + case GOTO_TARGETS: return "gotoTargets"; + } + return null; + } + + @JsonCreator + public static GotoTargetsRequestCommand forValue(String value) throws IOException { + if (value.equals("gotoTargets")) return GOTO_TARGETS; + throw new IOException("Cannot deserialize GotoTargetsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsResponseBody.java new file mode 100644 index 0000000..1cb2253 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class GotoTargetsResponseBody { + private GotoTarget[] targets; + + /** + * The possible goto targets of the specified location. + */ + @JsonProperty("targets") + public GotoTarget[] getTargets() { return targets; } + @JsonProperty("targets") + public void setTargets(GotoTarget[] value) { this.targets = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsResponseClass.java new file mode 100644 index 0000000..d3ec76c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/GotoTargetsResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `gotoTargets` request. + */ +public class GotoTargetsResponseClass { + private long seq; + private AttachResponseType type; + private GotoTargetsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public GotoTargetsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(GotoTargetsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Group.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Group.java new file mode 100644 index 0000000..d28d4d6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Group.java @@ -0,0 +1,29 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * Support for keeping an output log organized by grouping related messages. + */ +public enum Group { + END, START, START_COLLAPSED; + + @JsonValue + public String toValue() { + switch (this) { + case END: return "end"; + case START: return "start"; + case START_COLLAPSED: return "startCollapsed"; + } + return null; + } + + @JsonCreator + public static Group forValue(String value) throws IOException { + if (value.equals("end")) return END; + if (value.equals("start")) return START; + if (value.equals("startCollapsed")) return START_COLLAPSED; + throw new IOException("Cannot deserialize Group"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/IDUnion.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/IDUnion.java new file mode 100644 index 0000000..36b3436 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/IDUnion.java @@ -0,0 +1,52 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; + +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; + +/** + * Unique identifier for the module. + * + * The module associated with this frame, if any. + */ +@JsonDeserialize(using = IDUnion.Deserializer.class) +@JsonSerialize(using = IDUnion.Serializer.class) +public class IDUnion { + public Long integerValue; + public String stringValue; + + static class Deserializer extends JsonDeserializer { + @Override + public IDUnion deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { + IDUnion value = new IDUnion(); + switch (jsonParser.currentToken()) { + case VALUE_NUMBER_INT: + value.integerValue = jsonParser.readValueAs(Long.class); + break; + case VALUE_STRING: + String string = jsonParser.readValueAs(String.class); + value.stringValue = string; + break; + default: throw new IOException("Cannot deserialize IDUnion"); + } + return value; + } + } + + static class Serializer extends JsonSerializer { + @Override + public void serialize(IDUnion obj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (obj.integerValue != null) { + jsonGenerator.writeObject(obj.integerValue); + return; + } + if (obj.stringValue != null) { + jsonGenerator.writeObject(obj.stringValue); + return; + } + throw new IOException("IDUnion must not be null"); + } + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestArguments.java new file mode 100644 index 0000000..999fedd --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestArguments.java @@ -0,0 +1,156 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `initialize` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class InitializeRequestArguments { + private String adapterID; + private String clientID; + private String clientName; + private Boolean columnsStartAt1; + private Boolean linesStartAt1; + private String locale; + private String pathFormat; + private Boolean supportsArgsCanBeInterpretedByShell; + private Boolean supportsInvalidatedEvent; + private Boolean supportsMemoryEvent; + private Boolean supportsMemoryReferences; + private Boolean supportsProgressReporting; + private Boolean supportsRunInTerminalRequest; + private Boolean supportsStartDebuggingRequest; + private Boolean supportsVariablePaging; + private Boolean supportsVariableType; + + /** + * The ID of the debug adapter. + */ + @JsonProperty("adapterID") + public String getAdapterID() { return adapterID; } + @JsonProperty("adapterID") + public void setAdapterID(String value) { this.adapterID = value; } + + /** + * The ID of the client using this adapter. + */ + @JsonProperty("clientID") + public String getClientID() { return clientID; } + @JsonProperty("clientID") + public void setClientID(String value) { this.clientID = value; } + + /** + * The human-readable name of the client using this adapter. + */ + @JsonProperty("clientName") + public String getClientName() { return clientName; } + @JsonProperty("clientName") + public void setClientName(String value) { this.clientName = value; } + + /** + * If true all column numbers are 1-based (default). + */ + @JsonProperty("columnsStartAt1") + public Boolean getColumnsStartAt1() { return columnsStartAt1; } + @JsonProperty("columnsStartAt1") + public void setColumnsStartAt1(Boolean value) { this.columnsStartAt1 = value; } + + /** + * If true all line numbers are 1-based (default). + */ + @JsonProperty("linesStartAt1") + public Boolean getLinesStartAt1() { return linesStartAt1; } + @JsonProperty("linesStartAt1") + public void setLinesStartAt1(Boolean value) { this.linesStartAt1 = value; } + + /** + * The ISO-639 locale of the client using this adapter, e.g. en-US or de-CH. + */ + @JsonProperty("locale") + public String getLocale() { return locale; } + @JsonProperty("locale") + public void setLocale(String value) { this.locale = value; } + + /** + * Determines in what format paths are specified. The default is `path`, which is the native + * format. + */ + @JsonProperty("pathFormat") + public String getPathFormat() { return pathFormat; } + @JsonProperty("pathFormat") + public void setPathFormat(String value) { this.pathFormat = value; } + + /** + * Client supports the `argsCanBeInterpretedByShell` attribute on the `runInTerminal` + * request. + */ + @JsonProperty("supportsArgsCanBeInterpretedByShell") + public Boolean getSupportsArgsCanBeInterpretedByShell() { return supportsArgsCanBeInterpretedByShell; } + @JsonProperty("supportsArgsCanBeInterpretedByShell") + public void setSupportsArgsCanBeInterpretedByShell(Boolean value) { this.supportsArgsCanBeInterpretedByShell = value; } + + /** + * Client supports the `invalidated` event. + */ + @JsonProperty("supportsInvalidatedEvent") + public Boolean getSupportsInvalidatedEvent() { return supportsInvalidatedEvent; } + @JsonProperty("supportsInvalidatedEvent") + public void setSupportsInvalidatedEvent(Boolean value) { this.supportsInvalidatedEvent = value; } + + /** + * Client supports the `memory` event. + */ + @JsonProperty("supportsMemoryEvent") + public Boolean getSupportsMemoryEvent() { return supportsMemoryEvent; } + @JsonProperty("supportsMemoryEvent") + public void setSupportsMemoryEvent(Boolean value) { this.supportsMemoryEvent = value; } + + /** + * Client supports memory references. + */ + @JsonProperty("supportsMemoryReferences") + public Boolean getSupportsMemoryReferences() { return supportsMemoryReferences; } + @JsonProperty("supportsMemoryReferences") + public void setSupportsMemoryReferences(Boolean value) { this.supportsMemoryReferences = value; } + + /** + * Client supports progress reporting. + */ + @JsonProperty("supportsProgressReporting") + public Boolean getSupportsProgressReporting() { return supportsProgressReporting; } + @JsonProperty("supportsProgressReporting") + public void setSupportsProgressReporting(Boolean value) { this.supportsProgressReporting = value; } + + /** + * Client supports the `runInTerminal` request. + */ + @JsonProperty("supportsRunInTerminalRequest") + public Boolean getSupportsRunInTerminalRequest() { return supportsRunInTerminalRequest; } + @JsonProperty("supportsRunInTerminalRequest") + public void setSupportsRunInTerminalRequest(Boolean value) { this.supportsRunInTerminalRequest = value; } + + /** + * Client supports the `startDebugging` request. + */ + @JsonProperty("supportsStartDebuggingRequest") + public Boolean getSupportsStartDebuggingRequest() { return supportsStartDebuggingRequest; } + @JsonProperty("supportsStartDebuggingRequest") + public void setSupportsStartDebuggingRequest(Boolean value) { this.supportsStartDebuggingRequest = value; } + + /** + * Client supports the paging of variables. + */ + @JsonProperty("supportsVariablePaging") + public Boolean getSupportsVariablePaging() { return supportsVariablePaging; } + @JsonProperty("supportsVariablePaging") + public void setSupportsVariablePaging(Boolean value) { this.supportsVariablePaging = value; } + + /** + * Client supports the `type` attribute for variables. + */ + @JsonProperty("supportsVariableType") + public Boolean getSupportsVariableType() { return supportsVariableType; } + @JsonProperty("supportsVariableType") + public void setSupportsVariableType(Boolean value) { this.supportsVariableType = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestArgumentsClass.java new file mode 100644 index 0000000..b72a750 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestArgumentsClass.java @@ -0,0 +1,155 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `initialize` request. + */ +public class InitializeRequestArgumentsClass { + private String adapterID; + private String clientID; + private String clientName; + private Boolean columnsStartAt1; + private Boolean linesStartAt1; + private String locale; + private String pathFormat; + private Boolean supportsArgsCanBeInterpretedByShell; + private Boolean supportsInvalidatedEvent; + private Boolean supportsMemoryEvent; + private Boolean supportsMemoryReferences; + private Boolean supportsProgressReporting; + private Boolean supportsRunInTerminalRequest; + private Boolean supportsStartDebuggingRequest; + private Boolean supportsVariablePaging; + private Boolean supportsVariableType; + + /** + * The ID of the debug adapter. + */ + @JsonProperty("adapterID") + public String getAdapterID() { return adapterID; } + @JsonProperty("adapterID") + public void setAdapterID(String value) { this.adapterID = value; } + + /** + * The ID of the client using this adapter. + */ + @JsonProperty("clientID") + public String getClientID() { return clientID; } + @JsonProperty("clientID") + public void setClientID(String value) { this.clientID = value; } + + /** + * The human-readable name of the client using this adapter. + */ + @JsonProperty("clientName") + public String getClientName() { return clientName; } + @JsonProperty("clientName") + public void setClientName(String value) { this.clientName = value; } + + /** + * If true all column numbers are 1-based (default). + */ + @JsonProperty("columnsStartAt1") + public Boolean getColumnsStartAt1() { return columnsStartAt1; } + @JsonProperty("columnsStartAt1") + public void setColumnsStartAt1(Boolean value) { this.columnsStartAt1 = value; } + + /** + * If true all line numbers are 1-based (default). + */ + @JsonProperty("linesStartAt1") + public Boolean getLinesStartAt1() { return linesStartAt1; } + @JsonProperty("linesStartAt1") + public void setLinesStartAt1(Boolean value) { this.linesStartAt1 = value; } + + /** + * The ISO-639 locale of the client using this adapter, e.g. en-US or de-CH. + */ + @JsonProperty("locale") + public String getLocale() { return locale; } + @JsonProperty("locale") + public void setLocale(String value) { this.locale = value; } + + /** + * Determines in what format paths are specified. The default is `path`, which is the native + * format. + */ + @JsonProperty("pathFormat") + public String getPathFormat() { return pathFormat; } + @JsonProperty("pathFormat") + public void setPathFormat(String value) { this.pathFormat = value; } + + /** + * Client supports the `argsCanBeInterpretedByShell` attribute on the `runInTerminal` + * request. + */ + @JsonProperty("supportsArgsCanBeInterpretedByShell") + public Boolean getSupportsArgsCanBeInterpretedByShell() { return supportsArgsCanBeInterpretedByShell; } + @JsonProperty("supportsArgsCanBeInterpretedByShell") + public void setSupportsArgsCanBeInterpretedByShell(Boolean value) { this.supportsArgsCanBeInterpretedByShell = value; } + + /** + * Client supports the `invalidated` event. + */ + @JsonProperty("supportsInvalidatedEvent") + public Boolean getSupportsInvalidatedEvent() { return supportsInvalidatedEvent; } + @JsonProperty("supportsInvalidatedEvent") + public void setSupportsInvalidatedEvent(Boolean value) { this.supportsInvalidatedEvent = value; } + + /** + * Client supports the `memory` event. + */ + @JsonProperty("supportsMemoryEvent") + public Boolean getSupportsMemoryEvent() { return supportsMemoryEvent; } + @JsonProperty("supportsMemoryEvent") + public void setSupportsMemoryEvent(Boolean value) { this.supportsMemoryEvent = value; } + + /** + * Client supports memory references. + */ + @JsonProperty("supportsMemoryReferences") + public Boolean getSupportsMemoryReferences() { return supportsMemoryReferences; } + @JsonProperty("supportsMemoryReferences") + public void setSupportsMemoryReferences(Boolean value) { this.supportsMemoryReferences = value; } + + /** + * Client supports progress reporting. + */ + @JsonProperty("supportsProgressReporting") + public Boolean getSupportsProgressReporting() { return supportsProgressReporting; } + @JsonProperty("supportsProgressReporting") + public void setSupportsProgressReporting(Boolean value) { this.supportsProgressReporting = value; } + + /** + * Client supports the `runInTerminal` request. + */ + @JsonProperty("supportsRunInTerminalRequest") + public Boolean getSupportsRunInTerminalRequest() { return supportsRunInTerminalRequest; } + @JsonProperty("supportsRunInTerminalRequest") + public void setSupportsRunInTerminalRequest(Boolean value) { this.supportsRunInTerminalRequest = value; } + + /** + * Client supports the `startDebugging` request. + */ + @JsonProperty("supportsStartDebuggingRequest") + public Boolean getSupportsStartDebuggingRequest() { return supportsStartDebuggingRequest; } + @JsonProperty("supportsStartDebuggingRequest") + public void setSupportsStartDebuggingRequest(Boolean value) { this.supportsStartDebuggingRequest = value; } + + /** + * Client supports the paging of variables. + */ + @JsonProperty("supportsVariablePaging") + public Boolean getSupportsVariablePaging() { return supportsVariablePaging; } + @JsonProperty("supportsVariablePaging") + public void setSupportsVariablePaging(Boolean value) { this.supportsVariablePaging = value; } + + /** + * Client supports the `type` attribute for variables. + */ + @JsonProperty("supportsVariableType") + public Boolean getSupportsVariableType() { return supportsVariableType; } + @JsonProperty("supportsVariableType") + public void setSupportsVariableType(Boolean value) { this.supportsVariableType = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestClass.java new file mode 100644 index 0000000..16af676 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestClass.java @@ -0,0 +1,63 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The `initialize` request is sent as the first request from the client to the debug + * adapter in order to configure it with client capabilities and to retrieve capabilities + * from the debug adapter. + * Until the debug adapter has responded with an `initialize` response, the client must not + * send any additional requests or events to the debug adapter. + * In addition the debug adapter is not allowed to send any requests or events to the client + * until it has responded with an `initialize` response. + * The `initialize` request may only be sent once. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class InitializeRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private InitializeRequestArguments arguments; + private InitializeRequestCommand command = InitializeRequestCommand.INITIALIZE; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public InitializeRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(InitializeRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public InitializeRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(InitializeRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestCommand.java new file mode 100644 index 0000000..c2bd6ab --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum InitializeRequestCommand { + INITIALIZE; + + @JsonValue + public String toValue() { + switch (this) { + case INITIALIZE: return "initialize"; + } + return null; + } + + @JsonCreator + public static InitializeRequestCommand forValue(String value) throws IOException { + if (value.equals("initialize")) return INITIALIZE; + throw new IOException("Cannot deserialize InitializeRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeResponseClass.java new file mode 100644 index 0000000..e0ad255 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializeResponseClass.java @@ -0,0 +1,91 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `initialize` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class InitializeResponseClass implements DAPResponse { + private long seq; + private String type; + private BodyClass body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + * + * The capabilities of this debug adapter. + */ + @JsonProperty("body") + public BodyClass getBody() { return body; } + @JsonProperty("body") + public void setBody(BodyClass value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializedEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializedEventClass.java new file mode 100644 index 0000000..2c38e1a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializedEventClass.java @@ -0,0 +1,69 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPEvent; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * This event indicates that the debug adapter is ready to accept configuration requests + * (e.g. `setBreakpoints`, `setExceptionBreakpoints`). + * A debug adapter is expected to send this event when it is ready to accept configuration + * requests (but not before the `initialize` request has finished). + * The sequence of events/requests is as follows: + * - adapters sends `initialized` event (after the `initialize` request has returned) + * - client sends zero or more `setBreakpoints` requests + * - client sends one `setFunctionBreakpoints` request (if corresponding capability + * `supportsFunctionBreakpoints` is true) + * - client sends a `setExceptionBreakpoints` request if one or more + * `exceptionBreakpointFilters` have been defined (or if `supportsConfigurationDoneRequest` + * is not true) + * - client sends other future configuration requests + * - client sends one `configurationDone` request to indicate the end of the configuration. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class InitializedEventClass implements DAPEvent { + private long seq; + private String type; + private Restart body; + private String event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public String getEvent() { return event; } + @JsonProperty("event") + public void setEvent(String value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializedEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializedEventEvent.java new file mode 100644 index 0000000..9adde44 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InitializedEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum InitializedEventEvent { + INITIALIZED; + + @JsonValue + public String toValue() { + switch (this) { + case INITIALIZED: return "initialized"; + } + return null; + } + + @JsonCreator + public static InitializedEventEvent forValue(String value) throws IOException { + if (value.equals("initialized")) return INITIALIZED; + throw new IOException("Cannot deserialize InitializedEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InstructionBreakpoint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InstructionBreakpoint.java new file mode 100644 index 0000000..a1cfbfb --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InstructionBreakpoint.java @@ -0,0 +1,53 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Properties of a breakpoint passed to the `setInstructionBreakpoints` request + */ +public class InstructionBreakpoint { + private String condition; + private String hitCondition; + private String instructionReference; + private Long offset; + + /** + * An expression for conditional breakpoints. + * It is only honored by a debug adapter if the corresponding capability + * `supportsConditionalBreakpoints` is true. + */ + @JsonProperty("condition") + public String getCondition() { return condition; } + @JsonProperty("condition") + public void setCondition(String value) { this.condition = value; } + + /** + * An expression that controls how many hits of the breakpoint are ignored. + * The debug adapter is expected to interpret the expression as needed. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsHitConditionalBreakpoints` is true. + */ + @JsonProperty("hitCondition") + public String getHitCondition() { return hitCondition; } + @JsonProperty("hitCondition") + public void setHitCondition(String value) { this.hitCondition = value; } + + /** + * The instruction reference of the breakpoint. + * This should be a memory or instruction pointer reference from an `EvaluateResponse`, + * `Variable`, `StackFrame`, `GotoTarget`, or `Breakpoint`. + */ + @JsonProperty("instructionReference") + public String getInstructionReference() { return instructionReference; } + @JsonProperty("instructionReference") + public void setInstructionReference(String value) { this.instructionReference = value; } + + /** + * The offset from the instruction reference in bytes. + * This can be negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventBody.java new file mode 100644 index 0000000..cace39b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventBody.java @@ -0,0 +1,37 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class InvalidatedEventBody { + private String[] areas; + private Long stackFrameID; + private Long threadID; + + /** + * Set of logical areas that got invalidated. This property has a hint characteristic: a + * client can only be expected to make a 'best effort' in honoring the areas but there are + * no guarantees. If this property is missing, empty, or if values are not understood, the + * client should assume a single value `all`. + */ + @JsonProperty("areas") + public String[] getAreas() { return areas; } + @JsonProperty("areas") + public void setAreas(String[] value) { this.areas = value; } + + /** + * If specified, the client only needs to refetch data related to this stack frame (and the + * `threadId` is ignored). + */ + @JsonProperty("stackFrameId") + public Long getStackFrameID() { return stackFrameID; } + @JsonProperty("stackFrameId") + public void setStackFrameID(Long value) { this.stackFrameID = value; } + + /** + * If specified, the client only needs to refetch data related to this thread. + */ + @JsonProperty("threadId") + public Long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(Long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventClass.java new file mode 100644 index 0000000..dfb1154 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventClass.java @@ -0,0 +1,61 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * This event signals that some state in the debug adapter has changed and requires that the + * client needs to re-render the data snapshot previously requested. + * Debug adapters do not have to emit this event for runtime changes like stopped or thread + * events because in that case the client refetches the new state anyway. But the event can + * be used for example to refresh the UI after rendering formatting has changed in the debug + * adapter. + * This event should only be sent if the corresponding capability `supportsInvalidatedEvent` + * is true. + */ +public class InvalidatedEventClass { + private long seq; + private BreakpointEventType type; + private InvalidatedEventBody body; + private InvalidatedEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public InvalidatedEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(InvalidatedEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public InvalidatedEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(InvalidatedEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventEvent.java new file mode 100644 index 0000000..121cf6a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/InvalidatedEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum InvalidatedEventEvent { + INVALIDATED; + + @JsonValue + public String toValue() { + switch (this) { + case INVALIDATED: return "invalidated"; + } + return null; + } + + @JsonCreator + public static InvalidatedEventEvent forValue(String value) throws IOException { + if (value.equals("invalidated")) return INVALIDATED; + throw new IOException("Cannot deserialize InvalidatedEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Kind.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Kind.java new file mode 100644 index 0000000..57fa32e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Kind.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * What kind of terminal to launch. Defaults to `integrated` if not specified. + */ +public enum Kind { + EXTERNAL, INTEGRATED; + + @JsonValue + public String toValue() { + switch (this) { + case EXTERNAL: return "external"; + case INTEGRATED: return "integrated"; + } + return null; + } + + @JsonCreator + public static Kind forValue(String value) throws IOException { + if (value.equals("external")) return EXTERNAL; + if (value.equals("integrated")) return INTEGRATED; + throw new IOException("Cannot deserialize Kind"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestArguments.java new file mode 100644 index 0000000..109af8a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestArguments.java @@ -0,0 +1,29 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `launch` request. Additional attributes are implementation specific. + */ +public class LaunchRequestArguments { + private Restart restart; + private Boolean noDebug; + + /** + * Arbitrary data from the previous, restarted session. + * The data is sent as the `restart` attribute of the `terminated` event. + * The client should leave the data intact. + */ + @JsonProperty("__restart") + public Restart getRestart() { return restart; } + @JsonProperty("__restart") + public void setRestart(Restart value) { this.restart = value; } + + /** + * If true, the launch request should launch the program without enabling debugging. + */ + @JsonProperty("noDebug") + public Boolean getNoDebug() { return noDebug; } + @JsonProperty("noDebug") + public void setNoDebug(Boolean value) { this.noDebug = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestArgumentsClass.java new file mode 100644 index 0000000..0ddc3b6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestArgumentsClass.java @@ -0,0 +1,29 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `launch` request. Additional attributes are implementation specific. + */ +public class LaunchRequestArgumentsClass { + private Restart restart; + private Boolean noDebug; + + /** + * Arbitrary data from the previous, restarted session. + * The data is sent as the `restart` attribute of the `terminated` event. + * The client should leave the data intact. + */ + @JsonProperty("__restart") + public Restart getRestart() { return restart; } + @JsonProperty("__restart") + public void setRestart(Restart value) { this.restart = value; } + + /** + * If true, the launch request should launch the program without enabling debugging. + */ + @JsonProperty("noDebug") + public Boolean getNoDebug() { return noDebug; } + @JsonProperty("noDebug") + public void setNoDebug(Boolean value) { this.noDebug = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestClass.java new file mode 100644 index 0000000..e4be19f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * This launch request is sent from the client to the debug adapter to start the debuggee + * with or without debugging (if `noDebug` is true). + * Since launching is debugger/runtime specific, the arguments for this request are not part + * of this specification. + */ +public class LaunchRequestClass { + private long seq; + private AttachRequestType type; + private LaunchRequestArguments arguments; + private LaunchRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public LaunchRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(LaunchRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public LaunchRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(LaunchRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestCommand.java new file mode 100644 index 0000000..b8abbf2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum LaunchRequestCommand { + LAUNCH; + + @JsonValue + public String toValue() { + switch (this) { + case LAUNCH: return "launch"; + } + return null; + } + + @JsonCreator + public static LaunchRequestCommand forValue(String value) throws IOException { + if (value.equals("launch")) return LAUNCH; + throw new IOException("Cannot deserialize LaunchRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchResponseClass.java new file mode 100644 index 0000000..0eec160 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LaunchResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `launch` request. This is just an acknowledgement, so no body field is + * required. + */ +public class LaunchResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventBody.java new file mode 100644 index 0000000..f12c39c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventBody.java @@ -0,0 +1,24 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class LoadedSourceEventBody { + private BodyReason reason; + private Source source; + + /** + * The reason for the event. + */ + @JsonProperty("reason") + public BodyReason getReason() { return reason; } + @JsonProperty("reason") + public void setReason(BodyReason value) { this.reason = value; } + + /** + * The new, changed, or removed source. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventClass.java new file mode 100644 index 0000000..3fd84c7 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventClass.java @@ -0,0 +1,55 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that some source has been added, changed, or removed from the set of + * all loaded sources. + */ +public class LoadedSourceEventClass { + private long seq; + private BreakpointEventType type; + private LoadedSourceEventBody body; + private LoadedSourceEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public LoadedSourceEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(LoadedSourceEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public LoadedSourceEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(LoadedSourceEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventEvent.java new file mode 100644 index 0000000..91d8f68 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourceEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum LoadedSourceEventEvent { + LOADED_SOURCE; + + @JsonValue + public String toValue() { + switch (this) { + case LOADED_SOURCE: return "loadedSource"; + } + return null; + } + + @JsonCreator + public static LoadedSourceEventEvent forValue(String value) throws IOException { + if (value.equals("loadedSource")) return LOADED_SOURCE; + throw new IOException("Cannot deserialize LoadedSourceEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesRequestClass.java new file mode 100644 index 0000000..3f9079a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import java.util.Map; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Retrieves the set of all sources currently loaded by the debugged process. + * Clients should only call this request if the corresponding capability + * `supportsLoadedSourcesRequest` is true. + */ +public class LoadedSourcesRequestClass { + private long seq; + private AttachRequestType type; + private Map arguments; + private LoadedSourcesRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public Map getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(Map value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public LoadedSourcesRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(LoadedSourcesRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesRequestCommand.java new file mode 100644 index 0000000..912bf13 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum LoadedSourcesRequestCommand { + LOADED_SOURCES; + + @JsonValue + public String toValue() { + switch (this) { + case LOADED_SOURCES: return "loadedSources"; + } + return null; + } + + @JsonCreator + public static LoadedSourcesRequestCommand forValue(String value) throws IOException { + if (value.equals("loadedSources")) return LOADED_SOURCES; + throw new IOException("Cannot deserialize LoadedSourcesRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesResponseBody.java new file mode 100644 index 0000000..5a6b0f1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class LoadedSourcesResponseBody { + private Source[] sources; + + /** + * Set of loaded sources. + */ + @JsonProperty("sources") + public Source[] getSources() { return sources; } + @JsonProperty("sources") + public void setSources(Source[] value) { this.sources = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesResponseClass.java new file mode 100644 index 0000000..ebac73d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/LoadedSourcesResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `loadedSources` request. + */ +public class LoadedSourcesResponseClass { + private long seq; + private AttachResponseType type; + private LoadedSourcesResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public LoadedSourcesResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(LoadedSourcesResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventBody.java new file mode 100644 index 0000000..c89c76b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventBody.java @@ -0,0 +1,33 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class MemoryEventBody { + private long count; + private String memoryReference; + private long offset; + + /** + * Number of bytes updated. + */ + @JsonProperty("count") + public long getCount() { return count; } + @JsonProperty("count") + public void setCount(long value) { this.count = value; } + + /** + * Memory reference of a memory range that has been updated. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * Starting offset in bytes where memory has been updated. Can be negative. + */ + @JsonProperty("offset") + public long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(long value) { this.offset = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventClass.java new file mode 100644 index 0000000..45f76d3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventClass.java @@ -0,0 +1,65 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * This event indicates that some memory range has been updated. It should only be sent if + * the corresponding capability `supportsMemoryEvent` is true. + * Clients typically react to the event by re-issuing a `readMemory` request if they show + * the memory identified by the `memoryReference` and if the updated memory range overlaps + * the displayed range. Clients should not make assumptions how individual memory references + * relate to each other, so they should not assume that they are part of a single continuous + * address range and might overlap. + * Debug adapters can use this event to indicate that the contents of a memory range has + * changed due to some other request like `setVariable` or `setExpression`. Debug adapters + * are not expected to emit this event for each and every memory change of a running + * program, because that information is typically not available from debuggers and it would + * flood clients with too many events. + */ +public class MemoryEventClass { + private long seq; + private BreakpointEventType type; + private MemoryEventBody body; + private MemoryEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public MemoryEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(MemoryEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public MemoryEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(MemoryEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventEvent.java new file mode 100644 index 0000000..ceefad1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/MemoryEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum MemoryEventEvent { + MEMORY; + + @JsonValue + public String toValue() { + switch (this) { + case MEMORY: return "memory"; + } + return null; + } + + @JsonCreator + public static MemoryEventEvent forValue(String value) throws IOException { + if (value.equals("memory")) return MEMORY; + throw new IOException("Cannot deserialize MemoryEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Message.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Message.java new file mode 100644 index 0000000..be00719 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Message.java @@ -0,0 +1,80 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import java.util.Map; + +/** + * A structured error message. + * + * A structured message object. Used to return errors from requests. + */ +public class Message { + private String format; + private long id; + private Boolean sendTelemetry; + private Boolean showUser; + private String url; + private String urlLabel; + private Map variables; + + /** + * A format string for the message. Embedded variables have the form `{name}`. + * If variable name starts with an underscore character, the variable does not contain user + * data (PII) and can be safely used for telemetry purposes. + */ + @JsonProperty("format") + public String getFormat() { return format; } + @JsonProperty("format") + public void setFormat(String value) { this.format = value; } + + /** + * Unique (within a debug adapter implementation) identifier for the message. The purpose of + * these error IDs is to help extension authors that have the requirement that every user + * visible error message needs a corresponding error number, so that users or customer + * support can find information about the specific error more easily. + */ + @JsonProperty("id") + public long getID() { return id; } + @JsonProperty("id") + public void setID(long value) { this.id = value; } + + /** + * If true send to telemetry. + */ + @JsonProperty("sendTelemetry") + public Boolean getSendTelemetry() { return sendTelemetry; } + @JsonProperty("sendTelemetry") + public void setSendTelemetry(Boolean value) { this.sendTelemetry = value; } + + /** + * If true show user. + */ + @JsonProperty("showUser") + public Boolean getShowUser() { return showUser; } + @JsonProperty("showUser") + public void setShowUser(Boolean value) { this.showUser = value; } + + /** + * A url where additional information about this message can be found. + */ + @JsonProperty("url") + public String getURL() { return url; } + @JsonProperty("url") + public void setURL(String value) { this.url = value; } + + /** + * A label that is presented to the user as the UI for opening the url. + */ + @JsonProperty("urlLabel") + public String getURLLabel() { return urlLabel; } + @JsonProperty("urlLabel") + public void setURLLabel(String value) { this.urlLabel = value; } + + /** + * An object used as a dictionary for looking up the variables in the format string. + */ + @JsonProperty("variables") + public Map getVariables() { return variables; } + @JsonProperty("variables") + public void setVariables(Map value) { this.variables = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Module.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Module.java new file mode 100644 index 0000000..ac62a05 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Module.java @@ -0,0 +1,113 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A Module object represents a row in the modules view. + * The `id` attribute identifies a module in the modules view and is used in a `module` + * event for identifying a module for adding, updating or deleting. + * The `name` attribute is used to minimally render the module in the UI. + * + * Additional attributes can be added to the module. They show up in the module view if they + * have a corresponding `ColumnDescriptor`. + * + * To avoid an unnecessary proliferation of additional attributes with similar semantics but + * different names, we recommend to re-use attributes from the 'recommended' list below + * first, and only introduce new attributes if nothing appropriate could be found. + * + * The new, changed, or removed module. In case of `removed` only the module id is used. + */ +public class Module { + private String addressRange; + private String dateTimeStamp; + private IDUnion id; + private Boolean isOptimized; + private Boolean isUserCode; + private String name; + private String path; + private String symbolFilePath; + private String symbolStatus; + private String version; + + /** + * Address range covered by this module. + */ + @JsonProperty("addressRange") + public String getAddressRange() { return addressRange; } + @JsonProperty("addressRange") + public void setAddressRange(String value) { this.addressRange = value; } + + /** + * Module created or modified, encoded as a RFC 3339 timestamp. + */ + @JsonProperty("dateTimeStamp") + public String getDateTimeStamp() { return dateTimeStamp; } + @JsonProperty("dateTimeStamp") + public void setDateTimeStamp(String value) { this.dateTimeStamp = value; } + + /** + * Unique identifier for the module. + */ + @JsonProperty("id") + public IDUnion getID() { return id; } + @JsonProperty("id") + public void setID(IDUnion value) { this.id = value; } + + /** + * True if the module is optimized. + */ + @JsonProperty("isOptimized") + public Boolean getIsOptimized() { return isOptimized; } + @JsonProperty("isOptimized") + public void setIsOptimized(Boolean value) { this.isOptimized = value; } + + /** + * True if the module is considered 'user code' by a debugger that supports 'Just My Code'. + */ + @JsonProperty("isUserCode") + public Boolean getIsUserCode() { return isUserCode; } + @JsonProperty("isUserCode") + public void setIsUserCode(Boolean value) { this.isUserCode = value; } + + /** + * A name of the module. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * Logical full path to the module. The exact definition is implementation defined, but + * usually this would be a full path to the on-disk file for the module. + */ + @JsonProperty("path") + public String getPath() { return path; } + @JsonProperty("path") + public void setPath(String value) { this.path = value; } + + /** + * Logical full path to the symbol file. The exact definition is implementation defined. + */ + @JsonProperty("symbolFilePath") + public String getSymbolFilePath() { return symbolFilePath; } + @JsonProperty("symbolFilePath") + public void setSymbolFilePath(String value) { this.symbolFilePath = value; } + + /** + * User-understandable description of if symbols were found for the module (ex: 'Symbols + * Loaded', 'Symbols not found', etc.) + */ + @JsonProperty("symbolStatus") + public String getSymbolStatus() { return symbolStatus; } + @JsonProperty("symbolStatus") + public void setSymbolStatus(String value) { this.symbolStatus = value; } + + /** + * Version of Module. + */ + @JsonProperty("version") + public String getVersion() { return version; } + @JsonProperty("version") + public void setVersion(String value) { this.version = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventBody.java new file mode 100644 index 0000000..7d42e53 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventBody.java @@ -0,0 +1,24 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ModuleEventBody { + private Module module; + private BodyReason reason; + + /** + * The new, changed, or removed module. In case of `removed` only the module id is used. + */ + @JsonProperty("module") + public Module getModule() { return module; } + @JsonProperty("module") + public void setModule(Module value) { this.module = value; } + + /** + * The reason for the event. + */ + @JsonProperty("reason") + public BodyReason getReason() { return reason; } + @JsonProperty("reason") + public void setReason(BodyReason value) { this.reason = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventClass.java new file mode 100644 index 0000000..c7a0701 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventClass.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that some information about a module has changed. + */ +public class ModuleEventClass { + private long seq; + private BreakpointEventType type; + private ModuleEventBody body; + private ModuleEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ModuleEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ModuleEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public ModuleEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(ModuleEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventEvent.java new file mode 100644 index 0000000..208ef80 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ModuleEventEvent { + MODULE; + + @JsonValue + public String toValue() { + switch (this) { + case MODULE: return "module"; + } + return null; + } + + @JsonCreator + public static ModuleEventEvent forValue(String value) throws IOException { + if (value.equals("module")) return MODULE; + throw new IOException("Cannot deserialize ModuleEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleIDUnion.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleIDUnion.java new file mode 100644 index 0000000..6db20d3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModuleIDUnion.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; + +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; + +/** + * Unique identifier for the module. + * + * The module associated with this frame, if any. + */ +@JsonDeserialize(using = ModuleIDUnion.Deserializer.class) +@JsonSerialize(using = ModuleIDUnion.Serializer.class) +public class ModuleIDUnion { + public Long integerValue; + public String stringValue; + + static class Deserializer extends JsonDeserializer { + @Override + public ModuleIDUnion deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { + ModuleIDUnion value = new ModuleIDUnion(); + switch (jsonParser.currentToken()) { + case VALUE_NULL: + break; + case VALUE_NUMBER_INT: + value.integerValue = jsonParser.readValueAs(Long.class); + break; + case VALUE_STRING: + String string = jsonParser.readValueAs(String.class); + value.stringValue = string; + break; + default: throw new IOException("Cannot deserialize ModuleIDUnion"); + } + return value; + } + } + + static class Serializer extends JsonSerializer { + @Override + public void serialize(ModuleIDUnion obj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (obj.integerValue != null) { + jsonGenerator.writeObject(obj.integerValue); + return; + } + if (obj.stringValue != null) { + jsonGenerator.writeObject(obj.stringValue); + return; + } + jsonGenerator.writeNull(); + } + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesArgumentsClass.java new file mode 100644 index 0000000..5089be0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesArgumentsClass.java @@ -0,0 +1,28 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `modules` request. + */ +public class ModulesArgumentsClass { + private Long moduleCount; + private Long startModule; + + /** + * The number of modules to return. If `moduleCount` is not specified or 0, all modules are + * returned. + */ + @JsonProperty("moduleCount") + public Long getModuleCount() { return moduleCount; } + @JsonProperty("moduleCount") + public void setModuleCount(Long value) { this.moduleCount = value; } + + /** + * The index of the first module to return; if omitted modules start at 0. + */ + @JsonProperty("startModule") + public Long getStartModule() { return startModule; } + @JsonProperty("startModule") + public void setStartModule(Long value) { this.startModule = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestArguments.java new file mode 100644 index 0000000..0f88438 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestArguments.java @@ -0,0 +1,28 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `modules` request. + */ +public class ModulesRequestArguments { + private Long moduleCount; + private Long startModule; + + /** + * The number of modules to return. If `moduleCount` is not specified or 0, all modules are + * returned. + */ + @JsonProperty("moduleCount") + public Long getModuleCount() { return moduleCount; } + @JsonProperty("moduleCount") + public void setModuleCount(Long value) { this.moduleCount = value; } + + /** + * The index of the first module to return; if omitted modules start at 0. + */ + @JsonProperty("startModule") + public Long getStartModule() { return startModule; } + @JsonProperty("startModule") + public void setStartModule(Long value) { this.startModule = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestClass.java new file mode 100644 index 0000000..e15c6ca --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Modules can be retrieved from the debug adapter with this request which can either return + * all modules or a range of modules to support paging. + * Clients should only call this request if the corresponding capability + * `supportsModulesRequest` is true. + */ +public class ModulesRequestClass { + private long seq; + private AttachRequestType type; + private ModulesRequestArguments arguments; + private ModulesRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public ModulesRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ModulesRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public ModulesRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(ModulesRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestCommand.java new file mode 100644 index 0000000..04172dc --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ModulesRequestCommand { + MODULES; + + @JsonValue + public String toValue() { + switch (this) { + case MODULES: return "modules"; + } + return null; + } + + @JsonCreator + public static ModulesRequestCommand forValue(String value) throws IOException { + if (value.equals("modules")) return MODULES; + throw new IOException("Cannot deserialize ModulesRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesResponseBody.java new file mode 100644 index 0000000..5bb3aa2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesResponseBody.java @@ -0,0 +1,24 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ModulesResponseBody { + private Module[] modules; + private Long totalModules; + + /** + * All modules or range of modules. + */ + @JsonProperty("modules") + public Module[] getModules() { return modules; } + @JsonProperty("modules") + public void setModules(Module[] value) { this.modules = value; } + + /** + * The total number of modules available. + */ + @JsonProperty("totalModules") + public Long getTotalModules() { return totalModules; } + @JsonProperty("totalModules") + public void setTotalModules(Long value) { this.totalModules = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesResponseClass.java new file mode 100644 index 0000000..f48f356 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ModulesResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `modules` request. + */ +public class ModulesResponseClass { + private long seq; + private AttachResponseType type; + private ModulesResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public ModulesResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ModulesResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextArgumentsClass.java new file mode 100644 index 0000000..a17779e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextArgumentsClass.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `next` request. + */ +public class NextArgumentsClass { + private SteppingGranularity granularity; + private Boolean singleThread; + private long threadID; + + /** + * Stepping granularity. If no granularity is specified, a granularity of `statement` is + * assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the thread for which to resume execution for one step (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestArguments.java new file mode 100644 index 0000000..1e78799 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestArguments.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `next` request. + */ +public class NextRequestArguments { + private SteppingGranularity granularity; + private Boolean singleThread; + private long threadID; + + /** + * Stepping granularity. If no granularity is specified, a granularity of `statement` is + * assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the thread for which to resume execution for one step (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestClass.java new file mode 100644 index 0000000..8e5b490 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestClass.java @@ -0,0 +1,60 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request executes one step (in the given granularity) for the specified thread and + * allows all other threads to run freely by resuming them. + * If the debug adapter supports single thread execution (see capability + * `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true + * prevents other suspended threads from resuming. + * The debug adapter first sends the response and then a `stopped` event (with reason + * `step`) after the step has completed. + */ +public class NextRequestClass { + private long seq; + private AttachRequestType type; + private NextRequestArguments arguments; + private NextRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public NextRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(NextRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public NextRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(NextRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestCommand.java new file mode 100644 index 0000000..fccaccf --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum NextRequestCommand { + NEXT; + + @JsonValue + public String toValue() { + switch (this) { + case NEXT: return "next"; + } + return null; + } + + @JsonCreator + public static NextRequestCommand forValue(String value) throws IOException { + if (value.equals("next")) return NEXT; + throw new IOException("Cannot deserialize NextRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextResponseClass.java new file mode 100644 index 0000000..f9e05e1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/NextResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `next` request. This is just an acknowledgement, so no body field is required. + */ +public class NextResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventBody.java new file mode 100644 index 0000000..16a4949 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventBody.java @@ -0,0 +1,84 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class OutputEventBody { + private String category; + private Long column; + private Restart data; + private Group group; + private Long line; + private String output; + private Source source; + private Long variablesReference; + + /** + * The output category. If not specified or if the category is not understood by the client, + * `console` is assumed. + */ + @JsonProperty("category") + public String getCategory() { return category; } + @JsonProperty("category") + public void setCategory(String value) { this.category = value; } + + /** + * The position in `line` where the output was produced. It is measured in UTF-16 code units + * and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * Additional data to report. For the `telemetry` category the data is sent to telemetry, + * for the other categories the data is shown in JSON format. + */ + @JsonProperty("data") + public Restart getData() { return data; } + @JsonProperty("data") + public void setData(Restart value) { this.data = value; } + + /** + * Support for keeping an output log organized by grouping related messages. + */ + @JsonProperty("group") + public Group getGroup() { return group; } + @JsonProperty("group") + public void setGroup(Group value) { this.group = value; } + + /** + * The source location's line where the output was produced. + */ + @JsonProperty("line") + public Long getLine() { return line; } + @JsonProperty("line") + public void setLine(Long value) { this.line = value; } + + /** + * The output to report. + */ + @JsonProperty("output") + public String getOutput() { return output; } + @JsonProperty("output") + public void setOutput(String value) { this.output = value; } + + /** + * The source location where the output was produced. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + /** + * If an attribute `variablesReference` exists and its value is > 0, the output contains + * objects which can be retrieved by passing `variablesReference` to the `variables` request + * as long as execution remains suspended. See 'Lifetime of Object References' in the + * Overview section for details. + */ + @JsonProperty("variablesReference") + public Long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(Long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventClass.java new file mode 100644 index 0000000..89bde7f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventClass.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that the target has produced some output. + */ +public class OutputEventClass { + private long seq; + private BreakpointEventType type; + private OutputEventBody body; + private OutputEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public OutputEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(OutputEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public OutputEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(OutputEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventEvent.java new file mode 100644 index 0000000..f5a611b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/OutputEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum OutputEventEvent { + OUTPUT; + + @JsonValue + public String toValue() { + switch (this) { + case OUTPUT: return "output"; + } + return null; + } + + @JsonCreator + public static OutputEventEvent forValue(String value) throws IOException { + if (value.equals("output")) return OUTPUT; + throw new IOException("Cannot deserialize OutputEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseArgumentsClass.java new file mode 100644 index 0000000..8cec922 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `pause` request. + */ +public class PauseArgumentsClass { + private long threadID; + + /** + * Pause execution for this thread. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestArguments.java new file mode 100644 index 0000000..935e72b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `pause` request. + */ +public class PauseRequestArguments { + private long threadID; + + /** + * Pause execution for this thread. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestClass.java new file mode 100644 index 0000000..b4a9e67 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestClass.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request suspends the debuggee. + * The debug adapter first sends the response and then a `stopped` event (with reason + * `pause`) after the thread has been paused successfully. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PauseRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private PauseRequestArguments arguments; + private String command = "pause"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public PauseRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(PauseRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestCommand.java new file mode 100644 index 0000000..e290a7c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum PauseRequestCommand { + PAUSE; + + @JsonValue + public String toValue() { + switch (this) { + case PAUSE: return "pause"; + } + return null; + } + + @JsonCreator + public static PauseRequestCommand forValue(String value) throws IOException { + if (value.equals("pause")) return PAUSE; + throw new IOException("Cannot deserialize PauseRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseResponseClass.java new file mode 100644 index 0000000..3b98f29 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/PauseResponseClass.java @@ -0,0 +1,90 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `pause` request. This is just an acknowledgement, so no body field is + * required. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PauseResponseClass implements DAPResponse { + private long seq; + private String type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventBody.java new file mode 100644 index 0000000..9a2cbc1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventBody.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ProcessEventBody { + private Boolean isLocalProcess; + private String name; + private Long pointerSize; + private StartMethod startMethod; + private Long systemProcessID; + + /** + * If true, the process is running on the same computer as the debug adapter. + */ + @JsonProperty("isLocalProcess") + public Boolean getIsLocalProcess() { return isLocalProcess; } + @JsonProperty("isLocalProcess") + public void setIsLocalProcess(Boolean value) { this.isLocalProcess = value; } + + /** + * The logical name of the process. This is usually the full path to process's executable + * file. Example: /home/example/myproj/program.js. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * The size of a pointer or address for this process, in bits. This value may be used by + * clients when formatting addresses for display. + */ + @JsonProperty("pointerSize") + public Long getPointerSize() { return pointerSize; } + @JsonProperty("pointerSize") + public void setPointerSize(Long value) { this.pointerSize = value; } + + /** + * Describes how the debug engine started debugging this process. + */ + @JsonProperty("startMethod") + public StartMethod getStartMethod() { return startMethod; } + @JsonProperty("startMethod") + public void setStartMethod(StartMethod value) { this.startMethod = value; } + + /** + * The system process id of the debugged process. This property is missing for non-system + * processes. + */ + @JsonProperty("systemProcessId") + public Long getSystemProcessID() { return systemProcessID; } + @JsonProperty("systemProcessId") + public void setSystemProcessID(Long value) { this.systemProcessID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventClass.java new file mode 100644 index 0000000..a7063bb --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventClass.java @@ -0,0 +1,55 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that the debugger has begun debugging a new process. Either one that + * it has launched, or one that it has attached to. + */ +public class ProcessEventClass { + private long seq; + private BreakpointEventType type; + private ProcessEventBody body; + private ProcessEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ProcessEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ProcessEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public ProcessEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(ProcessEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventEvent.java new file mode 100644 index 0000000..c2ad3b8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProcessEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ProcessEventEvent { + PROCESS; + + @JsonValue + public String toValue() { + switch (this) { + case PROCESS: return "process"; + } + return null; + } + + @JsonCreator + public static ProcessEventEvent forValue(String value) throws IOException { + if (value.equals("process")) return PROCESS; + throw new IOException("Cannot deserialize ProcessEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventBody.java new file mode 100644 index 0000000..eddca9c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventBody.java @@ -0,0 +1,24 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ProgressEndEventBody { + private String message; + private String progressID; + + /** + * More detailed progress message. If omitted, the previous message (if any) is used. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * The ID that was introduced in the initial `ProgressStartEvent`. + */ + @JsonProperty("progressId") + public String getProgressID() { return progressID; } + @JsonProperty("progressId") + public void setProgressID(String value) { this.progressID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventClass.java new file mode 100644 index 0000000..6530964 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event signals the end of the progress reporting with a final message. + * This event should only be sent if the corresponding capability + * `supportsProgressReporting` is true. + */ +public class ProgressEndEventClass { + private long seq; + private BreakpointEventType type; + private ProgressEndEventBody body; + private ProgressEndEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ProgressEndEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ProgressEndEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public ProgressEndEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(ProgressEndEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventEvent.java new file mode 100644 index 0000000..f92b269 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressEndEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ProgressEndEventEvent { + PROGRESS_END; + + @JsonValue + public String toValue() { + switch (this) { + case PROGRESS_END: return "progressEnd"; + } + return null; + } + + @JsonCreator + public static ProgressEndEventEvent forValue(String value) throws IOException { + if (value.equals("progressEnd")) return PROGRESS_END; + throw new IOException("Cannot deserialize ProgressEndEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventBody.java new file mode 100644 index 0000000..bc4ec08 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventBody.java @@ -0,0 +1,70 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ProgressStartEventBody { + private Boolean cancellable; + private String message; + private Double percentage; + private String progressID; + private Long requestID; + private String title; + + /** + * If true, the request that reports progress may be cancelled with a `cancel` request. + * So this property basically controls whether the client should use UX that supports + * cancellation. + * Clients that don't support cancellation are allowed to ignore the setting. + */ + @JsonProperty("cancellable") + public Boolean getCancellable() { return cancellable; } + @JsonProperty("cancellable") + public void setCancellable(Boolean value) { this.cancellable = value; } + + /** + * More detailed progress message. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown. + */ + @JsonProperty("percentage") + public Double getPercentage() { return percentage; } + @JsonProperty("percentage") + public void setPercentage(Double value) { this.percentage = value; } + + /** + * An ID that can be used in subsequent `progressUpdate` and `progressEnd` events to make + * them refer to the same progress reporting. + * IDs must be unique within a debug session. + */ + @JsonProperty("progressId") + public String getProgressID() { return progressID; } + @JsonProperty("progressId") + public void setProgressID(String value) { this.progressID = value; } + + /** + * The request ID that this progress report is related to. If specified a debug adapter is + * expected to emit progress events for the long running request until the request has been + * either completed or cancelled. + * If the request ID is omitted, the progress report is assumed to be related to some + * general activity of the debug adapter. + */ + @JsonProperty("requestId") + public Long getRequestID() { return requestID; } + @JsonProperty("requestId") + public void setRequestID(Long value) { this.requestID = value; } + + /** + * Short title of the progress reporting. Shown in the UI to describe the long running + * operation. + */ + @JsonProperty("title") + public String getTitle() { return title; } + @JsonProperty("title") + public void setTitle(String value) { this.title = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventClass.java new file mode 100644 index 0000000..901be4a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventClass.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event signals that a long running operation is about to start and provides additional + * information for the client to set up a corresponding progress and cancellation UI. + * The client is free to delay the showing of the UI in order to reduce flicker. + * This event should only be sent if the corresponding capability + * `supportsProgressReporting` is true. + */ +public class ProgressStartEventClass { + private long seq; + private BreakpointEventType type; + private ProgressStartEventBody body; + private ProgressStartEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ProgressStartEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ProgressStartEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public ProgressStartEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(ProgressStartEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventEvent.java new file mode 100644 index 0000000..a0e49a7 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressStartEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ProgressStartEventEvent { + PROGRESS_START; + + @JsonValue + public String toValue() { + switch (this) { + case PROGRESS_START: return "progressStart"; + } + return null; + } + + @JsonCreator + public static ProgressStartEventEvent forValue(String value) throws IOException { + if (value.equals("progressStart")) return PROGRESS_START; + throw new IOException("Cannot deserialize ProgressStartEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventBody.java new file mode 100644 index 0000000..84f8a64 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventBody.java @@ -0,0 +1,33 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ProgressUpdateEventBody { + private String message; + private Double percentage; + private String progressID; + + /** + * More detailed progress message. If omitted, the previous message (if any) is used. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Progress percentage to display (value range: 0 to 100). If omitted no percentage is shown. + */ + @JsonProperty("percentage") + public Double getPercentage() { return percentage; } + @JsonProperty("percentage") + public void setPercentage(Double value) { this.percentage = value; } + + /** + * The ID that was introduced in the initial `progressStart` event. + */ + @JsonProperty("progressId") + public String getProgressID() { return progressID; } + @JsonProperty("progressId") + public void setProgressID(String value) { this.progressID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventClass.java new file mode 100644 index 0000000..92ff800 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event signals that the progress reporting needs to be updated with a new message + * and/or percentage. + * The client does not have to update the UI immediately, but the clients needs to keep + * track of the message and/or percentage values. + * This event should only be sent if the corresponding capability + * `supportsProgressReporting` is true. + */ +public class ProgressUpdateEventClass { + private long seq; + private BreakpointEventType type; + private ProgressUpdateEventBody body; + private ProgressUpdateEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ProgressUpdateEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ProgressUpdateEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public ProgressUpdateEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(ProgressUpdateEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventEvent.java new file mode 100644 index 0000000..12b0a1f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ProgressUpdateEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ProgressUpdateEventEvent { + PROGRESS_UPDATE; + + @JsonValue + public String toValue() { + switch (this) { + case PROGRESS_UPDATE: return "progressUpdate"; + } + return null; + } + + @JsonCreator + public static ProgressUpdateEventEvent forValue(String value) throws IOException { + if (value.equals("progressUpdate")) return PROGRESS_UPDATE; + throw new IOException("Cannot deserialize ProgressUpdateEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryArgumentsClass.java new file mode 100644 index 0000000..32d244e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryArgumentsClass.java @@ -0,0 +1,37 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `readMemory` request. + */ +public class ReadMemoryArgumentsClass { + private long count; + private String memoryReference; + private Long offset; + + /** + * Number of bytes to read at the specified location and offset. + */ + @JsonProperty("count") + public long getCount() { return count; } + @JsonProperty("count") + public void setCount(long value) { this.count = value; } + + /** + * Memory reference to the base location from which data should be read. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * Offset (in bytes) to be applied to the reference location before reading data. Can be + * negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestArguments.java new file mode 100644 index 0000000..a7381e4 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestArguments.java @@ -0,0 +1,37 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `readMemory` request. + */ +public class ReadMemoryRequestArguments { + private long count; + private String memoryReference; + private Long offset; + + /** + * Number of bytes to read at the specified location and offset. + */ + @JsonProperty("count") + public long getCount() { return count; } + @JsonProperty("count") + public void setCount(long value) { this.count = value; } + + /** + * Memory reference to the base location from which data should be read. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * Offset (in bytes) to be applied to the reference location before reading data. Can be + * negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestClass.java new file mode 100644 index 0000000..5341f55 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Reads bytes from memory at the provided location. + * Clients should only call this request if the corresponding capability + * `supportsReadMemoryRequest` is true. + */ +public class ReadMemoryRequestClass { + private long seq; + private AttachRequestType type; + private ReadMemoryRequestArguments arguments; + private ReadMemoryRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public ReadMemoryRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ReadMemoryRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public ReadMemoryRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(ReadMemoryRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestCommand.java new file mode 100644 index 0000000..5d818a9 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ReadMemoryRequestCommand { + READ_MEMORY; + + @JsonValue + public String toValue() { + switch (this) { + case READ_MEMORY: return "readMemory"; + } + return null; + } + + @JsonCreator + public static ReadMemoryRequestCommand forValue(String value) throws IOException { + if (value.equals("readMemory")) return READ_MEMORY; + throw new IOException("Cannot deserialize ReadMemoryRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryResponseBody.java new file mode 100644 index 0000000..6688f4b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryResponseBody.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ReadMemoryResponseBody { + private String address; + private String data; + private Long unreadableBytes; + + /** + * The address of the first byte of data returned. + * Treated as a hex value if prefixed with `0x`, or as a decimal value otherwise. + */ + @JsonProperty("address") + public String getAddress() { return address; } + @JsonProperty("address") + public void setAddress(String value) { this.address = value; } + + /** + * The bytes read from memory, encoded using base64. If the decoded length of `data` is less + * than the requested `count` in the original `readMemory` request, and `unreadableBytes` is + * zero or omitted, then the client should assume it's reached the end of readable memory. + */ + @JsonProperty("data") + public String getData() { return data; } + @JsonProperty("data") + public void setData(String value) { this.data = value; } + + /** + * The number of unreadable bytes encountered after the last successfully read byte. + * This can be used to determine the number of bytes that should be skipped before a + * subsequent `readMemory` request succeeds. + */ + @JsonProperty("unreadableBytes") + public Long getUnreadableBytes() { return unreadableBytes; } + @JsonProperty("unreadableBytes") + public void setUnreadableBytes(Long value) { this.unreadableBytes = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryResponseClass.java new file mode 100644 index 0000000..fa6c3b6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReadMemoryResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `readMemory` request. + */ +public class ReadMemoryResponseClass { + private long seq; + private AttachResponseType type; + private ReadMemoryResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public ReadMemoryResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ReadMemoryResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Request.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Request.java new file mode 100644 index 0000000..f9bc067 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Request.java @@ -0,0 +1,52 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + */ +public class Request { + private long seq; + private AttachRequestType type; + private Restart arguments; + private String command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public Restart getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(Restart value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RequestEnum.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RequestEnum.java new file mode 100644 index 0000000..74c5e3c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RequestEnum.java @@ -0,0 +1,28 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * Indicates whether the new debug session should be started with a `launch` or `attach` + * request. + */ +public enum RequestEnum { + ATTACH, LAUNCH; + + @JsonValue + public String toValue() { + switch (this) { + case ATTACH: return "attach"; + case LAUNCH: return "launch"; + } + return null; + } + + @JsonCreator + public static RequestEnum forValue(String value) throws IOException { + if (value.equals("attach")) return ATTACH; + if (value.equals("launch")) return LAUNCH; + throw new IOException("Cannot deserialize RequestEnum"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Response.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Response.java new file mode 100644 index 0000000..42496b6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Response.java @@ -0,0 +1,85 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + */ +public class Response { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Restart.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Restart.java new file mode 100644 index 0000000..4cd6483 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Restart.java @@ -0,0 +1,106 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; + +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Map; + +/** + * Arbitrary data from the previous, restarted session. + * The data is sent as the `restart` attribute of the `terminated` event. + * The client should leave the data intact. + * + * Contains request result if success is true and error details if success is false. + * + * Additional data that a debug adapter might want to loop through the client. + * The client should leave the data intact and persist it across sessions. The client should + * not interpret the data. + * + * Event-specific information. + * + * Additional data to report. For the `telemetry` category the data is sent to telemetry, + * for the other categories the data is shown in JSON format. + * + * Object containing arguments for the command. + * + * A debug adapter may set `restart` to true (or to an arbitrary object) to request that the + * client restarts the session. + * The value is not interpreted by the client and passed unmodified as an attribute + * `__restart` to the `launch` and `attach` requests. + */ +@JsonDeserialize(using = Restart.Deserializer.class) +@JsonSerialize(using = Restart.Serializer.class) +public class Restart { + public Double doubleValue; + public Long integerValue; + public Boolean boolValue; + public String stringValue; + public Object[] anythingArrayValue; + public Map anythingMapValue; + + static class Deserializer extends JsonDeserializer { + @Override + public Restart deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException { + Restart value = new Restart(); + switch (jsonParser.currentToken()) { + case VALUE_NULL: + break; + case VALUE_NUMBER_INT: + value.integerValue = jsonParser.readValueAs(Long.class); + break; + case VALUE_NUMBER_FLOAT: + value.doubleValue = jsonParser.readValueAs(Double.class); + break; + case VALUE_TRUE: + case VALUE_FALSE: + value.boolValue = jsonParser.readValueAs(Boolean.class); + break; + case VALUE_STRING: + String string = jsonParser.readValueAs(String.class); + value.stringValue = string; + break; + case START_ARRAY: + value.anythingArrayValue = jsonParser.readValueAs(Object[].class); + break; + case START_OBJECT: + value.anythingMapValue = jsonParser.readValueAs(Map.class); + break; + default: throw new IOException("Cannot deserialize Restart"); + } + return value; + } + } + + static class Serializer extends JsonSerializer { + @Override + public void serialize(Restart obj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (obj.doubleValue != null) { + jsonGenerator.writeObject(obj.doubleValue); + return; + } + if (obj.integerValue != null) { + jsonGenerator.writeObject(obj.integerValue); + return; + } + if (obj.boolValue != null) { + jsonGenerator.writeObject(obj.boolValue); + return; + } + if (obj.stringValue != null) { + jsonGenerator.writeObject(obj.stringValue); + return; + } + if (obj.anythingArrayValue != null) { + jsonGenerator.writeObject(obj.anythingArrayValue); + return; + } + if (obj.anythingMapValue != null) { + jsonGenerator.writeObject(obj.anythingMapValue); + return; + } + jsonGenerator.writeNull(); + } + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartArgumentsClass.java new file mode 100644 index 0000000..838cfd8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `restart` request. + */ +public class RestartArgumentsClass { + private ChRequestArguments arguments; + + /** + * The latest version of the `launch` or `attach` configuration. + */ + @JsonProperty("arguments") + public ChRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ChRequestArguments value) { this.arguments = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameArgumentsClass.java new file mode 100644 index 0000000..7b4e7f8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameArgumentsClass.java @@ -0,0 +1,20 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `restartFrame` request. + */ +public class RestartFrameArgumentsClass { + private long frameID; + + /** + * Restart the stack frame identified by `frameId`. The `frameId` must have been obtained in + * the current suspended state. See 'Lifetime of Object References' in the Overview section + * for details. + */ + @JsonProperty("frameId") + public long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestArguments.java new file mode 100644 index 0000000..7c271ea --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestArguments.java @@ -0,0 +1,20 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `restartFrame` request. + */ +public class RestartFrameRequestArguments { + private long frameID; + + /** + * Restart the stack frame identified by `frameId`. The `frameId` must have been obtained in + * the current suspended state. See 'Lifetime of Object References' in the Overview section + * for details. + */ + @JsonProperty("frameId") + public long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestClass.java new file mode 100644 index 0000000..02f67c5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestClass.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request restarts execution of the specified stack frame. + * The debug adapter first sends the response and then a `stopped` event (with reason + * `restart`) after the restart has completed. + * Clients should only call this request if the corresponding capability + * `supportsRestartFrame` is true. + */ +public class RestartFrameRequestClass { + private long seq; + private AttachRequestType type; + private RestartFrameRequestArguments arguments; + private RestartFrameRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public RestartFrameRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(RestartFrameRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public RestartFrameRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(RestartFrameRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestCommand.java new file mode 100644 index 0000000..fd7c924 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum RestartFrameRequestCommand { + RESTART_FRAME; + + @JsonValue + public String toValue() { + switch (this) { + case RESTART_FRAME: return "restartFrame"; + } + return null; + } + + @JsonCreator + public static RestartFrameRequestCommand forValue(String value) throws IOException { + if (value.equals("restartFrame")) return RESTART_FRAME; + throw new IOException("Cannot deserialize RestartFrameRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameResponseClass.java new file mode 100644 index 0000000..d4eaef2 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartFrameResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `restartFrame` request. This is just an acknowledgement, so no body field is + * required. + */ +public class RestartFrameResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestArguments.java new file mode 100644 index 0000000..c2b8400 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `restart` request. + */ +public class RestartRequestArguments { + private ChRequestArguments arguments; + + /** + * The latest version of the `launch` or `attach` configuration. + */ + @JsonProperty("arguments") + public ChRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ChRequestArguments value) { this.arguments = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestClass.java new file mode 100644 index 0000000..a79ef7d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Restarts a debug session. Clients should only call this request if the corresponding + * capability `supportsRestartRequest` is true. + * If the capability is missing or has the value false, a typical client emulates `restart` + * by terminating the debug adapter first and then launching it anew. + */ +public class RestartRequestClass { + private long seq; + private AttachRequestType type; + private RestartRequestArguments arguments; + private RestartRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public RestartRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(RestartRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public RestartRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(RestartRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestCommand.java new file mode 100644 index 0000000..56e516c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum RestartRequestCommand { + RESTART; + + @JsonValue + public String toValue() { + switch (this) { + case RESTART: return "restart"; + } + return null; + } + + @JsonCreator + public static RestartRequestCommand forValue(String value) throws IOException { + if (value.equals("restart")) return RESTART; + throw new IOException("Cannot deserialize RestartRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartResponseClass.java new file mode 100644 index 0000000..453cd96 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RestartResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `restart` request. This is just an acknowledgement, so no body field is + * required. + */ +public class RestartResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueArgumentsClass.java new file mode 100644 index 0000000..54b720c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueArgumentsClass.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `reverseContinue` request. + */ +public class ReverseContinueArgumentsClass { + private Boolean singleThread; + private long threadID; + + /** + * If this flag is true, backward execution is resumed only for the thread with given + * `threadId`. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the active thread. If the debug adapter supports single thread execution (see + * `supportsSingleThreadExecutionRequests`) and the `singleThread` argument is true, only + * the thread with this ID is resumed. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestArguments.java new file mode 100644 index 0000000..68e836d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestArguments.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `reverseContinue` request. + */ +public class ReverseContinueRequestArguments { + private Boolean singleThread; + private long threadID; + + /** + * If this flag is true, backward execution is resumed only for the thread with given + * `threadId`. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the active thread. If the debug adapter supports single thread execution (see + * `supportsSingleThreadExecutionRequests`) and the `singleThread` argument is true, only + * the thread with this ID is resumed. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestClass.java new file mode 100644 index 0000000..fb1258c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request resumes backward execution of all threads. If the debug adapter supports + * single thread execution (see capability `supportsSingleThreadExecutionRequests`), setting + * the `singleThread` argument to true resumes only the specified thread. If not all threads + * were resumed, the `allThreadsContinued` attribute of the response should be set to false. + * Clients should only call this request if the corresponding capability `supportsStepBack` + * is true. + */ +public class ReverseContinueRequestClass { + private long seq; + private AttachRequestType type; + private ReverseContinueRequestArguments arguments; + private ReverseContinueRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public ReverseContinueRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ReverseContinueRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public ReverseContinueRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(ReverseContinueRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestCommand.java new file mode 100644 index 0000000..deda5c4 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ReverseContinueRequestCommand { + REVERSE_CONTINUE; + + @JsonValue + public String toValue() { + switch (this) { + case REVERSE_CONTINUE: return "reverseContinue"; + } + return null; + } + + @JsonCreator + public static ReverseContinueRequestCommand forValue(String value) throws IOException { + if (value.equals("reverseContinue")) return REVERSE_CONTINUE; + throw new IOException("Cannot deserialize ReverseContinueRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueResponseClass.java new file mode 100644 index 0000000..7245e7c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ReverseContinueResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `reverseContinue` request. This is just an acknowledgement, so no body field + * is required. + */ +public class ReverseContinueResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestArguments.java new file mode 100644 index 0000000..14e3ddd --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestArguments.java @@ -0,0 +1,69 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import java.util.Map; + +/** + * Arguments for `runInTerminal` request. + */ +public class RunInTerminalRequestArguments { + private String[] args; + private Boolean argsCanBeInterpretedByShell; + private String cwd; + private Map env; + private Kind kind; + private String title; + + /** + * List of arguments. The first argument is the command to run. + */ + @JsonProperty("args") + public String[] getArgs() { return args; } + @JsonProperty("args") + public void setArgs(String[] value) { this.args = value; } + + /** + * This property should only be set if the corresponding capability + * `supportsArgsCanBeInterpretedByShell` is true. If the client uses an intermediary shell + * to launch the application, then the client must not attempt to escape characters with + * special meanings for the shell. The user is fully responsible for escaping as needed and + * that arguments using special characters may not be portable across shells. + */ + @JsonProperty("argsCanBeInterpretedByShell") + public Boolean getArgsCanBeInterpretedByShell() { return argsCanBeInterpretedByShell; } + @JsonProperty("argsCanBeInterpretedByShell") + public void setArgsCanBeInterpretedByShell(Boolean value) { this.argsCanBeInterpretedByShell = value; } + + /** + * Working directory for the command. For non-empty, valid paths this typically results in + * execution of a change directory command. + */ + @JsonProperty("cwd") + public String getCwd() { return cwd; } + @JsonProperty("cwd") + public void setCwd(String value) { this.cwd = value; } + + /** + * Environment key-value pairs that are added to or removed from the default environment. + */ + @JsonProperty("env") + public Map getEnv() { return env; } + @JsonProperty("env") + public void setEnv(Map value) { this.env = value; } + + /** + * What kind of terminal to launch. Defaults to `integrated` if not specified. + */ + @JsonProperty("kind") + public Kind getKind() { return kind; } + @JsonProperty("kind") + public void setKind(Kind value) { this.kind = value; } + + /** + * Title of the terminal. + */ + @JsonProperty("title") + public String getTitle() { return title; } + @JsonProperty("title") + public void setTitle(String value) { this.title = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestArgumentsClass.java new file mode 100644 index 0000000..cf41431 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestArgumentsClass.java @@ -0,0 +1,69 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import java.util.Map; + +/** + * Arguments for `runInTerminal` request. + */ +public class RunInTerminalRequestArgumentsClass { + private String[] args; + private Boolean argsCanBeInterpretedByShell; + private String cwd; + private Map env; + private Kind kind; + private String title; + + /** + * List of arguments. The first argument is the command to run. + */ + @JsonProperty("args") + public String[] getArgs() { return args; } + @JsonProperty("args") + public void setArgs(String[] value) { this.args = value; } + + /** + * This property should only be set if the corresponding capability + * `supportsArgsCanBeInterpretedByShell` is true. If the client uses an intermediary shell + * to launch the application, then the client must not attempt to escape characters with + * special meanings for the shell. The user is fully responsible for escaping as needed and + * that arguments using special characters may not be portable across shells. + */ + @JsonProperty("argsCanBeInterpretedByShell") + public Boolean getArgsCanBeInterpretedByShell() { return argsCanBeInterpretedByShell; } + @JsonProperty("argsCanBeInterpretedByShell") + public void setArgsCanBeInterpretedByShell(Boolean value) { this.argsCanBeInterpretedByShell = value; } + + /** + * Working directory for the command. For non-empty, valid paths this typically results in + * execution of a change directory command. + */ + @JsonProperty("cwd") + public String getCwd() { return cwd; } + @JsonProperty("cwd") + public void setCwd(String value) { this.cwd = value; } + + /** + * Environment key-value pairs that are added to or removed from the default environment. + */ + @JsonProperty("env") + public Map getEnv() { return env; } + @JsonProperty("env") + public void setEnv(Map value) { this.env = value; } + + /** + * What kind of terminal to launch. Defaults to `integrated` if not specified. + */ + @JsonProperty("kind") + public Kind getKind() { return kind; } + @JsonProperty("kind") + public void setKind(Kind value) { this.kind = value; } + + /** + * Title of the terminal. + */ + @JsonProperty("title") + public String getTitle() { return title; } + @JsonProperty("title") + public void setTitle(String value) { this.title = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestClass.java new file mode 100644 index 0000000..decea03 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestClass.java @@ -0,0 +1,67 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * This request is sent from the debug adapter to the client to run a command in a terminal. + * This is typically used to launch the debuggee in a terminal provided by the client. + * This request should only be called if the corresponding client capability + * `supportsRunInTerminalRequest` is true. + * Client implementations of `runInTerminal` are free to run the command however they choose + * including issuing the command to a command line interpreter (aka 'shell'). Argument + * strings passed to the `runInTerminal` request must arrive verbatim in the command to be + * run. As a consequence, clients which use a shell are responsible for escaping any special + * shell characters in the argument strings to prevent them from being interpreted (and + * modified) by the shell. + * Some users may wish to take advantage of shell processing in the argument strings. For + * clients which implement `runInTerminal` using an intermediary shell, the + * `argsCanBeInterpretedByShell` property can be set to true. In this case the client is + * requested not to escape any special shell characters in the argument strings. + */ +public class RunInTerminalRequestClass { + private long seq; + private AttachRequestType type; + private RunInTerminalRequestArguments arguments; + private RunInTerminalRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public RunInTerminalRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(RunInTerminalRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public RunInTerminalRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(RunInTerminalRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestCommand.java new file mode 100644 index 0000000..348c23b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum RunInTerminalRequestCommand { + RUN_IN_TERMINAL; + + @JsonValue + public String toValue() { + switch (this) { + case RUN_IN_TERMINAL: return "runInTerminal"; + } + return null; + } + + @JsonCreator + public static RunInTerminalRequestCommand forValue(String value) throws IOException { + if (value.equals("runInTerminal")) return RUN_IN_TERMINAL; + throw new IOException("Cannot deserialize RunInTerminalRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalResponseBody.java new file mode 100644 index 0000000..e8a5f75 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalResponseBody.java @@ -0,0 +1,25 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class RunInTerminalResponseBody { + private Long processID; + private Long shellProcessID; + + /** + * The process ID. The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("processId") + public Long getProcessID() { return processID; } + @JsonProperty("processId") + public void setProcessID(Long value) { this.processID = value; } + + /** + * The process ID of the terminal shell. The value should be less than or equal to + * 2147483647 (2^31-1). + */ + @JsonProperty("shellProcessId") + public Long getShellProcessID() { return shellProcessID; } + @JsonProperty("shellProcessId") + public void setShellProcessID(Long value) { this.shellProcessID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalResponseClass.java new file mode 100644 index 0000000..ea071b7 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/RunInTerminalResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `runInTerminal` request. + */ +public class RunInTerminalResponseClass { + private long seq; + private AttachResponseType type; + private RunInTerminalResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public RunInTerminalResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(RunInTerminalResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Scope.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Scope.java new file mode 100644 index 0000000..ad870c6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Scope.java @@ -0,0 +1,119 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A `Scope` is a named container for variables. Optionally a scope can map to a source or a + * range within a source. + */ +public class Scope { + private Long column; + private Long endColumn; + private Long endLine; + private boolean expensive; + private Long indexedVariables; + private Long line; + private String name; + private Long namedVariables; + private String presentationHint; + private Source source; + private long variablesReference; + + /** + * Start position of the range covered by the scope. It is measured in UTF-16 code units and + * the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * End position of the range covered by the scope. It is measured in UTF-16 code units and + * the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * The end line of the range covered by this scope. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * If true, the number of variables in this scope is large or expensive to retrieve. + */ + @JsonProperty("expensive") + public boolean getExpensive() { return expensive; } + @JsonProperty("expensive") + public void setExpensive(boolean value) { this.expensive = value; } + + /** + * The number of indexed variables in this scope. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + */ + @JsonProperty("indexedVariables") + public Long getIndexedVariables() { return indexedVariables; } + @JsonProperty("indexedVariables") + public void setIndexedVariables(Long value) { this.indexedVariables = value; } + + /** + * The start line of the range covered by this scope. + */ + @JsonProperty("line") + public Long getLine() { return line; } + @JsonProperty("line") + public void setLine(Long value) { this.line = value; } + + /** + * Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This string is shown in + * the UI as is and can be translated. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * The number of named variables in this scope. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + */ + @JsonProperty("namedVariables") + public Long getNamedVariables() { return namedVariables; } + @JsonProperty("namedVariables") + public void setNamedVariables(Long value) { this.namedVariables = value; } + + /** + * A hint for how to present this scope in the UI. If this attribute is missing, the scope + * is shown with a generic UI. + */ + @JsonProperty("presentationHint") + public String getPresentationHint() { return presentationHint; } + @JsonProperty("presentationHint") + public void setPresentationHint(String value) { this.presentationHint = value; } + + /** + * The source for this scope. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + /** + * The variables of this scope can be retrieved by passing the value of `variablesReference` + * to the `variables` request as long as execution remains suspended. See 'Lifetime of + * Object References' in the Overview section for details. + */ + @JsonProperty("variablesReference") + public long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesArgumentsClass.java new file mode 100644 index 0000000..0ab983c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesArgumentsClass.java @@ -0,0 +1,20 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `scopes` request. + */ +public class ScopesArgumentsClass { + private long frameID; + + /** + * Retrieve the scopes for the stack frame identified by `frameId`. The `frameId` must have + * been obtained in the current suspended state. See 'Lifetime of Object References' in the + * Overview section for details. + */ + @JsonProperty("frameId") + public long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestArguments.java new file mode 100644 index 0000000..795115a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestArguments.java @@ -0,0 +1,20 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `scopes` request. + */ +public class ScopesRequestArguments { + private long frameID; + + /** + * Retrieve the scopes for the stack frame identified by `frameId`. The `frameId` must have + * been obtained in the current suspended state. See 'Lifetime of Object References' in the + * Overview section for details. + */ + @JsonProperty("frameId") + public long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestClass.java new file mode 100644 index 0000000..696a84f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestClass.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request returns the variable scopes for a given stack frame ID. + */ +public class ScopesRequestClass { + private long seq; + private AttachRequestType type; + private ScopesRequestArguments arguments; + private ScopesRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public ScopesRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(ScopesRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public ScopesRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(ScopesRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestCommand.java new file mode 100644 index 0000000..9ad8b50 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ScopesRequestCommand { + SCOPES; + + @JsonValue + public String toValue() { + switch (this) { + case SCOPES: return "scopes"; + } + return null; + } + + @JsonCreator + public static ScopesRequestCommand forValue(String value) throws IOException { + if (value.equals("scopes")) return SCOPES; + throw new IOException("Cannot deserialize ScopesRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesResponseBody.java new file mode 100644 index 0000000..17f13f8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesResponseBody.java @@ -0,0 +1,16 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ScopesResponseBody { + private Scope[] scopes; + + /** + * The scopes of the stack frame. If the array has length zero, there are no scopes + * available. + */ + @JsonProperty("scopes") + public Scope[] getScopes() { return scopes; } + @JsonProperty("scopes") + public void setScopes(Scope[] value) { this.scopes = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesResponseClass.java new file mode 100644 index 0000000..8f57454 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ScopesResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `scopes` request. + */ +public class ScopesResponseClass { + private long seq; + private AttachResponseType type; + private ScopesResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public ScopesResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ScopesResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsArgumentsClass.java new file mode 100644 index 0000000..7bf00ba --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsArgumentsClass.java @@ -0,0 +1,47 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setBreakpoints` request. + */ +public class SetBreakpointsArgumentsClass { + private SourceBreakpoint[] breakpoints; + private long[] lines; + private Source source; + private Boolean sourceModified; + + /** + * The code locations of the breakpoints. + */ + @JsonProperty("breakpoints") + public SourceBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(SourceBreakpoint[] value) { this.breakpoints = value; } + + /** + * Deprecated: The code locations of the breakpoints. + */ + @JsonProperty("lines") + public long[] getLines() { return lines; } + @JsonProperty("lines") + public void setLines(long[] value) { this.lines = value; } + + /** + * The source location of the breakpoints; either `source.path` or `source.sourceReference` + * must be specified. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + /** + * A value of true indicates that the underlying source has been modified which results in + * new breakpoint locations. + */ + @JsonProperty("sourceModified") + public Boolean getSourceModified() { return sourceModified; } + @JsonProperty("sourceModified") + public void setSourceModified(Boolean value) { this.sourceModified = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestArguments.java new file mode 100644 index 0000000..06f59fc --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestArguments.java @@ -0,0 +1,48 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setBreakpoints` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SetBreakpointsRequestArguments { + private SourceBreakpoint[] breakpoints; + private long[] lines; + private Source source; + private Boolean sourceModified; + + /** + * The code locations of the breakpoints. + */ + @JsonProperty("breakpoints") + public SourceBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(SourceBreakpoint[] value) { this.breakpoints = value; } + + /** + * Deprecated: The code locations of the breakpoints. + */ + @JsonProperty("lines") + public long[] getLines() { return lines; } + @JsonProperty("lines") + public void setLines(long[] value) { this.lines = value; } + + /** + * The source location of the breakpoints; either `source.path` or `source.sourceReference` + * must be specified. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + /** + * A value of true indicates that the underlying source has been modified which results in + * new breakpoint locations. + */ + @JsonProperty("sourceModified") + public Boolean getSourceModified() { return sourceModified; } + @JsonProperty("sourceModified") + public void setSourceModified(Boolean value) { this.sourceModified = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestClass.java new file mode 100644 index 0000000..cee664e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Sets multiple breakpoints for a single source and clears all previous breakpoints in that + * source. + * To clear all breakpoint for a source, specify an empty array. + * When a breakpoint is hit, a `stopped` event (with reason `breakpoint`) is generated. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SetBreakpointsRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private SetBreakpointsRequestArguments arguments; + private String command = "setBreakpoints"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SetBreakpointsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SetBreakpointsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestCommand.java new file mode 100644 index 0000000..4398e5f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SetBreakpointsRequestCommand { + SET_BREAKPOINTS; + + @JsonValue + public String toValue() { + switch (this) { + case SET_BREAKPOINTS: return "setBreakpoints"; + } + return null; + } + + @JsonCreator + public static SetBreakpointsRequestCommand forValue(String value) throws IOException { + if (value.equals("setBreakpoints")) return SET_BREAKPOINTS; + throw new IOException("Cannot deserialize SetBreakpointsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsResponseBody.java new file mode 100644 index 0000000..6d4fa2a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsResponseBody.java @@ -0,0 +1,17 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SetBreakpointsResponseBody { + private Breakpoint[] breakpoints; + + /** + * Information about the breakpoints. + * The array elements are in the same order as the elements of the `breakpoints` (or the + * deprecated `lines`) array in the arguments. + */ + @JsonProperty("breakpoints") + public Breakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(Breakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsResponseClass.java new file mode 100644 index 0000000..980cd3a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetBreakpointsResponseClass.java @@ -0,0 +1,93 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `setBreakpoints` request. + * Returned is information about each breakpoint created by this request. + * This includes the actual code location and whether the breakpoint could be verified. + * The breakpoints returned are in the same order as the elements of the `breakpoints` + * (or the deprecated `lines`) array in the arguments. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SetBreakpointsResponseClass implements DAPResponse { + private long seq; + private String type; + private SetBreakpointsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SetBreakpointsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SetBreakpointsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsArgumentsClass.java new file mode 100644 index 0000000..da6c318 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsArgumentsClass.java @@ -0,0 +1,19 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setDataBreakpoints` request. + */ +public class SetDataBreakpointsArgumentsClass { + private DataBreakpoint[] breakpoints; + + /** + * The contents of this array replaces all existing data breakpoints. An empty array clears + * all data breakpoints. + */ + @JsonProperty("breakpoints") + public DataBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(DataBreakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestArguments.java new file mode 100644 index 0000000..735837f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestArguments.java @@ -0,0 +1,19 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setDataBreakpoints` request. + */ +public class SetDataBreakpointsRequestArguments { + private DataBreakpoint[] breakpoints; + + /** + * The contents of this array replaces all existing data breakpoints. An empty array clears + * all data breakpoints. + */ + @JsonProperty("breakpoints") + public DataBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(DataBreakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestClass.java new file mode 100644 index 0000000..da83ed5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Replaces all existing data breakpoints with new data breakpoints. + * To clear all data breakpoints, specify an empty array. + * When a data breakpoint is hit, a `stopped` event (with reason `data breakpoint`) is + * generated. + * Clients should only call this request if the corresponding capability + * `supportsDataBreakpoints` is true. + */ +public class SetDataBreakpointsRequestClass { + private long seq; + private AttachRequestType type; + private SetDataBreakpointsRequestArguments arguments; + private SetDataBreakpointsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SetDataBreakpointsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SetDataBreakpointsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public SetDataBreakpointsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(SetDataBreakpointsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestCommand.java new file mode 100644 index 0000000..df69636 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SetDataBreakpointsRequestCommand { + SET_DATA_BREAKPOINTS; + + @JsonValue + public String toValue() { + switch (this) { + case SET_DATA_BREAKPOINTS: return "setDataBreakpoints"; + } + return null; + } + + @JsonCreator + public static SetDataBreakpointsRequestCommand forValue(String value) throws IOException { + if (value.equals("setDataBreakpoints")) return SET_DATA_BREAKPOINTS; + throw new IOException("Cannot deserialize SetDataBreakpointsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsResponseBody.java new file mode 100644 index 0000000..1f2783e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsResponseBody.java @@ -0,0 +1,16 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SetDataBreakpointsResponseBody { + private Breakpoint[] breakpoints; + + /** + * Information about the data breakpoints. The array elements correspond to the elements of + * the input argument `breakpoints` array. + */ + @JsonProperty("breakpoints") + public Breakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(Breakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsResponseClass.java new file mode 100644 index 0000000..5337e4b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetDataBreakpointsResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `setDataBreakpoints` request. + * Returned is information about each breakpoint created by this request. + */ +public class SetDataBreakpointsResponseClass { + private long seq; + private AttachResponseType type; + private SetDataBreakpointsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SetDataBreakpointsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SetDataBreakpointsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsArgumentsClass.java new file mode 100644 index 0000000..e24bfd4 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsArgumentsClass.java @@ -0,0 +1,43 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setExceptionBreakpoints` request. + */ +public class SetExceptionBreakpointsArgumentsClass { + private ExceptionOptions[] exceptionOptions; + private ExceptionFilterOptions[] filterOptions; + private String[] filters; + + /** + * Configuration options for selected exceptions. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsExceptionOptions` is true. + */ + @JsonProperty("exceptionOptions") + public ExceptionOptions[] getExceptionOptions() { return exceptionOptions; } + @JsonProperty("exceptionOptions") + public void setExceptionOptions(ExceptionOptions[] value) { this.exceptionOptions = value; } + + /** + * Set of exception filters and their options. The set of all possible exception filters is + * defined by the `exceptionBreakpointFilters` capability. This attribute is only honored by + * a debug adapter if the corresponding capability `supportsExceptionFilterOptions` is true. + * The `filter` and `filterOptions` sets are additive. + */ + @JsonProperty("filterOptions") + public ExceptionFilterOptions[] getFilterOptions() { return filterOptions; } + @JsonProperty("filterOptions") + public void setFilterOptions(ExceptionFilterOptions[] value) { this.filterOptions = value; } + + /** + * Set of exception filters specified by their ID. The set of all possible exception filters + * is defined by the `exceptionBreakpointFilters` capability. The `filter` and + * `filterOptions` sets are additive. + */ + @JsonProperty("filters") + public String[] getFilters() { return filters; } + @JsonProperty("filters") + public void setFilters(String[] value) { this.filters = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestArguments.java new file mode 100644 index 0000000..db65d2a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestArguments.java @@ -0,0 +1,43 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setExceptionBreakpoints` request. + */ +public class SetExceptionBreakpointsRequestArguments { + private ExceptionOptions[] exceptionOptions; + private ExceptionFilterOptions[] filterOptions; + private String[] filters; + + /** + * Configuration options for selected exceptions. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsExceptionOptions` is true. + */ + @JsonProperty("exceptionOptions") + public ExceptionOptions[] getExceptionOptions() { return exceptionOptions; } + @JsonProperty("exceptionOptions") + public void setExceptionOptions(ExceptionOptions[] value) { this.exceptionOptions = value; } + + /** + * Set of exception filters and their options. The set of all possible exception filters is + * defined by the `exceptionBreakpointFilters` capability. This attribute is only honored by + * a debug adapter if the corresponding capability `supportsExceptionFilterOptions` is true. + * The `filter` and `filterOptions` sets are additive. + */ + @JsonProperty("filterOptions") + public ExceptionFilterOptions[] getFilterOptions() { return filterOptions; } + @JsonProperty("filterOptions") + public void setFilterOptions(ExceptionFilterOptions[] value) { this.filterOptions = value; } + + /** + * Set of exception filters specified by their ID. The set of all possible exception filters + * is defined by the `exceptionBreakpointFilters` capability. The `filter` and + * `filterOptions` sets are additive. + */ + @JsonProperty("filters") + public String[] getFilters() { return filters; } + @JsonProperty("filters") + public void setFilters(String[] value) { this.filters = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestClass.java new file mode 100644 index 0000000..2d75ff5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestClass.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request configures the debugger's response to thrown exceptions. + * If an exception is configured to break, a `stopped` event is fired (with reason + * `exception`). + * Clients should only call this request if the corresponding capability + * `exceptionBreakpointFilters` returns one or more filters. + */ +public class SetExceptionBreakpointsRequestClass { + private long seq; + private AttachRequestType type; + private SetExceptionBreakpointsRequestArguments arguments; + private SetExceptionBreakpointsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SetExceptionBreakpointsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SetExceptionBreakpointsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public SetExceptionBreakpointsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(SetExceptionBreakpointsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestCommand.java new file mode 100644 index 0000000..c606be3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SetExceptionBreakpointsRequestCommand { + SET_EXCEPTION_BREAKPOINTS; + + @JsonValue + public String toValue() { + switch (this) { + case SET_EXCEPTION_BREAKPOINTS: return "setExceptionBreakpoints"; + } + return null; + } + + @JsonCreator + public static SetExceptionBreakpointsRequestCommand forValue(String value) throws IOException { + if (value.equals("setExceptionBreakpoints")) return SET_EXCEPTION_BREAKPOINTS; + throw new IOException("Cannot deserialize SetExceptionBreakpointsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsResponseBody.java new file mode 100644 index 0000000..6d5d21d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsResponseBody.java @@ -0,0 +1,19 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SetExceptionBreakpointsResponseBody { + private Breakpoint[] breakpoints; + + /** + * Information about the exception breakpoints or filters. + * The breakpoints returned are in the same order as the elements of the `filters`, + * `filterOptions`, `exceptionOptions` arrays in the arguments. If both `filters` and + * `filterOptions` are given, the returned array must start with `filters` information + * first, followed by `filterOptions` information. + */ + @JsonProperty("breakpoints") + public Breakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(Breakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsResponseClass.java new file mode 100644 index 0000000..50674fa --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExceptionBreakpointsResponseClass.java @@ -0,0 +1,100 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `setExceptionBreakpoints` request. + * The response contains an array of `Breakpoint` objects with information about each + * exception breakpoint or filter. The `Breakpoint` objects are in the same order as the + * elements of the `filters`, `filterOptions`, `exceptionOptions` arrays given as arguments. + * If both `filters` and `filterOptions` are given, the returned array must start with + * `filters` information first, followed by `filterOptions` information. + * The `verified` property of a `Breakpoint` object signals whether the exception breakpoint + * or filter could be successfully created and whether the condition is valid. In case of an + * error the `message` property explains the problem. The `id` property can be used to + * introduce a unique ID for the exception breakpoint or filter so that it can be updated + * subsequently by sending breakpoint events. + * For backward compatibility both the `breakpoints` array and the enclosing `body` are + * optional. If these elements are missing a client is not able to show problems for + * individual exception breakpoints or filters. + */ +public class SetExceptionBreakpointsResponseClass { + private long seq; + private AttachResponseType type; + private SetExceptionBreakpointsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SetExceptionBreakpointsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SetExceptionBreakpointsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionArgumentsClass.java new file mode 100644 index 0000000..27118da --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionArgumentsClass.java @@ -0,0 +1,46 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setExpression` request. + */ +public class SetExpressionArgumentsClass { + private String expression; + private ValueFormat format; + private Long frameID; + private String value; + + /** + * The l-value expression to assign to. + */ + @JsonProperty("expression") + public String getExpression() { return expression; } + @JsonProperty("expression") + public void setExpression(String value) { this.expression = value; } + + /** + * Specifies how the resulting value should be formatted. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * Evaluate the expressions in the scope of this stack frame. If not specified, the + * expressions are evaluated in the global scope. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } + + /** + * The value expression to assign to the l-value expression. + */ + @JsonProperty("value") + public String getValue() { return value; } + @JsonProperty("value") + public void setValue(String value) { this.value = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestArguments.java new file mode 100644 index 0000000..200ea4a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestArguments.java @@ -0,0 +1,46 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setExpression` request. + */ +public class SetExpressionRequestArguments { + private String expression; + private ValueFormat format; + private Long frameID; + private String value; + + /** + * The l-value expression to assign to. + */ + @JsonProperty("expression") + public String getExpression() { return expression; } + @JsonProperty("expression") + public void setExpression(String value) { this.expression = value; } + + /** + * Specifies how the resulting value should be formatted. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * Evaluate the expressions in the scope of this stack frame. If not specified, the + * expressions are evaluated in the global scope. + */ + @JsonProperty("frameId") + public Long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(Long value) { this.frameID = value; } + + /** + * The value expression to assign to the l-value expression. + */ + @JsonProperty("value") + public String getValue() { return value; } + @JsonProperty("value") + public void setValue(String value) { this.value = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestClass.java new file mode 100644 index 0000000..a6433f1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestClass.java @@ -0,0 +1,61 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Evaluates the given `value` expression and assigns it to the `expression` which must be a + * modifiable l-value. + * The expressions have access to any variables and arguments that are in scope of the + * specified frame. + * Clients should only call this request if the corresponding capability + * `supportsSetExpression` is true. + * If a debug adapter implements both `setExpression` and `setVariable`, a client uses + * `setExpression` if the variable has an `evaluateName` property. + */ +public class SetExpressionRequestClass { + private long seq; + private AttachRequestType type; + private SetExpressionRequestArguments arguments; + private SetExpressionRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SetExpressionRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SetExpressionRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public SetExpressionRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(SetExpressionRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestCommand.java new file mode 100644 index 0000000..59a905b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SetExpressionRequestCommand { + SET_EXPRESSION; + + @JsonValue + public String toValue() { + switch (this) { + case SET_EXPRESSION: return "setExpression"; + } + return null; + } + + @JsonCreator + public static SetExpressionRequestCommand forValue(String value) throws IOException { + if (value.equals("setExpression")) return SET_EXPRESSION; + throw new IOException("Cannot deserialize SetExpressionRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionResponseBody.java new file mode 100644 index 0000000..d4fc669 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionResponseBody.java @@ -0,0 +1,84 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SetExpressionResponseBody { + private Long indexedVariables; + private String memoryReference; + private Long namedVariables; + private VariablePresentationHint presentationHint; + private String type; + private String value; + private Long variablesReference; + + /** + * The number of indexed child variables. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + * The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("indexedVariables") + public Long getIndexedVariables() { return indexedVariables; } + @JsonProperty("indexedVariables") + public void setIndexedVariables(Long value) { this.indexedVariables = value; } + + /** + * A memory reference to a location appropriate for this result. + * For pointer type eval results, this is generally a reference to the memory address + * contained in the pointer. + * This attribute may be returned by a debug adapter if corresponding capability + * `supportsMemoryReferences` is true. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * The number of named child variables. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + * The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("namedVariables") + public Long getNamedVariables() { return namedVariables; } + @JsonProperty("namedVariables") + public void setNamedVariables(Long value) { this.namedVariables = value; } + + /** + * Properties of a value that can be used to determine how to render the result in the UI. + */ + @JsonProperty("presentationHint") + public VariablePresentationHint getPresentationHint() { return presentationHint; } + @JsonProperty("presentationHint") + public void setPresentationHint(VariablePresentationHint value) { this.presentationHint = value; } + + /** + * The type of the value. + * This attribute should only be returned by a debug adapter if the corresponding capability + * `supportsVariableType` is true. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * The new value of the expression. + */ + @JsonProperty("value") + public String getValue() { return value; } + @JsonProperty("value") + public void setValue(String value) { this.value = value; } + + /** + * If `variablesReference` is > 0, the evaluate result is structured and its children can be + * retrieved by passing `variablesReference` to the `variables` request as long as execution + * remains suspended. See 'Lifetime of Object References' in the Overview section for + * details. + */ + @JsonProperty("variablesReference") + public Long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(Long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionResponseClass.java new file mode 100644 index 0000000..c084087 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetExpressionResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `setExpression` request. + */ +public class SetExpressionResponseClass { + private long seq; + private AttachResponseType type; + private SetExpressionResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SetExpressionResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SetExpressionResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsArgumentsClass.java new file mode 100644 index 0000000..58f6664 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setFunctionBreakpoints` request. + */ +public class SetFunctionBreakpointsArgumentsClass { + private FunctionBreakpoint[] breakpoints; + + /** + * The function names of the breakpoints. + */ + @JsonProperty("breakpoints") + public FunctionBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(FunctionBreakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestArguments.java new file mode 100644 index 0000000..cfeb1ff --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setFunctionBreakpoints` request. + */ +public class SetFunctionBreakpointsRequestArguments { + private FunctionBreakpoint[] breakpoints; + + /** + * The function names of the breakpoints. + */ + @JsonProperty("breakpoints") + public FunctionBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(FunctionBreakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestClass.java new file mode 100644 index 0000000..58a3b6a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestClass.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Replaces all existing function breakpoints with new function breakpoints. + * To clear all function breakpoints, specify an empty array. + * When a function breakpoint is hit, a `stopped` event (with reason `function breakpoint`) + * is generated. + * Clients should only call this request if the corresponding capability + * `supportsFunctionBreakpoints` is true. + */ +public class SetFunctionBreakpointsRequestClass { + private long seq; + private AttachRequestType type; + private SetFunctionBreakpointsRequestArguments arguments; + private SetFunctionBreakpointsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SetFunctionBreakpointsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SetFunctionBreakpointsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public SetFunctionBreakpointsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(SetFunctionBreakpointsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestCommand.java new file mode 100644 index 0000000..fdce962 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SetFunctionBreakpointsRequestCommand { + SET_FUNCTION_BREAKPOINTS; + + @JsonValue + public String toValue() { + switch (this) { + case SET_FUNCTION_BREAKPOINTS: return "setFunctionBreakpoints"; + } + return null; + } + + @JsonCreator + public static SetFunctionBreakpointsRequestCommand forValue(String value) throws IOException { + if (value.equals("setFunctionBreakpoints")) return SET_FUNCTION_BREAKPOINTS; + throw new IOException("Cannot deserialize SetFunctionBreakpointsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsResponseBody.java new file mode 100644 index 0000000..037357d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsResponseBody.java @@ -0,0 +1,16 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SetFunctionBreakpointsResponseBody { + private Breakpoint[] breakpoints; + + /** + * Information about the breakpoints. The array elements correspond to the elements of the + * `breakpoints` array. + */ + @JsonProperty("breakpoints") + public Breakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(Breakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsResponseClass.java new file mode 100644 index 0000000..d050fc3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetFunctionBreakpointsResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `setFunctionBreakpoints` request. + * Returned is information about each breakpoint created by this request. + */ +public class SetFunctionBreakpointsResponseClass { + private long seq; + private AttachResponseType type; + private SetFunctionBreakpointsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SetFunctionBreakpointsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SetFunctionBreakpointsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsArgumentsClass.java new file mode 100644 index 0000000..9c94daf --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setInstructionBreakpoints` request + */ +public class SetInstructionBreakpointsArgumentsClass { + private InstructionBreakpoint[] breakpoints; + + /** + * The instruction references of the breakpoints + */ + @JsonProperty("breakpoints") + public InstructionBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(InstructionBreakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestArguments.java new file mode 100644 index 0000000..93a888f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setInstructionBreakpoints` request + */ +public class SetInstructionBreakpointsRequestArguments { + private InstructionBreakpoint[] breakpoints; + + /** + * The instruction references of the breakpoints + */ + @JsonProperty("breakpoints") + public InstructionBreakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(InstructionBreakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestClass.java new file mode 100644 index 0000000..e21951a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestClass.java @@ -0,0 +1,60 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Replaces all existing instruction breakpoints. Typically, instruction breakpoints would + * be set from a disassembly window. + * To clear all instruction breakpoints, specify an empty array. + * When an instruction breakpoint is hit, a `stopped` event (with reason `instruction + * breakpoint`) is generated. + * Clients should only call this request if the corresponding capability + * `supportsInstructionBreakpoints` is true. + */ +public class SetInstructionBreakpointsRequestClass { + private long seq; + private AttachRequestType type; + private SetInstructionBreakpointsRequestArguments arguments; + private SetInstructionBreakpointsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SetInstructionBreakpointsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SetInstructionBreakpointsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public SetInstructionBreakpointsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(SetInstructionBreakpointsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestCommand.java new file mode 100644 index 0000000..09c8386 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SetInstructionBreakpointsRequestCommand { + SET_INSTRUCTION_BREAKPOINTS; + + @JsonValue + public String toValue() { + switch (this) { + case SET_INSTRUCTION_BREAKPOINTS: return "setInstructionBreakpoints"; + } + return null; + } + + @JsonCreator + public static SetInstructionBreakpointsRequestCommand forValue(String value) throws IOException { + if (value.equals("setInstructionBreakpoints")) return SET_INSTRUCTION_BREAKPOINTS; + throw new IOException("Cannot deserialize SetInstructionBreakpointsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsResponseBody.java new file mode 100644 index 0000000..fcf09c0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsResponseBody.java @@ -0,0 +1,16 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SetInstructionBreakpointsResponseBody { + private Breakpoint[] breakpoints; + + /** + * Information about the breakpoints. The array elements correspond to the elements of the + * `breakpoints` array. + */ + @JsonProperty("breakpoints") + public Breakpoint[] getBreakpoints() { return breakpoints; } + @JsonProperty("breakpoints") + public void setBreakpoints(Breakpoint[] value) { this.breakpoints = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsResponseClass.java new file mode 100644 index 0000000..01f4be8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetInstructionBreakpointsResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `setInstructionBreakpoints` request + */ +public class SetInstructionBreakpointsResponseClass { + private long seq; + private AttachResponseType type; + private SetInstructionBreakpointsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SetInstructionBreakpointsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SetInstructionBreakpointsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableArgumentsClass.java new file mode 100644 index 0000000..97cfe07 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableArgumentsClass.java @@ -0,0 +1,47 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setVariable` request. + */ +public class SetVariableArgumentsClass { + private ValueFormat format; + private String name; + private String value; + private long variablesReference; + + /** + * Specifies details on how to format the response value. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * The name of the variable in the container. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * The value of the variable. + */ + @JsonProperty("value") + public String getValue() { return value; } + @JsonProperty("value") + public void setValue(String value) { this.value = value; } + + /** + * The reference of the variable container. The `variablesReference` must have been obtained + * in the current suspended state. See 'Lifetime of Object References' in the Overview + * section for details. + */ + @JsonProperty("variablesReference") + public long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestArguments.java new file mode 100644 index 0000000..02b0497 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestArguments.java @@ -0,0 +1,47 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `setVariable` request. + */ +public class SetVariableRequestArguments { + private ValueFormat format; + private String name; + private String value; + private long variablesReference; + + /** + * Specifies details on how to format the response value. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * The name of the variable in the container. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * The value of the variable. + */ + @JsonProperty("value") + public String getValue() { return value; } + @JsonProperty("value") + public void setValue(String value) { this.value = value; } + + /** + * The reference of the variable container. The `variablesReference` must have been obtained + * in the current suspended state. See 'Lifetime of Object References' in the Overview + * section for details. + */ + @JsonProperty("variablesReference") + public long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestClass.java new file mode 100644 index 0000000..6438e43 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestClass.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Set the variable with the given name in the variable container to a new value. Clients + * should only call this request if the corresponding capability `supportsSetVariable` is + * true. + * If a debug adapter implements both `setVariable` and `setExpression`, a client will only + * use `setExpression` if the variable has an `evaluateName` property. + */ +public class SetVariableRequestClass { + private long seq; + private AttachRequestType type; + private SetVariableRequestArguments arguments; + private SetVariableRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SetVariableRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SetVariableRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public SetVariableRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(SetVariableRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestCommand.java new file mode 100644 index 0000000..fba23a4 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SetVariableRequestCommand { + SET_VARIABLE; + + @JsonValue + public String toValue() { + switch (this) { + case SET_VARIABLE: return "setVariable"; + } + return null; + } + + @JsonCreator + public static SetVariableRequestCommand forValue(String value) throws IOException { + if (value.equals("setVariable")) return SET_VARIABLE; + throw new IOException("Cannot deserialize SetVariableRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableResponseBody.java new file mode 100644 index 0000000..186bd8f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableResponseBody.java @@ -0,0 +1,73 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SetVariableResponseBody { + private Long indexedVariables; + private String memoryReference; + private Long namedVariables; + private String type; + private String value; + private Long variablesReference; + + /** + * The number of indexed child variables. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + * The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("indexedVariables") + public Long getIndexedVariables() { return indexedVariables; } + @JsonProperty("indexedVariables") + public void setIndexedVariables(Long value) { this.indexedVariables = value; } + + /** + * A memory reference to a location appropriate for this result. + * For pointer type eval results, this is generally a reference to the memory address + * contained in the pointer. + * This attribute may be returned by a debug adapter if corresponding capability + * `supportsMemoryReferences` is true. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * The number of named child variables. + * The client can use this information to present the variables in a paged UI and fetch them + * in chunks. + * The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("namedVariables") + public Long getNamedVariables() { return namedVariables; } + @JsonProperty("namedVariables") + public void setNamedVariables(Long value) { this.namedVariables = value; } + + /** + * The type of the new value. Typically shown in the UI when hovering over the value. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * The new value of the variable. + */ + @JsonProperty("value") + public String getValue() { return value; } + @JsonProperty("value") + public void setValue(String value) { this.value = value; } + + /** + * If `variablesReference` is > 0, the new value is structured and its children can be + * retrieved by passing `variablesReference` to the `variables` request as long as execution + * remains suspended. See 'Lifetime of Object References' in the Overview section for + * details. + */ + @JsonProperty("variablesReference") + public Long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(Long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableResponseClass.java new file mode 100644 index 0000000..3b322de --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SetVariableResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `setVariable` request. + */ +public class SetVariableResponseClass { + private long seq; + private AttachResponseType type; + private SetVariableResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SetVariableResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SetVariableResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Source.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Source.java new file mode 100644 index 0000000..5a20007 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Source.java @@ -0,0 +1,137 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +import java.util.Arrays; + +/** + * The source where the breakpoint is located. + * + * A `Source` is a descriptor for source code. + * It is returned from the debug adapter as part of a `StackFrame` and it is used by clients + * when specifying breakpoints. + * + * The source location of the breakpoints; either `source.path` or `source.sourceReference` + * must be specified. + * + * Source location that corresponds to this instruction, if any. + * Should always be set (if available) on the first instruction returned, + * but can be omitted afterwards if this instruction maps to the same source file as the + * previous instruction. + * + * The source location for which the goto targets are determined. + * + * The new, changed, or removed source. + * + * The source location where the output was produced. + * + * The source for this scope. + * + * Specifies the source content to load. Either `source.path` or `source.sourceReference` + * must be specified. + * + * The source of the frame. + */ + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Source { + private Restart adapterData; + private Checksum[] checksums; + private String name; + private String origin; + private String path; + private SourcePresentationHint presentationHint; + private Long sourceReference; + private Source[] sources; + + /** + * Additional data that a debug adapter might want to loop through the client. + * The client should leave the data intact and persist it across sessions. The client should + * not interpret the data. + */ + @JsonProperty("adapterData") + public Restart getAdapterData() { return adapterData; } + @JsonProperty("adapterData") + public void setAdapterData(Restart value) { this.adapterData = value; } + + /** + * The checksums associated with this file. + */ + @JsonProperty("checksums") + public Checksum[] getChecksums() { return checksums; } + @JsonProperty("checksums") + public void setChecksums(Checksum[] value) { this.checksums = value; } + + /** + * The short name of the source. Every source returned from the debug adapter has a name. + * When sending a source to the debug adapter this name is optional. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * The origin of this source. For example, 'internal module', 'inlined content from source + * map', etc. + */ + @JsonProperty("origin") + public String getOrigin() { return origin; } + @JsonProperty("origin") + public void setOrigin(String value) { this.origin = value; } + + /** + * The path of the source to be shown in the UI. + * It is only used to locate and load the content of the source if no `sourceReference` is + * specified (or its value is 0). + */ + @JsonProperty("path") + public String getPath() { return path; } + @JsonProperty("path") + public void setPath(String value) { this.path = value; } + + /** + * A hint for how to present the source in the UI. + * A value of `deemphasize` can be used to indicate that the source is not available or that + * it is skipped on stepping. + */ + @JsonProperty("presentationHint") + public SourcePresentationHint getPresentationHint() { return presentationHint; } + @JsonProperty("presentationHint") + public void setPresentationHint(SourcePresentationHint value) { this.presentationHint = value; } + + /** + * If the value > 0 the contents of the source must be retrieved through the `source` + * request (even if a path is specified). + * Since a `sourceReference` is only valid for a session, it can not be used to persist a + * source. + * The value should be less than or equal to 2147483647 (2^31-1). + */ + @JsonProperty("sourceReference") + public Long getSourceReference() { return sourceReference; } + @JsonProperty("sourceReference") + public void setSourceReference(Long value) { this.sourceReference = value; } + + /** + * A list of sources that are related to this source. These may be the source that generated + * this source. + */ + @JsonProperty("sources") + public Source[] getSources() { return sources; } + @JsonProperty("sources") + public void setSources(Source[] value) { this.sources = value; } + + @Override + public String toString() { + return "Source{" + + "adapterData=" + adapterData + + ", checksums=" + Arrays.toString(checksums) + + ", name='" + name + '\'' + + ", origin='" + origin + '\'' + + ", path='" + path + '\'' + + ", presentationHint=" + presentationHint + + ", sourceReference=" + sourceReference + + ", sources=" + Arrays.toString(sources) + + '}'; + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceArgumentsClass.java new file mode 100644 index 0000000..d8288c7 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceArgumentsClass.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `source` request. + */ +public class SourceArgumentsClass { + private Source source; + private long sourceReference; + + /** + * Specifies the source content to load. Either `source.path` or `source.sourceReference` + * must be specified. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + /** + * The reference to the source. This is the same as `source.sourceReference`. + * This is provided for backward compatibility since old clients do not understand the + * `source` attribute. + */ + @JsonProperty("sourceReference") + public long getSourceReference() { return sourceReference; } + @JsonProperty("sourceReference") + public void setSourceReference(long value) { this.sourceReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceBreakpoint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceBreakpoint.java new file mode 100644 index 0000000..ebdbb9f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceBreakpoint.java @@ -0,0 +1,71 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Properties of a breakpoint or logpoint passed to the `setBreakpoints` request. + */ + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class SourceBreakpoint { + private Long column; + private String condition; + private String hitCondition; + private long line; + private String logMessage; + + /** + * Start position within source line of the breakpoint or logpoint. It is measured in UTF-16 + * code units and the client capability `columnsStartAt1` determines whether it is 0- or + * 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * The expression for conditional breakpoints. + * It is only honored by a debug adapter if the corresponding capability + * `supportsConditionalBreakpoints` is true. + */ + @JsonProperty("condition") + public String getCondition() { return condition; } + @JsonProperty("condition") + public void setCondition(String value) { this.condition = value; } + + /** + * The expression that controls how many hits of the breakpoint are ignored. + * The debug adapter is expected to interpret the expression as needed. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsHitConditionalBreakpoints` is true. + * If both this property and `condition` are specified, `hitCondition` should be evaluated + * only if the `condition` is met, and the debug adapter should stop only if both conditions + * are met. + */ + @JsonProperty("hitCondition") + public String getHitCondition() { return hitCondition; } + @JsonProperty("hitCondition") + public void setHitCondition(String value) { this.hitCondition = value; } + + /** + * The source line of the breakpoint or logpoint. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } + + /** + * If this attribute exists and is non-empty, the debug adapter must not 'break' (stop) + * but log the message instead. Expressions within `{}` are interpolated. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsLogPoints` is true. + * If either `hitCondition` or `condition` is specified, then the message should only be + * logged if those conditions are met. + */ + @JsonProperty("logMessage") + public String getLogMessage() { return logMessage; } + @JsonProperty("logMessage") + public void setLogMessage(String value) { this.logMessage = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourcePresentationHint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourcePresentationHint.java new file mode 100644 index 0000000..4883dca --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourcePresentationHint.java @@ -0,0 +1,31 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * A hint for how to present the source in the UI. + * A value of `deemphasize` can be used to indicate that the source is not available or that + * it is skipped on stepping. + */ +public enum SourcePresentationHint { + DEEMPHASIZE, EMPHASIZE, NORMAL; + + @JsonValue + public String toValue() { + switch (this) { + case DEEMPHASIZE: return "deemphasize"; + case EMPHASIZE: return "emphasize"; + case NORMAL: return "normal"; + } + return null; + } + + @JsonCreator + public static SourcePresentationHint forValue(String value) throws IOException { + if (value.equals("deemphasize")) return DEEMPHASIZE; + if (value.equals("emphasize")) return EMPHASIZE; + if (value.equals("normal")) return NORMAL; + throw new IOException("Cannot deserialize SourcePresentationHint"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestArguments.java new file mode 100644 index 0000000..0c04e71 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestArguments.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `source` request. + */ +public class SourceRequestArguments { + private Source source; + private long sourceReference; + + /** + * Specifies the source content to load. Either `source.path` or `source.sourceReference` + * must be specified. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + /** + * The reference to the source. This is the same as `source.sourceReference`. + * This is provided for backward compatibility since old clients do not understand the + * `source` attribute. + */ + @JsonProperty("sourceReference") + public long getSourceReference() { return sourceReference; } + @JsonProperty("sourceReference") + public void setSourceReference(long value) { this.sourceReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestClass.java new file mode 100644 index 0000000..b7231e6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestClass.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request retrieves the source code for a given source reference. + */ +public class SourceRequestClass { + private long seq; + private AttachRequestType type; + private SourceRequestArguments arguments; + private SourceRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public SourceRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(SourceRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public SourceRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(SourceRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestCommand.java new file mode 100644 index 0000000..572f8c0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum SourceRequestCommand { + SOURCE; + + @JsonValue + public String toValue() { + switch (this) { + case SOURCE: return "source"; + } + return null; + } + + @JsonCreator + public static SourceRequestCommand forValue(String value) throws IOException { + if (value.equals("source")) return SOURCE; + throw new IOException("Cannot deserialize SourceRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceResponseBody.java new file mode 100644 index 0000000..fd0c01a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceResponseBody.java @@ -0,0 +1,24 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class SourceResponseBody { + private String content; + private String mimeType; + + /** + * Content of the source reference. + */ + @JsonProperty("content") + public String getContent() { return content; } + @JsonProperty("content") + public void setContent(String value) { this.content = value; } + + /** + * Content type (MIME type) of the source. + */ + @JsonProperty("mimeType") + public String getMIMEType() { return mimeType; } + @JsonProperty("mimeType") + public void setMIMEType(String value) { this.mimeType = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceResponseClass.java new file mode 100644 index 0000000..b882a08 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SourceResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `source` request. + */ +public class SourceResponseClass { + private long seq; + private AttachResponseType type; + private SourceResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public SourceResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(SourceResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFrame.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFrame.java new file mode 100644 index 0000000..48da4c6 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFrame.java @@ -0,0 +1,138 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A Stackframe contains the source location. + */ +public class StackFrame { + private Boolean canRestart; + private long column; + private Long endColumn; + private Long endLine; + private long id; + private String instructionPointerReference; + private long line; + private ModuleIDUnion moduleID; + private String name; + private StackFramePresentationHint presentationHint; + private Source source; + + /** + * Indicates whether this frame can be restarted with the `restart` request. Clients should + * only use this if the debug adapter supports the `restart` request and the corresponding + * capability `supportsRestartRequest` is true. If a debug adapter has this capability, then + * `canRestart` defaults to `true` if the property is absent. + */ + @JsonProperty("canRestart") + public Boolean getCanRestart() { return canRestart; } + @JsonProperty("canRestart") + public void setCanRestart(Boolean value) { this.canRestart = value; } + + /** + * Start position of the range covered by the stack frame. It is measured in UTF-16 code + * units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + * If attribute `source` is missing or doesn't exist, `column` is 0 and should be ignored by + * the client. + */ + @JsonProperty("column") + public long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(long value) { this.column = value; } + + /** + * End position of the range covered by the stack frame. It is measured in UTF-16 code units + * and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * The end line of the range covered by the stack frame. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * An identifier for the stack frame. It must be unique across all threads. + * This id can be used to retrieve the scopes of the frame with the `scopes` request or to + * restart the execution of a stack frame. + */ + @JsonProperty("id") + public long getID() { return id; } + @JsonProperty("id") + public void setID(long value) { this.id = value; } + + /** + * A memory reference for the current instruction pointer in this frame. + */ + @JsonProperty("instructionPointerReference") + public String getInstructionPointerReference() { return instructionPointerReference; } + @JsonProperty("instructionPointerReference") + public void setInstructionPointerReference(String value) { this.instructionPointerReference = value; } + + /** + * The line within the source of the frame. If the source attribute is missing or doesn't + * exist, `line` is 0 and should be ignored by the client. + */ + @JsonProperty("line") + public long getLine() { return line; } + @JsonProperty("line") + public void setLine(long value) { this.line = value; } + + /** + * The module associated with this frame, if any. + */ + @JsonProperty("moduleId") + public ModuleIDUnion getModuleID() { return moduleID; } + @JsonProperty("moduleId") + public void setModuleID(ModuleIDUnion value) { this.moduleID = value; } + + /** + * The name of the stack frame, typically a method name. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * A hint for how to present this frame in the UI. + * A value of `label` can be used to indicate that the frame is an artificial frame that is + * used as a visual label or separator. A value of `subtle` can be used to change the + * appearance of a frame in a 'subtle' way. + */ + @JsonProperty("presentationHint") + public StackFramePresentationHint getPresentationHint() { return presentationHint; } + @JsonProperty("presentationHint") + public void setPresentationHint(StackFramePresentationHint value) { this.presentationHint = value; } + + /** + * The source of the frame. + */ + @JsonProperty("source") + public Source getSource() { return source; } + @JsonProperty("source") + public void setSource(Source value) { this.source = value; } + + @Override + public String toString() { + return "StackFrame{" + + "canRestart=" + canRestart + + ", column=" + column + + ", endColumn=" + endColumn + + ", endLine=" + endLine + + ", id=" + id + + ", instructionPointerReference='" + instructionPointerReference + '\'' + + ", line=" + line + + ", moduleID=" + moduleID + + ", name='" + name + '\'' + + ", presentationHint=" + presentationHint + + ", source=" + source + + '}'; + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFrameFormat.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFrameFormat.java new file mode 100644 index 0000000..d8d63fa --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFrameFormat.java @@ -0,0 +1,99 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Specifies details on how to format the stack frames. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + * + * Specifies details on how to format the result. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + * + * Provides formatting information for a value. + * + * Specifies how the resulting value should be formatted. + * + * Specifies details on how to format the response value. + * + * Specifies details on how to format the Variable values. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + * + * Provides formatting information for a stack frame. + */ +public class StackFrameFormat { + private Boolean hex; + private Boolean includeAll; + private Boolean line; + private Boolean module; + private Boolean parameterNames; + private Boolean parameters; + private Boolean parameterTypes; + private Boolean parameterValues; + + /** + * Display the value in hex. + */ + @JsonProperty("hex") + public Boolean getHex() { return hex; } + @JsonProperty("hex") + public void setHex(Boolean value) { this.hex = value; } + + /** + * Includes all stack frames, including those the debug adapter might otherwise hide. + */ + @JsonProperty("includeAll") + public Boolean getIncludeAll() { return includeAll; } + @JsonProperty("includeAll") + public void setIncludeAll(Boolean value) { this.includeAll = value; } + + /** + * Displays the line number of the stack frame. + */ + @JsonProperty("line") + public Boolean getLine() { return line; } + @JsonProperty("line") + public void setLine(Boolean value) { this.line = value; } + + /** + * Displays the module of the stack frame. + */ + @JsonProperty("module") + public Boolean getModule() { return module; } + @JsonProperty("module") + public void setModule(Boolean value) { this.module = value; } + + /** + * Displays the names of parameters for the stack frame. + */ + @JsonProperty("parameterNames") + public Boolean getParameterNames() { return parameterNames; } + @JsonProperty("parameterNames") + public void setParameterNames(Boolean value) { this.parameterNames = value; } + + /** + * Displays parameters for the stack frame. + */ + @JsonProperty("parameters") + public Boolean getParameters() { return parameters; } + @JsonProperty("parameters") + public void setParameters(Boolean value) { this.parameters = value; } + + /** + * Displays the types of parameters for the stack frame. + */ + @JsonProperty("parameterTypes") + public Boolean getParameterTypes() { return parameterTypes; } + @JsonProperty("parameterTypes") + public void setParameterTypes(Boolean value) { this.parameterTypes = value; } + + /** + * Displays the values of parameters for the stack frame. + */ + @JsonProperty("parameterValues") + public Boolean getParameterValues() { return parameterValues; } + @JsonProperty("parameterValues") + public void setParameterValues(Boolean value) { this.parameterValues = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFramePresentationHint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFramePresentationHint.java new file mode 100644 index 0000000..8e6cf25 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackFramePresentationHint.java @@ -0,0 +1,32 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * A hint for how to present this frame in the UI. + * A value of `label` can be used to indicate that the frame is an artificial frame that is + * used as a visual label or separator. A value of `subtle` can be used to change the + * appearance of a frame in a 'subtle' way. + */ +public enum StackFramePresentationHint { + LABEL, NORMAL, SUBTLE; + + @JsonValue + public String toValue() { + switch (this) { + case LABEL: return "label"; + case NORMAL: return "normal"; + case SUBTLE: return "subtle"; + } + return null; + } + + @JsonCreator + public static StackFramePresentationHint forValue(String value) throws IOException { + if (value.equals("label")) return LABEL; + if (value.equals("normal")) return NORMAL; + if (value.equals("subtle")) return SUBTLE; + throw new IOException("Cannot deserialize StackFramePresentationHint"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceArgumentsClass.java new file mode 100644 index 0000000..c9f657f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceArgumentsClass.java @@ -0,0 +1,48 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stackTrace` request. + */ +public class StackTraceArgumentsClass { + private StackFrameFormat format; + private Long levels; + private Long startFrame; + private long threadID; + + /** + * Specifies details on how to format the stack frames. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + */ + @JsonProperty("format") + public StackFrameFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(StackFrameFormat value) { this.format = value; } + + /** + * The maximum number of frames to return. If levels is not specified or 0, all frames are + * returned. + */ + @JsonProperty("levels") + public Long getLevels() { return levels; } + @JsonProperty("levels") + public void setLevels(Long value) { this.levels = value; } + + /** + * The index of the first frame to return; if omitted frames start at 0. + */ + @JsonProperty("startFrame") + public Long getStartFrame() { return startFrame; } + @JsonProperty("startFrame") + public void setStartFrame(Long value) { this.startFrame = value; } + + /** + * Retrieve the stacktrace for this thread. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestArguments.java new file mode 100644 index 0000000..5a7f4ea --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestArguments.java @@ -0,0 +1,48 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stackTrace` request. + */ +public class StackTraceRequestArguments { + private StackFrameFormat format; + private Long levels; + private Long startFrame; + private long threadID; + + /** + * Specifies details on how to format the stack frames. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + */ + @JsonProperty("format") + public StackFrameFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(StackFrameFormat value) { this.format = value; } + + /** + * The maximum number of frames to return. If levels is not specified or 0, all frames are + * returned. + */ + @JsonProperty("levels") + public Long getLevels() { return levels; } + @JsonProperty("levels") + public void setLevels(Long value) { this.levels = value; } + + /** + * The index of the first frame to return; if omitted frames start at 0. + */ + @JsonProperty("startFrame") + public Long getStartFrame() { return startFrame; } + @JsonProperty("startFrame") + public void setStartFrame(Long value) { this.startFrame = value; } + + /** + * Retrieve the stacktrace for this thread. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestClass.java new file mode 100644 index 0000000..18ff54b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestClass.java @@ -0,0 +1,65 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request returns a stacktrace from the current execution state of a given thread. + * A client can request all stack frames by omitting the startFrame and levels arguments. + * For performance-conscious clients and if the corresponding capability + * `supportsDelayedStackTraceLoading` is true, stack frames can be retrieved in a piecemeal + * way with the `startFrame` and `levels` arguments. The response of the `stackTrace` + * request may contain a `totalFrames` property that hints at the total number of frames in + * the stack. If a client needs this total number upfront, it can issue a request for a + * single (first) frame and depending on the value of `totalFrames` decide how to proceed. + * In any case a client should be prepared to receive fewer frames than requested, which is + * an indication that the end of the stack has been reached. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StackTraceRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private StackTraceRequestArguments arguments; + private String command = "stackTrace"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public StackTraceRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(StackTraceRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestCommand.java new file mode 100644 index 0000000..c8b1907 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum StackTraceRequestCommand { + STACK_TRACE; + + @JsonValue + public String toValue() { + switch (this) { + case STACK_TRACE: return "stackTrace"; + } + return null; + } + + @JsonCreator + public static StackTraceRequestCommand forValue(String value) throws IOException { + if (value.equals("stackTrace")) return STACK_TRACE; + throw new IOException("Cannot deserialize StackTraceRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceResponseBody.java new file mode 100644 index 0000000..4714320 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceResponseBody.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class StackTraceResponseBody { + private StackFrame[] stackFrames; + private Long totalFrames; + + /** + * The frames of the stack frame. If the array has length zero, there are no stack frames + * available. + * This means that there is no location information available. + */ + @JsonProperty("stackFrames") + public StackFrame[] getStackFrames() { return stackFrames; } + @JsonProperty("stackFrames") + public void setStackFrames(StackFrame[] value) { this.stackFrames = value; } + + /** + * The total number of frames available in the stack. If omitted or if `totalFrames` is + * larger than the available frames, a client is expected to request frames until a request + * returns less frames than requested (which indicates the end of the stack). Returning + * monotonically increasing `totalFrames` values for subsequent requests can be used to + * enforce paging in the client. + */ + @JsonProperty("totalFrames") + public Long getTotalFrames() { return totalFrames; } + @JsonProperty("totalFrames") + public void setTotalFrames(Long value) { this.totalFrames = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceResponseClass.java new file mode 100644 index 0000000..9058633 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StackTraceResponseClass.java @@ -0,0 +1,89 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `stackTrace` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StackTraceResponseClass implements DAPResponse { + private long seq; + private String type; + private StackTraceResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public StackTraceResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(StackTraceResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestArguments.java new file mode 100644 index 0000000..b448a40 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestArguments.java @@ -0,0 +1,32 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import java.util.Map; + +/** + * Arguments for `startDebugging` request. + */ +public class StartDebuggingRequestArguments { + private Map configuration; + private RequestEnum request; + + /** + * Arguments passed to the new debug session. The arguments must only contain properties + * understood by the `launch` or `attach` requests of the debug adapter and they must not + * contain any client-specific properties (e.g. `type`) or client-specific features (e.g. + * substitutable 'variables'). + */ + @JsonProperty("configuration") + public Map getConfiguration() { return configuration; } + @JsonProperty("configuration") + public void setConfiguration(Map value) { this.configuration = value; } + + /** + * Indicates whether the new debug session should be started with a `launch` or `attach` + * request. + */ + @JsonProperty("request") + public RequestEnum getRequest() { return request; } + @JsonProperty("request") + public void setRequest(RequestEnum value) { this.request = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestArgumentsClass.java new file mode 100644 index 0000000..decf2a5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestArgumentsClass.java @@ -0,0 +1,32 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import java.util.Map; + +/** + * Arguments for `startDebugging` request. + */ +public class StartDebuggingRequestArgumentsClass { + private Map configuration; + private RequestEnum request; + + /** + * Arguments passed to the new debug session. The arguments must only contain properties + * understood by the `launch` or `attach` requests of the debug adapter and they must not + * contain any client-specific properties (e.g. `type`) or client-specific features (e.g. + * substitutable 'variables'). + */ + @JsonProperty("configuration") + public Map getConfiguration() { return configuration; } + @JsonProperty("configuration") + public void setConfiguration(Map value) { this.configuration = value; } + + /** + * Indicates whether the new debug session should be started with a `launch` or `attach` + * request. + */ + @JsonProperty("request") + public RequestEnum getRequest() { return request; } + @JsonProperty("request") + public void setRequest(RequestEnum value) { this.request = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestClass.java new file mode 100644 index 0000000..20f4ce0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestClass.java @@ -0,0 +1,61 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * This request is sent from the debug adapter to the client to start a new debug session of + * the same type as the caller. + * This request should only be sent if the corresponding client capability + * `supportsStartDebuggingRequest` is true. + * A client implementation of `startDebugging` should start a new debug session (of the same + * type as the caller) in the same way that the caller's session was started. If the client + * supports hierarchical debug sessions, the newly created session can be treated as a child + * of the caller session. + */ +public class StartDebuggingRequestClass { + private long seq; + private AttachRequestType type; + private StartDebuggingRequestArguments arguments; + private StartDebuggingRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public StartDebuggingRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(StartDebuggingRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public StartDebuggingRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(StartDebuggingRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestCommand.java new file mode 100644 index 0000000..226ced3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum StartDebuggingRequestCommand { + START_DEBUGGING; + + @JsonValue + public String toValue() { + switch (this) { + case START_DEBUGGING: return "startDebugging"; + } + return null; + } + + @JsonCreator + public static StartDebuggingRequestCommand forValue(String value) throws IOException { + if (value.equals("startDebugging")) return START_DEBUGGING; + throw new IOException("Cannot deserialize StartDebuggingRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingResponseClass.java new file mode 100644 index 0000000..949f904 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartDebuggingResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `startDebugging` request. This is just an acknowledgement, so no body field + * is required. + */ +public class StartDebuggingResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartMethod.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartMethod.java new file mode 100644 index 0000000..e254c8b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StartMethod.java @@ -0,0 +1,29 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * Describes how the debug engine started debugging this process. + */ +public enum StartMethod { + ATTACH, ATTACH_FOR_SUSPENDED_LAUNCH, LAUNCH; + + @JsonValue + public String toValue() { + switch (this) { + case ATTACH: return "attach"; + case ATTACH_FOR_SUSPENDED_LAUNCH: return "attachForSuspendedLaunch"; + case LAUNCH: return "launch"; + } + return null; + } + + @JsonCreator + public static StartMethod forValue(String value) throws IOException { + if (value.equals("attach")) return ATTACH; + if (value.equals("attachForSuspendedLaunch")) return ATTACH_FOR_SUSPENDED_LAUNCH; + if (value.equals("launch")) return LAUNCH; + throw new IOException("Cannot deserialize StartMethod"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackArgumentsClass.java new file mode 100644 index 0000000..543a2ce --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackArgumentsClass.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepBack` request. + */ +public class StepBackArgumentsClass { + private SteppingGranularity granularity; + private Boolean singleThread; + private long threadID; + + /** + * Stepping granularity to step. If no granularity is specified, a granularity of + * `statement` is assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the thread for which to resume execution for one step backwards (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestArguments.java new file mode 100644 index 0000000..1d5a6dc --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestArguments.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepBack` request. + */ +public class StepBackRequestArguments { + private SteppingGranularity granularity; + private Boolean singleThread; + private long threadID; + + /** + * Stepping granularity to step. If no granularity is specified, a granularity of + * `statement` is assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the thread for which to resume execution for one step backwards (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestClass.java new file mode 100644 index 0000000..71078e7 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestClass.java @@ -0,0 +1,62 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request executes one backward step (in the given granularity) for the specified + * thread and allows all other threads to run backward freely by resuming them. + * If the debug adapter supports single thread execution (see capability + * `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true + * prevents other suspended threads from resuming. + * The debug adapter first sends the response and then a `stopped` event (with reason + * `step`) after the step has completed. + * Clients should only call this request if the corresponding capability `supportsStepBack` + * is true. + */ +public class StepBackRequestClass { + private long seq; + private AttachRequestType type; + private StepBackRequestArguments arguments; + private StepBackRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public StepBackRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(StepBackRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public StepBackRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(StepBackRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestCommand.java new file mode 100644 index 0000000..a883062 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum StepBackRequestCommand { + STEP_BACK; + + @JsonValue + public String toValue() { + switch (this) { + case STEP_BACK: return "stepBack"; + } + return null; + } + + @JsonCreator + public static StepBackRequestCommand forValue(String value) throws IOException { + if (value.equals("stepBack")) return STEP_BACK; + throw new IOException("Cannot deserialize StepBackRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackResponseClass.java new file mode 100644 index 0000000..019c741 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepBackResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `stepBack` request. This is just an acknowledgement, so no body field is + * required. + */ +public class StepBackResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInArgumentsClass.java new file mode 100644 index 0000000..671ebd5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInArgumentsClass.java @@ -0,0 +1,47 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepIn` request. + */ +public class StepInArgumentsClass { + private SteppingGranularity granularity; + private Boolean singleThread; + private Long targetID; + private long threadID; + + /** + * Stepping granularity. If no granularity is specified, a granularity of `statement` is + * assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Id of the target to step into. + */ + @JsonProperty("targetId") + public Long getTargetID() { return targetID; } + @JsonProperty("targetId") + public void setTargetID(Long value) { this.targetID = value; } + + /** + * Specifies the thread for which to resume execution for one step-into (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestArguments.java new file mode 100644 index 0000000..f08ede8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestArguments.java @@ -0,0 +1,47 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepIn` request. + */ +public class StepInRequestArguments { + private SteppingGranularity granularity; + private Boolean singleThread; + private Long targetID; + private long threadID; + + /** + * Stepping granularity. If no granularity is specified, a granularity of `statement` is + * assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Id of the target to step into. + */ + @JsonProperty("targetId") + public Long getTargetID() { return targetID; } + @JsonProperty("targetId") + public void setTargetID(Long value) { this.targetID = value; } + + /** + * Specifies the thread for which to resume execution for one step-into (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestClass.java new file mode 100644 index 0000000..a756999 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestClass.java @@ -0,0 +1,66 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request resumes the given thread to step into a function/method and allows all other + * threads to run freely by resuming them. + * If the debug adapter supports single thread execution (see capability + * `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true + * prevents other suspended threads from resuming. + * If the request cannot step into a target, `stepIn` behaves like the `next` request. + * The debug adapter first sends the response and then a `stopped` event (with reason + * `step`) after the step has completed. + * If there are multiple function/method calls (or other targets) on the source line, + * the argument `targetId` can be used to control into which target the `stepIn` should + * occur. + * The list of possible targets for a given source line can be retrieved via the + * `stepInTargets` request. + */ +public class StepInRequestClass { + private long seq; + private AttachRequestType type; + private StepInRequestArguments arguments; + private StepInRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public StepInRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(StepInRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public StepInRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(StepInRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestCommand.java new file mode 100644 index 0000000..9c396e0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum StepInRequestCommand { + STEP_IN; + + @JsonValue + public String toValue() { + switch (this) { + case STEP_IN: return "stepIn"; + } + return null; + } + + @JsonCreator + public static StepInRequestCommand forValue(String value) throws IOException { + if (value.equals("stepIn")) return STEP_IN; + throw new IOException("Cannot deserialize StepInRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInResponseClass.java new file mode 100644 index 0000000..7676e11 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `stepIn` request. This is just an acknowledgement, so no body field is + * required. + */ +public class StepInResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTarget.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTarget.java new file mode 100644 index 0000000..2417144 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTarget.java @@ -0,0 +1,66 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A `StepInTarget` can be used in the `stepIn` request and determines into which single + * target the `stepIn` request should step. + */ +public class StepInTarget { + private Long column; + private Long endColumn; + private Long endLine; + private long id; + private String label; + private Long line; + + /** + * Start position of the range covered by the step in target. It is measured in UTF-16 code + * units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + */ + @JsonProperty("column") + public Long getColumn() { return column; } + @JsonProperty("column") + public void setColumn(Long value) { this.column = value; } + + /** + * End position of the range covered by the step in target. It is measured in UTF-16 code + * units and the client capability `columnsStartAt1` determines whether it is 0- or 1-based. + */ + @JsonProperty("endColumn") + public Long getEndColumn() { return endColumn; } + @JsonProperty("endColumn") + public void setEndColumn(Long value) { this.endColumn = value; } + + /** + * The end line of the range covered by the step-in target. + */ + @JsonProperty("endLine") + public Long getEndLine() { return endLine; } + @JsonProperty("endLine") + public void setEndLine(Long value) { this.endLine = value; } + + /** + * Unique identifier for a step-in target. + */ + @JsonProperty("id") + public long getID() { return id; } + @JsonProperty("id") + public void setID(long value) { this.id = value; } + + /** + * The name of the step-in target (shown in the UI). + */ + @JsonProperty("label") + public String getLabel() { return label; } + @JsonProperty("label") + public void setLabel(String value) { this.label = value; } + + /** + * The line of the step-in target. + */ + @JsonProperty("line") + public Long getLine() { return line; } + @JsonProperty("line") + public void setLine(Long value) { this.line = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsArgumentsClass.java new file mode 100644 index 0000000..eb20d83 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepInTargets` request. + */ +public class StepInTargetsArgumentsClass { + private long frameID; + + /** + * The stack frame for which to retrieve the possible step-in targets. + */ + @JsonProperty("frameId") + public long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestArguments.java new file mode 100644 index 0000000..2b9ee48 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepInTargets` request. + */ +public class StepInTargetsRequestArguments { + private long frameID; + + /** + * The stack frame for which to retrieve the possible step-in targets. + */ + @JsonProperty("frameId") + public long getFrameID() { return frameID; } + @JsonProperty("frameId") + public void setFrameID(long value) { this.frameID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestClass.java new file mode 100644 index 0000000..1e25017 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * This request retrieves the possible step-in targets for the specified stack frame. + * These targets can be used in the `stepIn` request. + * Clients should only call this request if the corresponding capability + * `supportsStepInTargetsRequest` is true. + */ +public class StepInTargetsRequestClass { + private long seq; + private AttachRequestType type; + private StepInTargetsRequestArguments arguments; + private StepInTargetsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public StepInTargetsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(StepInTargetsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public StepInTargetsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(StepInTargetsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestCommand.java new file mode 100644 index 0000000..17eea86 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum StepInTargetsRequestCommand { + STEP_IN_TARGETS; + + @JsonValue + public String toValue() { + switch (this) { + case STEP_IN_TARGETS: return "stepInTargets"; + } + return null; + } + + @JsonCreator + public static StepInTargetsRequestCommand forValue(String value) throws IOException { + if (value.equals("stepInTargets")) return STEP_IN_TARGETS; + throw new IOException("Cannot deserialize StepInTargetsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsResponseBody.java new file mode 100644 index 0000000..b2ef1ff --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class StepInTargetsResponseBody { + private StepInTarget[] targets; + + /** + * The possible step-in targets of the specified source location. + */ + @JsonProperty("targets") + public StepInTarget[] getTargets() { return targets; } + @JsonProperty("targets") + public void setTargets(StepInTarget[] value) { this.targets = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsResponseClass.java new file mode 100644 index 0000000..4809b53 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepInTargetsResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `stepInTargets` request. + */ +public class StepInTargetsResponseClass { + private long seq; + private AttachResponseType type; + private StepInTargetsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public StepInTargetsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(StepInTargetsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutArgumentsClass.java new file mode 100644 index 0000000..36cb836 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutArgumentsClass.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepOut` request. + */ +public class StepOutArgumentsClass { + private SteppingGranularity granularity; + private Boolean singleThread; + private long threadID; + + /** + * Stepping granularity. If no granularity is specified, a granularity of `statement` is + * assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the thread for which to resume execution for one step-out (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestArguments.java new file mode 100644 index 0000000..436ed3d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestArguments.java @@ -0,0 +1,38 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `stepOut` request. + */ +public class StepOutRequestArguments { + private SteppingGranularity granularity; + private Boolean singleThread; + private long threadID; + + /** + * Stepping granularity. If no granularity is specified, a granularity of `statement` is + * assumed. + */ + @JsonProperty("granularity") + public SteppingGranularity getGranularity() { return granularity; } + @JsonProperty("granularity") + public void setGranularity(SteppingGranularity value) { this.granularity = value; } + + /** + * If this flag is true, all other suspended threads are not resumed. + */ + @JsonProperty("singleThread") + public Boolean getSingleThread() { return singleThread; } + @JsonProperty("singleThread") + public void setSingleThread(Boolean value) { this.singleThread = value; } + + /** + * Specifies the thread for which to resume execution for one step-out (of the given + * granularity). + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestClass.java new file mode 100644 index 0000000..22f3def --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestClass.java @@ -0,0 +1,60 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request resumes the given thread to step out (return) from a function/method and + * allows all other threads to run freely by resuming them. + * If the debug adapter supports single thread execution (see capability + * `supportsSingleThreadExecutionRequests`), setting the `singleThread` argument to true + * prevents other suspended threads from resuming. + * The debug adapter first sends the response and then a `stopped` event (with reason + * `step`) after the step has completed. + */ +public class StepOutRequestClass { + private long seq; + private AttachRequestType type; + private StepOutRequestArguments arguments; + private StepOutRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public StepOutRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(StepOutRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public StepOutRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(StepOutRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestCommand.java new file mode 100644 index 0000000..60f3058 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum StepOutRequestCommand { + STEP_OUT; + + @JsonValue + public String toValue() { + switch (this) { + case STEP_OUT: return "stepOut"; + } + return null; + } + + @JsonCreator + public static StepOutRequestCommand forValue(String value) throws IOException { + if (value.equals("stepOut")) return STEP_OUT; + throw new IOException("Cannot deserialize StepOutRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutResponseClass.java new file mode 100644 index 0000000..85d66c8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StepOutResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `stepOut` request. This is just an acknowledgement, so no body field is + * required. + */ +public class StepOutResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SteppingGranularity.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SteppingGranularity.java new file mode 100644 index 0000000..794095f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/SteppingGranularity.java @@ -0,0 +1,36 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * Stepping granularity. If no granularity is specified, a granularity of `statement` is + * assumed. + * + * The granularity of one 'step' in the stepping requests `next`, `stepIn`, `stepOut`, and + * `stepBack`. + * + * Stepping granularity to step. If no granularity is specified, a granularity of + * `statement` is assumed. + */ +public enum SteppingGranularity { + INSTRUCTION, LINE, STATEMENT; + + @JsonValue + public String toValue() { + switch (this) { + case INSTRUCTION: return "instruction"; + case LINE: return "line"; + case STATEMENT: return "statement"; + } + return null; + } + + @JsonCreator + public static SteppingGranularity forValue(String value) throws IOException { + if (value.equals("instruction")) return INSTRUCTION; + if (value.equals("line")) return LINE; + if (value.equals("statement")) return STATEMENT; + throw new IOException("Cannot deserialize SteppingGranularity"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventBody.java new file mode 100644 index 0000000..bbf53dd --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventBody.java @@ -0,0 +1,84 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoppedEventBody { + private Boolean allThreadsStopped; + private String description; + private long[] hitBreakpointIDS; + private Boolean preserveFocusHint; + private String reason; + private String text; + private Long threadID; + + /** + * If `allThreadsStopped` is true, a debug adapter can announce that all threads have + * stopped. + * - The client should use this information to enable that all threads can be expanded to + * access their stacktraces. + * - If the attribute is missing or false, only the thread with the given `threadId` can be + * expanded. + */ + @JsonProperty("allThreadsStopped") + public Boolean getAllThreadsStopped() { return allThreadsStopped; } + @JsonProperty("allThreadsStopped") + public void setAllThreadsStopped(Boolean value) { this.allThreadsStopped = value; } + + /** + * The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI + * as is and can be translated. + */ + @JsonProperty("description") + public String getDescription() { return description; } + @JsonProperty("description") + public void setDescription(String value) { this.description = value; } + + /** + * Ids of the breakpoints that triggered the event. In most cases there is only a single + * breakpoint but here are some examples for multiple breakpoints: + * - Different types of breakpoints map to the same location. + * - Multiple source breakpoints get collapsed to the same instruction by the + * compiler/runtime. + * - Multiple function breakpoints with different function names map to the same location. + */ + @JsonProperty("hitBreakpointIds") + public long[] getHitBreakpointIDS() { return hitBreakpointIDS; } + @JsonProperty("hitBreakpointIds") + public void setHitBreakpointIDS(long[] value) { this.hitBreakpointIDS = value; } + + /** + * A value of true hints to the client that this event should not change the focus. + */ + @JsonProperty("preserveFocusHint") + public Boolean getPreserveFocusHint() { return preserveFocusHint; } + @JsonProperty("preserveFocusHint") + public void setPreserveFocusHint(Boolean value) { this.preserveFocusHint = value; } + + /** + * The reason for the event. + * For backward compatibility this string is shown in the UI if the `description` attribute + * is missing (but it must not be translated). + */ + @JsonProperty("reason") + public String getReason() { return reason; } + @JsonProperty("reason") + public void setReason(String value) { this.reason = value; } + + /** + * Additional information. E.g. if reason is `exception`, text contains the exception name. + * This string is shown in the UI. + */ + @JsonProperty("text") + public String getText() { return text; } + @JsonProperty("text") + public void setText(String value) { this.text = value; } + + /** + * The thread which was stopped. + */ + @JsonProperty("threadId") + public Long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(Long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventClass.java new file mode 100644 index 0000000..df5940f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventClass.java @@ -0,0 +1,58 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPEvent; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that the execution of the debuggee has stopped due to some condition. + * This can be caused by a breakpoint previously set, a stepping request has completed, by + * executing a debugger statement etc. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class StoppedEventClass implements DAPEvent { + private long seq; + private String type; + private StoppedEventBody body; + private String event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public StoppedEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(StoppedEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public String getEvent() { return event; } + @JsonProperty("event") + public void setEvent(String value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventEvent.java new file mode 100644 index 0000000..ea1f7d1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/StoppedEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum StoppedEventEvent { + STOPPED; + + @JsonValue + public String toValue() { + switch (this) { + case STOPPED: return "stopped"; + } + return null; + } + + @JsonCreator + public static StoppedEventEvent forValue(String value) throws IOException { + if (value.equals("stopped")) return STOPPED; + throw new IOException("Cannot deserialize StoppedEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateArgumentsClass.java new file mode 100644 index 0000000..136b788 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `terminate` request. + */ +public class TerminateArgumentsClass { + private Boolean restart; + + /** + * A value of true indicates that this `terminate` request is part of a restart sequence. + */ + @JsonProperty("restart") + public Boolean getRestart() { return restart; } + @JsonProperty("restart") + public void setRestart(Boolean value) { this.restart = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestArguments.java new file mode 100644 index 0000000..0210adf --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `terminate` request. + */ +public class TerminateRequestArguments { + private Boolean restart; + + /** + * A value of true indicates that this `terminate` request is part of a restart sequence. + */ + @JsonProperty("restart") + public Boolean getRestart() { return restart; } + @JsonProperty("restart") + public void setRestart(Boolean value) { this.restart = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestClass.java new file mode 100644 index 0000000..efcaa4a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestClass.java @@ -0,0 +1,64 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The `terminate` request is sent from the client to the debug adapter in order to shut + * down the debuggee gracefully. Clients should only call this request if the capability + * `supportsTerminateRequest` is true. + * Typically a debug adapter implements `terminate` by sending a software signal which the + * debuggee intercepts in order to clean things up properly before terminating itself. + * Please note that this request does not directly affect the state of the debug session: if + * the debuggee decides to veto the graceful shutdown for any reason by not terminating + * itself, then the debug session just continues. + * Clients can surface the `terminate` request as an explicit command or they can integrate + * it into a two stage Stop command that first sends `terminate` to request a graceful + * shutdown, and if that fails uses `disconnect` for a forceful shutdown. + */ +public class TerminateRequestClass { + private long seq; + private AttachRequestType type; + private TerminateRequestArguments arguments; + private TerminateRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public TerminateRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(TerminateRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public TerminateRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(TerminateRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestCommand.java new file mode 100644 index 0000000..49f83c9 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum TerminateRequestCommand { + TERMINATE; + + @JsonValue + public String toValue() { + switch (this) { + case TERMINATE: return "terminate"; + } + return null; + } + + @JsonCreator + public static TerminateRequestCommand forValue(String value) throws IOException { + if (value.equals("terminate")) return TERMINATE; + throw new IOException("Cannot deserialize TerminateRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateResponseClass.java new file mode 100644 index 0000000..5e3535e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `terminate` request. This is just an acknowledgement, so no body field is + * required. + */ +public class TerminateResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsArgumentsClass.java new file mode 100644 index 0000000..2d8370c --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsArgumentsClass.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `terminateThreads` request. + */ +public class TerminateThreadsArgumentsClass { + private long[] threadIDS; + + /** + * Ids of threads to be terminated. + */ + @JsonProperty("threadIds") + public long[] getThreadIDS() { return threadIDS; } + @JsonProperty("threadIds") + public void setThreadIDS(long[] value) { this.threadIDS = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestArguments.java new file mode 100644 index 0000000..c8f6375 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestArguments.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `terminateThreads` request. + */ +public class TerminateThreadsRequestArguments { + private long[] threadIDS; + + /** + * Ids of threads to be terminated. + */ + @JsonProperty("threadIds") + public long[] getThreadIDS() { return threadIDS; } + @JsonProperty("threadIds") + public void setThreadIDS(long[] value) { this.threadIDS = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestClass.java new file mode 100644 index 0000000..7efa65b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request terminates the threads with the given ids. + * Clients should only call this request if the corresponding capability + * `supportsTerminateThreadsRequest` is true. + */ +public class TerminateThreadsRequestClass { + private long seq; + private AttachRequestType type; + private TerminateThreadsRequestArguments arguments; + private TerminateThreadsRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public TerminateThreadsRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(TerminateThreadsRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public TerminateThreadsRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(TerminateThreadsRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestCommand.java new file mode 100644 index 0000000..77c06f3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum TerminateThreadsRequestCommand { + TERMINATE_THREADS; + + @JsonValue + public String toValue() { + switch (this) { + case TERMINATE_THREADS: return "terminateThreads"; + } + return null; + } + + @JsonCreator + public static TerminateThreadsRequestCommand forValue(String value) throws IOException { + if (value.equals("terminateThreads")) return TERMINATE_THREADS; + throw new IOException("Cannot deserialize TerminateThreadsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsResponseClass.java new file mode 100644 index 0000000..9a5461a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminateThreadsResponseClass.java @@ -0,0 +1,88 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `terminateThreads` request. This is just an acknowledgement, no body field is + * required. + */ +public class TerminateThreadsResponseClass { + private long seq; + private AttachResponseType type; + private Restart body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public Restart getBody() { return body; } + @JsonProperty("body") + public void setBody(Restart value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventBody.java new file mode 100644 index 0000000..d0b968e --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventBody.java @@ -0,0 +1,18 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class TerminatedEventBody { + private Restart restart; + + /** + * A debug adapter may set `restart` to true (or to an arbitrary object) to request that the + * client restarts the session. + * The value is not interpreted by the client and passed unmodified as an attribute + * `__restart` to the `launch` and `attach` requests. + */ + @JsonProperty("restart") + public Restart getRestart() { return restart; } + @JsonProperty("restart") + public void setRestart(Restart value) { this.restart = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventClass.java new file mode 100644 index 0000000..3a232b3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPEvent; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that debugging of the debuggee has terminated. This does **not** mean + * that the debuggee itself has exited. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class TerminatedEventClass implements DAPEvent { + private long seq; + private String type; + private TerminatedEventBody body; + private String event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public TerminatedEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(TerminatedEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public String getEvent() { return event; } + @JsonProperty("event") + public void setEvent(String value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventEvent.java new file mode 100644 index 0000000..418c062 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/TerminatedEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum TerminatedEventEvent { + TERMINATED; + + @JsonValue + public String toValue() { + switch (this) { + case TERMINATED: return "terminated"; + } + return null; + } + + @JsonCreator + public static TerminatedEventEvent forValue(String value) throws IOException { + if (value.equals("terminated")) return TERMINATED; + throw new IOException("Cannot deserialize TerminatedEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Thread.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Thread.java new file mode 100644 index 0000000..af3fbff --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Thread.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A Thread + */ +public class Thread { + private long id; + private String name; + + /** + * Unique identifier for the thread. + */ + @JsonProperty("id") + public long getID() { return id; } + @JsonProperty("id") + public void setID(long value) { this.id = value; } + + /** + * The name of the thread. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventBody.java new file mode 100644 index 0000000..8e37c36 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventBody.java @@ -0,0 +1,24 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ThreadEventBody { + private String reason; + private long threadID; + + /** + * The reason for the event. + */ + @JsonProperty("reason") + public String getReason() { return reason; } + @JsonProperty("reason") + public void setReason(String value) { this.reason = value; } + + /** + * The identifier of the thread. + */ + @JsonProperty("threadId") + public long getThreadID() { return threadID; } + @JsonProperty("threadId") + public void setThreadID(long value) { this.threadID = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventClass.java new file mode 100644 index 0000000..354bb10 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventClass.java @@ -0,0 +1,54 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A debug adapter initiated event. + * + * The event indicates that a thread has started or exited. + */ +public class ThreadEventClass { + private long seq; + private BreakpointEventType type; + private ThreadEventBody body; + private ThreadEventEvent event; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public BreakpointEventType getType() { return type; } + @JsonProperty("type") + public void setType(BreakpointEventType value) { this.type = value; } + + /** + * Event-specific information. + */ + @JsonProperty("body") + public ThreadEventBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ThreadEventBody value) { this.body = value; } + + /** + * Type of event. + */ + @JsonProperty("event") + public ThreadEventEvent getEvent() { return event; } + @JsonProperty("event") + public void setEvent(ThreadEventEvent value) { this.event = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventEvent.java new file mode 100644 index 0000000..1e27b9b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadEventEvent.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ThreadEventEvent { + THREAD; + + @JsonValue + public String toValue() { + switch (this) { + case THREAD: return "thread"; + } + return null; + } + + @JsonCreator + public static ThreadEventEvent forValue(String value) throws IOException { + if (value.equals("thread")) return THREAD; + throw new IOException("Cannot deserialize ThreadEventEvent"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsRequestClass.java new file mode 100644 index 0000000..0840b5b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsRequestClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * The request retrieves a list of all threads. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ThreadsRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private Restart arguments; + private String command = "threads"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public Restart getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(Restart value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsRequestCommand.java new file mode 100644 index 0000000..6a573b0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum ThreadsRequestCommand { + THREADS; + + @JsonValue + public String toValue() { + switch (this) { + case THREADS: return "threads"; + } + return null; + } + + @JsonCreator + public static ThreadsRequestCommand forValue(String value) throws IOException { + if (value.equals("threads")) return THREADS; + throw new IOException("Cannot deserialize ThreadsRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsResponseBody.java new file mode 100644 index 0000000..7811cc3 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class ThreadsResponseBody { + private Thread[] threads; + + /** + * All threads. + */ + @JsonProperty("threads") + public Thread[] getThreads() { return threads; } + @JsonProperty("threads") + public void setThreads(Thread[] value) { this.threads = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsResponseClass.java new file mode 100644 index 0000000..252abcb --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ThreadsResponseClass.java @@ -0,0 +1,89 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `threads` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ThreadsResponseClass implements DAPResponse { + private long seq; + private String type; + private ThreadsResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public ThreadsResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(ThreadsResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Type.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Type.java new file mode 100644 index 0000000..a4d44a0 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Type.java @@ -0,0 +1,31 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * Datatype of values in this column. Defaults to `string` if not specified. + */ +public enum Type { + BOOLEAN, NUMBER, STRING, UNIX_TIMESTAMP_UTC; + + @JsonValue + public String toValue() { + switch (this) { + case BOOLEAN: return "boolean"; + case NUMBER: return "number"; + case STRING: return "string"; + case UNIX_TIMESTAMP_UTC: return "unixTimestampUTC"; + } + return null; + } + + @JsonCreator + public static Type forValue(String value) throws IOException { + if (value.equals("boolean")) return BOOLEAN; + if (value.equals("number")) return NUMBER; + if (value.equals("string")) return STRING; + if (value.equals("unixTimestampUTC")) return UNIX_TIMESTAMP_UTC; + throw new IOException("Cannot deserialize Type"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ValueFormat.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ValueFormat.java new file mode 100644 index 0000000..9787409 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/ValueFormat.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Specifies details on how to format the result. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + * + * Provides formatting information for a value. + * + * Specifies how the resulting value should be formatted. + * + * Specifies details on how to format the response value. + * + * Specifies details on how to format the Variable values. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + */ +public class ValueFormat { + private Boolean hex; + + /** + * Display the value in hex. + */ + @JsonProperty("hex") + public Boolean getHex() { return hex; } + @JsonProperty("hex") + public void setHex(Boolean value) { this.hex = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Variable.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Variable.java new file mode 100644 index 0000000..a26abea --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/Variable.java @@ -0,0 +1,135 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * A Variable is a name/value pair. + * The `type` attribute is shown if space permits or when hovering over the variable's name. + * The `kind` attribute is used to render additional properties of the variable, e.g. + * different icons can be used to indicate that a variable is public or private. + * If the value is structured (has children), a handle is provided to retrieve the children + * with the `variables` request. + * If the number of named or indexed children is large, the numbers should be returned via + * the `namedVariables` and `indexedVariables` attributes. + * The client can use this information to present the children in a paged UI and fetch them + * in chunks. + */ +public class Variable { + private String evaluateName; + private Long indexedVariables; + private String memoryReference; + private String name; + private Long namedVariables; + private VariablePresentationHint presentationHint; + private String type; + private String value; + private long variablesReference; + + /** + * The evaluatable name of this variable which can be passed to the `evaluate` request to + * fetch the variable's value. + */ + @JsonProperty("evaluateName") + public String getEvaluateName() { return evaluateName; } + @JsonProperty("evaluateName") + public void setEvaluateName(String value) { this.evaluateName = value; } + + /** + * The number of indexed child variables. + * The client can use this information to present the children in a paged UI and fetch them + * in chunks. + */ + @JsonProperty("indexedVariables") + public Long getIndexedVariables() { return indexedVariables; } + @JsonProperty("indexedVariables") + public void setIndexedVariables(Long value) { this.indexedVariables = value; } + + /** + * A memory reference associated with this variable. + * For pointer type variables, this is generally a reference to the memory address contained + * in the pointer. + * For executable data, this reference may later be used in a `disassemble` request. + * This attribute may be returned by a debug adapter if corresponding capability + * `supportsMemoryReferences` is true. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * The variable's name. + */ + @JsonProperty("name") + public String getName() { return name; } + @JsonProperty("name") + public void setName(String value) { this.name = value; } + + /** + * The number of named child variables. + * The client can use this information to present the children in a paged UI and fetch them + * in chunks. + */ + @JsonProperty("namedVariables") + public Long getNamedVariables() { return namedVariables; } + @JsonProperty("namedVariables") + public void setNamedVariables(Long value) { this.namedVariables = value; } + + /** + * Properties of a variable that can be used to determine how to render the variable in the + * UI. + */ + @JsonProperty("presentationHint") + public VariablePresentationHint getPresentationHint() { return presentationHint; } + @JsonProperty("presentationHint") + public void setPresentationHint(VariablePresentationHint value) { this.presentationHint = value; } + + /** + * The type of the variable's value. Typically shown in the UI when hovering over the value. + * This attribute should only be returned by a debug adapter if the corresponding capability + * `supportsVariableType` is true. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * The variable's value. + * This can be a multi-line text, e.g. for a function the body of a function. + * For structured variables (which do not have a simple value), it is recommended to provide + * a one-line representation of the structured object. This helps to identify the structured + * object in the collapsed state when its children are not yet visible. + * An empty string can be used if no value should be shown in the UI. + */ + @JsonProperty("value") + public String getValue() { return value; } + @JsonProperty("value") + public void setValue(String value) { this.value = value; } + + /** + * If `variablesReference` is > 0, the variable is structured and its children can be + * retrieved by passing `variablesReference` to the `variables` request as long as execution + * remains suspended. See 'Lifetime of Object References' in the Overview section for + * details. + */ + @JsonProperty("variablesReference") + public long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(long value) { this.variablesReference = value; } + + @Override + public String toString() { + return "Variable{" + + "evaluateName='" + evaluateName + '\'' + + ", indexedVariables=" + indexedVariables + + ", memoryReference='" + memoryReference + '\'' + + ", name='" + name + '\'' + + ", namedVariables=" + namedVariables + + ", presentationHint=" + presentationHint + + ", type='" + type + '\'' + + ", value='" + value + '\'' + + ", variablesReference=" + variablesReference + + '}'; + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablePresentationHint.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablePresentationHint.java new file mode 100644 index 0000000..393ff85 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablePresentationHint.java @@ -0,0 +1,74 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +import java.util.Arrays; + +/** + * Properties of an evaluate result that can be used to determine how to render the result + * in the UI. + * + * Properties of a variable that can be used to determine how to render the variable in the + * UI. + * + * Properties of a value that can be used to determine how to render the result in the UI. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class VariablePresentationHint { + private String[] attributes; + private String kind; + private Boolean lazy; + private String visibility; + + /** + * Set of attributes represented as an array of strings. Before introducing additional + * values, try to use the listed values. + */ + @JsonProperty("attributes") + public String[] getAttributes() { return attributes; } + @JsonProperty("attributes") + public void setAttributes(String[] value) { this.attributes = value; } + + /** + * The kind of variable. Before introducing additional values, try to use the listed values. + */ + @JsonProperty("kind") + public String getKind() { return kind; } + @JsonProperty("kind") + public void setKind(String value) { this.kind = value; } + + /** + * If true, clients can present the variable with a UI that supports a specific gesture to + * trigger its evaluation. + * This mechanism can be used for properties that require executing code when retrieving + * their value and where the code execution can be expensive and/or produce side-effects. A + * typical example are properties based on a getter function. + * Please note that in addition to the `lazy` flag, the variable's `variablesReference` is + * expected to refer to a variable that will provide the value through another `variable` + * request. + */ + @JsonProperty("lazy") + public Boolean getLazy() { return lazy; } + @JsonProperty("lazy") + public void setLazy(Boolean value) { this.lazy = value; } + + /** + * Visibility of variable. Before introducing additional values, try to use the listed + * values. + */ + @JsonProperty("visibility") + public String getVisibility() { return visibility; } + @JsonProperty("visibility") + public void setVisibility(String value) { this.visibility = value; } + + @Override + public String toString() { + return "VariablePresentationHint{" + + "attributes=" + Arrays.toString(attributes) + + ", kind='" + kind + '\'' + + ", lazy=" + lazy + + ", visibility='" + visibility + '\'' + + '}'; + } +} + diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesArgumentsClass.java new file mode 100644 index 0000000..2a3bb6a --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesArgumentsClass.java @@ -0,0 +1,63 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `variables` request. + */ +public class VariablesArgumentsClass { + private Long count; + private Filter filter; + private ValueFormat format; + private Long start; + private long variablesReference; + + /** + * The number of variables to return. If count is missing or 0, all variables are returned. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsVariablePaging` is true. + */ + @JsonProperty("count") + public Long getCount() { return count; } + @JsonProperty("count") + public void setCount(Long value) { this.count = value; } + + /** + * Filter to limit the child variables to either named or indexed. If omitted, both types + * are fetched. + */ + @JsonProperty("filter") + public Filter getFilter() { return filter; } + @JsonProperty("filter") + public void setFilter(Filter value) { this.filter = value; } + + /** + * Specifies details on how to format the Variable values. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * The index of the first variable to return; if omitted children start at 0. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsVariablePaging` is true. + */ + @JsonProperty("start") + public Long getStart() { return start; } + @JsonProperty("start") + public void setStart(Long value) { this.start = value; } + + /** + * The variable for which to retrieve its children. The `variablesReference` must have been + * obtained in the current suspended state. See 'Lifetime of Object References' in the + * Overview section for details. + */ + @JsonProperty("variablesReference") + public long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestArguments.java new file mode 100644 index 0000000..31fa7bc --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestArguments.java @@ -0,0 +1,64 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `variables` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class VariablesRequestArguments { + private Long count; + private Filter filter; + private ValueFormat format; + private Long start; + private long variablesReference; + + /** + * The number of variables to return. If count is missing or 0, all variables are returned. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsVariablePaging` is true. + */ + @JsonProperty("count") + public Long getCount() { return count; } + @JsonProperty("count") + public void setCount(Long value) { this.count = value; } + + /** + * Filter to limit the child variables to either named or indexed. If omitted, both types + * are fetched. + */ + @JsonProperty("filter") + public Filter getFilter() { return filter; } + @JsonProperty("filter") + public void setFilter(Filter value) { this.filter = value; } + + /** + * Specifies details on how to format the Variable values. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsValueFormattingOptions` is true. + */ + @JsonProperty("format") + public ValueFormat getFormat() { return format; } + @JsonProperty("format") + public void setFormat(ValueFormat value) { this.format = value; } + + /** + * The index of the first variable to return; if omitted children start at 0. + * The attribute is only honored by a debug adapter if the corresponding capability + * `supportsVariablePaging` is true. + */ + @JsonProperty("start") + public Long getStart() { return start; } + @JsonProperty("start") + public void setStart(Long value) { this.start = value; } + + /** + * The variable for which to retrieve its children. The `variablesReference` must have been + * obtained in the current suspended state. See 'Lifetime of Object References' in the + * Overview section for details. + */ + @JsonProperty("variablesReference") + public long getVariablesReference() { return variablesReference; } + @JsonProperty("variablesReference") + public void setVariablesReference(long value) { this.variablesReference = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestClass.java new file mode 100644 index 0000000..76b00ff --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestClass.java @@ -0,0 +1,57 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPRequest; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Retrieves all child variables for the given variable reference. + * A filter can be used to limit the fetched children to either named or indexed children. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class VariablesRequestClass implements DAPRequest { + private long seq; + private String type = "request"; + private VariablesRequestArguments arguments; + private String command = "variables"; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public VariablesRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(VariablesRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestCommand.java new file mode 100644 index 0000000..17a68ca --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum VariablesRequestCommand { + VARIABLES; + + @JsonValue + public String toValue() { + switch (this) { + case VARIABLES: return "variables"; + } + return null; + } + + @JsonCreator + public static VariablesRequestCommand forValue(String value) throws IOException { + if (value.equals("variables")) return VARIABLES; + throw new IOException("Cannot deserialize VariablesRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesResponseBody.java new file mode 100644 index 0000000..e90bfe5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesResponseBody.java @@ -0,0 +1,15 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class VariablesResponseBody { + private Variable[] variables; + + /** + * All (or a range) of variables for the given variable reference. + */ + @JsonProperty("variables") + public Variable[] getVariables() { return variables; } + @JsonProperty("variables") + public void setVariables(Variable[] value) { this.variables = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesResponseClass.java new file mode 100644 index 0000000..d5bdd04 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/VariablesResponseClass.java @@ -0,0 +1,89 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import org.tzi.use.monitor.adapter.python.dap.custom.DAPResponse; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `variables` request. + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class VariablesResponseClass implements DAPResponse { + private long seq; + private String type; + private VariablesResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public String getType() { return type; } + @JsonProperty("type") + public void setType(String value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public VariablesResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(VariablesResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WrapperRoot.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WrapperRoot.java new file mode 100644 index 0000000..0801276 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WrapperRoot.java @@ -0,0 +1,1133 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; +import java.util.Map; + +/** + * The Debug Adapter Protocol defines the protocol used between an editor or IDE and a + * debugger or runtime. + */ +public class WrapperRoot { + private AttachRequestClass attachRequest; + private AttachRequestArgumentsClass attachRequestArguments; + private AttachResponseClass attachResponse; + private Breakpoint breakpoint; + private BreakpointEventClass breakpointEvent; + private BreakpointLocation breakpointLocation; + private BreakpointLocationsArgumentsClass breakpointLocationsArguments; + private BreakpointLocationsRequestClass breakpointLocationsRequest; + private BreakpointLocationsResponseClass breakpointLocationsResponse; + private CancelArgumentsClass cancelArguments; + private CancelRequestClass cancelRequest; + private CancelResponseClass cancelResponse; + private CapabilitiesClass capabilities; + private CapabilitiesEventClass capabilitiesEvent; + private Checksum checksum; + private ChecksumAlgorithm checksumAlgorithm; + private ColumnDescriptor columnDescriptor; + private CompletionItem completionItem; + private CompletionItemType completionItemType; + private CompletionsArgumentsClass completionsArguments; + private CompletionsRequestClass completionsRequest; + private CompletionsResponseClass completionsResponse; + private Map configurationDoneArguments; + private ConfigurationDoneRequestClass configurationDoneRequest; + private ConfigurationDoneResponseClass configurationDoneResponse; + private ContinueArgumentsClass continueArguments; + private ContinuedEventClass continuedEvent; + private ContinueRequestClass continueRequest; + private ContinueResponseClass continueResponse; + private DataBreakpoint dataBreakpoint; + private DataBreakpointAccessType dataBreakpointAccessType; + private DataBreakpointInfoArgumentsClass dataBreakpointInfoArguments; + private DataBreakpointInfoRequestClass dataBreakpointInfoRequest; + private DataBreakpointInfoResponseClass dataBreakpointInfoResponse; + private DisassembleArgumentsClass disassembleArguments; + private DisassembledInstruction disassembledInstruction; + private DisassembleRequestClass disassembleRequest; + private DisassembleResponseClass disassembleResponse; + private DisconnectArgumentsClass disconnectArguments; + private DisconnectRequestClass disconnectRequest; + private DisconnectResponseClass disconnectResponse; + private ErrorResponseClass errorResponse; + private EvaluateArgumentsClass evaluateArguments; + private EvaluateRequestClass evaluateRequest; + private EvaluateResponseClass evaluateResponse; + private Event event; + private ExceptionBreakMode exceptionBreakMode; + private ExceptionBreakpointsFilter exceptionBreakpointsFilter; + private ExceptionDetails exceptionDetails; + private ExceptionFilterOptions exceptionFilterOptions; + private ExceptionInfoArgumentsClass exceptionInfoArguments; + private ExceptionInfoRequestClass exceptionInfoRequest; + private ExceptionInfoResponseClass exceptionInfoResponse; + private ExceptionOptions exceptionOptions; + private ExceptionPathSegment exceptionPathSegment; + private ExitedEventClass exitedEvent; + private FunctionBreakpoint functionBreakpoint; + private GotoArgumentsClass gotoArguments; + private GotoRequestClass gotoRequest; + private GotoResponseClass gotoResponse; + private GotoTarget gotoTarget; + private GotoTargetsArgumentsClass gotoTargetsArguments; + private GotoTargetsRequestClass gotoTargetsRequest; + private GotoTargetsResponseClass gotoTargetsResponse; + private InitializedEventClass initializedEvent; + private InitializeRequestClass initializeRequest; + private InitializeRequestArgumentsClass initializeRequestArguments; + private InitializeResponseClass initializeResponse; + private InstructionBreakpoint instructionBreakpoint; + private String invalidatedAreas; + private InvalidatedEventClass invalidatedEvent; + private LaunchRequestClass launchRequest; + private LaunchRequestArgumentsClass launchRequestArguments; + private LaunchResponseClass launchResponse; + private LoadedSourceEventClass loadedSourceEvent; + private Map loadedSourcesArguments; + private LoadedSourcesRequestClass loadedSourcesRequest; + private LoadedSourcesResponseClass loadedSourcesResponse; + private MemoryEventClass memoryEvent; + private Message message; + private Module module; + private ModuleEventClass moduleEvent; + private ModulesArgumentsClass modulesArguments; + private ModulesRequestClass modulesRequest; + private ModulesResponseClass modulesResponse; + private NextArgumentsClass nextArguments; + private NextRequestClass nextRequest; + private NextResponseClass nextResponse; + private OutputEventClass outputEvent; + private PauseArgumentsClass pauseArguments; + private PauseRequestClass pauseRequest; + private PauseResponseClass pauseResponse; + private ProcessEventClass processEvent; + private ProgressEndEventClass progressEndEvent; + private ProgressStartEventClass progressStartEvent; + private ProgressUpdateEventClass progressUpdateEvent; + private BaseProtocol protocolMessage; + private ReadMemoryArgumentsClass readMemoryArguments; + private ReadMemoryRequestClass readMemoryRequest; + private ReadMemoryResponseClass readMemoryResponse; + private Request request; + private Response response; + private RestartArgumentsClass restartArguments; + private RestartFrameArgumentsClass restartFrameArguments; + private RestartFrameRequestClass restartFrameRequest; + private RestartFrameResponseClass restartFrameResponse; + private RestartRequestClass restartRequest; + private RestartResponseClass restartResponse; + private ReverseContinueArgumentsClass reverseContinueArguments; + private ReverseContinueRequestClass reverseContinueRequest; + private ReverseContinueResponseClass reverseContinueResponse; + private RunInTerminalRequestClass runInTerminalRequest; + private RunInTerminalRequestArgumentsClass runInTerminalRequestArguments; + private RunInTerminalResponseClass runInTerminalResponse; + private Scope scope; + private ScopesArgumentsClass scopesArguments; + private ScopesRequestClass scopesRequest; + private ScopesResponseClass scopesResponse; + private SetBreakpointsArgumentsClass setBreakpointsArguments; + private SetBreakpointsRequestClass setBreakpointsRequest; + private SetBreakpointsResponseClass setBreakpointsResponse; + private SetDataBreakpointsArgumentsClass setDataBreakpointsArguments; + private SetDataBreakpointsRequestClass setDataBreakpointsRequest; + private SetDataBreakpointsResponseClass setDataBreakpointsResponse; + private SetExceptionBreakpointsArgumentsClass setExceptionBreakpointsArguments; + private SetExceptionBreakpointsRequestClass setExceptionBreakpointsRequest; + private SetExceptionBreakpointsResponseClass setExceptionBreakpointsResponse; + private SetExpressionArgumentsClass setExpressionArguments; + private SetExpressionRequestClass setExpressionRequest; + private SetExpressionResponseClass setExpressionResponse; + private SetFunctionBreakpointsArgumentsClass setFunctionBreakpointsArguments; + private SetFunctionBreakpointsRequestClass setFunctionBreakpointsRequest; + private SetFunctionBreakpointsResponseClass setFunctionBreakpointsResponse; + private SetInstructionBreakpointsArgumentsClass setInstructionBreakpointsArguments; + private SetInstructionBreakpointsRequestClass setInstructionBreakpointsRequest; + private SetInstructionBreakpointsResponseClass setInstructionBreakpointsResponse; + private SetVariableArgumentsClass setVariableArguments; + private SetVariableRequestClass setVariableRequest; + private SetVariableResponseClass setVariableResponse; + private Source source; + private SourceArgumentsClass sourceArguments; + private SourceBreakpoint sourceBreakpoint; + private SourceRequestClass sourceRequest; + private SourceResponseClass sourceResponse; + private StackFrame stackFrame; + private StackFrameFormat stackFrameFormat; + private StackTraceArgumentsClass stackTraceArguments; + private StackTraceRequestClass stackTraceRequest; + private StackTraceResponseClass stackTraceResponse; + private StartDebuggingRequestClass startDebuggingRequest; + private StartDebuggingRequestArgumentsClass startDebuggingRequestArguments; + private StartDebuggingResponseClass startDebuggingResponse; + private StepBackArgumentsClass stepBackArguments; + private StepBackRequestClass stepBackRequest; + private StepBackResponseClass stepBackResponse; + private StepInArgumentsClass stepInArguments; + private StepInRequestClass stepInRequest; + private StepInResponseClass stepInResponse; + private StepInTarget stepInTarget; + private StepInTargetsArgumentsClass stepInTargetsArguments; + private StepInTargetsRequestClass stepInTargetsRequest; + private StepInTargetsResponseClass stepInTargetsResponse; + private StepOutArgumentsClass stepOutArguments; + private StepOutRequestClass stepOutRequest; + private StepOutResponseClass stepOutResponse; + private SteppingGranularity steppingGranularity; + private StoppedEventClass stoppedEvent; + private TerminateArgumentsClass terminateArguments; + private TerminatedEventClass terminatedEvent; + private TerminateRequestClass terminateRequest; + private TerminateResponseClass terminateResponse; + private TerminateThreadsArgumentsClass terminateThreadsArguments; + private TerminateThreadsRequestClass terminateThreadsRequest; + private TerminateThreadsResponseClass terminateThreadsResponse; + private Thread thread; + private ThreadEventClass threadEvent; + private ThreadsRequestClass threadsRequest; + private ThreadsResponseClass threadsResponse; + private ValueFormat valueFormat; + private Variable variable; + private VariablePresentationHint variablePresentationHint; + private VariablesArgumentsClass variablesArguments; + private VariablesRequestClass variablesRequest; + private VariablesResponseClass variablesResponse; + private WriteMemoryArgumentsClass writeMemoryArguments; + private WriteMemoryRequestClass writeMemoryRequest; + private WriteMemoryResponseClass writeMemoryResponse; + + @JsonProperty("AttachRequest") + public AttachRequestClass getAttachRequest() { return attachRequest; } + @JsonProperty("AttachRequest") + public void setAttachRequest(AttachRequestClass value) { this.attachRequest = value; } + + @JsonProperty("AttachRequestArguments") + public AttachRequestArgumentsClass getAttachRequestArguments() { return attachRequestArguments; } + @JsonProperty("AttachRequestArguments") + public void setAttachRequestArguments(AttachRequestArgumentsClass value) { this.attachRequestArguments = value; } + + @JsonProperty("AttachResponse") + public AttachResponseClass getAttachResponse() { return attachResponse; } + @JsonProperty("AttachResponse") + public void setAttachResponse(AttachResponseClass value) { this.attachResponse = value; } + + @JsonProperty("Breakpoint") + public Breakpoint getBreakpoint() { return breakpoint; } + @JsonProperty("Breakpoint") + public void setBreakpoint(Breakpoint value) { this.breakpoint = value; } + + @JsonProperty("BreakpointEvent") + public BreakpointEventClass getBreakpointEvent() { return breakpointEvent; } + @JsonProperty("BreakpointEvent") + public void setBreakpointEvent(BreakpointEventClass value) { this.breakpointEvent = value; } + + @JsonProperty("BreakpointLocation") + public BreakpointLocation getBreakpointLocation() { return breakpointLocation; } + @JsonProperty("BreakpointLocation") + public void setBreakpointLocation(BreakpointLocation value) { this.breakpointLocation = value; } + + @JsonProperty("BreakpointLocationsArguments") + public BreakpointLocationsArgumentsClass getBreakpointLocationsArguments() { return breakpointLocationsArguments; } + @JsonProperty("BreakpointLocationsArguments") + public void setBreakpointLocationsArguments(BreakpointLocationsArgumentsClass value) { this.breakpointLocationsArguments = value; } + + @JsonProperty("BreakpointLocationsRequest") + public BreakpointLocationsRequestClass getBreakpointLocationsRequest() { return breakpointLocationsRequest; } + @JsonProperty("BreakpointLocationsRequest") + public void setBreakpointLocationsRequest(BreakpointLocationsRequestClass value) { this.breakpointLocationsRequest = value; } + + @JsonProperty("BreakpointLocationsResponse") + public BreakpointLocationsResponseClass getBreakpointLocationsResponse() { return breakpointLocationsResponse; } + @JsonProperty("BreakpointLocationsResponse") + public void setBreakpointLocationsResponse(BreakpointLocationsResponseClass value) { this.breakpointLocationsResponse = value; } + + @JsonProperty("CancelArguments") + public CancelArgumentsClass getCancelArguments() { return cancelArguments; } + @JsonProperty("CancelArguments") + public void setCancelArguments(CancelArgumentsClass value) { this.cancelArguments = value; } + + @JsonProperty("CancelRequest") + public CancelRequestClass getCancelRequest() { return cancelRequest; } + @JsonProperty("CancelRequest") + public void setCancelRequest(CancelRequestClass value) { this.cancelRequest = value; } + + @JsonProperty("CancelResponse") + public CancelResponseClass getCancelResponse() { return cancelResponse; } + @JsonProperty("CancelResponse") + public void setCancelResponse(CancelResponseClass value) { this.cancelResponse = value; } + + @JsonProperty("Capabilities") + public CapabilitiesClass getCapabilities() { return capabilities; } + @JsonProperty("Capabilities") + public void setCapabilities(CapabilitiesClass value) { this.capabilities = value; } + + @JsonProperty("CapabilitiesEvent") + public CapabilitiesEventClass getCapabilitiesEvent() { return capabilitiesEvent; } + @JsonProperty("CapabilitiesEvent") + public void setCapabilitiesEvent(CapabilitiesEventClass value) { this.capabilitiesEvent = value; } + + @JsonProperty("Checksum") + public Checksum getChecksum() { return checksum; } + @JsonProperty("Checksum") + public void setChecksum(Checksum value) { this.checksum = value; } + + @JsonProperty("ChecksumAlgorithm") + public ChecksumAlgorithm getChecksumAlgorithm() { return checksumAlgorithm; } + @JsonProperty("ChecksumAlgorithm") + public void setChecksumAlgorithm(ChecksumAlgorithm value) { this.checksumAlgorithm = value; } + + @JsonProperty("ColumnDescriptor") + public ColumnDescriptor getColumnDescriptor() { return columnDescriptor; } + @JsonProperty("ColumnDescriptor") + public void setColumnDescriptor(ColumnDescriptor value) { this.columnDescriptor = value; } + + @JsonProperty("CompletionItem") + public CompletionItem getCompletionItem() { return completionItem; } + @JsonProperty("CompletionItem") + public void setCompletionItem(CompletionItem value) { this.completionItem = value; } + + @JsonProperty("CompletionItemType") + public CompletionItemType getCompletionItemType() { return completionItemType; } + @JsonProperty("CompletionItemType") + public void setCompletionItemType(CompletionItemType value) { this.completionItemType = value; } + + @JsonProperty("CompletionsArguments") + public CompletionsArgumentsClass getCompletionsArguments() { return completionsArguments; } + @JsonProperty("CompletionsArguments") + public void setCompletionsArguments(CompletionsArgumentsClass value) { this.completionsArguments = value; } + + @JsonProperty("CompletionsRequest") + public CompletionsRequestClass getCompletionsRequest() { return completionsRequest; } + @JsonProperty("CompletionsRequest") + public void setCompletionsRequest(CompletionsRequestClass value) { this.completionsRequest = value; } + + @JsonProperty("CompletionsResponse") + public CompletionsResponseClass getCompletionsResponse() { return completionsResponse; } + @JsonProperty("CompletionsResponse") + public void setCompletionsResponse(CompletionsResponseClass value) { this.completionsResponse = value; } + + @JsonProperty("ConfigurationDoneArguments") + public Map getConfigurationDoneArguments() { return configurationDoneArguments; } + @JsonProperty("ConfigurationDoneArguments") + public void setConfigurationDoneArguments(Map value) { this.configurationDoneArguments = value; } + + @JsonProperty("ConfigurationDoneRequest") + public ConfigurationDoneRequestClass getConfigurationDoneRequest() { return configurationDoneRequest; } + @JsonProperty("ConfigurationDoneRequest") + public void setConfigurationDoneRequest(ConfigurationDoneRequestClass value) { this.configurationDoneRequest = value; } + + @JsonProperty("ConfigurationDoneResponse") + public ConfigurationDoneResponseClass getConfigurationDoneResponse() { return configurationDoneResponse; } + @JsonProperty("ConfigurationDoneResponse") + public void setConfigurationDoneResponse(ConfigurationDoneResponseClass value) { this.configurationDoneResponse = value; } + + @JsonProperty("ContinueArguments") + public ContinueArgumentsClass getContinueArguments() { return continueArguments; } + @JsonProperty("ContinueArguments") + public void setContinueArguments(ContinueArgumentsClass value) { this.continueArguments = value; } + + @JsonProperty("ContinuedEvent") + public ContinuedEventClass getContinuedEvent() { return continuedEvent; } + @JsonProperty("ContinuedEvent") + public void setContinuedEvent(ContinuedEventClass value) { this.continuedEvent = value; } + + @JsonProperty("ContinueRequest") + public ContinueRequestClass getContinueRequest() { return continueRequest; } + @JsonProperty("ContinueRequest") + public void setContinueRequest(ContinueRequestClass value) { this.continueRequest = value; } + + @JsonProperty("ContinueResponse") + public ContinueResponseClass getContinueResponse() { return continueResponse; } + @JsonProperty("ContinueResponse") + public void setContinueResponse(ContinueResponseClass value) { this.continueResponse = value; } + + @JsonProperty("DataBreakpoint") + public DataBreakpoint getDataBreakpoint() { return dataBreakpoint; } + @JsonProperty("DataBreakpoint") + public void setDataBreakpoint(DataBreakpoint value) { this.dataBreakpoint = value; } + + @JsonProperty("DataBreakpointAccessType") + public DataBreakpointAccessType getDataBreakpointAccessType() { return dataBreakpointAccessType; } + @JsonProperty("DataBreakpointAccessType") + public void setDataBreakpointAccessType(DataBreakpointAccessType value) { this.dataBreakpointAccessType = value; } + + @JsonProperty("DataBreakpointInfoArguments") + public DataBreakpointInfoArgumentsClass getDataBreakpointInfoArguments() { return dataBreakpointInfoArguments; } + @JsonProperty("DataBreakpointInfoArguments") + public void setDataBreakpointInfoArguments(DataBreakpointInfoArgumentsClass value) { this.dataBreakpointInfoArguments = value; } + + @JsonProperty("DataBreakpointInfoRequest") + public DataBreakpointInfoRequestClass getDataBreakpointInfoRequest() { return dataBreakpointInfoRequest; } + @JsonProperty("DataBreakpointInfoRequest") + public void setDataBreakpointInfoRequest(DataBreakpointInfoRequestClass value) { this.dataBreakpointInfoRequest = value; } + + @JsonProperty("DataBreakpointInfoResponse") + public DataBreakpointInfoResponseClass getDataBreakpointInfoResponse() { return dataBreakpointInfoResponse; } + @JsonProperty("DataBreakpointInfoResponse") + public void setDataBreakpointInfoResponse(DataBreakpointInfoResponseClass value) { this.dataBreakpointInfoResponse = value; } + + @JsonProperty("DisassembleArguments") + public DisassembleArgumentsClass getDisassembleArguments() { return disassembleArguments; } + @JsonProperty("DisassembleArguments") + public void setDisassembleArguments(DisassembleArgumentsClass value) { this.disassembleArguments = value; } + + @JsonProperty("DisassembledInstruction") + public DisassembledInstruction getDisassembledInstruction() { return disassembledInstruction; } + @JsonProperty("DisassembledInstruction") + public void setDisassembledInstruction(DisassembledInstruction value) { this.disassembledInstruction = value; } + + @JsonProperty("DisassembleRequest") + public DisassembleRequestClass getDisassembleRequest() { return disassembleRequest; } + @JsonProperty("DisassembleRequest") + public void setDisassembleRequest(DisassembleRequestClass value) { this.disassembleRequest = value; } + + @JsonProperty("DisassembleResponse") + public DisassembleResponseClass getDisassembleResponse() { return disassembleResponse; } + @JsonProperty("DisassembleResponse") + public void setDisassembleResponse(DisassembleResponseClass value) { this.disassembleResponse = value; } + + @JsonProperty("DisconnectArguments") + public DisconnectArgumentsClass getDisconnectArguments() { return disconnectArguments; } + @JsonProperty("DisconnectArguments") + public void setDisconnectArguments(DisconnectArgumentsClass value) { this.disconnectArguments = value; } + + @JsonProperty("DisconnectRequest") + public DisconnectRequestClass getDisconnectRequest() { return disconnectRequest; } + @JsonProperty("DisconnectRequest") + public void setDisconnectRequest(DisconnectRequestClass value) { this.disconnectRequest = value; } + + @JsonProperty("DisconnectResponse") + public DisconnectResponseClass getDisconnectResponse() { return disconnectResponse; } + @JsonProperty("DisconnectResponse") + public void setDisconnectResponse(DisconnectResponseClass value) { this.disconnectResponse = value; } + + @JsonProperty("ErrorResponse") + public ErrorResponseClass getErrorResponse() { return errorResponse; } + @JsonProperty("ErrorResponse") + public void setErrorResponse(ErrorResponseClass value) { this.errorResponse = value; } + + @JsonProperty("EvaluateArguments") + public EvaluateArgumentsClass getEvaluateArguments() { return evaluateArguments; } + @JsonProperty("EvaluateArguments") + public void setEvaluateArguments(EvaluateArgumentsClass value) { this.evaluateArguments = value; } + + @JsonProperty("EvaluateRequest") + public EvaluateRequestClass getEvaluateRequest() { return evaluateRequest; } + @JsonProperty("EvaluateRequest") + public void setEvaluateRequest(EvaluateRequestClass value) { this.evaluateRequest = value; } + + @JsonProperty("EvaluateResponse") + public EvaluateResponseClass getEvaluateResponse() { return evaluateResponse; } + @JsonProperty("EvaluateResponse") + public void setEvaluateResponse(EvaluateResponseClass value) { this.evaluateResponse = value; } + + @JsonProperty("Event") + public Event getEvent() { return event; } + @JsonProperty("Event") + public void setEvent(Event value) { this.event = value; } + + @JsonProperty("ExceptionBreakMode") + public ExceptionBreakMode getExceptionBreakMode() { return exceptionBreakMode; } + @JsonProperty("ExceptionBreakMode") + public void setExceptionBreakMode(ExceptionBreakMode value) { this.exceptionBreakMode = value; } + + @JsonProperty("ExceptionBreakpointsFilter") + public ExceptionBreakpointsFilter getExceptionBreakpointsFilter() { return exceptionBreakpointsFilter; } + @JsonProperty("ExceptionBreakpointsFilter") + public void setExceptionBreakpointsFilter(ExceptionBreakpointsFilter value) { this.exceptionBreakpointsFilter = value; } + + @JsonProperty("ExceptionDetails") + public ExceptionDetails getExceptionDetails() { return exceptionDetails; } + @JsonProperty("ExceptionDetails") + public void setExceptionDetails(ExceptionDetails value) { this.exceptionDetails = value; } + + @JsonProperty("ExceptionFilterOptions") + public ExceptionFilterOptions getExceptionFilterOptions() { return exceptionFilterOptions; } + @JsonProperty("ExceptionFilterOptions") + public void setExceptionFilterOptions(ExceptionFilterOptions value) { this.exceptionFilterOptions = value; } + + @JsonProperty("ExceptionInfoArguments") + public ExceptionInfoArgumentsClass getExceptionInfoArguments() { return exceptionInfoArguments; } + @JsonProperty("ExceptionInfoArguments") + public void setExceptionInfoArguments(ExceptionInfoArgumentsClass value) { this.exceptionInfoArguments = value; } + + @JsonProperty("ExceptionInfoRequest") + public ExceptionInfoRequestClass getExceptionInfoRequest() { return exceptionInfoRequest; } + @JsonProperty("ExceptionInfoRequest") + public void setExceptionInfoRequest(ExceptionInfoRequestClass value) { this.exceptionInfoRequest = value; } + + @JsonProperty("ExceptionInfoResponse") + public ExceptionInfoResponseClass getExceptionInfoResponse() { return exceptionInfoResponse; } + @JsonProperty("ExceptionInfoResponse") + public void setExceptionInfoResponse(ExceptionInfoResponseClass value) { this.exceptionInfoResponse = value; } + + @JsonProperty("ExceptionOptions") + public ExceptionOptions getExceptionOptions() { return exceptionOptions; } + @JsonProperty("ExceptionOptions") + public void setExceptionOptions(ExceptionOptions value) { this.exceptionOptions = value; } + + @JsonProperty("ExceptionPathSegment") + public ExceptionPathSegment getExceptionPathSegment() { return exceptionPathSegment; } + @JsonProperty("ExceptionPathSegment") + public void setExceptionPathSegment(ExceptionPathSegment value) { this.exceptionPathSegment = value; } + + @JsonProperty("ExitedEvent") + public ExitedEventClass getExitedEvent() { return exitedEvent; } + @JsonProperty("ExitedEvent") + public void setExitedEvent(ExitedEventClass value) { this.exitedEvent = value; } + + @JsonProperty("FunctionBreakpoint") + public FunctionBreakpoint getFunctionBreakpoint() { return functionBreakpoint; } + @JsonProperty("FunctionBreakpoint") + public void setFunctionBreakpoint(FunctionBreakpoint value) { this.functionBreakpoint = value; } + + @JsonProperty("GotoArguments") + public GotoArgumentsClass getGotoArguments() { return gotoArguments; } + @JsonProperty("GotoArguments") + public void setGotoArguments(GotoArgumentsClass value) { this.gotoArguments = value; } + + @JsonProperty("GotoRequest") + public GotoRequestClass getGotoRequest() { return gotoRequest; } + @JsonProperty("GotoRequest") + public void setGotoRequest(GotoRequestClass value) { this.gotoRequest = value; } + + @JsonProperty("GotoResponse") + public GotoResponseClass getGotoResponse() { return gotoResponse; } + @JsonProperty("GotoResponse") + public void setGotoResponse(GotoResponseClass value) { this.gotoResponse = value; } + + @JsonProperty("GotoTarget") + public GotoTarget getGotoTarget() { return gotoTarget; } + @JsonProperty("GotoTarget") + public void setGotoTarget(GotoTarget value) { this.gotoTarget = value; } + + @JsonProperty("GotoTargetsArguments") + public GotoTargetsArgumentsClass getGotoTargetsArguments() { return gotoTargetsArguments; } + @JsonProperty("GotoTargetsArguments") + public void setGotoTargetsArguments(GotoTargetsArgumentsClass value) { this.gotoTargetsArguments = value; } + + @JsonProperty("GotoTargetsRequest") + public GotoTargetsRequestClass getGotoTargetsRequest() { return gotoTargetsRequest; } + @JsonProperty("GotoTargetsRequest") + public void setGotoTargetsRequest(GotoTargetsRequestClass value) { this.gotoTargetsRequest = value; } + + @JsonProperty("GotoTargetsResponse") + public GotoTargetsResponseClass getGotoTargetsResponse() { return gotoTargetsResponse; } + @JsonProperty("GotoTargetsResponse") + public void setGotoTargetsResponse(GotoTargetsResponseClass value) { this.gotoTargetsResponse = value; } + + @JsonProperty("InitializedEvent") + public InitializedEventClass getInitializedEvent() { return initializedEvent; } + @JsonProperty("InitializedEvent") + public void setInitializedEvent(InitializedEventClass value) { this.initializedEvent = value; } + + @JsonProperty("InitializeRequest") + public InitializeRequestClass getInitializeRequest() { return initializeRequest; } + @JsonProperty("InitializeRequest") + public void setInitializeRequest(InitializeRequestClass value) { this.initializeRequest = value; } + + @JsonProperty("InitializeRequestArguments") + public InitializeRequestArgumentsClass getInitializeRequestArguments() { return initializeRequestArguments; } + @JsonProperty("InitializeRequestArguments") + public void setInitializeRequestArguments(InitializeRequestArgumentsClass value) { this.initializeRequestArguments = value; } + + @JsonProperty("InitializeResponse") + public InitializeResponseClass getInitializeResponse() { return initializeResponse; } + @JsonProperty("InitializeResponse") + public void setInitializeResponse(InitializeResponseClass value) { this.initializeResponse = value; } + + @JsonProperty("InstructionBreakpoint") + public InstructionBreakpoint getInstructionBreakpoint() { return instructionBreakpoint; } + @JsonProperty("InstructionBreakpoint") + public void setInstructionBreakpoint(InstructionBreakpoint value) { this.instructionBreakpoint = value; } + + @JsonProperty("InvalidatedAreas") + public String getInvalidatedAreas() { return invalidatedAreas; } + @JsonProperty("InvalidatedAreas") + public void setInvalidatedAreas(String value) { this.invalidatedAreas = value; } + + @JsonProperty("InvalidatedEvent") + public InvalidatedEventClass getInvalidatedEvent() { return invalidatedEvent; } + @JsonProperty("InvalidatedEvent") + public void setInvalidatedEvent(InvalidatedEventClass value) { this.invalidatedEvent = value; } + + @JsonProperty("LaunchRequest") + public LaunchRequestClass getLaunchRequest() { return launchRequest; } + @JsonProperty("LaunchRequest") + public void setLaunchRequest(LaunchRequestClass value) { this.launchRequest = value; } + + @JsonProperty("LaunchRequestArguments") + public LaunchRequestArgumentsClass getLaunchRequestArguments() { return launchRequestArguments; } + @JsonProperty("LaunchRequestArguments") + public void setLaunchRequestArguments(LaunchRequestArgumentsClass value) { this.launchRequestArguments = value; } + + @JsonProperty("LaunchResponse") + public LaunchResponseClass getLaunchResponse() { return launchResponse; } + @JsonProperty("LaunchResponse") + public void setLaunchResponse(LaunchResponseClass value) { this.launchResponse = value; } + + @JsonProperty("LoadedSourceEvent") + public LoadedSourceEventClass getLoadedSourceEvent() { return loadedSourceEvent; } + @JsonProperty("LoadedSourceEvent") + public void setLoadedSourceEvent(LoadedSourceEventClass value) { this.loadedSourceEvent = value; } + + @JsonProperty("LoadedSourcesArguments") + public Map getLoadedSourcesArguments() { return loadedSourcesArguments; } + @JsonProperty("LoadedSourcesArguments") + public void setLoadedSourcesArguments(Map value) { this.loadedSourcesArguments = value; } + + @JsonProperty("LoadedSourcesRequest") + public LoadedSourcesRequestClass getLoadedSourcesRequest() { return loadedSourcesRequest; } + @JsonProperty("LoadedSourcesRequest") + public void setLoadedSourcesRequest(LoadedSourcesRequestClass value) { this.loadedSourcesRequest = value; } + + @JsonProperty("LoadedSourcesResponse") + public LoadedSourcesResponseClass getLoadedSourcesResponse() { return loadedSourcesResponse; } + @JsonProperty("LoadedSourcesResponse") + public void setLoadedSourcesResponse(LoadedSourcesResponseClass value) { this.loadedSourcesResponse = value; } + + @JsonProperty("MemoryEvent") + public MemoryEventClass getMemoryEvent() { return memoryEvent; } + @JsonProperty("MemoryEvent") + public void setMemoryEvent(MemoryEventClass value) { this.memoryEvent = value; } + + @JsonProperty("Message") + public Message getMessage() { return message; } + @JsonProperty("Message") + public void setMessage(Message value) { this.message = value; } + + @JsonProperty("Module") + public Module getModule() { return module; } + @JsonProperty("Module") + public void setModule(Module value) { this.module = value; } + + @JsonProperty("ModuleEvent") + public ModuleEventClass getModuleEvent() { return moduleEvent; } + @JsonProperty("ModuleEvent") + public void setModuleEvent(ModuleEventClass value) { this.moduleEvent = value; } + + @JsonProperty("ModulesArguments") + public ModulesArgumentsClass getModulesArguments() { return modulesArguments; } + @JsonProperty("ModulesArguments") + public void setModulesArguments(ModulesArgumentsClass value) { this.modulesArguments = value; } + + @JsonProperty("ModulesRequest") + public ModulesRequestClass getModulesRequest() { return modulesRequest; } + @JsonProperty("ModulesRequest") + public void setModulesRequest(ModulesRequestClass value) { this.modulesRequest = value; } + + @JsonProperty("ModulesResponse") + public ModulesResponseClass getModulesResponse() { return modulesResponse; } + @JsonProperty("ModulesResponse") + public void setModulesResponse(ModulesResponseClass value) { this.modulesResponse = value; } + + @JsonProperty("NextArguments") + public NextArgumentsClass getNextArguments() { return nextArguments; } + @JsonProperty("NextArguments") + public void setNextArguments(NextArgumentsClass value) { this.nextArguments = value; } + + @JsonProperty("NextRequest") + public NextRequestClass getNextRequest() { return nextRequest; } + @JsonProperty("NextRequest") + public void setNextRequest(NextRequestClass value) { this.nextRequest = value; } + + @JsonProperty("NextResponse") + public NextResponseClass getNextResponse() { return nextResponse; } + @JsonProperty("NextResponse") + public void setNextResponse(NextResponseClass value) { this.nextResponse = value; } + + @JsonProperty("OutputEvent") + public OutputEventClass getOutputEvent() { return outputEvent; } + @JsonProperty("OutputEvent") + public void setOutputEvent(OutputEventClass value) { this.outputEvent = value; } + + @JsonProperty("PauseArguments") + public PauseArgumentsClass getPauseArguments() { return pauseArguments; } + @JsonProperty("PauseArguments") + public void setPauseArguments(PauseArgumentsClass value) { this.pauseArguments = value; } + + @JsonProperty("PauseRequest") + public PauseRequestClass getPauseRequest() { return pauseRequest; } + @JsonProperty("PauseRequest") + public void setPauseRequest(PauseRequestClass value) { this.pauseRequest = value; } + + @JsonProperty("PauseResponse") + public PauseResponseClass getPauseResponse() { return pauseResponse; } + @JsonProperty("PauseResponse") + public void setPauseResponse(PauseResponseClass value) { this.pauseResponse = value; } + + @JsonProperty("ProcessEvent") + public ProcessEventClass getProcessEvent() { return processEvent; } + @JsonProperty("ProcessEvent") + public void setProcessEvent(ProcessEventClass value) { this.processEvent = value; } + + @JsonProperty("ProgressEndEvent") + public ProgressEndEventClass getProgressEndEvent() { return progressEndEvent; } + @JsonProperty("ProgressEndEvent") + public void setProgressEndEvent(ProgressEndEventClass value) { this.progressEndEvent = value; } + + @JsonProperty("ProgressStartEvent") + public ProgressStartEventClass getProgressStartEvent() { return progressStartEvent; } + @JsonProperty("ProgressStartEvent") + public void setProgressStartEvent(ProgressStartEventClass value) { this.progressStartEvent = value; } + + @JsonProperty("ProgressUpdateEvent") + public ProgressUpdateEventClass getProgressUpdateEvent() { return progressUpdateEvent; } + @JsonProperty("ProgressUpdateEvent") + public void setProgressUpdateEvent(ProgressUpdateEventClass value) { this.progressUpdateEvent = value; } + + @JsonProperty("ProtocolMessage") + public BaseProtocol getProtocolMessage() { return protocolMessage; } + @JsonProperty("ProtocolMessage") + public void setProtocolMessage(BaseProtocol value) { this.protocolMessage = value; } + + @JsonProperty("ReadMemoryArguments") + public ReadMemoryArgumentsClass getReadMemoryArguments() { return readMemoryArguments; } + @JsonProperty("ReadMemoryArguments") + public void setReadMemoryArguments(ReadMemoryArgumentsClass value) { this.readMemoryArguments = value; } + + @JsonProperty("ReadMemoryRequest") + public ReadMemoryRequestClass getReadMemoryRequest() { return readMemoryRequest; } + @JsonProperty("ReadMemoryRequest") + public void setReadMemoryRequest(ReadMemoryRequestClass value) { this.readMemoryRequest = value; } + + @JsonProperty("ReadMemoryResponse") + public ReadMemoryResponseClass getReadMemoryResponse() { return readMemoryResponse; } + @JsonProperty("ReadMemoryResponse") + public void setReadMemoryResponse(ReadMemoryResponseClass value) { this.readMemoryResponse = value; } + + @JsonProperty("Request") + public Request getRequest() { return request; } + @JsonProperty("Request") + public void setRequest(Request value) { this.request = value; } + + @JsonProperty("Response") + public Response getResponse() { return response; } + @JsonProperty("Response") + public void setResponse(Response value) { this.response = value; } + + @JsonProperty("RestartArguments") + public RestartArgumentsClass getRestartArguments() { return restartArguments; } + @JsonProperty("RestartArguments") + public void setRestartArguments(RestartArgumentsClass value) { this.restartArguments = value; } + + @JsonProperty("RestartFrameArguments") + public RestartFrameArgumentsClass getRestartFrameArguments() { return restartFrameArguments; } + @JsonProperty("RestartFrameArguments") + public void setRestartFrameArguments(RestartFrameArgumentsClass value) { this.restartFrameArguments = value; } + + @JsonProperty("RestartFrameRequest") + public RestartFrameRequestClass getRestartFrameRequest() { return restartFrameRequest; } + @JsonProperty("RestartFrameRequest") + public void setRestartFrameRequest(RestartFrameRequestClass value) { this.restartFrameRequest = value; } + + @JsonProperty("RestartFrameResponse") + public RestartFrameResponseClass getRestartFrameResponse() { return restartFrameResponse; } + @JsonProperty("RestartFrameResponse") + public void setRestartFrameResponse(RestartFrameResponseClass value) { this.restartFrameResponse = value; } + + @JsonProperty("RestartRequest") + public RestartRequestClass getRestartRequest() { return restartRequest; } + @JsonProperty("RestartRequest") + public void setRestartRequest(RestartRequestClass value) { this.restartRequest = value; } + + @JsonProperty("RestartResponse") + public RestartResponseClass getRestartResponse() { return restartResponse; } + @JsonProperty("RestartResponse") + public void setRestartResponse(RestartResponseClass value) { this.restartResponse = value; } + + @JsonProperty("ReverseContinueArguments") + public ReverseContinueArgumentsClass getReverseContinueArguments() { return reverseContinueArguments; } + @JsonProperty("ReverseContinueArguments") + public void setReverseContinueArguments(ReverseContinueArgumentsClass value) { this.reverseContinueArguments = value; } + + @JsonProperty("ReverseContinueRequest") + public ReverseContinueRequestClass getReverseContinueRequest() { return reverseContinueRequest; } + @JsonProperty("ReverseContinueRequest") + public void setReverseContinueRequest(ReverseContinueRequestClass value) { this.reverseContinueRequest = value; } + + @JsonProperty("ReverseContinueResponse") + public ReverseContinueResponseClass getReverseContinueResponse() { return reverseContinueResponse; } + @JsonProperty("ReverseContinueResponse") + public void setReverseContinueResponse(ReverseContinueResponseClass value) { this.reverseContinueResponse = value; } + + @JsonProperty("RunInTerminalRequest") + public RunInTerminalRequestClass getRunInTerminalRequest() { return runInTerminalRequest; } + @JsonProperty("RunInTerminalRequest") + public void setRunInTerminalRequest(RunInTerminalRequestClass value) { this.runInTerminalRequest = value; } + + @JsonProperty("RunInTerminalRequestArguments") + public RunInTerminalRequestArgumentsClass getRunInTerminalRequestArguments() { return runInTerminalRequestArguments; } + @JsonProperty("RunInTerminalRequestArguments") + public void setRunInTerminalRequestArguments(RunInTerminalRequestArgumentsClass value) { this.runInTerminalRequestArguments = value; } + + @JsonProperty("RunInTerminalResponse") + public RunInTerminalResponseClass getRunInTerminalResponse() { return runInTerminalResponse; } + @JsonProperty("RunInTerminalResponse") + public void setRunInTerminalResponse(RunInTerminalResponseClass value) { this.runInTerminalResponse = value; } + + @JsonProperty("Scope") + public Scope getScope() { return scope; } + @JsonProperty("Scope") + public void setScope(Scope value) { this.scope = value; } + + @JsonProperty("ScopesArguments") + public ScopesArgumentsClass getScopesArguments() { return scopesArguments; } + @JsonProperty("ScopesArguments") + public void setScopesArguments(ScopesArgumentsClass value) { this.scopesArguments = value; } + + @JsonProperty("ScopesRequest") + public ScopesRequestClass getScopesRequest() { return scopesRequest; } + @JsonProperty("ScopesRequest") + public void setScopesRequest(ScopesRequestClass value) { this.scopesRequest = value; } + + @JsonProperty("ScopesResponse") + public ScopesResponseClass getScopesResponse() { return scopesResponse; } + @JsonProperty("ScopesResponse") + public void setScopesResponse(ScopesResponseClass value) { this.scopesResponse = value; } + + @JsonProperty("SetBreakpointsArguments") + public SetBreakpointsArgumentsClass getSetBreakpointsArguments() { return setBreakpointsArguments; } + @JsonProperty("SetBreakpointsArguments") + public void setSetBreakpointsArguments(SetBreakpointsArgumentsClass value) { this.setBreakpointsArguments = value; } + + @JsonProperty("SetBreakpointsRequest") + public SetBreakpointsRequestClass getSetBreakpointsRequest() { return setBreakpointsRequest; } + @JsonProperty("SetBreakpointsRequest") + public void setSetBreakpointsRequest(SetBreakpointsRequestClass value) { this.setBreakpointsRequest = value; } + + @JsonProperty("SetBreakpointsResponse") + public SetBreakpointsResponseClass getSetBreakpointsResponse() { return setBreakpointsResponse; } + @JsonProperty("SetBreakpointsResponse") + public void setSetBreakpointsResponse(SetBreakpointsResponseClass value) { this.setBreakpointsResponse = value; } + + @JsonProperty("SetDataBreakpointsArguments") + public SetDataBreakpointsArgumentsClass getSetDataBreakpointsArguments() { return setDataBreakpointsArguments; } + @JsonProperty("SetDataBreakpointsArguments") + public void setSetDataBreakpointsArguments(SetDataBreakpointsArgumentsClass value) { this.setDataBreakpointsArguments = value; } + + @JsonProperty("SetDataBreakpointsRequest") + public SetDataBreakpointsRequestClass getSetDataBreakpointsRequest() { return setDataBreakpointsRequest; } + @JsonProperty("SetDataBreakpointsRequest") + public void setSetDataBreakpointsRequest(SetDataBreakpointsRequestClass value) { this.setDataBreakpointsRequest = value; } + + @JsonProperty("SetDataBreakpointsResponse") + public SetDataBreakpointsResponseClass getSetDataBreakpointsResponse() { return setDataBreakpointsResponse; } + @JsonProperty("SetDataBreakpointsResponse") + public void setSetDataBreakpointsResponse(SetDataBreakpointsResponseClass value) { this.setDataBreakpointsResponse = value; } + + @JsonProperty("SetExceptionBreakpointsArguments") + public SetExceptionBreakpointsArgumentsClass getSetExceptionBreakpointsArguments() { return setExceptionBreakpointsArguments; } + @JsonProperty("SetExceptionBreakpointsArguments") + public void setSetExceptionBreakpointsArguments(SetExceptionBreakpointsArgumentsClass value) { this.setExceptionBreakpointsArguments = value; } + + @JsonProperty("SetExceptionBreakpointsRequest") + public SetExceptionBreakpointsRequestClass getSetExceptionBreakpointsRequest() { return setExceptionBreakpointsRequest; } + @JsonProperty("SetExceptionBreakpointsRequest") + public void setSetExceptionBreakpointsRequest(SetExceptionBreakpointsRequestClass value) { this.setExceptionBreakpointsRequest = value; } + + @JsonProperty("SetExceptionBreakpointsResponse") + public SetExceptionBreakpointsResponseClass getSetExceptionBreakpointsResponse() { return setExceptionBreakpointsResponse; } + @JsonProperty("SetExceptionBreakpointsResponse") + public void setSetExceptionBreakpointsResponse(SetExceptionBreakpointsResponseClass value) { this.setExceptionBreakpointsResponse = value; } + + @JsonProperty("SetExpressionArguments") + public SetExpressionArgumentsClass getSetExpressionArguments() { return setExpressionArguments; } + @JsonProperty("SetExpressionArguments") + public void setSetExpressionArguments(SetExpressionArgumentsClass value) { this.setExpressionArguments = value; } + + @JsonProperty("SetExpressionRequest") + public SetExpressionRequestClass getSetExpressionRequest() { return setExpressionRequest; } + @JsonProperty("SetExpressionRequest") + public void setSetExpressionRequest(SetExpressionRequestClass value) { this.setExpressionRequest = value; } + + @JsonProperty("SetExpressionResponse") + public SetExpressionResponseClass getSetExpressionResponse() { return setExpressionResponse; } + @JsonProperty("SetExpressionResponse") + public void setSetExpressionResponse(SetExpressionResponseClass value) { this.setExpressionResponse = value; } + + @JsonProperty("SetFunctionBreakpointsArguments") + public SetFunctionBreakpointsArgumentsClass getSetFunctionBreakpointsArguments() { return setFunctionBreakpointsArguments; } + @JsonProperty("SetFunctionBreakpointsArguments") + public void setSetFunctionBreakpointsArguments(SetFunctionBreakpointsArgumentsClass value) { this.setFunctionBreakpointsArguments = value; } + + @JsonProperty("SetFunctionBreakpointsRequest") + public SetFunctionBreakpointsRequestClass getSetFunctionBreakpointsRequest() { return setFunctionBreakpointsRequest; } + @JsonProperty("SetFunctionBreakpointsRequest") + public void setSetFunctionBreakpointsRequest(SetFunctionBreakpointsRequestClass value) { this.setFunctionBreakpointsRequest = value; } + + @JsonProperty("SetFunctionBreakpointsResponse") + public SetFunctionBreakpointsResponseClass getSetFunctionBreakpointsResponse() { return setFunctionBreakpointsResponse; } + @JsonProperty("SetFunctionBreakpointsResponse") + public void setSetFunctionBreakpointsResponse(SetFunctionBreakpointsResponseClass value) { this.setFunctionBreakpointsResponse = value; } + + @JsonProperty("SetInstructionBreakpointsArguments") + public SetInstructionBreakpointsArgumentsClass getSetInstructionBreakpointsArguments() { return setInstructionBreakpointsArguments; } + @JsonProperty("SetInstructionBreakpointsArguments") + public void setSetInstructionBreakpointsArguments(SetInstructionBreakpointsArgumentsClass value) { this.setInstructionBreakpointsArguments = value; } + + @JsonProperty("SetInstructionBreakpointsRequest") + public SetInstructionBreakpointsRequestClass getSetInstructionBreakpointsRequest() { return setInstructionBreakpointsRequest; } + @JsonProperty("SetInstructionBreakpointsRequest") + public void setSetInstructionBreakpointsRequest(SetInstructionBreakpointsRequestClass value) { this.setInstructionBreakpointsRequest = value; } + + @JsonProperty("SetInstructionBreakpointsResponse") + public SetInstructionBreakpointsResponseClass getSetInstructionBreakpointsResponse() { return setInstructionBreakpointsResponse; } + @JsonProperty("SetInstructionBreakpointsResponse") + public void setSetInstructionBreakpointsResponse(SetInstructionBreakpointsResponseClass value) { this.setInstructionBreakpointsResponse = value; } + + @JsonProperty("SetVariableArguments") + public SetVariableArgumentsClass getSetVariableArguments() { return setVariableArguments; } + @JsonProperty("SetVariableArguments") + public void setSetVariableArguments(SetVariableArgumentsClass value) { this.setVariableArguments = value; } + + @JsonProperty("SetVariableRequest") + public SetVariableRequestClass getSetVariableRequest() { return setVariableRequest; } + @JsonProperty("SetVariableRequest") + public void setSetVariableRequest(SetVariableRequestClass value) { this.setVariableRequest = value; } + + @JsonProperty("SetVariableResponse") + public SetVariableResponseClass getSetVariableResponse() { return setVariableResponse; } + @JsonProperty("SetVariableResponse") + public void setSetVariableResponse(SetVariableResponseClass value) { this.setVariableResponse = value; } + + @JsonProperty("Source") + public Source getSource() { return source; } + @JsonProperty("Source") + public void setSource(Source value) { this.source = value; } + + @JsonProperty("SourceArguments") + public SourceArgumentsClass getSourceArguments() { return sourceArguments; } + @JsonProperty("SourceArguments") + public void setSourceArguments(SourceArgumentsClass value) { this.sourceArguments = value; } + + @JsonProperty("SourceBreakpoint") + public SourceBreakpoint getSourceBreakpoint() { return sourceBreakpoint; } + @JsonProperty("SourceBreakpoint") + public void setSourceBreakpoint(SourceBreakpoint value) { this.sourceBreakpoint = value; } + + @JsonProperty("SourceRequest") + public SourceRequestClass getSourceRequest() { return sourceRequest; } + @JsonProperty("SourceRequest") + public void setSourceRequest(SourceRequestClass value) { this.sourceRequest = value; } + + @JsonProperty("SourceResponse") + public SourceResponseClass getSourceResponse() { return sourceResponse; } + @JsonProperty("SourceResponse") + public void setSourceResponse(SourceResponseClass value) { this.sourceResponse = value; } + + @JsonProperty("StackFrame") + public StackFrame getStackFrame() { return stackFrame; } + @JsonProperty("StackFrame") + public void setStackFrame(StackFrame value) { this.stackFrame = value; } + + @JsonProperty("StackFrameFormat") + public StackFrameFormat getStackFrameFormat() { return stackFrameFormat; } + @JsonProperty("StackFrameFormat") + public void setStackFrameFormat(StackFrameFormat value) { this.stackFrameFormat = value; } + + @JsonProperty("StackTraceArguments") + public StackTraceArgumentsClass getStackTraceArguments() { return stackTraceArguments; } + @JsonProperty("StackTraceArguments") + public void setStackTraceArguments(StackTraceArgumentsClass value) { this.stackTraceArguments = value; } + + @JsonProperty("StackTraceRequest") + public StackTraceRequestClass getStackTraceRequest() { return stackTraceRequest; } + @JsonProperty("StackTraceRequest") + public void setStackTraceRequest(StackTraceRequestClass value) { this.stackTraceRequest = value; } + + @JsonProperty("StackTraceResponse") + public StackTraceResponseClass getStackTraceResponse() { return stackTraceResponse; } + @JsonProperty("StackTraceResponse") + public void setStackTraceResponse(StackTraceResponseClass value) { this.stackTraceResponse = value; } + + @JsonProperty("StartDebuggingRequest") + public StartDebuggingRequestClass getStartDebuggingRequest() { return startDebuggingRequest; } + @JsonProperty("StartDebuggingRequest") + public void setStartDebuggingRequest(StartDebuggingRequestClass value) { this.startDebuggingRequest = value; } + + @JsonProperty("StartDebuggingRequestArguments") + public StartDebuggingRequestArgumentsClass getStartDebuggingRequestArguments() { return startDebuggingRequestArguments; } + @JsonProperty("StartDebuggingRequestArguments") + public void setStartDebuggingRequestArguments(StartDebuggingRequestArgumentsClass value) { this.startDebuggingRequestArguments = value; } + + @JsonProperty("StartDebuggingResponse") + public StartDebuggingResponseClass getStartDebuggingResponse() { return startDebuggingResponse; } + @JsonProperty("StartDebuggingResponse") + public void setStartDebuggingResponse(StartDebuggingResponseClass value) { this.startDebuggingResponse = value; } + + @JsonProperty("StepBackArguments") + public StepBackArgumentsClass getStepBackArguments() { return stepBackArguments; } + @JsonProperty("StepBackArguments") + public void setStepBackArguments(StepBackArgumentsClass value) { this.stepBackArguments = value; } + + @JsonProperty("StepBackRequest") + public StepBackRequestClass getStepBackRequest() { return stepBackRequest; } + @JsonProperty("StepBackRequest") + public void setStepBackRequest(StepBackRequestClass value) { this.stepBackRequest = value; } + + @JsonProperty("StepBackResponse") + public StepBackResponseClass getStepBackResponse() { return stepBackResponse; } + @JsonProperty("StepBackResponse") + public void setStepBackResponse(StepBackResponseClass value) { this.stepBackResponse = value; } + + @JsonProperty("StepInArguments") + public StepInArgumentsClass getStepInArguments() { return stepInArguments; } + @JsonProperty("StepInArguments") + public void setStepInArguments(StepInArgumentsClass value) { this.stepInArguments = value; } + + @JsonProperty("StepInRequest") + public StepInRequestClass getStepInRequest() { return stepInRequest; } + @JsonProperty("StepInRequest") + public void setStepInRequest(StepInRequestClass value) { this.stepInRequest = value; } + + @JsonProperty("StepInResponse") + public StepInResponseClass getStepInResponse() { return stepInResponse; } + @JsonProperty("StepInResponse") + public void setStepInResponse(StepInResponseClass value) { this.stepInResponse = value; } + + @JsonProperty("StepInTarget") + public StepInTarget getStepInTarget() { return stepInTarget; } + @JsonProperty("StepInTarget") + public void setStepInTarget(StepInTarget value) { this.stepInTarget = value; } + + @JsonProperty("StepInTargetsArguments") + public StepInTargetsArgumentsClass getStepInTargetsArguments() { return stepInTargetsArguments; } + @JsonProperty("StepInTargetsArguments") + public void setStepInTargetsArguments(StepInTargetsArgumentsClass value) { this.stepInTargetsArguments = value; } + + @JsonProperty("StepInTargetsRequest") + public StepInTargetsRequestClass getStepInTargetsRequest() { return stepInTargetsRequest; } + @JsonProperty("StepInTargetsRequest") + public void setStepInTargetsRequest(StepInTargetsRequestClass value) { this.stepInTargetsRequest = value; } + + @JsonProperty("StepInTargetsResponse") + public StepInTargetsResponseClass getStepInTargetsResponse() { return stepInTargetsResponse; } + @JsonProperty("StepInTargetsResponse") + public void setStepInTargetsResponse(StepInTargetsResponseClass value) { this.stepInTargetsResponse = value; } + + @JsonProperty("StepOutArguments") + public StepOutArgumentsClass getStepOutArguments() { return stepOutArguments; } + @JsonProperty("StepOutArguments") + public void setStepOutArguments(StepOutArgumentsClass value) { this.stepOutArguments = value; } + + @JsonProperty("StepOutRequest") + public StepOutRequestClass getStepOutRequest() { return stepOutRequest; } + @JsonProperty("StepOutRequest") + public void setStepOutRequest(StepOutRequestClass value) { this.stepOutRequest = value; } + + @JsonProperty("StepOutResponse") + public StepOutResponseClass getStepOutResponse() { return stepOutResponse; } + @JsonProperty("StepOutResponse") + public void setStepOutResponse(StepOutResponseClass value) { this.stepOutResponse = value; } + + @JsonProperty("SteppingGranularity") + public SteppingGranularity getSteppingGranularity() { return steppingGranularity; } + @JsonProperty("SteppingGranularity") + public void setSteppingGranularity(SteppingGranularity value) { this.steppingGranularity = value; } + + @JsonProperty("StoppedEvent") + public StoppedEventClass getStoppedEvent() { return stoppedEvent; } + @JsonProperty("StoppedEvent") + public void setStoppedEvent(StoppedEventClass value) { this.stoppedEvent = value; } + + @JsonProperty("TerminateArguments") + public TerminateArgumentsClass getTerminateArguments() { return terminateArguments; } + @JsonProperty("TerminateArguments") + public void setTerminateArguments(TerminateArgumentsClass value) { this.terminateArguments = value; } + + @JsonProperty("TerminatedEvent") + public TerminatedEventClass getTerminatedEvent() { return terminatedEvent; } + @JsonProperty("TerminatedEvent") + public void setTerminatedEvent(TerminatedEventClass value) { this.terminatedEvent = value; } + + @JsonProperty("TerminateRequest") + public TerminateRequestClass getTerminateRequest() { return terminateRequest; } + @JsonProperty("TerminateRequest") + public void setTerminateRequest(TerminateRequestClass value) { this.terminateRequest = value; } + + @JsonProperty("TerminateResponse") + public TerminateResponseClass getTerminateResponse() { return terminateResponse; } + @JsonProperty("TerminateResponse") + public void setTerminateResponse(TerminateResponseClass value) { this.terminateResponse = value; } + + @JsonProperty("TerminateThreadsArguments") + public TerminateThreadsArgumentsClass getTerminateThreadsArguments() { return terminateThreadsArguments; } + @JsonProperty("TerminateThreadsArguments") + public void setTerminateThreadsArguments(TerminateThreadsArgumentsClass value) { this.terminateThreadsArguments = value; } + + @JsonProperty("TerminateThreadsRequest") + public TerminateThreadsRequestClass getTerminateThreadsRequest() { return terminateThreadsRequest; } + @JsonProperty("TerminateThreadsRequest") + public void setTerminateThreadsRequest(TerminateThreadsRequestClass value) { this.terminateThreadsRequest = value; } + + @JsonProperty("TerminateThreadsResponse") + public TerminateThreadsResponseClass getTerminateThreadsResponse() { return terminateThreadsResponse; } + @JsonProperty("TerminateThreadsResponse") + public void setTerminateThreadsResponse(TerminateThreadsResponseClass value) { this.terminateThreadsResponse = value; } + + @JsonProperty("Thread") + public Thread getThread() { return thread; } + @JsonProperty("Thread") + public void setThread(Thread value) { this.thread = value; } + + @JsonProperty("ThreadEvent") + public ThreadEventClass getThreadEvent() { return threadEvent; } + @JsonProperty("ThreadEvent") + public void setThreadEvent(ThreadEventClass value) { this.threadEvent = value; } + + @JsonProperty("ThreadsRequest") + public ThreadsRequestClass getThreadsRequest() { return threadsRequest; } + @JsonProperty("ThreadsRequest") + public void setThreadsRequest(ThreadsRequestClass value) { this.threadsRequest = value; } + + @JsonProperty("ThreadsResponse") + public ThreadsResponseClass getThreadsResponse() { return threadsResponse; } + @JsonProperty("ThreadsResponse") + public void setThreadsResponse(ThreadsResponseClass value) { this.threadsResponse = value; } + + @JsonProperty("ValueFormat") + public ValueFormat getValueFormat() { return valueFormat; } + @JsonProperty("ValueFormat") + public void setValueFormat(ValueFormat value) { this.valueFormat = value; } + + @JsonProperty("Variable") + public Variable getVariable() { return variable; } + @JsonProperty("Variable") + public void setVariable(Variable value) { this.variable = value; } + + @JsonProperty("VariablePresentationHint") + public VariablePresentationHint getVariablePresentationHint() { return variablePresentationHint; } + @JsonProperty("VariablePresentationHint") + public void setVariablePresentationHint(VariablePresentationHint value) { this.variablePresentationHint = value; } + + @JsonProperty("VariablesArguments") + public VariablesArgumentsClass getVariablesArguments() { return variablesArguments; } + @JsonProperty("VariablesArguments") + public void setVariablesArguments(VariablesArgumentsClass value) { this.variablesArguments = value; } + + @JsonProperty("VariablesRequest") + public VariablesRequestClass getVariablesRequest() { return variablesRequest; } + @JsonProperty("VariablesRequest") + public void setVariablesRequest(VariablesRequestClass value) { this.variablesRequest = value; } + + @JsonProperty("VariablesResponse") + public VariablesResponseClass getVariablesResponse() { return variablesResponse; } + @JsonProperty("VariablesResponse") + public void setVariablesResponse(VariablesResponseClass value) { this.variablesResponse = value; } + + @JsonProperty("WriteMemoryArguments") + public WriteMemoryArgumentsClass getWriteMemoryArguments() { return writeMemoryArguments; } + @JsonProperty("WriteMemoryArguments") + public void setWriteMemoryArguments(WriteMemoryArgumentsClass value) { this.writeMemoryArguments = value; } + + @JsonProperty("WriteMemoryRequest") + public WriteMemoryRequestClass getWriteMemoryRequest() { return writeMemoryRequest; } + @JsonProperty("WriteMemoryRequest") + public void setWriteMemoryRequest(WriteMemoryRequestClass value) { this.writeMemoryRequest = value; } + + @JsonProperty("WriteMemoryResponse") + public WriteMemoryResponseClass getWriteMemoryResponse() { return writeMemoryResponse; } + @JsonProperty("WriteMemoryResponse") + public void setWriteMemoryResponse(WriteMemoryResponseClass value) { this.writeMemoryResponse = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryArgumentsClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryArgumentsClass.java new file mode 100644 index 0000000..8b5d23b --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryArgumentsClass.java @@ -0,0 +1,51 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `writeMemory` request. + */ +public class WriteMemoryArgumentsClass { + private Boolean allowPartial; + private String data; + private String memoryReference; + private Long offset; + + /** + * Property to control partial writes. If true, the debug adapter should attempt to write + * memory even if the entire memory region is not writable. In such a case the debug adapter + * should stop after hitting the first byte of memory that cannot be written and return the + * number of bytes written in the response via the `offset` and `bytesWritten` properties. + * If false or missing, a debug adapter should attempt to verify the region is writable + * before writing, and fail the response if it is not. + */ + @JsonProperty("allowPartial") + public Boolean getAllowPartial() { return allowPartial; } + @JsonProperty("allowPartial") + public void setAllowPartial(Boolean value) { this.allowPartial = value; } + + /** + * Bytes to write, encoded using base64. + */ + @JsonProperty("data") + public String getData() { return data; } + @JsonProperty("data") + public void setData(String value) { this.data = value; } + + /** + * Memory reference to the base location to which data should be written. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * Offset (in bytes) to be applied to the reference location before writing data. Can be + * negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestArguments.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestArguments.java new file mode 100644 index 0000000..86a9205 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestArguments.java @@ -0,0 +1,51 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Arguments for `writeMemory` request. + */ +public class WriteMemoryRequestArguments { + private Boolean allowPartial; + private String data; + private String memoryReference; + private Long offset; + + /** + * Property to control partial writes. If true, the debug adapter should attempt to write + * memory even if the entire memory region is not writable. In such a case the debug adapter + * should stop after hitting the first byte of memory that cannot be written and return the + * number of bytes written in the response via the `offset` and `bytesWritten` properties. + * If false or missing, a debug adapter should attempt to verify the region is writable + * before writing, and fail the response if it is not. + */ + @JsonProperty("allowPartial") + public Boolean getAllowPartial() { return allowPartial; } + @JsonProperty("allowPartial") + public void setAllowPartial(Boolean value) { this.allowPartial = value; } + + /** + * Bytes to write, encoded using base64. + */ + @JsonProperty("data") + public String getData() { return data; } + @JsonProperty("data") + public void setData(String value) { this.data = value; } + + /** + * Memory reference to the base location to which data should be written. + */ + @JsonProperty("memoryReference") + public String getMemoryReference() { return memoryReference; } + @JsonProperty("memoryReference") + public void setMemoryReference(String value) { this.memoryReference = value; } + + /** + * Offset (in bytes) to be applied to the reference location before writing data. Can be + * negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestClass.java new file mode 100644 index 0000000..50dbf42 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestClass.java @@ -0,0 +1,56 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * A client or debug adapter initiated request. + * + * Writes bytes to memory at the provided location. + * Clients should only call this request if the corresponding capability + * `supportsWriteMemoryRequest` is true. + */ +public class WriteMemoryRequestClass { + private long seq; + private AttachRequestType type; + private WriteMemoryRequestArguments arguments; + private WriteMemoryRequestCommand command; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachRequestType getType() { return type; } + @JsonProperty("type") + public void setType(AttachRequestType value) { this.type = value; } + + /** + * Object containing arguments for the command. + */ + @JsonProperty("arguments") + public WriteMemoryRequestArguments getArguments() { return arguments; } + @JsonProperty("arguments") + public void setArguments(WriteMemoryRequestArguments value) { this.arguments = value; } + + /** + * The command to execute. + */ + @JsonProperty("command") + public WriteMemoryRequestCommand getCommand() { return command; } + @JsonProperty("command") + public void setCommand(WriteMemoryRequestCommand value) { this.command = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestCommand.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestCommand.java new file mode 100644 index 0000000..b252a8f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryRequestCommand.java @@ -0,0 +1,27 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import java.io.IOException; +import com.fasterxml.jackson.annotation.*; + +/** + * All dictionary values must be strings. + * + * Logical areas that can be invalidated by the `invalidated` event. + */ +public enum WriteMemoryRequestCommand { + WRITE_MEMORY; + + @JsonValue + public String toValue() { + switch (this) { + case WRITE_MEMORY: return "writeMemory"; + } + return null; + } + + @JsonCreator + public static WriteMemoryRequestCommand forValue(String value) throws IOException { + if (value.equals("writeMemory")) return WRITE_MEMORY; + throw new IOException("Cannot deserialize WriteMemoryRequestCommand"); + } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryResponseBody.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryResponseBody.java new file mode 100644 index 0000000..358f5e1 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryResponseBody.java @@ -0,0 +1,26 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +public class WriteMemoryResponseBody { + private Long bytesWritten; + private Long offset; + + /** + * Property that should be returned when `allowPartial` is true to indicate the number of + * bytes starting from address that were successfully written. + */ + @JsonProperty("bytesWritten") + public Long getBytesWritten() { return bytesWritten; } + @JsonProperty("bytesWritten") + public void setBytesWritten(Long value) { this.bytesWritten = value; } + + /** + * Property that should be returned when `allowPartial` is true to indicate the offset of + * the first byte of data successfully written. Can be negative. + */ + @JsonProperty("offset") + public Long getOffset() { return offset; } + @JsonProperty("offset") + public void setOffset(Long value) { this.offset = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryResponseClass.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryResponseClass.java new file mode 100644 index 0000000..b97d40d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/WriteMemoryResponseClass.java @@ -0,0 +1,87 @@ +package org.tzi.use.monitor.adapter.python.dap; + +import com.fasterxml.jackson.annotation.*; + +/** + * Base class of requests, responses, and events. + * + * Response for a request. + * + * Response to `writeMemory` request. + */ +public class WriteMemoryResponseClass { + private long seq; + private AttachResponseType type; + private WriteMemoryResponseBody body; + private String command; + private String message; + private long requestSeq; + private boolean success; + + /** + * Sequence number of the message (also known as message ID). The `seq` for the first + * message sent by a client or debug adapter is 1, and for each subsequent message is 1 + * greater than the previous message sent by that actor. `seq` can be used to order + * requests, responses, and events, and to associate requests with their corresponding + * responses. For protocol messages of type `request` the sequence number can be used to + * cancel the request. + */ + @JsonProperty("seq") + public long getSeq() { return seq; } + @JsonProperty("seq") + public void setSeq(long value) { this.seq = value; } + + /** + * Message type. + */ + @JsonProperty("type") + public AttachResponseType getType() { return type; } + @JsonProperty("type") + public void setType(AttachResponseType value) { this.type = value; } + + /** + * Contains request result if success is true and error details if success is false. + */ + @JsonProperty("body") + public WriteMemoryResponseBody getBody() { return body; } + @JsonProperty("body") + public void setBody(WriteMemoryResponseBody value) { this.body = value; } + + /** + * The command requested. + */ + @JsonProperty("command") + public String getCommand() { return command; } + @JsonProperty("command") + public void setCommand(String value) { this.command = value; } + + /** + * Contains the raw error in short form if `success` is false. + * This raw error might be interpreted by the client and is not shown in the UI. + * Some predefined values exist. + */ + @JsonProperty("message") + public String getMessage() { return message; } + @JsonProperty("message") + public void setMessage(String value) { this.message = value; } + + /** + * Sequence number of the corresponding request. + */ + @JsonProperty("request_seq") + public long getRequestSeq() { return requestSeq; } + @JsonProperty("request_seq") + public void setRequestSeq(long value) { this.requestSeq = value; } + + /** + * Outcome of the request. + * If true, the request was successful and the `body` attribute may contain the result of + * the request. + * If the value is false, the attribute `message` contains the error in short form and the + * `body` may contain additional information (see `ErrorResponse.body.error`). + */ + @JsonProperty("success") + public boolean getSuccess() { return success; } + @JsonProperty("success") + public void setSuccess(boolean value) { this.success = value; } +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPEvent.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPEvent.java new file mode 100644 index 0000000..c29bdba --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPEvent.java @@ -0,0 +1,4 @@ +package org.tzi.use.monitor.adapter.python.dap.custom; + +public interface DAPEvent extends DAPMessage { +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPMessage.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPMessage.java new file mode 100644 index 0000000..9935ce5 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPMessage.java @@ -0,0 +1,4 @@ +package org.tzi.use.monitor.adapter.python.dap.custom; + +public interface DAPMessage { +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPRequest.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPRequest.java new file mode 100644 index 0000000..80e16d8 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPRequest.java @@ -0,0 +1,5 @@ +package org.tzi.use.monitor.adapter.python.dap.custom; + +public interface DAPRequest extends DAPMessage { + long getSeq(); +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPResponse.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPResponse.java new file mode 100644 index 0000000..e334446 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPResponse.java @@ -0,0 +1,5 @@ +package org.tzi.use.monitor.adapter.python.dap.custom; + +public interface DAPResponse extends DAPMessage { + long getRequestSeq(); +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPUnknown.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPUnknown.java new file mode 100644 index 0000000..d3c429d --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPUnknown.java @@ -0,0 +1,30 @@ +package org.tzi.use.monitor.adapter.python.dap.custom; + +public class DAPUnknown implements DAPMessage, DAPEvent, DAPResponse { + private final String rawJson; + private final String reason; + + public DAPUnknown(String rawJson, String reason) { + this.rawJson = rawJson; + this.reason = reason; + } + + public String getRawJson() { + return rawJson; + } + + public String getReason() { + return reason; + } + + @Override + public String toString() { + return "DAPUnknown{reason='%s', rawJson='%s'}".formatted(reason, rawJson); + } + + @Override + public long getRequestSeq() { + return 0; + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPValue.java b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPValue.java new file mode 100644 index 0000000..21228ca --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/adapter/python/dap/custom/DAPValue.java @@ -0,0 +1,45 @@ +package org.tzi.use.monitor.adapter.python.dap.custom; + +public final class DAPValue { + private final String result; + private final String type; + private final long variablesReference; + private String name; + + public DAPValue(String result, String type, long variablesReference) { + this.result = result; + this.type = type; + this.variablesReference = variablesReference; + } + + public String getResult() { + return result; + } + + public String getType() { + return type; + } + + public long getVariablesReference() { + return variablesReference; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "DAPValue{" + + "result='" + result + '\'' + + ", type='" + type + '\'' + + ", variablesReference=" + variablesReference + + ", name='" + name + '\'' + + '}'; + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyField.java b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyField.java new file mode 100644 index 0000000..f1eb560 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyField.java @@ -0,0 +1,61 @@ +package org.tzi.use.monitor.plugins.monitor.vm.mm.python; + +import org.tzi.use.plugins.monitor.vm.mm.VMField; +import org.tzi.use.uml.mm.MAssociationEnd; +import org.tzi.use.uml.mm.MAttribute; + +public class PyField implements VMField { + + private final String id; + private final String className; + private final String fieldName; + + private MAttribute useAttribute; + private MAssociationEnd useAssociationEnd; + + public PyField(String fieldName, String className) { + this.fieldName = fieldName; + this.className = className; + this.id = String.format("%s:%s", className, fieldName); + } + + @Override + public String getName() { + return fieldName; + } + + @Override + public void setUSEAttribute(MAttribute attr) { + useAttribute = attr; + } + + @Override + public MAttribute getUSEAttribute() { + return useAttribute; + } + + @Override + public void setUSEAssociationEnd(MAssociationEnd end) { + useAssociationEnd = end; + } + + @Override + public MAssociationEnd getUSEAssociationEnd() { + return useAssociationEnd; + } + + @Override + public Object getId() { + return id; + } + + public String getClassName() { + return className; + } + + @Override + public String toString() { + return id; + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyMethod.java b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyMethod.java new file mode 100644 index 0000000..3e3e5da --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyMethod.java @@ -0,0 +1,115 @@ +package org.tzi.use.monitor.plugins.monitor.vm.mm.python; + +import org.tzi.use.monitor.adapter.python.PythonAdapter; +import org.tzi.use.plugins.monitor.vm.mm.VMMethod; +import org.tzi.use.plugins.monitor.vm.mm.VMType; +import org.tzi.use.uml.mm.MOperation; + +import java.util.ArrayList; +import java.util.List; + +public class PyMethod implements VMMethod { + + private final String id; + private final String name; + private final String className; + private final PythonAdapter adapter; + + private List argumentNames; + private List argumentTypes; + private String file; + private int startLineNo; + private int endLineNo; + private List returnLines; + private MOperation useOperation; + + public PyMethod(PythonAdapter adapter, String methodName, String className) { + this.adapter = adapter; + this.id = String.format("%s:%s", className, methodName); + this.name = methodName; + this.className = className; + } + + @Override + public Object getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + @Override + public List getArgumentTypes() { + List types = new ArrayList<>(); + for (String typeName : argumentTypes) { + types.add(adapter.getVMType(typeName)); + } + return types; + } + + @Override + public MOperation getUSEOperation() { + return useOperation; + } + + @Override + public void setUSEOperation(MOperation useOperation) { + this.useOperation = useOperation; + } + + public String getClassName() { + return className; + } + + public List getArgumentNames() { + return argumentNames; + } + + public void setArgumentNames(List argumentNames) { + this.argumentNames = argumentNames; + } + + public void setArgumentTypes(List argumentTypes) { + this.argumentTypes = argumentTypes; + } + + public String getFile() { + return file; + } + + public void setFile(String file) { + this.file = file; + } + + public int getStartLineNo() { + return startLineNo; + } + + public void setStartLineNo(int startLineNo) { + this.startLineNo = startLineNo; + } + + public int getEndLineNo() { + return endLineNo; + } + + public void setEndLineNo(int endLineNo) { + this.endLineNo = endLineNo; + } + + public List getReturnLines() { + return returnLines; + } + + public void setReturnLines(List returnLines) { + this.returnLines = returnLines; + } + + @Override + public String toString() { + return id; + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyMethodCall.java b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyMethodCall.java new file mode 100644 index 0000000..7a016eb --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyMethodCall.java @@ -0,0 +1,43 @@ +package org.tzi.use.monitor.plugins.monitor.vm.mm.python; + +import org.tzi.use.plugins.monitor.vm.adapter.VMAccessException; +import org.tzi.use.plugins.monitor.vm.mm.VMMethod; +import org.tzi.use.plugins.monitor.vm.mm.VMMethodCall; +import org.tzi.use.plugins.monitor.vm.mm.VMObject; +import org.tzi.use.uml.ocl.value.Value; + +import java.util.List; + +public class PyMethodCall implements VMMethodCall { + + private final PyMethod pyMethod; + private final PyObject pyObject; + private final List argVals; + + public PyMethodCall(PyMethod pyMethod, PyObject pyObject, List argVals) { + this.pyMethod = pyMethod; + this.pyObject = pyObject; + this.argVals = argVals; + } + + @Override + public List getArgumentValues() throws VMAccessException { + return argVals; + } + + @Override + public VMMethod getMethod() { + return pyMethod; + } + + @Override + public VMObject getThisObject() throws VMAccessException { + return pyObject; + } + + @Override + public int getNumArguments() throws VMAccessException { + return pyMethod.getArgumentTypes().size(); + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyObject.java b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyObject.java new file mode 100644 index 0000000..e086342 --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyObject.java @@ -0,0 +1,59 @@ +package org.tzi.use.monitor.plugins.monitor.vm.mm.python; + +import org.tzi.use.monitor.adapter.python.PythonAdapter; +import org.tzi.use.plugins.monitor.vm.mm.VMField; +import org.tzi.use.plugins.monitor.vm.mm.VMObject; +import org.tzi.use.plugins.monitor.vm.mm.VMType; +import org.tzi.use.uml.ocl.value.Value; +import org.tzi.use.uml.sys.MObject; + +public class PyObject implements VMObject { + + private final long id; + private final VMType type; + private final PythonAdapter adapter; + + private MObject useObject; + + public PyObject(PythonAdapter adapter, long id, PyType type) { + this.adapter = adapter; + this.type = type; + this.id = id; + } + + @Override + public Object getId() { + return id; + } + + @Override + public boolean isAlive() { + return true; + } + + @Override + public VMType getType() { + return type; + } + + @Override + public MObject getUSEObject() { + return useObject; + } + + @Override + public void setUSEObject(MObject obj) { + useObject = obj; + } + + @Override + public Value getValue(VMField field) { + return adapter.getUSEValue(id, field.getName()); + } + + @Override + public String toString() { + return String.format("%s:%d", type, type.toString(), id); + } + +} diff --git a/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyType.java b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyType.java new file mode 100644 index 0000000..7e97a6f --- /dev/null +++ b/adapter/Python/src/main/java/org/tzi/use/monitor/plugins/monitor/vm/mm/python/PyType.java @@ -0,0 +1,83 @@ +package org.tzi.use.monitor.plugins.monitor.vm.mm.python; + +import org.tzi.use.monitor.adapter.python.PythonAdapter; +import org.tzi.use.plugins.monitor.vm.mm.VMField; +import org.tzi.use.plugins.monitor.vm.mm.VMMethod; +import org.tzi.use.plugins.monitor.vm.mm.VMObject; +import org.tzi.use.plugins.monitor.vm.mm.VMType; +import org.tzi.use.uml.mm.MClass; + +import java.util.*; + +public class PyType implements VMType { + + private final String typeName; + private final PythonAdapter adapter; + private final boolean isClass; + + private MClass useClass; + + public PyType(PythonAdapter adapter, String typeName, boolean isClass) { + this.adapter = adapter; + this.typeName = typeName; + this.isClass = isClass; + } + + @Override + public String getName() { + return typeName; + } + + @Override + public Set getSuperClasses() { + return Set.of(); + } + + @Override + public Set getSubClasses() { + return Set.of(); + } + + @Override + public boolean isClassType() { + return true; + } + + public boolean isModule() { + return !isClass; + } + + @Override + public Set getInstances() { + return adapter.readInstances(this); + } + + @Override + public List getMethodsByName(String methodName) { + VMMethod vmMethod = adapter.getVMMethod(typeName, methodName, !isClass); + return (vmMethod != null) + ? Collections.singletonList(vmMethod) + : Collections.emptyList(); + } + + @Override + public VMField getFieldByName(String fieldName) { + return adapter.getVMField(typeName, fieldName); + } + + @Override + public MClass getUSEClass() { + return useClass; + } + + @Override + public void setUSEClass(MClass cls) { + this.useClass = cls; + } + + @Override + public String toString() { + return typeName; + } + +} diff --git a/monitor/pom.xml b/monitor/pom.xml new file mode 100644 index 0000000..2fe1edc --- /dev/null +++ b/monitor/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + + org.tzi.use + plugin_monitor + 1.0-SNAPSHOT + ../pom.xml + + + monitor + 1.0-SNAPSHOT + jar + + + + org.tzi.use + use-core + + + org.tzi.use + use-gui + + + it.cnr.imaa.essi + lablib-checkboxtree + 3.2 + system + ${project.basedir}/lib/lablib-checkboxtree-3.2.jar + + + com.google.guava + guava + 12.0 + system + ${project.basedir}/lib/guava-12.0.jar + + + + + + + ${project.basedir} + + useplugin.xml + + + + ${project.basedir}/src/main/resources + resources + + * + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + true + + --add-exports=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.2 + + + ${project.basedir}/META-INF/MANIFEST.MF + + + + + + + diff --git a/monitor/src/org/tzi/use/plugins/monitor/AbstractMonitorStateListener.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/AbstractMonitorStateListener.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/AbstractMonitorStateListener.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/AbstractMonitorStateListener.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/AdapterRegistry.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/AdapterRegistry.java similarity index 74% rename from monitor/src/org/tzi/use/plugins/monitor/AdapterRegistry.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/AdapterRegistry.java index 5b9ec72..a2b61a5 100644 --- a/monitor/src/org/tzi/use/plugins/monitor/AdapterRegistry.java +++ b/monitor/src/main/java/org/tzi/use/plugins/monitor/AdapterRegistry.java @@ -75,27 +75,29 @@ public boolean accept(File dir, String name) { Enumeration enumEntries = jarFile.entries(); while(enumEntries.hasMoreElements()) { JarEntry entry = enumEntries.nextElement(); - if (!entry.isDirectory() && entry.getName().endsWith(".class")) { + String rawName = entry.getName(); + if (rawName.startsWith("META-INF/versions/")) { + // Remove "META-INF/versions//" + rawName = rawName.substring(rawName.indexOf('/', "META-INF/versions/".length()) + 1); + } + String className = rawName.replace('/', '.').replace(".class", ""); + // Skip descriptor classes + if (className.endsWith("module-info") || className.endsWith("package-info")) { + continue; + } try { - Class clazz = Class.forName(entry.getName().replace('/', '.').replace(".class", ""), true, loader); + Class clazz = Class.forName(className, true, loader); Class adapterClass = clazz.asSubclass(VMAdapter.class); - // Avoid Class.newInstance, for it is evil. + Constructor ctor = adapterClass.getConstructor(); - VMAdapter adapter = ctor.newInstance(); result.add(adapter); - } - catch (ClassNotFoundException e) {} - catch (SecurityException e) {} - catch (NoSuchMethodException e) {} - catch (IllegalArgumentException e) {} - catch (InstantiationException e) {} - catch (IllegalAccessException e) {} - catch (InvocationTargetException e) {} - catch (ClassCastException e) {} - - } + } catch (ClassNotFoundException | InvocationTargetException | ClassCastException | + IllegalAccessException | InstantiationException | IllegalArgumentException | + NoSuchMethodException | SecurityException ignored) { + } + } } } diff --git a/monitor/src/org/tzi/use/plugins/monitor/IdentifierMappingHelper.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/IdentifierMappingHelper.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/IdentifierMappingHelper.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/IdentifierMappingHelper.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/LogListener.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/LogListener.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/LogListener.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/LogListener.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/ModelBreakpoint.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/ModelBreakpoint.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/ModelBreakpoint.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/ModelBreakpoint.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/Monitor.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/Monitor.java similarity index 96% rename from monitor/src/org/tzi/use/plugins/monitor/Monitor.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/Monitor.java index 22f5c9d..4ddd7d5 100644 --- a/monitor/src/org/tzi/use/plugins/monitor/Monitor.java +++ b/monitor/src/main/java/org/tzi/use/plugins/monitor/Monitor.java @@ -727,7 +727,7 @@ private void setupClassMappings() { } VMType vmType = getVMType(useClass); - if (!vmType.isClassType()) { + if (vmType != null && !vmType.isClassType()) { fireNewLogMessage(Level.FINE, String.format("Found VM type for class %s, but the returned type is not a class", useClass.name())); } @@ -1472,7 +1472,19 @@ public boolean existsVMMethod(Object key) { public void storeVMMethod(Object key, VMMethod type) { adapterMethodMapping.put(key, type); } - + + public VMField getVMField(Object key) { + return adapterFieldMapping.get(key); + } + + public boolean existsVMField(Object key) { + return adapterFieldMapping.containsKey(key); + } + + public void storeVMField(Object key, VMField field) { + adapterFieldMapping.put(key, field); + } + /** * Needs to be called if a method is called * which the monitor registered for. diff --git a/monitor/src/org/tzi/use/plugins/monitor/MonitorException.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/MonitorException.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/MonitorException.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/MonitorException.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/MonitorPlugin.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/MonitorPlugin.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/MonitorPlugin.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/MonitorPlugin.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/MonitorStateListener.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/MonitorStateListener.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/MonitorStateListener.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/MonitorStateListener.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/ProgressArgs.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/ProgressArgs.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/ProgressArgs.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/ProgressArgs.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/ProgressListener.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/ProgressListener.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/ProgressListener.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/ProgressListener.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/cmd/AbstractMonitorCmd.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/AbstractMonitorCmd.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/cmd/AbstractMonitorCmd.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/AbstractMonitorCmd.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/cmd/EndMonitorCmd.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/EndMonitorCmd.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/cmd/EndMonitorCmd.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/EndMonitorCmd.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/cmd/PauseMonitorCmd.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/PauseMonitorCmd.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/cmd/PauseMonitorCmd.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/PauseMonitorCmd.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/cmd/ResumeMonitorCmd.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/ResumeMonitorCmd.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/cmd/ResumeMonitorCmd.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/ResumeMonitorCmd.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/cmd/StartMonitorCmd.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/StartMonitorCmd.java similarity index 55% rename from monitor/src/org/tzi/use/plugins/monitor/cmd/StartMonitorCmd.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/StartMonitorCmd.java index 2729f07..a946d84 100644 --- a/monitor/src/org/tzi/use/plugins/monitor/cmd/StartMonitorCmd.java +++ b/monitor/src/main/java/org/tzi/use/plugins/monitor/cmd/StartMonitorCmd.java @@ -4,6 +4,7 @@ import org.tzi.use.plugins.monitor.MonitorPlugin; import org.tzi.use.plugins.monitor.vm.adapter.InvalidAdapterConfiguration; import org.tzi.use.plugins.monitor.vm.adapter.VMAdapter; +import org.tzi.use.plugins.monitor.vm.adapter.jvm.JVMAdapter; import org.tzi.use.util.Log; import org.tzi.use.util.StringUtil; @@ -12,28 +13,25 @@ public class StartMonitorCmd extends AbstractMonitorCmd { @Override public void doPerformCommand(IPluginShellCmd pluginCommand) { if (MonitorPlugin.getInstance().getMonitor().isRunning()) { - Log.error("Already monitioring an application. Please stop before starting a new monitor."); - return; - } - - String[] args = pluginCommand.getCmdArguments().split(" "); + Log.error("Already monitoring an application. Please stop before starting a new monitor."); + return; + } + + String[] args = pluginCommand.getCmdArgumentList(); + String adapterName; + if (args.length == 0) { + adapterName = JVMAdapter.JVM_ADAPTER_NAME; + Log.println("Using default value for JVM remote debugger: localhost:6000"); + } else { + adapterName = args[0]; + } + + VMAdapter adapter = MonitorPlugin.getInstance().getAdapterRegistry().getAdapterByName(adapterName); + if (adapter == null) { + Log.println("Invalid adapter name " + StringUtil.inQuotes(adapterName) + " specified."); + return; + } - if (args.length == 0) { - Log.println("Using default value for JVM remote debugger: localhost:6000"); - } - - String adpaterName = args[0]; - VMAdapter adapter = MonitorPlugin.getInstance().getAdapterRegistry().getAdapterByName(adpaterName); - - if (adapter == null) { - Log.print("Invalid adapter name " + StringUtil.inQuotes(adpaterName) + " specified."); - return; - } - - for (int i = 1; i < args.length;++i) { - - } - try { MonitorPlugin.getInstance().startMonitor(pluginCommand.getSession(), adapter, false); } catch (InvalidAdapterConfiguration e) { @@ -41,6 +39,4 @@ public void doPerformCommand(IPluginShellCmd pluginCommand) { } } - - -} +} \ No newline at end of file diff --git a/monitor/src/org/tzi/use/plugins/monitor/gui/ActionShowMonitorControl.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/gui/ActionShowMonitorControl.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/gui/ActionShowMonitorControl.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/gui/ActionShowMonitorControl.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/gui/MonitorControlView.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/gui/MonitorControlView.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/gui/MonitorControlView.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/gui/MonitorControlView.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/adapter/AbstractVMAdapter.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/AbstractVMAdapter.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/adapter/AbstractVMAdapter.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/AbstractVMAdapter.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/adapter/InvalidAdapterConfiguration.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/InvalidAdapterConfiguration.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/adapter/InvalidAdapterConfiguration.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/InvalidAdapterConfiguration.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/adapter/VMAccessException.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/VMAccessException.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/adapter/VMAccessException.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/VMAccessException.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/adapter/VMAdapter.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/VMAdapter.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/adapter/VMAdapter.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/VMAdapter.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/adapter/VMAdapterSetting.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/VMAdapterSetting.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/adapter/VMAdapterSetting.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/VMAdapterSetting.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/adapter/jvm/JVMAdapter.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/jvm/JVMAdapter.java similarity index 97% rename from monitor/src/org/tzi/use/plugins/monitor/vm/adapter/jvm/JVMAdapter.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/jvm/JVMAdapter.java index 0629ffc..cc8eef1 100644 --- a/monitor/src/org/tzi/use/plugins/monitor/vm/adapter/jvm/JVMAdapter.java +++ b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/adapter/jvm/JVMAdapter.java @@ -80,6 +80,8 @@ * */ public class JVMAdapter extends AbstractVMAdapter { + + public static final String JVM_ADAPTER_NAME = "JVMAdapter"; private static final int SETTING_HOST = 0; diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMField.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMField.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMField.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMField.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMIdentifiable.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMIdentifiable.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMIdentifiable.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMIdentifiable.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMMethod.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMMethod.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMMethod.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMMethod.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMMethodCall.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMMethodCall.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMMethodCall.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMMethodCall.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMObject.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMObject.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMObject.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMObject.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMType.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMType.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMType.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMType.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMValue.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMValue.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/VMValue.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/VMValue.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/impl/VMBase.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/impl/VMBase.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/impl/VMBase.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/impl/VMBase.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/impl/VMFieldImpl.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/impl/VMFieldImpl.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/impl/VMFieldImpl.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/impl/VMFieldImpl.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMBase.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMBase.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMBase.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMBase.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMField.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMField.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMField.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMField.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethod.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethod.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethod.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethod.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethodCall.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethodCall.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethodCall.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMMethodCall.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMObject.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMObject.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMObject.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMObject.java diff --git a/monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMType.java b/monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMType.java similarity index 100% rename from monitor/src/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMType.java rename to monitor/src/main/java/org/tzi/use/plugins/monitor/vm/mm/jvm/JVMType.java diff --git a/monitor/resources/Attributes.gif b/monitor/src/main/resources/Attributes.gif similarity index 100% rename from monitor/resources/Attributes.gif rename to monitor/src/main/resources/Attributes.gif diff --git a/monitor/resources/MAssociation.gif b/monitor/src/main/resources/MAssociation.gif similarity index 100% rename from monitor/resources/MAssociation.gif rename to monitor/src/main/resources/MAssociation.gif diff --git a/monitor/resources/MClass.gif b/monitor/src/main/resources/MClass.gif similarity index 100% rename from monitor/resources/MClass.gif rename to monitor/src/main/resources/MClass.gif diff --git a/monitor/resources/Monitor.png b/monitor/src/main/resources/Monitor.png similarity index 100% rename from monitor/resources/Monitor.png rename to monitor/src/main/resources/Monitor.png diff --git a/monitor/resources/Operations.gif b/monitor/src/main/resources/Operations.gif similarity index 100% rename from monitor/resources/Operations.gif rename to monitor/src/main/resources/Operations.gif diff --git a/monitor/resources/pause.png b/monitor/src/main/resources/pause.png similarity index 100% rename from monitor/resources/pause.png rename to monitor/src/main/resources/pause.png diff --git a/monitor/resources/play.png b/monitor/src/main/resources/play.png similarity index 100% rename from monitor/resources/play.png rename to monitor/src/main/resources/play.png diff --git a/monitor/resources/stop.png b/monitor/src/main/resources/stop.png similarity index 100% rename from monitor/resources/stop.png rename to monitor/src/main/resources/stop.png diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..2e60c30 --- /dev/null +++ b/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + + org.tzi.use + plugin_monitor + 1.0-SNAPSHOT + pom + + + 21 + 21 + UTF-8 + + + + monitor + adapter/Python + + + + + + org.tzi.use + use-core + 7.1.1 + provided + + + org.tzi.use + use-gui + 7.1.1 + provided + + + org.tzi.use + monitor + 1.0-SNAPSHOT + provided + + + + +