@Override public void handleDebugEvents(DebugEvent[] events) { for (int i = 0; i < events.length; i++) { DebugEvent debugEvent = events[i]; if (debugEvent.getKind() == DebugEvent.TERMINATE) { // this event is fired for each thread and stuff, but we only want to remove our breakpoints, // when the JVM process terminates if (debugEvent.getSource() instanceof RuntimeProcess) { // remove this debug event listener to release it for garbage collection DebugPlugin.getDefault().removeDebugEventListener(this); // remove temporary jimple breakpoints try { JimpleBreakpointManager.getInstance().removeTemporaryBreakpoints(); } catch (CoreException e) { logger.error("Couldn't delete temporary jimple breakpoints after termination", e); } // stop the monitoring server monitoringServer.stop(); // delete the agent jar if (agentJar != null && agentJar.exists()) { agentJar.delete(); } // remove the jimple instruction pointer marker (green debug line highlighting) removeJimpleInstructionPointerMarker(); } } } }
public void connect(TextConsole console) { try { /* * Now we have to go digging for the Connect IQ project. * * It seems to be rather difficult to find, and we do with the debug * info file. */ Object consoleProcessObj = console .getAttribute("org.eclipse.debug.ui.ATTR_CONSOLE_PROCESS"); if (!(consoleProcessObj instanceof RuntimeProcess)) return; RuntimeProcess rp = (RuntimeProcess) consoleProcessObj; ILaunch launch = rp.getLaunch(); if (launch == null) return; ILaunchConfiguration launchConf = launch.getLaunchConfiguration(); if (launchConf == null) return; String debugInfoFile = launchConf.getAttribute( "connectiq.debugInfo", (String) null); if (debugInfoFile == null) return; myDebugInfo = DebugInfoManager.getDebugInfo(debugInfoFile); myGlobalDebugInfo = getGlobalDebugInfo(); myConsole = console; } catch (CoreException e) { } }
public void handleDebugEvents(DebugEvent[] events) { if(events.length > 0 && runtime != null && !runtime.isTerminated()) { DebugEvent e = events[0]; PandionJUI.executeUpdate(() -> { if(e.getKind() == DebugEvent.SUSPEND && e.getDetail() == DebugEvent.STEP_END && exception == null) { IJavaThread thread = (IJavaThread) e.getSource(); IStackFrame f = thread.getTopStackFrame(); if(f == null) return; ISourceLocator sourceLocator = f.getLaunch().getSourceLocator(); Object sourceElement = sourceLocator == null ? null : sourceLocator.getSourceElement(f); if(sourceElement != null) { if(sourceElement instanceof IFile) handleFrames(thread); else thread.stepReturn(); if(f != null && f.getLineNumber() == -1) thread.resume(); // to jump over injected code } else { thread.stepReturn(); } // Job job = Job.create("Update table", (ICoreRunnable) monitor -> { // System.out.println("STEP"); // thread.stepInto(); // }); // job.schedule(3000); } else if(e.getKind() == DebugEvent.CHANGE && e.getDetail() == DebugEvent.CONTENT) { runtime = new RuntimeModel(); runtimeView.setInput(runtime); } else if(e.getKind() == DebugEvent.TERMINATE && e.getSource() instanceof RuntimeProcess) { runtime.setTerminated(); } }); } }
@Override public IProcess newProcess(ILaunch launch, Process process, String label, Map attributes) { return new RuntimeProcess(launch, new ProcessWrapper(process), label, attributes); }