use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebugger method stepOut.
@Override
public void stepOut(StepOutAction action) throws DebuggerException {
try {
GdbInfoLine gdbInfoLine = gdb.finish();
if (gdbInfoLine == null) {
disconnect();
return;
}
currentLocation = gdbInfoLine.getLocation();
debuggerCallback.onEvent(new SuspendEventImpl(gdbInfoLine.getLocation()));
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Step out error. " + e.getMessage(), e);
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebugger method start.
@Override
public void start(StartAction action) throws DebuggerException {
try {
for (Breakpoint b : action.getBreakpoints()) {
try {
addBreakpoint(b);
} catch (DebuggerException e) {
// can't add breakpoint, skip it
}
}
Breakpoint breakpoint;
if (isRemoteConnection()) {
GdbContinue gdbContinue = gdb.cont();
breakpoint = gdbContinue.getBreakpoint();
} else {
GdbRun gdbRun = gdb.run();
breakpoint = gdbRun.getBreakpoint();
}
if (breakpoint != null) {
currentLocation = breakpoint.getLocation();
debuggerCallback.onEvent(new SuspendEventImpl(breakpoint.getLocation()));
} else {
GdbInfoProgram gdbInfoProgram = gdb.infoProgram();
if (gdbInfoProgram.getStoppedAddress() == null) {
disconnect();
}
}
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Error during running. " + e.getMessage(), e);
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebugger method stepInto.
@Override
public void stepInto(StepIntoAction action) throws DebuggerException {
try {
GdbInfoLine gdbInfoLine = gdb.step();
if (gdbInfoLine == null) {
disconnect();
return;
}
currentLocation = gdbInfoLine.getLocation();
debuggerCallback.onEvent(new SuspendEventImpl(gdbInfoLine.getLocation()));
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Step into error. " + e.getMessage(), e);
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebugger method getValue.
@Override
public SimpleValue getValue(VariablePath variablePath) throws DebuggerException {
try {
List<String> path = variablePath.getPath();
if (path.isEmpty()) {
throw new DebuggerException("Variable path is empty");
}
GdbPrint gdbPrint = gdb.print(path.get(0));
return new SimpleValueImpl(Collections.emptyList(), gdbPrint.getValue());
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Can't get value for " + variablePath + ". " + e.getMessage(), e);
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class ZendDbgFactory method create.
@Override
public Debugger create(Map<String, String> properties, Debugger.DebuggerCallback debuggerCallback) throws DebuggerException {
Map<String, String> normalizedProps = properties.entrySet().stream().collect(toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
String breakAtFirstLineProp = normalizedProps.get("break-at-first-line");
if (breakAtFirstLineProp == null) {
throw new DebuggerException("Can't establish connection: debug break at first line property is unknown.");
}
boolean breakAtFirstLine = Boolean.valueOf(breakAtFirstLineProp);
String clientHostIPProp = normalizedProps.get("client-host-ip");
if (clientHostIPProp == null) {
throw new DebuggerException("Can't establish connection: client host/IP property is unknown.");
}
String debugPortProp = normalizedProps.get("debug-port");
if (debugPortProp == null) {
throw new DebuggerException("Can't establish connection: debug port property is unknown.");
}
int debugPort;
try {
debugPort = Integer.parseInt(debugPortProp);
} catch (NumberFormatException e) {
throw new DebuggerException("Unknown debug port property format: " + debugPortProp);
}
String useSslEncryptionProp = normalizedProps.get("use-ssl-encryption");
if (useSslEncryptionProp == null) {
throw new DebuggerException("Can't establish connection: debug use SSL encryption property is unknown.");
}
boolean useSslEncryption = Boolean.valueOf(useSslEncryptionProp);
return new ZendDebugger(new ZendDbgSettings(debugPort, clientHostIPProp, breakAtFirstLine, useSslEncryption), new ZendDbgLocationHandler(), debuggerCallback);
}
Aggregations