Search in sources :

Example 21 with IAttributeValueMap

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

the class PlatformSectionParser method crashInfo.

/**
 * Parse the exception information lines
 * @throws ParserException
 */
private void crashInfo() throws ParserException {
    IAttributeValueMap results = null;
    // 1XHEXCPCODE line if present contains the signal information
    while ((results = processTagLineOptional(T_1XHEXCPCODE)) != null) {
        int j9_signal = results.getIntValue(PL_SIGNAL);
        if (j9_signal != IBuilderData.NOT_AVAILABLE) {
            fImageProcessBuilder.setSignal(resolveGenericSignal(j9_signal));
        }
    }
    // 1XHERROR2 line indicates no crash information
    processTagLineOptional(T_1XHERROR2);
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)

Example 22 with IAttributeValueMap

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

the class PlatformSectionParser method moduleInfo.

/**
 * Parse the exception information lines
 * @throws ParserException
 */
private void moduleInfo() throws ParserException {
    IAttributeValueMap results;
    // T_1XHEXCPMODULE line if present indicates registers
    String moduleName = null;
    long moduleBase = IBuilderData.NOT_AVAILABLE;
    while ((results = processTagLineOptional(T_1XHEXCPMODULE)) != null) {
        String name = results.getTokenValue(PL_MODULE_NAME);
        if (name != null) {
            moduleName = name;
        }
        long base = results.getLongValue(PL_MODULE_BASE);
        if (base != IBuilderData.NOT_AVAILABLE) {
            moduleBase = base;
        }
        if (moduleName != null && moduleBase != IBuilderData.NOT_AVAILABLE) {
            fImageProcessBuilder.addLibrary(moduleName);
            moduleName = null;
            moduleBase = IBuilderData.NOT_AVAILABLE;
        }
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)

Example 23 with IAttributeValueMap

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

the class TitleSectionParser method topLevelRule.

/**
 * Controls parsing for title stuff
 * @throws ParserException
 */
protected void topLevelRule() throws ParserException {
    IAttributeValueMap results = null;
    Date dumpDate = null;
    processTagLineRequired(T_1TISIGINFO);
    results = processTagLineRequired(T_1TIDATETIME);
    if (results != null) {
        String tm = results.getTokenValue(TI_DATE);
        if (tm != null) {
            // Java 8 SR2 or later, with millisecs added:
            // 1TIDATETIME    Date:    2015/07/17 at 09:46:27:261
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd 'at' HH:mm:ss:S");
            dumpDate = sdf.parse(tm, new ParsePosition(0));
            if (dumpDate == null) {
                // Earlier javacores:
                // 1TIDATETIME    Date:    2009/02/09 at 15:48:30
                sdf = new SimpleDateFormat("yyyy/MM/dd 'at' HH:mm:ss");
                dumpDate = sdf.parse(tm, new ParsePosition(0));
            }
            if (dumpDate != null) {
                long time = dumpDate.getTime();
                fImageBuilder.setCreationTime(time);
            }
        }
    }
    results = processTagLineOptional(T_1TINANOTIME);
    if (results != null) {
        String nanoTimeString = results.getTokenValue(TI_NANO);
        if (nanoTimeString != null) {
            fImageBuilder.setCreationTimeNanos(Long.parseLong(nanoTimeString));
        }
    }
    results = processTagLineRequired(T_1TIFILENAME);
    if (results != null) {
        String fn = results.getTokenValue(TI_FILENAME);
        if (fn != null && dumpDate != null) {
            // Strip off the path
            fn = fn.replaceAll(".*[\\\\/]", "");
            Date d1 = dumpDate;
            Date d2 = new Date(dumpDate.getTime() + 5 * 60 * 1000);
            String pid = getPID(fn, d1, d2);
            if (pid == null) {
                // The AIX file date is in UTC - the javacore date is local time for the dump system,
                // converted as though it was local time on the running system.
                // E.g. dump at 23:00 UTC+14, current TZ = UTC-12
                // converted to 23:00 UTC-12 = 11:00 +1 UTC
                // AIX date 09:00 UTC
                // 
                // E.g. dump at 23:00 UTC-12, current TZ = UTC+14
                // converted to 23:00 UTC+14 = 09:00 UTC
                // AIX date 11:00 UTC + 1
                // We don't know the timezone, so try a generous range
                d1 = new Date(dumpDate.getTime() - 26 * 60 * 60 * 1000);
                d2 = new Date(dumpDate.getTime() + 26 * 60 * 60 * 1000);
                pid = getPIDAIX(fn, d1, d2);
            }
            if (pid != null) {
                fImageBuilder.getCurrentAddressSpaceBuilder().getCurrentImageProcessBuilder().setID(pid);
            }
        }
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) ParsePosition(java.text.ParsePosition)

Example 24 with IAttributeValueMap

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

the class ThreadSectionParser method threadInfo.

/**
 * @param buildModel true if data parsed should be added into the builder.
 * @param currentThread This is the current thread
 * @throws ParserException
 */
protected void threadInfo(boolean buildModel, boolean currentThread) throws ParserException {
    IAttributeValueMap results = null;
    int currentLineNumber = getCurrentFileLineNumber();
    if ((results = processTagLineRequired(T_3XMTHREADINFO)) != null) {
        // Always parse the first thread of the section so that the first thread in
        // the current thread section will be generated first. It will be reparsed later,
        // but that doesn't matter.
        processThreadandStackTrace(results, buildModel, currentThread, currentLineNumber);
        if (!currentThread) {
            while ((results = processTagLineOptional(T_3XMTHREADINFO)) != null) {
                processThreadandStackTrace(results, buildModel, false, currentLineNumber);
            }
        }
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)

Example 25 with IAttributeValueMap

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

the class ThreadSectionParser method processThreadandStackTrace.

/**
 * @param javaThreadResults
 * @param buildModel
 * @param currentThread Is this the current thread?
 * @param currentLineNumber
 * @return updated line number
 * @throws ParserException
 */
protected int processThreadandStackTrace(IAttributeValueMap javaThreadResults, boolean buildModel, boolean currentThread, int currentLineNumber) throws ParserException {
    JavaThread javaThread = null;
    // 3XMTHREADINFO1 found only in J9 2.4 or higher. Native thread ID is contained
    // in the latter. For all other older VMs, native thread ID is contained in 3XMTHREADINFO
    IAttributeValueMap nativeResults = processTagLineOptional(T_3XMTHREADINFO1);
    IAttributeValueMap nativeStack;
    ArrayList nativeStacks = new ArrayList();
    while ((nativeStack = processTagLineOptional(T_3XMTHREADINFO2)) != null) {
        nativeStacks.add(nativeStack);
    }
    IAttributeValueMap blockerInfo = processTagLineOptional(T_3XMTHREADBLOCK);
    IAttributeValueMap cpuTimes = processTagLineOptional(T_3XMCPUTIME);
    if (buildModel) {
        javaThread = addThread(javaThreadResults, nativeResults, nativeStacks, blockerInfo, cpuTimes, currentLineNumber);
    }
    long imageThreadID = (nativeResults != null) ? nativeResults.getLongValue(NATIVE_THREAD_ID) : javaThreadResults.getLongValue(NATIVE_THREAD_ID);
    long tid = javaThreadResults.getLongValue(VM_THREAD_ID);
    if (imageThreadID == IBuilderData.NOT_AVAILABLE) {
        imageThreadID = tid;
    }
    parseStackTrace(javaThread, currentLineNumber, buildModel);
    parseNativeStackTrace(imageThreadID, buildModel);
    if (currentThread) {
        // Indicate we have a possible current thread
        fImageProcessBuilder.setCurrentThreadID(imageThreadID);
    }
    return getCurrentFileLineNumber();
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) ArrayList(java.util.ArrayList) JavaThread(com.ibm.dtfj.java.JavaThread)

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