use of org.erlide.backend.debug.model.ErlangDebugTarget in project erlide_eclipse by erlang.
the class DebuggerTraceView method handleDebugEvents.
@Override
public void handleDebugEvents(final DebugEvent[] events) {
for (final DebugEvent event : events) {
if (event.getKind() == DebugEvent.MODEL_SPECIFIC && event.getDetail() == ErlangDebugTarget.TRACE_CHANGED) {
final Object source = event.getSource();
if (source instanceof ErlangDebugTarget) {
final TraceChangedEventData data = (TraceChangedEventData) event.getData();
traceChanged(data, source);
}
}
}
}
use of org.erlide.backend.debug.model.ErlangDebugTarget in project erlide_eclipse by erlang.
the class ErlangDebuggerBackendListener method moduleLoaded.
@Override
public void moduleLoaded(final IBackend backend, final IProject project, final String moduleName) {
try {
final ErlangDebugTarget erlangDebugTarget = debugTargetOfBackend(backend.getOtpRpc());
if (erlangDebugTarget != null && erlangDebugTarget.getInterpretedModules().contains(moduleName)) {
if (isModuleRunningInInterpreter(erlangDebugTarget, backend.getOtpRpc(), moduleName)) {
abortContinueDialog(erlangDebugTarget);
} else {
final ILaunchConfiguration launchConfiguration = erlangDebugTarget.getLaunch().getLaunchConfiguration();
final EnumSet<ErlDebugFlags> debugFlags = ErlDebugFlags.makeSet(launchConfiguration.getAttribute(ErlRuntimeAttributes.DEBUG_FLAGS, ErlDebugFlags.getFlag(ErlDebugFlags.DEFAULT_DEBUG_FLAGS)));
final boolean distributed = debugFlags.contains(ErlDebugFlags.DISTRIBUTED_DEBUG);
erlangDebugTarget.interpret(project, moduleName, distributed, true);
}
}
} catch (final CoreException e) {
ErlLogger.error(e);
}
}
use of org.erlide.backend.debug.model.ErlangDebugTarget in project erlide_eclipse by erlang.
the class BreakpointMarkerUpdater method updateMarker.
@Override
public boolean updateMarker(final IMarker marker, final IDocument document, final Position position) {
if (position.isDeleted()) {
return false;
}
try {
final int line = MarkerUtilities.getLineNumber(marker);
final int newLine = document.getLineOfOffset(position.getOffset()) + 1;
if (line == newLine) {
return true;
}
final IBreakpointManager manager = DebugPlugin.getDefault().getBreakpointManager();
final IBreakpoint breakpoint = manager.getBreakpoint(marker);
if (breakpoint == null) {
return false;
}
if (breakpoint instanceof ErlangLineBreakpoint) {
final ErlangLineBreakpoint erlangLineBreakpoint = (ErlangLineBreakpoint) breakpoint;
final ErlangDebugTarget target = erlangLineBreakpoint.getTarget();
erlangLineBreakpoint.remove(target);
MarkerUtilities.setLineNumber(marker, newLine);
erlangLineBreakpoint.install(target);
return true;
}
// if there exists a breakpoint on the line remove this one
if (BreakpointMarkerUpdater.isLineBreakpointMarker(marker)) {
ensureRanges(document, marker, line);
return lineBreakpointExists(marker.getResource(), line, marker) == null;
}
// a line breakpoint must be removed
if (BreakpointMarkerUpdater.isLineBreakpointMarker(marker) && line == -1) {
return false;
}
MarkerUtilities.setLineNumber(marker, line);
if (BreakpointMarkerUpdater.isLineBreakpointMarker(marker)) {
ensureRanges(document, marker, line);
}
return true;
} catch (final BadLocationException e) {
ErlLogger.error(e);
} catch (final CoreException e) {
ErlLogger.error(e);
}
return false;
}
use of org.erlide.backend.debug.model.ErlangDebugTarget in project erlide_eclipse by erlang.
the class Backend method postLaunch.
protected void postLaunch() throws DebugException {
final Collection<IProject> projects = Lists.newArrayList(data.getProjects());
registerProjectsWithExecutionBackend(projects);
if (data.isDebug()) {
// add debugTarget
final ILaunch launch = getData().getLaunch();
if (!debuggerIsRunning()) {
debugTarget = new ErlangDebugTarget(launch, this, projects);
launch.addDebugTarget(debugTarget);
registerStartupFunctionStarter(data);
debugTarget.sendStarted();
}
} else if (data.isManaged()) {
// don't run this if the node is already running
final ErlangFunctionCall initCall = data.getInitialCall();
if (initCall != null) {
runInitial(initCall.getModule(), initCall.getName(), initCall.getParameters());
}
}
}
Aggregations