use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.
the class DebuggerService method deleteBreakpoint.
@DELETE
@Path("{id}/breakpoint")
public void deleteBreakpoint(@PathParam("id") String sessionId, @QueryParam("target") String target, @QueryParam("line") @DefaultValue("0") int lineNumber) throws DebuggerException {
if (target == null) {
debuggerManager.getDebugger(sessionId).deleteAllBreakpoints();
} else {
Location location = new LocationImpl(target, lineNumber);
debuggerManager.getDebugger(sessionId).deleteBreakpoint(location);
}
}
use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.
the class ZendDbgLocationHandler method convertToVFS.
/**
* Convert DBG specific location to VFS one.
*
* @param dbgLocation
* @return VFS specific location.
*/
public Location convertToVFS(Location dbgLocation) {
VirtualFileEntry localFileEntry = ZendDbgFileUtils.findVirtualFileEntry(dbgLocation.getResourcePath());
if (localFileEntry == null) {
return null;
}
String resourceProjectPath = localFileEntry.getProject();
String target = localFileEntry.getName();
String resourcePath = localFileEntry.getPath().toString();
int lineNumber = dbgLocation.getLineNumber();
return new LocationImpl(target, lineNumber, resourcePath, false, 0, resourceProjectPath);
}
use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.
the class GdbRun method parse.
/**
* Factory method.
*/
public static GdbRun parse(GdbOutput gdbOutput) throws GdbParseException {
String output = gdbOutput.getOutput();
for (String line : output.split("\n")) {
Matcher matcher = GDB_BREAKPOINT.matcher(line);
if (matcher.find()) {
String file = matcher.group(1);
String lineNumber = matcher.group(2);
Location location = new LocationImpl(file, Integer.parseInt(lineNumber));
return new GdbRun(new BreakpointImpl(location));
}
}
return new GdbRun(null);
}
use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.
the class GdbDebuggerTest method addBreakpoint.
private void addBreakpoint() throws DebuggerException, InterruptedException {
Location location = new LocationImpl("h.cpp", 7);
Breakpoint breakpoint = new BreakpointImpl(location);
gdbDebugger.addBreakpoint(breakpoint);
assertEquals(events.size(), 1);
DebuggerEvent debuggerEvent = events.take();
assertTrue(debuggerEvent instanceof BreakpointActivatedEvent);
BreakpointActivatedEvent breakpointActivatedEvent = (BreakpointActivatedEvent) debuggerEvent;
assertEquals(breakpointActivatedEvent.getBreakpoint().getLocation().getTarget(), "h.cpp");
assertEquals(breakpointActivatedEvent.getBreakpoint().getLocation().getLineNumber(), 7);
}
use of org.eclipse.che.api.debug.shared.model.impl.LocationImpl in project che by eclipse.
the class JavaDebugger method processBreakPointEvent.
private boolean processBreakPointEvent(com.sun.jdi.event.BreakpointEvent event) throws DebuggerException {
setCurrentThread(event.thread());
boolean hitBreakpoint;
ExpressionParser parser = (ExpressionParser) event.request().getProperty("org.eclipse.che.ide.java.debug.condition.expression.parser");
if (parser != null) {
com.sun.jdi.Value result = evaluate(parser);
hitBreakpoint = result instanceof com.sun.jdi.BooleanValue && ((com.sun.jdi.BooleanValue) result).value();
} else {
// If there is no expression.
hitBreakpoint = true;
}
if (hitBreakpoint) {
com.sun.jdi.Location jdiLocation = event.location();
Location location;
try {
location = debuggerUtil.getLocation(jdiLocation);
} catch (DebuggerException e) {
location = new LocationImpl(jdiLocation.declaringType().name(), jdiLocation.lineNumber());
}
debuggerCallback.onEvent(new SuspendEventImpl(location));
}
// or if condition expression is not set.
return !hitBreakpoint;
}
Aggregations