Search in sources :

Example 16 with OtpErlangAtom

use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.

the class ErlangDebugTarget method addNodesAsDebugTargets.

private void addNodesAsDebugTargets(final ILaunch aLaunch) {
    final OtpErlangList nodes = ErlideDebug.nodes(backend.getOtpRpc());
    if (nodes != null) {
        for (int i = 1, n = nodes.arity(); i < n; ++i) {
            final OtpErlangAtom a = (OtpErlangAtom) nodes.elementAt(i);
            final IDebugTarget edn = new ErlangDebugNode(this, a.atomValue());
            aLaunch.addDebugTarget(edn);
        }
    }
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) IErlangDebugNode(org.erlide.backend.debug.IErlangDebugNode) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) IBreakpoint(org.eclipse.debug.core.model.IBreakpoint) ErlangLineBreakpoint(org.erlide.backend.debug.ErlangLineBreakpoint)

Example 17 with OtpErlangAtom

use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.

the class ErlangDebugTarget method distributeDebuggerCode.

private void distributeDebuggerCode() {
    final List<String> debuggerModules = getDebuggerModules();
    final List<OtpErlangTuple> modules = new ArrayList<>(debuggerModules.size());
    final String ver = backend.getRuntime().getVersion().asMajor().toString().toLowerCase();
    for (final String module : debuggerModules) {
        final OtpErlangBinary b = getDebuggerBeam(module, "org.erlide.kernel");
        if (b != null) {
            final OtpErlangString filename = new OtpErlangString(module + ".erl");
            final OtpErlangTuple t = OtpErlang.mkTuple(new OtpErlangAtom(module), filename, b);
            modules.add(t);
        } else {
            ErlLogger.warn("Could not find debugger module %s (%s)", module, ver);
        }
    }
    ErlideDebug.distributeDebuggerCode(backend.getOtpRpc(), modules);
}
Also used : ArrayList(java.util.ArrayList) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) OtpErlangBinary(com.ericsson.otp.erlang.OtpErlangBinary) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 18 with OtpErlangAtom

use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.

the class ErlideDebug method interpret.

@SuppressWarnings("boxing")
public static boolean interpret(final IOtpRpc backend, final String moduleName, final OtpErlangList options, final boolean distributed, final boolean interpret) {
    try {
        final OtpErlangObject res = backend.call(ErlideDebug.ERLIDE_DEBUG, "interpret", "alxoo", moduleName, options, distributed, interpret);
        if (res instanceof OtpErlangTuple) {
            final OtpErlangTuple t = (OtpErlangTuple) res;
            final OtpErlangObject o = t.elementAt(0);
            if (o instanceof OtpErlangAtom) {
                final OtpErlangAtom moduleAtom = (OtpErlangAtom) o;
                return "module".equals(moduleAtom.atomValue());
            }
        }
        return Util.isOk(res);
    } catch (final RpcException e) {
        ErlLogger.warn(e);
    }
    return false;
}
Also used : OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangTuple(com.ericsson.otp.erlang.OtpErlangTuple) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom)

Example 19 with OtpErlangAtom

use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.

the class ErlideDebug method isErlideProcess.

public static boolean isErlideProcess(final IOtpRpc backend, final OtpErlangPid pid) {
    boolean res = false;
    try {
        final OtpErlangAtom eres = (OtpErlangAtom) backend.call(ErlideDebug.ERLIDE_DEBUG, "is_erlide_process", "p", pid);
        res = Boolean.parseBoolean(eres.atomValue());
    } catch (final Exception e) {
    }
    return res;
}
Also used : OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) RpcTimeoutException(org.erlide.runtime.rpc.RpcTimeoutException) OtpParserException(org.erlide.util.erlang.OtpParserException) DebugException(org.eclipse.debug.core.DebugException) RpcException(org.erlide.runtime.rpc.RpcException)

Example 20 with OtpErlangAtom

use of com.ericsson.otp.erlang.OtpErlangAtom in project erlide_eclipse by erlang.

the class ErlideDebug method getAllModulesOnStack.

public static List<String> getAllModulesOnStack(final IOtpRpc backend, final OtpErlangPid meta) {
    try {
        final OtpErlangObject res = backend.call(ErlideDebug.ERLIDE_DEBUG, "all_modules_on_stack", "x", meta);
        if (res instanceof OtpErlangList) {
            final OtpErlangList modules = (OtpErlangList) res;
            final List<String> result = new ArrayList<>(modules.arity());
            for (final OtpErlangObject module : modules) {
                final OtpErlangAtom moduleA = (OtpErlangAtom) module;
                result.add(moduleA.atomValue());
            }
            return result;
        }
    } catch (final RpcException e) {
        ErlLogger.warn(e);
        ErlLogger.error(e);
    }
    return null;
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) RpcException(org.erlide.runtime.rpc.RpcException) ArrayList(java.util.ArrayList) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom)

Aggregations

OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)87 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)56 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)48 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)32 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)24 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)17 ArrayList (java.util.ArrayList)15 Test (org.junit.Test)14 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)11 RpcException (org.erlide.runtime.rpc.RpcException)11 OtpBindings (org.erlide.util.erlang.OtpBindings)9 IErlElement (org.erlide.engine.model.IErlElement)6 OtpErlangBinary (com.ericsson.otp.erlang.OtpErlangBinary)4 OtpErlangPid (com.ericsson.otp.erlang.OtpErlangPid)4 IErlModule (org.erlide.engine.model.root.IErlModule)4 OtpErlangInt (com.ericsson.otp.erlang.OtpErlangInt)3 OtpErlangMap (com.ericsson.otp.erlang.OtpErlangMap)3 Subscribe (com.google.common.eventbus.Subscribe)3 Collection (java.util.Collection)3 OtpErlangException (com.ericsson.otp.erlang.OtpErlangException)2