public DSPDebugTarget(ILaunch launch, Process process, InputStream in, OutputStream out, Map<String, Object> launchArguments) throws CoreException { super(null); this.launch = launch; this.process = process; DebugLauncher<IDebugProtocolServer> debugProtocolLauncher = DebugLauncher.createLauncher(this, IDebugProtocolServer.class, in, out, true, new PrintWriter(System.out)); debugProtocolFuture = debugProtocolLauncher.startListening(); debugProtocolServer = debugProtocolLauncher.getRemoteProxy(); complete(debugProtocolServer.initialize(new InitializeRequestArguments().setClientID("lsp4e") .setAdapterID((String) launchArguments.get("type")).setPathFormat("path"))); Object object = launchArguments.get("program"); targetName = Objects.toString(object, "Debug Adapter Target"); complete(debugProtocolServer.launch(Either.forLeft(launchArguments))); complete(debugProtocolServer.configurationDone()); IBreakpointManager breakpointManager = getBreakpointManager(); breakpointManager.addBreakpointListener(this); breakpointManager.addBreakpointManagerListener(this); breakpointManagerEnablementChanged(breakpointManager.isEnabled()); }
public static ChromiumLineBreakpoint createLocal(Breakpoint sdkBreakpoint, IBreakpointManager breakpointManager, IFile resource, int script_line_offset, String debugModelId) throws CoreException { ChromiumLineBreakpoint uiBreakpoint = new ChromiumLineBreakpoint(resource, (int) sdkBreakpoint.getLineNumber() + 1 + script_line_offset, debugModelId); uiBreakpoint.setCondition(sdkBreakpoint.getCondition()); uiBreakpoint.setEnabled(sdkBreakpoint.isEnabled()); ignoreList.add(uiBreakpoint); try { breakpointManager.addBreakpoint(uiBreakpoint); } finally { ignoreList.remove(uiBreakpoint); } return uiBreakpoint; }
private Performer createPerformer(ISelection selection) { final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); return new Performer() { @Override void run() { IResource resource = ResourcesPlugin.getWorkspace().getRoot(); boolean includingCaught = true; try { ChromiumExceptionBreakpoint exceptionBreakpoint = new ChromiumExceptionBreakpoint( resource, includingCaught, VProjectWorkspaceBridge.DEBUG_MODEL_ID); breakpointManager.addBreakpoint(exceptionBreakpoint); } catch (CoreException e) { throw new RuntimeException(e); } } }; }
public PyDebugTargetServer(ILaunch launch, IPath[] file, RemoteDebuggerServer debugger) { this.file = file; this.debugger = debugger; this.threads = new PyThread[0]; this.launch = launch; if (launch != null) { for (IDebugTarget target : launch.getDebugTargets()) { if (target instanceof PyDebugTargetServer && target.isTerminated()) { launch.removeDebugTarget(target); } } launch.addDebugTarget(this); } debugger.addTarget(this); PyExceptionBreakPointManager.getInstance().addListener(this); PyPropertyTraceManager.getInstance().addListener(this); IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); breakpointManager.addBreakpointListener(this); // we have to know when we get removed, so that we can shut off the debugger DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); }
public PyDebugTarget(ILaunch launch, IProcess process, IPath[] file, AbstractRemoteDebugger debugger, IProject project, boolean isAuxiliaryDebugTarget) { this.launch = launch; this.process = process; this.file = file; this.debugger = debugger; this.threads = new PyThread[0]; this.project = project; this.isAuxiliaryDebugTarget = isAuxiliaryDebugTarget; launch.addDebugTarget(this); debugger.addTarget(this); IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); breakpointManager.addBreakpointListener(this); PyExceptionBreakPointManager.getInstance().addListener(this); PyPropertyTraceManager.getInstance().addListener(this); // we have to know when we get removed, so that we can shut off the debugger DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); }
private void terminated() { fTerminated = true; IBreakpointManager breakpointManager = getBreakpointManager(); breakpointManager.removeBreakpointListener(this); breakpointManager.removeBreakpointManagerListener(this); fireTerminateEvent(); }
public void initListeners() { IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); breakpointManager.addBreakpointListener(debugTargetState.getBreakpointListner()); breakpointManager.addBreakpointManagerListener(workspaceRelations.getBreakpointHandler()); workspaceRelations.getBreakpointHandler().initBreakpointManagerListenerState( breakpointManager); workspaceRelations.startInitialization(); }
private ChromiumBreakpointsFiltered getUiBreakpoints() { IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); final Set<ChromiumLineBreakpoint> lineBreakpoints = new HashSet<ChromiumLineBreakpoint>(); final List<ChromiumExceptionBreakpoint> exceptionBreakpoints = new ArrayList<ChromiumExceptionBreakpoint>(2); for (IBreakpoint breakpoint : breakpointManager.getBreakpoints(VProjectWorkspaceBridge.DEBUG_MODEL_ID)) { { ChromiumLineBreakpoint chromiumLineBreakpoint = ChromiumBreakpointAdapter.tryCastBreakpoint(breakpoint); if (chromiumLineBreakpoint != null) { lineBreakpoints.add(chromiumLineBreakpoint); continue; } } { ChromiumExceptionBreakpoint chromiumExceptionBreakpoint = ChromiumExceptionBreakpoint.tryCastBreakpoint(breakpoint); if (chromiumExceptionBreakpoint != null) { exceptionBreakpoints.add(chromiumExceptionBreakpoint); continue; } } } return new ChromiumBreakpointsFiltered() { @Override public Set<ChromiumLineBreakpoint> getLineBreakpoints() { return lineBreakpoints; } @Override public Collection<ChromiumExceptionBreakpoint> getExceptionBreakpoints() { return exceptionBreakpoints; } }; }
@Override public void launchRemoved(ILaunch launch) { // shut down the remote debugger when parent launch if (launch == this.launch) { IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); breakpointManager.removeBreakpointListener(this); PyExceptionBreakPointManager.getInstance().removeListener(this); PyPropertyTraceManager.getInstance().removeListener(this); } }
@Override public void launchRemoved(ILaunch launch) { // shut down the remote debugger when parent launch if (launch == this.launch) { IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); breakpointManager.removeBreakpointListener(this); PyExceptionBreakPointManager.getInstance().removeListener(this); PyPropertyTraceManager.getInstance().removeListener(this); debugger.dispose(); debugger = null; } }
@Override public void onDispose(BaseEditor baseEditor, IProgressMonitor monitor) { if (this.edit != null) { this.edit = null; IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); breakpointManager.removeBreakpointListener(this); } }
@Override public void fireSuspendEvent(int detail) { this.stackFrame = new BfStackFrame(getDebugTarget(), this, "Brainfuck Stack Frame"); if (detail == DebugEvent.STEP_END) { this.isStepping = false; this.fireChangeEvent(DebugEvent.CONTENT | DebugEvent.STATE); } else if (detail == DebugEvent.BREAKPOINT) { try { IBreakpointManager bpManager = DebugPlugin.getDefault().getBreakpointManager(); int location = this.getDebugTarget().getProcess().getProcessListener().getInstructionPointer(); List<IBreakpoint> breakpoints = new ArrayList<>(); for (IBreakpoint bp : bpManager.getBreakpoints(getModelIdentifier())) { if (bp instanceof BfBreakpoint && ((BfBreakpoint) bp).getCharStart() == location) { breakpoints.add(bp); } } this.suspendedBreakpoints = breakpoints.toArray(new IBreakpoint[breakpoints.size()]); // this.fireChangeEvent(DebugEvent.CONTENT | DebugEvent.STATE); } catch (CoreException ex) { DbgActivator.getDefault().logError("Breakpoints cannot be found", ex); } } try { IMemoryBlockManager mbManager = DebugPlugin.getDefault().getMemoryBlockManager(); List<IMemoryBlock> memoryBlocks = Arrays.asList(mbManager.getMemoryBlocks(getDebugTarget())); boolean found = false; int length = this.getDebugTarget().getProcess().getProcessListener().getSuspendedState().getDataSize(); for (IMemoryBlock block : memoryBlocks) { if (block.getStartAddress() == 0 && block.getLength() == length) { found = true; break; } } if (!found) { BfMemoryBlock mb = (BfMemoryBlock) this.getDebugTarget().getMemoryBlock(0, length); mb.setUserCreated(false); mb.fireCreationEvent(); mbManager.addMemoryBlocks(new IMemoryBlock[]{mb}); } } catch (DebugException e) { DbgActivator.getDefault().logError("Memory block could not be created", e); } super.fireSuspendEvent(detail); }
public void initBreakpointManagerListenerState(IBreakpointManager breakpointManager) { for (BreakpointMapperBase<?, ?> handler : allHandlers) { handler.initEnablement(breakpointManager); } }
synchronized void init(IBreakpointManager breakpointManager) { sendRequest(breakpointManager.isEnabled()); }
void initEnablement(IBreakpointManager breakpointManager) { enablementMonitor.init(breakpointManager); }
@Override synchronized void initEnablement(IBreakpointManager breakpointManager) { breakpointsEnabled = breakpointManager.isEnabled(); }
/** * @param resource may be the file open in the editor or the workspace root (if it is an external file) * @param document is the document opened in the editor * @param externalFileEditorInput is not-null if this is an external file * @param info is the vertical ruler info (only used if this is not an external file) * @param onlyIncludeLastLineActivity if only the markers that are in the last mouse-click should be included * * @return the markers that correspond to the markers from the current editor. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public static List<Tuple<IMarker, IBreakpoint>> getMarkersAndBreakpointsFromEditorResource(IResource resource, IDocument document, IEditorInput externalFileEditorInput, int lastLineActivity, boolean onlyIncludeLastLineActivity, IAnnotationModel annotationModel) { List<Tuple<IMarker, IBreakpoint>> breakpoints = new ArrayList<Tuple<IMarker, IBreakpoint>>(); try { List<IMarker> markers = new ArrayList<IMarker>(); boolean isExternalFile = false; markers.addAll(Arrays.asList(resource.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE))); markers.addAll(Arrays.asList(resource.findMarkers(PyBreakpoint.PY_CONDITIONAL_BREAK_MARKER, true, IResource.DEPTH_INFINITE))); markers.addAll(Arrays.asList(resource.findMarkers(PyBreakpoint.DJANGO_BREAK_MARKER, true, IResource.DEPTH_INFINITE))); if (!(resource instanceof IFile)) { //it was created from an external file isExternalFile = true; } IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager(); for (IMarker marker : markers) { if (marker == null) { continue; } IBreakpoint breakpoint = breakpointManager.getBreakpoint(marker); if (breakpoint != null && breakpointManager.isRegistered(breakpoint)) { Position pos = PyMarkerUtils.getMarkerPosition(document, marker, annotationModel); if (!isExternalFile) { if (!onlyIncludeLastLineActivity) { breakpoints.add(new Tuple(marker, breakpoint)); } else if (includesRulerLine(pos, document, lastLineActivity)) { breakpoints.add(new Tuple(marker, breakpoint)); } } else { if (isInSameExternalEditor(marker, externalFileEditorInput)) { if (!onlyIncludeLastLineActivity) { breakpoints.add(new Tuple(marker, breakpoint)); } else if (includesRulerLine(pos, document, lastLineActivity)) { breakpoints.add(new Tuple(marker, breakpoint)); } } } } } } catch (CoreException x) { PydevDebugPlugin.log(IStatus.ERROR, "Unexpected getMarkers error (recovered properly)", x); } return breakpoints; }
/** * Returns the breakpoint manager * * @return the breakpoint manager */ protected IBreakpointManager getBreakpointManager() { return DebugPlugin.getDefault().getBreakpointManager(); }
void initBreakpointManagerListenerState(IBreakpointManager breakpointManager);
abstract void initEnablement(IBreakpointManager breakpointManager);