Search in sources :

Example 16 with IParserToken

use of com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken in project openj9 by eclipse.

the class JavaCoreAttributeValueMap method getTokenValue.

/*
	 * DATA EXTRACTION
	 */
/**
 * @param results
 * @param tokenType
 */
public String getTokenValue(String tokenType) {
    IParserToken token = getToken(tokenType);
    String value = null;
    if (token != null) {
        value = token.getValue();
    }
    return value;
}
Also used : IParserToken(com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken)

Example 17 with IParserToken

use of com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken in project openj9 by eclipse.

the class ClassLoaderSectionParser method classLoaderLibraries.

/**
 * Loaded libraries data may not be found in Sovereign VMs, therefore make
 * it optional, even though it is a standard tag in later J9 VMs.
 * @throws ParserException
 */
private void classLoaderLibraries() throws ParserException {
    if (matchOptional(T_1CLTEXTCLLIB)) {
        consume();
        /*
			 * Consume whatever other data is in the same line, as it's just header data.
			 */
        IParserToken token = lookAhead(1);
        if (token != null && token.getType().equals(IGeneralTokenTypes.UNPARSED_STRING)) {
            consume();
        }
        IAttributeValueMap results = null;
        if ((results = processTagLineRequired(T_2CLTEXTCLLIB)) != null) {
            processLibraryLoader(results);
            while ((results = processTagLineOptional(T_2CLTEXTCLLIB)) != null) {
                processLibraryLoader(results);
            }
        }
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) IParserToken(com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken)

Example 18 with IParserToken

use of com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken in project openj9 by eclipse.

the class MonitorSectionParser method waitOnNotifyOrEnter.

/**
 * This handles both wait on notify and wait on enter threads for a given java monitor.
 * <br><br>
 * If either a wait on notify or wait on enter header tag is parsed (3LKNOTIFYQ or 3LKWAITNOTIFY, respectively),
 * its corresponding data tag (3LKWAITNOTIFY and 3LKWAITER, respectively) is parsed iteratively.
 * For each of the data tags, a valid threadID must be parsed. If not, an exception is thrown and
 * the thread is not added to the monitor wait notify/wait enter thread list.However, the process
 * will continue regardless of whether errors are encountered or not, as long as the error handler permits it to
 * do so.
 * <br>
 * A valid thread ID must be parsed for each 3LKWAITNOTIFY or 3LKWAITER encountered, or error handler is invoked.
 * @throws ParserException
 */
private void waitOnNotifyOrEnter(JavaMonitor monitor) throws ParserException {
    boolean waitOnNotify = false;
    String tagName = null;
    while ((waitOnNotify = matchOptional(tagName = T_3LKNOTIFYQ)) || matchOptional(T_3LKWAITERQ)) {
        // Consume header tag
        consume();
        // Consume any unnecessary data contained in the same header tag line:
        IParserToken token = lookAhead(1);
        if (token != null && token.getType().equals(IGeneralTokenTypes.UNPARSED_STRING)) {
            consume();
        }
        tagName = (waitOnNotify) ? T_3LKWAITNOTIFY : T_3LKWAITER;
        IAttributeValueMap results = null;
        // This must match at least once. Subsequent matches are optional.
        if ((results = processTagLineRequired(tagName)) != null) {
            processNotifyOrEnterThreads(monitor, results, waitOnNotify);
            while ((results = processTagLineOptional(tagName)) != null) {
                processNotifyOrEnterThreads(monitor, results, waitOnNotify);
            }
        }
    }
}
Also used : IAttributeValueMap(com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap) IParserToken(com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken)

Example 19 with IParserToken

use of com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken in project openj9 by eclipse.

the class NativeStackTraceLineRule method processLine.

protected void processLine(String source, int startingOffset) {
    // 4XENATIVESTACK               _threadstart  (thread.c:196, 0x7C34940F [MSVCR71+0x6c])
    // 4XENATIVESTACK               GetModuleHandleA  (0x77E6482F [kernel32+0xdf])
    // 4XENATIVESTACK               monitor_enter_three_tier  (j9thread.c, 0x7FFA284B [J9THR26+0xbb])
    // 4XENATIVESTACK               (0x0000002A9632E2B9 [libj9prt26.so+0x112b9])
    // 4XENATIVESTACK               0x0000002A9632E2B9
    // new format with routine  plus offset
    // 4XENATIVESTACK               j9sig_protect+0x41 (j9signal.c:144, 0x7FECBE31 [J9PRT24+0xbe31])
    // Java 7.0
    // 4XENATIVESTACK               getFinalPath+0xaa (winntfilesystem_md.c:126, 0x00408C4F [java+0x8c4f])
    // 4XENATIVESTACK               GetModuleFileNameA+0x1b4 (0x7C80B683 [kernel32+0xb683])
    consumeUntilFirstMatch(CommonPatternMatchers.whitespace);
    // The routine name is ended by at least one space and an open parenthesis
    IParserToken routine = addAllCharactersAsTokenAndConsumeFirstMatch(STACK_ROUTINE, spaceparen);
    if (routine != null) {
        String val = routine.getValue();
        sign.reset(val);
        if (sign.find()) {
            addToken(STACK_ROUTINE, val.substring(0, sign.start()));
            CommonPatternMatchers.signed_hex_0x.reset(val);
            if (CommonPatternMatchers.signed_hex_0x.find()) {
                addToken(STACK_ROUTINE_OFFSET, CommonPatternMatchers.signed_hex_0x.group());
            }
        }
    }
    // The file name is ended by a comma
    int sourceIndex = indexOfLast(CommonPatternMatchers.comma);
    if (sourceIndex >= 0) {
        // The line number is indicated by a colon before the comma
        int sourceIndex2 = indexOfLast(CommonPatternMatchers.colon);
        if (sourceIndex2 < sourceIndex) {
            addAllCharactersAsTokenAndConsumeFirstMatch(STACK_FILE, CommonPatternMatchers.colon);
            addToken(STACK_LINE, CommonPatternMatchers.dec);
        } else {
            addAllCharactersAsTokenAndConsumeFirstMatch(STACK_FILE, CommonPatternMatchers.comma);
        }
    }
    addPrefixedHexToken(STACK_PROC_ADDRESS);
    consumeUntilFirstMatch(mb);
    addAllCharactersAsTokenUntilFirstMatch(STACK_MODULE, sign);
    addToken(STACK_MODULE_OFFSET, CommonPatternMatchers.signed_hex_0x);
}
Also used : IParserToken(com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken)

Aggregations

IParserToken (com.ibm.dtfj.javacore.parser.framework.scanner.IParserToken)19 IAttributeValueMap (com.ibm.dtfj.javacore.parser.j9.IAttributeValueMap)3 ParserException (com.ibm.dtfj.javacore.parser.framework.parser.ParserException)2 ImageModule (com.ibm.dtfj.image.ImageModule)1 BuilderFailureException (com.ibm.dtfj.javacore.builder.BuilderFailureException)1 IImageBuilder (com.ibm.dtfj.javacore.builder.IImageBuilder)1 ILookAheadBuffer (com.ibm.dtfj.javacore.parser.framework.parser.ILookAheadBuffer)1 ISectionParser (com.ibm.dtfj.javacore.parser.framework.parser.ISectionParser)1 ScannerException (com.ibm.dtfj.javacore.parser.framework.scanner.ScannerException)1 ILineRule (com.ibm.dtfj.javacore.parser.framework.tag.ILineRule)1 LineRule (com.ibm.dtfj.javacore.parser.framework.tag.LineRule)1 IOException (java.io.IOException)1 ParsePosition (java.text.ParsePosition)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Iterator (java.util.Iterator)1 Matcher (java.util.regex.Matcher)1