use of org.eclipse.debug.core.model.IStackFrame in project erlide_eclipse by erlang.
the class ErlangProcess method getBreakpoints.
@Override
public IBreakpoint[] getBreakpoints() {
IStackFrame top = null;
try {
top = getTopStackFrame();
} catch (final DebugException e1) {
// can never happen
}
if (top instanceof ErlangStackFrame) {
final ErlangStackFrame topFrame = (ErlangStackFrame) top;
final IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
final IBreakpoint[] breakpoints = breakpointManager.getBreakpoints();
for (final IBreakpoint breakpoint : breakpoints) {
if (breakpoint instanceof ErlangLineBreakpoint) {
final ErlangLineBreakpoint lineBreakpoint = (ErlangLineBreakpoint) breakpoint;
try {
if (lineBreakpoint.getModule().equals(topFrame.getModule()) && lineBreakpoint.getLineNumber() == topFrame.getLineNumber()) {
return new IBreakpoint[] { lineBreakpoint };
}
} catch (final DebugException e) {
ErlLogger.warn(e);
} catch (final CoreException e) {
ErlLogger.warn(e);
}
}
}
}
return new IBreakpoint[0];
}
use of org.eclipse.debug.core.model.IStackFrame in project erlide_eclipse by erlang.
the class DebugTraceEvent method getStackFrames.
public List<IStackFrame> getStackFrames(final IDebugTarget target, final IThread process) {
// XXX JC copy paste
final OtpErlangTuple tuple = getTuple();
final OtpErlangList erlStackFrames = (OtpErlangList) tuple.elementAt(2);
final OtpErlangTuple t2 = (OtpErlangTuple) tuple.elementAt(1);
final OtpErlangTuple ieval = (OtpErlangTuple) t2.elementAt(0);
OtpErlangAtom m = (OtpErlangAtom) ieval.elementAt(3);
OtpErlangList bindings = (OtpErlangList) t2.elementAt(t2.arity() - 1);
OtpErlangLong l = (OtpErlangLong) ieval.elementAt(1);
final List<IStackFrame> stackFrames = new ArrayList<>(erlStackFrames.arity() + 1);
for (final OtpErlangObject o : erlStackFrames) {
final OtpErlangTuple t = (OtpErlangTuple) o;
final OtpErlangTuple ml = (OtpErlangTuple) t.elementAt(1);
final OtpErlangObject ml0 = ml.elementAt(0);
int stackFrameNo;
final OtpErlangLong n = (OtpErlangLong) t.elementAt(3);
try {
stackFrameNo = n.intValue();
} catch (final OtpErlangRangeException e) {
stackFrameNo = -1;
}
final String module = m.atomValue();
int line;
try {
line = l.intValue();
} catch (final OtpErlangRangeException e) {
line = -1;
}
final IStackFrame sf = new ErlangStackFrame(module, (ErlangProcess) process, target, line, null, bindings, stackFrameNo);
stackFrames.add(sf);
bindings = (OtpErlangList) t.elementAt(2);
m = (OtpErlangAtom) ml0;
l = (OtpErlangLong) ml.elementAt(1);
}
return stackFrames;
}
use of org.eclipse.debug.core.model.IStackFrame in project webtools.sourceediting by eclipse.
the class JAXPJavaLaunchConfigurationDelegate method launch.
@Override
public synchronized void launch(ILaunchConfiguration configuration, final String mode, final ILaunch launch, IProgressMonitor monitor) throws CoreException {
this.mode = mode;
launchHelper.save(getLaunchConfigFile());
// set the launch name
IProcessorInstall install = getProcessorInstall(configuration, mode);
String tfactory = getTransformerFactory(install);
String name = install.getName();
if (tfactory != null)
// $NON-NLS-1$//$NON-NLS-2$
name += "[" + tfactory + "]";
// $NON-NLS-1$
launch.setAttribute("launchName", name);
// the super.launch will add a Java source director if we set it to null
// here
final ISourceLocator configuredLocator = launch.getSourceLocator();
launch.setSourceLocator(null);
super.launch(configuration, mode, launch, monitor);
// now get the java source locator
final ISourceLocator javaSourceLookupDirector = launch.getSourceLocator();
// now add our own participant to the java director
launch.setSourceLocator(new ISourceLocator() {
public Object getSourceElement(IStackFrame stackFrame) {
// simply look at one and then the other
Object sourceElement = javaSourceLookupDirector.getSourceElement(stackFrame);
if (sourceElement == null)
sourceElement = configuredLocator.getSourceElement(stackFrame);
return sourceElement;
}
});
// IJavaDebugTarget javaTarget =
// (IJavaDebugTarget)launch.getDebugTarget();
// launch.removeDebugTarget(javaTarget);
IDebugTarget javaTarget = launch.getDebugTarget();
IDebugTarget xslTarget = new JAXPDebugTarget(launch, launch.getProcesses()[0], launchHelper);
// remove java as the primary target and make xsl the primary target
launch.removeDebugTarget(javaTarget);
launch.addDebugTarget(xslTarget);
// add this here to make java the non-primary target
// launch.addDebugTarget(javaTarget);
// launch.addDebugTarget(new JavaXSLDebugTarget(launch,
// launch.getProcesses()[0], launchHelper, javaTarget));
}
use of org.eclipse.debug.core.model.IStackFrame in project webtools.sourceediting by eclipse.
the class JAXPDebugTarget method getStackFrames.
/**
* Returns the current stack frames in the target.
*/
public IStackFrame[] getStackFrames() throws DebugException {
synchronized (STACK_FRAMES_LOCK) {
if (stale) {
stale = false;
String framesData = sendRequest(DebugConstants.REQUEST_STACK);
// $NON-NLS-1$
String[] frames = framesData.split("\\$\\$\\$");
IStackFrame[] sf = new IStackFrame[frames.length];
List<IStackFrame> currentFrames = Arrays.asList(stackFramesCache);
for (int i = 0; i < frames.length; i++) {
String data = frames[i];
XSLStackFrame frame = new XSLStackFrame(thread, data, i);
int index;
if ((index = currentFrames.indexOf(frame)) != -1) {
XSLStackFrame curr = (XSLStackFrame) currentFrames.get(index);
curr.setLineNumber(frame.getLineNumber());
curr.setVariables(frame.getVariables());
frame = curr;
}
sf[frames.length - i - 1] = frame;
}
stackFramesCache = sf;
}
return stackFramesCache;
}
}
Aggregations