use of org.erlide.backend.debug.model.ErlangStackFrame 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;
}
Aggregations