use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class JdiStackFrameImpl method getLocalVariables.
@Override
public JdiLocalVariable[] getLocalVariables() throws DebuggerException {
if (localVariables == null) {
try {
List<LocalVariable> targetVariables = stackFrame.visibleVariables();
localVariables = new JdiLocalVariable[targetVariables.size()];
int i = 0;
for (LocalVariable var : targetVariables) {
localVariables[i++] = new JdiLocalVariableImpl(stackFrame, var);
}
} catch (AbsentInformationException e) {
throw new DebuggerAbsentInformationException(e.getMessage(), e);
} catch (InvalidStackFrameException | NativeMethodException e) {
throw new DebuggerException(e.getMessage(), e);
}
}
return localVariables;
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class JavaDebuggerUtils method getLocation.
/**
* Returns Location for current debugger resource.
*
* @param location
* location type from JVM
* @throws DebuggerException
* in case {@link org.eclipse.jdt.core.JavaModelException} or if Java {@link org.eclipse.jdt.core.IType}
* was not find
*/
public Location getLocation(com.sun.jdi.Location location) throws DebuggerException {
String fqn = location.declaringType().name();
List<IType> types;
try {
Pair<char[][], char[][]> fqnPair = prepareFqnToSearch(fqn);
types = findTypeByFqn(fqnPair.first, fqnPair.second, createWorkspaceScope());
} catch (JavaModelException e) {
throw new DebuggerException("Can't find class models by fqn: " + fqn, e);
}
if (types.isEmpty()) {
throw new DebuggerException("Type with fully qualified name: " + fqn + " was not found");
}
//TODO we need handle few result! It's temporary solution.
IType type = types.get(0);
String typeProjectPath = type.getJavaProject().getPath().toOSString();
if (type.isBinary()) {
IClassFile classFile = type.getClassFile();
int libId = classFile.getAncestor(IPackageFragmentRoot.PACKAGE_FRAGMENT_ROOT).hashCode();
return new LocationImpl(fqn, location.lineNumber(), null, true, libId, typeProjectPath);
} else {
ICompilationUnit compilationUnit = type.getCompilationUnit();
typeProjectPath = type.getJavaProject().getPath().toOSString();
String resourcePath = compilationUnit.getPath().toOSString();
return new LocationImpl(fqn, location.lineNumber(), resourcePath, false, -1, typeProjectPath);
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebugger method addBreakpoint.
@Override
public void addBreakpoint(Breakpoint breakpoint) throws DebuggerException {
try {
Location location = breakpoint.getLocation();
if (location.getTarget() == null) {
gdb.breakpoint(location.getLineNumber());
} else {
gdb.breakpoint(location.getTarget(), location.getLineNumber());
}
debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint));
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Can't add breakpoint: " + breakpoint + ". " + e.getMessage(), e);
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebugger method stepOver.
@Override
public void stepOver(StepOverAction action) throws DebuggerException {
try {
GdbInfoLine gdbInfoLine = gdb.next();
if (gdbInfoLine == null) {
disconnect();
return;
}
currentLocation = gdbInfoLine.getLocation();
debuggerCallback.onEvent(new SuspendEventImpl(gdbInfoLine.getLocation()));
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Step into error. " + e.getMessage(), e);
}
}
use of org.eclipse.che.api.debugger.server.exceptions.DebuggerException in project che by eclipse.
the class GdbDebugger method suspend.
@Override
public void suspend() throws DebuggerException {
try {
currentLocation = gdb.suspend(file, isRemoteConnection());
debuggerCallback.onEvent(new SuspendEventImpl(currentLocation));
} catch (IOException | InterruptedException e) {
throw new DebuggerException("Can not suspend debugger session. " + e.getMessage(), e);
}
}
Aggregations