Package org.openquark.cal.internal.runtime.ExecutionContextImpl

Examples of org.openquark.cal.internal.runtime.ExecutionContextImpl.SuspensionState


                    ExecutionContextImpl ec = getExecutionContext();
                    Map<Thread, SuspensionState> suspensions = ec.getThreadSuspensions();
                   
                    if (!suspensions.isEmpty()) {
                        Thread currentThread = getDebugController().getCurrentSuspendedThread();
                        SuspensionState suspension = suspensions.get(currentThread);
                        if (suspension == null) {
                            // the current thread is no longer suspended, so choose another one
                            final Map.Entry<Thread, SuspensionState> next = suspensions.entrySet().iterator().next();
                            currentThread = next.getKey();
                            suspension = next.getValue();
                            getDebugController().setCurrentSuspendedThread(currentThread);
                        }
                       
                        if (suspensions.size() > 1) {
                            // more than one thread suspended, so also display thread name
                            outputStream.print("(" + currentThread.getName() + ") " + suspension.getFunctionName() + "#>");
                        } else {
                            outputStream.print(suspension.getFunctionName() + "#>");
                        }
                    } else {
                        outputStream.print(targetModule + ">");
                    }
   
View Full Code Here


            return;
        }
       
        Thread currentThread = getDebugController().getCurrentSuspendedThread();
       
        SuspensionState suspension = suspensions.get(currentThread);
        if (suspension == null) {
            logInfo("The current thread is no longer suspended. Change to another thread.");
            return;
        }
        logInfo("Execution suspended in: " + suspension.getFunctionName());
        String[] argNames = suspension.getArgNames();
        CalValue[] argValues = suspension.getArgValues();
       
        if(argNames.length > 0) {
            String argValueStrings[] = DebugSupport.showInternal(argValues);
            logInfo("Argument values:");
            for (int i = 0, n = argNames.length; i < n; ++i) {
View Full Code Here

        if (!suspendedThreads.containsKey(currentSuspendedThread)) {
            iceLogger.log(Level.INFO, "The current thread is no longer suspended. Change to another thread.");
            return;
        }
       
        SuspensionState suspension = suspendedThreads.get(currentSuspendedThread);
       
        // Get first word from info.
        StringTokenizer tokenizer = new StringTokenizer(info);
        try {
            String firstWord = tokenizer.nextToken();
            String action = firstWord.toLowerCase();
           
            // :show function
            if (action.equals("function")) {
                // Show the name of the suspended function.
                logInfo("    " + suspension.getFunctionName());
            } else
            // :show argnames  or  :show argtypes
            if (action.equals("argnames") || action.equals("argtypes")) {
                // Display the argument names/types
                String[] argNames = suspension.getArgNames();
                String[] argTypes = suspension.getArgTypes();
                if (argNames.length == 0) {
                    logInfo("    " + suspension.getFunctionName() + " has no arguments.");
                } else {
                    for (int i = 0; i < argNames.length; ++i) {
                        logInfo("    " + argNames[i+ " - " + argTypes[i]);
                    }
                }
            } else
            // :show stack [expanded]
            if (action.equals("stack")) {
                // Show the suspended call stack.
                // By default this is limited to only showing generated CAL functions.
                // Specifying expanded shows everything in the suspended call stack.
                try {
                    String d = tokenizer.nextToken().toLowerCase();
                    if (d.equals("expanded")) {
                        StackTraceElement[] stackTrace = suspension.getStackTrace();
                        for (int i = 0; i < stackTrace.length; ++i) {
                            logInfo(stackTrace[i].toString());
                        }
                    } else {
                        iceLogger.log (Level.INFO, "Unrecognized directive: " + d);
                    }
                } catch (NoSuchElementException e) {
                    // There were no tokens after 'stack' so do the default behaviour.
                    StackTraceElement[] stackTrace = suspension.getStackTrace();
                    for (int i = 0; i < stackTrace.length; ++i) {
                        StackTraceElement ste = stackTrace[i];
                        if (ste.getClassName().indexOf("cal_") >= 0) {
                            logInfo(stackTrace[i].toString());
                        }
                    }
                   
                }
            } else {
                // :show <argument name>
                // Determine which argument and show the name, type, and value.
                String[] argNames = suspension.getArgNames();
                CalValue[] argValues = suspension.getArgValues();
                String[] argTypes = suspension.getArgTypes();
               
                for (int i = 0; i < argNames.length; ++i) {
                    if (argNames[i].equals(firstWord)) {
                        logInfo("    " + argNames[i] + " - " + argTypes[i] + " - " + DebugSupport.showInternal(argValues[i]));
                        return;
View Full Code Here

TOP

Related Classes of org.openquark.cal.internal.runtime.ExecutionContextImpl.SuspensionState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.