Search in sources :

Example 31 with DebuggerException

use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.

the class GdbDebuggerFactory 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 host = normalizedProps.get("host");
    int port;
    try {
        port = Integer.parseInt(normalizedProps.getOrDefault("port", "0"));
    } catch (NumberFormatException e) {
        throw new DebuggerException("Unknown port property format: " + normalizedProps.get("port"));
    }
    String file = normalizedProps.get("binary");
    if (file == null) {
        throw new DebuggerException("binary property is null. Debugger can't be started");
    }
    String sources = normalizedProps.get("sources");
    if (sources == null) {
        sources = Paths.get(file).getParent().toString();
    }
    return GdbDebugger.newInstance(host, port, file, sources, debuggerCallback);
}
Also used : DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) Collectors.toMap(java.util.stream.Collectors.toMap) Paths(java.nio.file.Paths) Map(java.util.Map) Debugger(org.eclipse.che.api.debugger.server.Debugger) DebuggerFactory(org.eclipse.che.api.debugger.server.DebuggerFactory) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map)

Aggregations

DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)31 IOException (java.io.IOException)13 GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)10 GdbTerminatedException (org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException)10 SuspendEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl)7 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)6 Location (org.eclipse.che.api.debug.shared.model.Location)6 Map (java.util.Map)5 Collectors.toMap (java.util.stream.Collectors.toMap)4 BreakpointActivatedEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.BreakpointActivatedEventImpl)4 Debugger (org.eclipse.che.api.debugger.server.Debugger)4 DebuggerFactory (org.eclipse.che.api.debugger.server.DebuggerFactory)4 ArrayList (java.util.ArrayList)3 GdbInfoLine (org.eclipse.che.plugin.gdb.server.parser.GdbInfoLine)3 NodeJsDebuggerException (org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerException)3 NodeJsDebuggerTerminatedException (org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerTerminatedException)3 AbsentInformationException (com.sun.jdi.AbsentInformationException)2 InvalidStackFrameException (com.sun.jdi.InvalidStackFrameException)2 NativeMethodException (com.sun.jdi.NativeMethodException)2 ReferenceType (com.sun.jdi.ReferenceType)2