Java Code Examples for org.eclipse.debug.core.ILaunch#addDebugTarget()
The following examples show how to use
org.eclipse.debug.core.ILaunch#addDebugTarget() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PyDebugTargetServer.java From Pydev with Eclipse Public License 1.0 | 6 votes |
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); }
Example 2
Source File: PyDebugTarget.java From Pydev with Eclipse Public License 1.0 | 6 votes |
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); }
Example 3
Source File: CodewindLaunchConfigDelegate.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
private void launchInner(ILaunchConfiguration config, String launchMode, ILaunch launch, IProgressMonitor monitor) throws Exception { CodewindEclipseApplication app = getApp(config); if (app.getDebugConnectHost() == null || app.getDebugConnectPort() <= 0) { String msg = "The debug connect host or debug connect port is not set up for application: " + app.name; // $NON-NLS-1$ Logger.logError(msg); abort(msg, null, IStatus.ERROR); } // Make sure the saved launch is up to date in case this is a relaunch app.setLaunch(launch); setDefaultSourceLocator(launch, config); Logger.log("Connecting the debugger for project: " + app.name); //$NON-NLS-1$ IDebugTarget debugTarget = CodewindDebugConnector.connectDebugger(launch, app, monitor); if (debugTarget != null) { Logger.log("Debugger connect success. Application should go into Debugging state soon."); //$NON-NLS-1$ launch.addDebugTarget(debugTarget); } else if (!monitor.isCanceled()) { Logger.logError("Debugger connect timeout for project: " + app.name); //$NON-NLS-1$ CoreUtil.openDialog(true, Messages.DebuggerConnectFailureDialogTitle, Messages.DebuggerConnectFailureTimeoutMsg); getLaunchManager().removeLaunch(launch); } monitor.done(); }
Example 4
Source File: ScriptDebugTarget.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * Contructor * * @param launch * @param vm * @param name * @param process * @param listenPort * @param eventPort * @param tempFolder */ public ScriptDebugTarget( ILaunch launch, ReportVMClient vm, String name, IProcess process, int listenPort, String tempFolder ) { super( null ); this.launch = launch; this.reportVM = vm; this.name = name; this.process = process; this.tempFolder = tempFolder; this.listenPort = listenPort; launch.addDebugTarget( this ); vm.addVMListener( this ); setTerminating( false ); setTerminated( false ); thread = new ScriptDebugThread( this ); // There are only one thread threads = new IThread[]{ thread }; DebugPlugin.getDefault( ) .getBreakpointManager( ) .addBreakpointListener( this ); DebugPlugin.getDefault().getBreakpointManager().addBreakpointManagerListener(this); // connect the server util the ReportLauncher run already while ( !isTerminated( ) ) { try { vm.connect( listenPort ); break; } catch ( VMException e ) { try { Thread.sleep( 100 ); } catch ( InterruptedException e1 ) { //do nothing } continue; } } }
Example 5
Source File: PydevConsoleFactory.java From Pydev with Eclipse Public License 1.0 | 4 votes |
private void createDebugTarget(PydevConsoleInterpreter interpreter, PydevConsole console, IProgressMonitor monitor) throws IOException, CoreException, DebugException, UserCanceledException { monitor.beginTask("Connect Debug Target", 2); try { // Jython within Eclipse does not yet support debugging // NOTE: Jython within Eclipse currently works "once", i.e. it sets up properly and you can debug your // scripts you run within Eclipse, but the termination does not work properly and it seems that // we don't clean-up properly. There is a small additional problem, pysrc is not on the PYTHONPATH // so it fails to run properly, a simple hack to the pydevconsole to add its dirname to the sys.path // resolves that issue though. Process process = interpreter.getProcess(); if (InteractiveConsolePrefs.getConsoleConnectDebugSession() && !(process instanceof JythonEclipseProcess)) { PydevConsoleCommunication consoleCommunication = (PydevConsoleCommunication) interpreter .getConsoleCommunication(); int acceptTimeout = PydevPrefs.getEclipsePreferences().getInt(PyDevEditorPreferences.CONNECT_TIMEOUT, PyDevEditorPreferences.DEFAULT_CONNECT_TIMEOUT); PyDebugTargetConsole pyDebugTargetConsole = null; ILaunch launch = interpreter.getLaunch(); IProcess eclipseProcess = launch.getProcesses()[0]; RemoteDebuggerConsole debugger = new RemoteDebuggerConsole(); ListenConnector connector = new ListenConnector(acceptTimeout); debugger.startConnect(connector); pyDebugTargetConsole = new PyDebugTargetConsole(consoleCommunication, launch, eclipseProcess, debugger); Socket socket = null; try { consoleCommunication.connectToDebugger(connector.getLocalPort()); socket = debugger.waitForConnect(monitor, process, eclipseProcess); if (socket == null) { throw new UserCanceledException("Cancelled"); } } catch (Exception ex) { try { if (ex instanceof UserCanceledException) { //Only close the console communication if the user actually cancelled (otherwise the user will expect it to still be working). consoleCommunication.close(); debugger.dispose(); //Can't terminate the process either! } else { //But we still want to dispose of the connector. debugger.disposeConnector(); } } catch (Exception e) { // Don't hide important information from user Log.log(e); } if (ex instanceof UserCanceledException) { UserCanceledException userCancelled = (UserCanceledException) ex; throw userCancelled; } String message = "Unexpected error setting up the debugger"; if (ex instanceof SocketTimeoutException) { message = "Timed out after " + Float.toString(acceptTimeout / 1000) + " seconds while waiting for python script to connect."; } throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, message, ex)); } pyDebugTargetConsole.startTransmission(socket); // this starts reading/writing from sockets pyDebugTargetConsole.initialize(); consoleCommunication.setDebugTarget(pyDebugTargetConsole); launch.addDebugTarget(pyDebugTargetConsole); launch.setSourceLocator(new PySourceLocator()); ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); launchManager.addLaunch(launch); pyDebugTargetConsole.setConsole(console); console.setProcess(pyDebugTargetConsole.getProcess()); pyDebugTargetConsole.finishedInit = true; } } finally { monitor.done(); } }