use of org.eclipse.che.api.debug.shared.model.Breakpoint 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.api.debug.shared.model.Breakpoint 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.debug.shared.model.Breakpoint in project che by eclipse.
the class GdbTest method testBreakpoints.
@Test
public void testBreakpoints() throws Exception {
gdb.file(file);
gdb.breakpoint(7);
gdb.clear(7);
gdb.breakpoint("h.cpp", 8);
gdb.clear("h.cpp", 8);
gdb.breakpoint(7);
gdb.breakpoint(8);
GdbInfoBreak gdbInfoBreak = gdb.infoBreak();
List<Breakpoint> breakpoints = gdbInfoBreak.getBreakpoints();
assertEquals(breakpoints.size(), 2);
gdb.delete();
gdbInfoBreak = gdb.infoBreak();
breakpoints = gdbInfoBreak.getBreakpoints();
assertTrue(breakpoints.isEmpty());
}
use of org.eclipse.che.api.debug.shared.model.Breakpoint in project che by eclipse.
the class GdbInfoBreakTest method testParse.
@Test
public void testParse() throws Exception {
GdbOutput gdbOutput = GdbOutput.of("Num Type Disp Enb Address What\n" + "1 breakpoint keep y 0x00000000004008ca in main() at h.cpp:7\n" + "2 breakpoint keep y 0x00000000004008ca in main() at h.cpp:8\n");
GdbInfoBreak gdbInfoBreak = GdbInfoBreak.parse(gdbOutput);
List<Breakpoint> breakpoints = gdbInfoBreak.getBreakpoints();
assertEquals(breakpoints.size(), 2);
Breakpoint breakpoint = breakpoints.get(0);
assertEquals(breakpoint.getLocation().getTarget(), "h.cpp");
assertEquals(breakpoint.getLocation().getLineNumber(), 7);
breakpoint = breakpoints.get(1);
assertEquals(breakpoint.getLocation().getTarget(), "h.cpp");
assertEquals(breakpoint.getLocation().getLineNumber(), 8);
}
use of org.eclipse.che.api.debug.shared.model.Breakpoint in project che by eclipse.
the class GdbRunTest method testParse.
@Test
public void testParse() throws Exception {
GdbOutput gdbOutput = GdbOutput.of("Starting program: /home/tolusha/java/gdb/hello \n" + "0\n" + "\n" + "Breakpoint 1, main () at h.cpp:7\n" + "7\t\t std::cout << \"Hello World!\" << std::endl;\n");
GdbRun gdbRun = GdbRun.parse(gdbOutput);
Breakpoint breakpoint = gdbRun.getBreakpoint();
assertNotNull(breakpoint);
assertEquals(breakpoint.getLocation().getTarget(), "h.cpp");
assertEquals(breakpoint.getLocation().getLineNumber(), 7);
}
Aggregations