use of com.jetbrains.cidr.execution.debugger.backend.DebuggerCommandException in project intellij-plugins by JetBrains.
the class MotionValueRendererFactory method createRenderer.
@Nullable
@Override
public ValueRenderer createRenderer(@NotNull FactoryContext context) throws ExecutionException, DebuggerCommandException {
try {
LLValueData data = context.getLLValueData();
if (data.isValidPointer()) {
context.getEvaluationContext().evaluate(EvaluationContext.cast("rb_inspect(" + EvaluationContext.cast(data.getPointer(), "id") + ")", "id"));
// we want ObjC renderers for our collections
// Ruby collections are inheriting from native ones and don't have any useful instance variables
final ValueRenderer collectionRenderer = new NSCollectionValueRenderer.Factory().createRenderer(context);
return collectionRenderer != null ? collectionRenderer : new MotionObjectRenderer(context.getPhysicalValue());
}
} catch (DebuggerCommandException ignored) {
}
return null;
}
use of com.jetbrains.cidr.execution.debugger.backend.DebuggerCommandException in project clion-embedded-arm by elmot.
the class OpenOcdLauncher method createDebugProcess.
@NotNull
@Override
protected CidrDebugProcess createDebugProcess(@NotNull CommandLineState commandLineState, @NotNull XDebugSession xDebugSession) throws ExecutionException {
Project project = commandLineState.getEnvironment().getProject();
OpenOcdSettingsState ocdSettings = project.getComponent(OpenOcdSettingsState.class);
CidrRemoteDebugParameters remoteDebugParameters = new CidrRemoteDebugParameters();
remoteDebugParameters.setSymbolFile(findRunFile(commandLineState).getAbsolutePath());
remoteDebugParameters.setRemoteCommand("tcp:localhost:" + ocdSettings.gdbPort);
CPPToolchains.Toolchain toolchain = CPPToolchains.getInstance().getDefaultToolchain();
if (toolchain == null) {
throw new ExecutionException("Project toolchain is not defined. Please define it in the project settings.");
}
String gdbPath;
toolchain = toolchain.copy();
if (ocdSettings.shippedGdb) {
gdbPath = PathManager.findBinFile("gdb/bin/gdb" + (OS.isWindows() ? ".exe" : "")).getAbsolutePath();
} else {
gdbPath = ocdSettings.gdbLocation;
}
CPPDebugger cppDebugger = CPPDebugger.create(CPPDebugger.Kind.CUSTOM_GDB, gdbPath);
toolchain.setDebugger(cppDebugger);
GDBDriverConfiguration gdbDriverConfiguration = new GDBDriverConfiguration(getProject(), toolchain);
xDebugSession.stop();
CidrRemoteGDBDebugProcess debugProcess = new CidrRemoteGDBDebugProcess(gdbDriverConfiguration, remoteDebugParameters, xDebugSession, commandLineState.getConsoleBuilder(), project1 -> new Filter[0]);
debugProcess.getProcessHandler().addProcessListener(new ProcessAdapter() {
@Override
public void processWillTerminate(@NotNull ProcessEvent event, boolean willBeDestroyed) {
super.processWillTerminate(event, willBeDestroyed);
findOpenOcdAction(project).stopOpenOcd();
}
});
debugProcess.getProcessHandler().putUserData(RESTART_KEY, new AnAction("Reset", "MCU Reset", IconLoader.findIcon("reset.png", OpenOcdLauncher.class)) {
@Override
public void actionPerformed(AnActionEvent e) {
XDebugSession session = debugProcess.getSession();
session.pause();
debugProcess.postCommand(drv -> {
try {
ProgressManager.getInstance().runProcess(() -> {
while (drv.getState() != DebuggerDriver.TargetState.SUSPENDED) {
Thread.yield();
}
}, null);
drv.executeConsoleCommand("monitor reset init");
session.resume();
} catch (DebuggerCommandException exception) {
Informational.showFailedDownloadNotification(e.getProject());
}
});
}
});
return debugProcess;
}
Aggregations