Search in sources :

Example 1 with GdbRun

use of org.eclipse.che.plugin.gdb.server.parser.GdbRun 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);
    }
}
Also used : SuspendEventImpl(org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl) Breakpoint(org.eclipse.che.api.debug.shared.model.Breakpoint) GdbRun(org.eclipse.che.plugin.gdb.server.parser.GdbRun) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) GdbContinue(org.eclipse.che.plugin.gdb.server.parser.GdbContinue) GdbInfoProgram(org.eclipse.che.plugin.gdb.server.parser.GdbInfoProgram) GdbTerminatedException(org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException) IOException(java.io.IOException) GdbParseException(org.eclipse.che.plugin.gdb.server.exception.GdbParseException)

Example 2 with GdbRun

use of org.eclipse.che.plugin.gdb.server.parser.GdbRun in project che by eclipse.

the class GdbTest method testRun.

@Test
public void testRun() throws Exception {
    gdb.file(file);
    gdb.breakpoint(7);
    GdbRun gdbRun = gdb.run();
    assertNotNull(gdbRun.getBreakpoint());
}
Also used : GdbRun(org.eclipse.che.plugin.gdb.server.parser.GdbRun) Test(org.testng.annotations.Test)

Aggregations

GdbRun (org.eclipse.che.plugin.gdb.server.parser.GdbRun)2 IOException (java.io.IOException)1 Breakpoint (org.eclipse.che.api.debug.shared.model.Breakpoint)1 SuspendEventImpl (org.eclipse.che.api.debug.shared.model.impl.event.SuspendEventImpl)1 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)1 GdbParseException (org.eclipse.che.plugin.gdb.server.exception.GdbParseException)1 GdbTerminatedException (org.eclipse.che.plugin.gdb.server.exception.GdbTerminatedException)1 GdbContinue (org.eclipse.che.plugin.gdb.server.parser.GdbContinue)1 GdbInfoProgram (org.eclipse.che.plugin.gdb.server.parser.GdbInfoProgram)1 Test (org.testng.annotations.Test)1