Examples of XDebugSession


Examples of com.intellij.xdebugger.XDebugSession

                execName = execName.concat(".exe");
                execName = execName.replaceAll("\\\\", "/");
            }

            env = RunContentBuilder.fix(env, this);
            final XDebugSession debugSession = XDebuggerManager.getInstance(project).startSession(env, new XDebugProcessStarter() {
                     @NotNull
                     @Override
                     public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException {
                            return new GdbDebugProcess(project, session, (GdbExecutionResult) executionResult);
                     }
            });

            Sdk sdk = GoSdkUtil.getGoogleGoSdkForProject(project);
            if ( sdk == null ) {
                debugSession.stop();
                return null;
            }

            final GoSdkData sdkData = (GoSdkData)sdk.getSdkAdditionalData();
            if ( sdkData == null ) {
                debugSession.stop();
                return null;
            }

            GdbDebugProcess debugProcess = ((GdbDebugProcess) debugSession.getDebugProcess());

            String goRootPath;
            try {
                goRootPath = (new File(sdkData.GO_GOROOT_PATH)).getCanonicalPath();
            } catch (IOException ignored) {
                debugSession.stop();
                return null;
            }

            final Gdb gdbProcess = debugProcess.m_gdb;

            // Queue startup commands
            gdbProcess.sendCommand("-list-features", new Gdb.GdbEventCallback() {
                 @Override
                 public void onGdbCommandCompleted(GdbEvent event) {
                      gdbProcess.onGdbCapabilitiesReady(event);
                 }
            });
            gdbProcess.sendCommand("add-auto-load-safe-path " + goRootPath);

            String pythonRuntime = goRootPath + "/src/pkg/runtime/runtime-gdb.py";
            if (GoSdkUtil.checkFileExists(pythonRuntime)) {
                gdbProcess.sendCommand("source " + pythonRuntime);
            }

            gdbProcess.sendCommand("file " + execName);

            //If we got any script arguments, pass them into gdb
            if(!configuration.scriptArguments.equals("")) {
                gdbProcess.sendCommand("set args " + configuration.scriptArguments);
            }

            debugSession.initBreakpoints();

            // Send startup commands
            String[] commandsArray = configuration.STARTUP_COMMANDS.split("\\r?\\n");
            for (String command : commandsArray) {
                command = command.trim();
                if (!command.isEmpty()) {
                    gdbProcess.sendCommand(command);
                }
            }

            if (configuration.autoStartGdb) {
                gdbProcess.sendCommand("run");
            }

            return debugSession.getRunContentDescriptor();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.