Search in sources :

Example 1 with IAttributeValueMap

use of com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap in project openj9 by eclipse.

the class ClassLoaderSectionParser method classLoaders.

/**
 * @throws ParserException
 */
private void classLoaders() throws ParserException {
    processTagLineRequired(T_1CLTEXTCLLOD);
    IAttributeValueMap results = null;
    if ((results = processTagLineRequired(T_2CLTEXTCLLOAD)) != null) {
        processClassLoaders(results);
        while ((results = processTagLineOptional(T_2CLTEXTCLLOAD)) != null) {
            processClassLoaders(results);
        }
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)

Example 2 with IAttributeValueMap

use of com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap in project openj9 by eclipse.

the class MonitorSectionParser method monitorsInUse.

/**
 * Will create monitor objects for each 2LKMONINUSE encountered.
 * <br>
 * <br>
 * For every one of these tags encountered, a valid monitor ID must be parsed
 * in order to create a valid monitor object. If a valid monitor ID is not
 * encountered for a particular 2LKMONINUSE tag, an exception is caught and
 * handled by the error handler. However the operation does not stop until
 * all 2LKMONINUSE tags are parsed, whether a valid monitor object is created or not,
 * unless the error handler decides to.
 * <br>
 * @throws ParserException
 */
private void monitorsInUse() throws ParserException {
    IAttributeValueMap results = null;
    while ((results = processTagLineOptional(T_2LKMONINUSE)) != null) {
        // Ignore inflated monitor for now, use system monitor as the monitor ID
        long monitorID = results.getLongValue(SYSTEM_MONITOR);
        long objectID = IBuilderData.NOT_AVAILABLE;
        String className = null;
        long monitorThreadID = IBuilderData.NOT_AVAILABLE;
        if ((results = processTagLineRequired(T_3LKMONOBJECT)) != null) {
            className = results.getTokenValue(MONITOR_OBJECT_FULL_JAVA_NAME);
            className = fixMonitorClassName(className);
            objectID = results.getLongValue(MONITOR_OBJECT_ADDRESS);
            monitorThreadID = results.getLongValue(MONITOR_THREAD_ID);
        }
        try {
            /*
				 * A monitor object must be created if the 2LKMONINUSE tag is encountered, else an 
				 * error encountered.
				 */
            generateMonitor(null, monitorID, objectID, className, monitorThreadID);
        } catch (BuilderFailureException e) {
            handleError("Could not add monitor to builder: " + monitorID, e);
        }
    }
}
Also used : BuilderFailureException(com.ibm.dtfj.javacore.builder.BuilderFailureException) IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)

Example 3 with IAttributeValueMap

use of com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap in project openj9 by eclipse.

the class MonitorSovSectionParserPart method computeSovRule.

public void computeSovRule(String sovRuleID, ILookAheadBuffer lookAheadBuffer) throws ParserException {
    setLookAheadBuffer(lookAheadBuffer);
    setTagManager(J9TagManager.getCurrent());
    if (sovRuleID.equals(T_1LKREGMONDUMP)) {
        IAttributeValueMap results;
        if ((results = processTagLineOptional(LK_FLAT_MON_DUMP)) != null) {
            HashMap threads = new HashMap();
            while ((results = processTagLineOptional(LK_FLAT_MON)) != null) {
                int flatid = results.getIntValue(MONITOR_FLAT_ID);
                String name = results.getTokenValue(MONITOR_THREAD_NAME);
                // Remove quotes
                if (name != null && name.length() >= 2) {
                    name = name.substring(1, name.length() - 1);
                }
                long tid = results.getLongValue(MONITOR_THREAD_ID);
                long ee = results.getLongValue(MONITOR_THREAD_EE);
                // Remember the flat thread id for later
                threads.put(new Integer(flatid), new Long(tid));
                try {
                    fRuntimeBuilder.addJavaThread(null, name, IBuilderData.NOT_AVAILABLE, tid, IBuilderData.NOT_AVAILABLE, ee, "", IBuilderData.NOT_AVAILABLE, 0, null);
                } catch (BuilderFailureException e) {
                // Expect a failure, but the JNIEnv will be remembered
                }
            }
            results = processTagLineRequired(LK_OBJ_MON_DUMP);
            do {
                if ((results = processTagLineOptional(LK_INFLATED_MON)) != null) {
                    processTagLineRequired(LK_INFL_DETAILS);
                } else {
                    if ((results = processTagLineOptional(LK_FLAT_LOCKED)) != null) {
                        String className = results.getTokenValue(MONITOR_OBJECT_FULL_JAVA_NAME);
                        className = MonitorSectionParser.fixMonitorClassName(className);
                        long objectID = results.getLongValue(MONITOR_OBJECT_ADDRESS);
                        long monitorID = results.getLongValue(MONITOR_OBJECT_ADDRESS);
                        results = processTagLineRequired(LK_FLAT_DETAILS);
                        int flatid = results.getIntValue(MONITOR_FLAT_ID);
                        Object p = threads.get(new Integer(flatid));
                        long threadID = p instanceof Long ? ((Long) p).longValue() : IBuilderData.NOT_AVAILABLE;
                        try {
                            if (monitorID != IBuilderData.NOT_AVAILABLE) {
                                // A valid monitor ID is required to build a monitor
                                fRuntimeBuilder.addJavaMonitor(null, monitorID, objectID, className, threadID);
                            }
                        } catch (BuilderFailureException e) {
                            handleError("Could not add monitor to builder: " + objectID, e);
                        }
                    }
                }
            } while (results != null);
        }
    }
}
Also used : BuilderFailureException(com.ibm.dtfj.javacore.builder.BuilderFailureException) IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) HashMap(java.util.HashMap)

Example 4 with IAttributeValueMap

use of com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap in project openj9 by eclipse.

the class PlatformSectionParser method registerInfo.

/**
 * Parse the exception register information lines
 * @throws ParserException
 */
private void registerInfo() throws ParserException {
    IAttributeValueMap results;
    // T_1XHREGISTERS line if present indicates registers
    if (processTagLineOptional(T_1XHREGISTERS) != null) {
        Map m = new LinkedHashMap();
        while ((results = processTagLineOptional(T_2XHREGISTER)) != null) {
            String name = results.getTokenValue(PL_REGISTER_NAME);
            String val = results.getTokenValue(PL_REGISTER_VALUE);
            Number n;
            if (val == null) {
                n = null;
            } else if (val.startsWith("0x") && val.length() <= 2 + 4) {
                n = new Short((short) results.getIntValue(PL_REGISTER_VALUE));
            } else if (val.startsWith("0x") && val.length() <= 2 + 8) {
                n = new Integer((int) results.getLongValue(PL_REGISTER_VALUE));
            } else {
                n = new Long(results.getLongValue(PL_REGISTER_VALUE));
            }
            m.put(name, n);
        }
        fImageProcessBuilder.setRegisters(m);
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) LinkedHashMap(java.util.LinkedHashMap) IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Example 5 with IAttributeValueMap

use of com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap in project openj9 by eclipse.

the class PlatformSectionParser method parseEnvironmentVars.

/**
 * Parse the user args information (1XHUSERARGS and 2XHUSERARG lines)
 * @throws ParserException
 */
private void parseEnvironmentVars() throws ParserException {
    IAttributeValueMap results = null;
    results = processTagLineOptional(T_1XHENVVARS);
    if (results != null) {
        while ((results = processTagLineOptional(T_2XHENVVAR)) != null) {
            String env_name = results.getTokenValue(ENV_NAME);
            String env_value = results.getTokenValue(ENV_VALUE);
            if (env_name != null) {
                fImageProcessBuilder.addEnvironmentVariable(env_name, env_value);
            }
        }
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)

Aggregations

IAttributeValueMap (com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)25 BuilderFailureException (com.ibm.dtfj.javacore.builder.BuilderFailureException)4 ImageModule (com.ibm.dtfj.image.ImageModule)3 IParserToken (com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken)3 JavaThread (com.ibm.dtfj.java.JavaThread)2 ParserException (com.ibm.dtfj.javacore.parser.framework.parser.ParserException)2 ParsePosition (java.text.ParsePosition)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 ImageSection (com.ibm.dtfj.image.ImageSection)1 ImageThread (com.ibm.dtfj.image.ImageThread)1 JavaRuntimeMemoryCategory (com.ibm.dtfj.java.JavaRuntimeMemoryCategory)1 IImageProcessBuilder (com.ibm.dtfj.javacore.builder.IImageProcessBuilder)1 IJavaRuntimeBuilder (com.ibm.dtfj.javacore.builder.IJavaRuntimeBuilder)1 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1