use of org.eclipse.che.plugin.gdb.server.parser.GdbContinue in project che by eclipse.
the class GdbDebugger method resume.
@Override
public void resume(ResumeAction action) throws DebuggerException {
try {
GdbContinue gdbContinue = gdb.cont();
Breakpoint breakpoint = gdbContinue.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("Resume error. " + e.getMessage(), e);
}
}
use of org.eclipse.che.plugin.gdb.server.parser.GdbContinue 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.plugin.gdb.server.parser.GdbContinue in project che by eclipse.
the class GdbTest method testInfoProgram.
@Test
public void testInfoProgram() throws Exception {
gdb.file(file);
GdbInfoProgram gdbInfoProgram = gdb.infoProgram();
assertNull(gdbInfoProgram.getStoppedAddress());
gdb.breakpoint(4);
gdb.run();
gdbInfoProgram = gdb.infoProgram();
assertNotNull(gdbInfoProgram.getStoppedAddress());
GdbContinue gdbContinue = gdb.cont();
assertNull(gdbContinue.getBreakpoint());
gdbInfoProgram = gdb.infoProgram();
assertNull(gdbInfoProgram.getStoppedAddress());
}
use of org.eclipse.che.plugin.gdb.server.parser.GdbContinue in project che by eclipse.
the class GdbTest method testTargetRemote.
@Test
public void testTargetRemote() throws Exception {
GdbServer gdbServer = GdbServer.start("localhost", 1111, file);
try {
gdb.file(file);
gdb.targetRemote("localhost", 1111);
gdb.breakpoint(7);
GdbContinue gdbContinue = gdb.cont();
Breakpoint breakpoint = gdbContinue.getBreakpoint();
assertNotNull(breakpoint);
assertEquals(breakpoint.getLocation().getTarget(), "h.cpp");
assertEquals(breakpoint.getLocation().getLineNumber(), 7);
} finally {
gdbServer.stop();
}
}
Aggregations