use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException 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.exception.GdbParseException in project che by eclipse.
the class GdbDebugger method dumpStackFrame.
/**
* Dump frame.
*/
@Override
public StackFrameDump dumpStackFrame() throws DebuggerException {
try {
Map<String, String> locals = gdb.infoLocals().getVariables();
locals.putAll(gdb.infoArgs().getVariables());
List<Variable> variables = new ArrayList<>(locals.size());
for (Map.Entry<String, String> e : locals.entrySet()) {
String varName = e.getKey();
String varValue = e.getValue();
String varType;
try {
varType = gdb.ptype(varName).getType();
} catch (GdbParseException pe) {
LOG.warn(pe.getMessage(), pe);
varType = "";
}
VariablePath variablePath = new VariablePathImpl(singletonList(varName));
VariableImpl variable = new VariableImpl(varType, varName, varValue, true, variablePath, Collections.emptyList(), true);
variables.add(variable);
}
return new StackFrameDumpImpl(Collections.emptyList(), variables);
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Can't dump stack frame. " + e.getMessage(), e);
}
}
use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException in project che by eclipse.
the class GdbDebugger method setValue.
@Override
public void setValue(Variable variable) throws DebuggerException {
try {
List<String> path = variable.getVariablePath().getPath();
if (path.isEmpty()) {
throw new DebuggerException("Variable path is empty");
}
gdb.setVar(path.get(0), variable.getValue());
} catch (GdbTerminatedException e) {
disconnect();
throw e;
} catch (IOException | GdbParseException | InterruptedException e) {
throw new DebuggerException("Can't set value for " + variable.getName() + ". " + e.getMessage(), e);
}
}
use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException in project che by eclipse.
the class GdbDebugger method stepOut.
@Override
public void stepOut(StepOutAction action) throws DebuggerException {
try {
GdbInfoLine gdbInfoLine = gdb.finish();
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 out error. " + e.getMessage(), e);
}
}
use of org.eclipse.che.plugin.gdb.server.exception.GdbParseException 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);
}
}
Aggregations