Search in sources :

Example 1 with CidrLocalDebugProcess

use of com.jetbrains.cidr.execution.debugger.CidrLocalDebugProcess in project intellij by bazelbuild.

the class BlazeCidrLauncher method createDebugProcess.

@Override
public CidrDebugProcess createDebugProcess(CommandLineState state, XDebugSession session) throws ExecutionException {
    TargetExpression target = configuration.getTarget();
    if (target == null) {
        throw new ExecutionException("Cannot parse run configuration target.");
    }
    if (runner.executableToDebug == null) {
        throw new ExecutionException("No debug binary found.");
    }
    WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
    GeneralCommandLine commandLine = new GeneralCommandLine(runner.executableToDebug.getPath());
    File workingDir = workspaceRoot.directory();
    commandLine.setWorkDirectory(workingDir);
    commandLine.addParameters(handlerState.getExeFlagsState().getExpandedFlags());
    EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData();
    commandLine.withParentEnvironmentType(envState.isPassParentEnvs() ? ParentEnvironmentType.SYSTEM : ParentEnvironmentType.NONE);
    commandLine.getEnvironment().putAll(envState.getEnvs());
    if (Kind.CC_TEST.equals(configuration.getTargetKind())) {
        convertBlazeTestFilterToExecutableFlag().ifPresent(commandLine::addParameters);
    }
    TrivialInstaller installer = new TrivialInstaller(commandLine);
    ImmutableList<String> startupCommands = getGdbStartupCommands(workingDir);
    CLionRunParameters parameters = new CLionRunParameters(new BlazeGDBDriverConfiguration(project, startupCommands, workspaceRoot), installer);
    state.setConsoleBuilder(createConsoleBuilder(null));
    state.addConsoleFilters(getConsoleFilters().toArray(new Filter[0]));
    return new CidrLocalDebugProcess(parameters, session, state.getConsoleBuilder());
}
Also used : CLionRunParameters(com.jetbrains.cidr.cpp.execution.CLionRunParameters) CidrLocalDebugProcess(com.jetbrains.cidr.execution.debugger.CidrLocalDebugProcess) TrivialInstaller(com.jetbrains.cidr.execution.TrivialInstaller) TargetExpression(com.google.idea.blaze.base.model.primitives.TargetExpression) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) EnvironmentVariablesData(com.intellij.execution.configuration.EnvironmentVariablesData) UrlFilter(com.intellij.execution.filters.UrlFilter) IssueOutputFilter(com.google.idea.blaze.base.issueparser.IssueOutputFilter) Filter(com.intellij.execution.filters.Filter) BlazeTargetFilter(com.google.idea.blaze.base.run.filter.BlazeTargetFilter) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) ExecutionException(com.intellij.execution.ExecutionException) File(java.io.File)

Aggregations

IssueOutputFilter (com.google.idea.blaze.base.issueparser.IssueOutputFilter)1 TargetExpression (com.google.idea.blaze.base.model.primitives.TargetExpression)1 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)1 BlazeTargetFilter (com.google.idea.blaze.base.run.filter.BlazeTargetFilter)1 ExecutionException (com.intellij.execution.ExecutionException)1 EnvironmentVariablesData (com.intellij.execution.configuration.EnvironmentVariablesData)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 Filter (com.intellij.execution.filters.Filter)1 UrlFilter (com.intellij.execution.filters.UrlFilter)1 CLionRunParameters (com.jetbrains.cidr.cpp.execution.CLionRunParameters)1 TrivialInstaller (com.jetbrains.cidr.execution.TrivialInstaller)1 CidrLocalDebugProcess (com.jetbrains.cidr.execution.debugger.CidrLocalDebugProcess)1 File (java.io.File)1