Search in sources :

Example 86 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class NativeMemInfoCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    this.out = out;
    try {
        Iterator<? extends OMRMemCategoryPointer> categories = MemoryCategoryIterator.iterateCategoryRootSet(DTFJContext.getVm().portLibrary());
        while (categories.hasNext()) {
            OMRMemCategoryPointer next = categories.next();
            printSections(next, 0);
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : OMRMemCategoryPointer(com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 87 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class ShrCCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        if (!J9BuildFlags.opt_sharedClasses) {
            CommandUtils.dbgPrint(out, "no shared cache\n");
            return;
        }
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9SharedClassConfigPointer sharedClassConfig = vm.sharedClassConfig();
        CommandUtils.dbgPrint(out, "!j9sharedclassconfig %s\n\n", sharedClassConfig.getHexAddress());
        if (args.length == 0) {
            printHelp(out);
        } else if (sharedClassConfig.notNull()) {
            U8Pointer metaStartInCache = getSharedCacheMetadataStart(vm, out);
            U8Pointer metaEndInCache = getSharedCacheMetadataEnd(vm, out);
            U8Pointer metaStart = metaStartInCache;
            U8Pointer metaEnd = metaEndInCache;
            initTotalCacheSize(out, sharedClassConfig);
            /* check if the first parameter specifies the range of metadata region to be used */
            if (args.length > 1) {
                /* Presence of '..' indicates user specified the range */
                if (args[1].indexOf(rangeDelim) != -1) {
                    String addr;
                    addr = args[1].substring(0, args[1].indexOf(rangeDelim));
                    metaStart = U8Pointer.cast(CommandUtils.parsePointer(addr, J9BuildFlags.env_data64));
                    addr = args[1].substring(args[1].indexOf(rangeDelim) + rangeDelim.length());
                    metaEnd = U8Pointer.cast(CommandUtils.parsePointer(addr, J9BuildFlags.env_data64));
                }
            }
            if (metaStart != null && metaStart.longValue() < metaStartInCache.longValue()) {
                CommandUtils.dbgPrint(out, "User specified start boundary is before metadata start in cache\n");
                metaStart = metaStartInCache;
            }
            if (metaEnd != null && metaEnd.longValue() > metaEndInCache.longValue()) {
                CommandUtils.dbgPrint(out, "User specified end boundary is beyond metadata end in cache\n");
                metaEnd = metaEndInCache;
            }
            if (metaStart != null && metaEnd != null && metaEnd.longValue() < metaStart.longValue()) {
                CommandUtils.dbgPrint(out, "User specified metadata region boundary is not valid. Ensure 'end' > 'start'\n");
                return;
            }
            CommandUtils.dbgPrint(out, "Meta data region to be used: %s..%s\n", metaStart.getHexAddress(), metaEnd.getHexAddress());
            if (args[0].equals("allstats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, ALL_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("rcstats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, ROMCLASS_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("cpstats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, CLASSPATH_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("aotstats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, AOT_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("invaotstats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, INV_AOT_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("orphanstats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, ORPHAN_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("scopestats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, SCOPE_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("bytestats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, BYTE_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("ubytestats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, UNINDEXED_BYTE_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("clstats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, CACHELET_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("stalestats")) {
                dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, ALL_STALE_STATS, null, false, VoidPointer.NULL, false);
            } else if (args[0].equals("classpath")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc classpath <address>\n");
                } else {
                    long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcPrintClasspath(out, ClasspathWrapperPointer.cast(address));
                }
            } else if (args[0].equals("findclass")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findclass <name>\n");
                } else {
                    String className = args[1];
                    CommandUtils.dbgPrint(out, "Looking for class \"%s\"\n", className);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, ROMCLASS_STATS | ORPHAN_STATS, className, false, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("findclassp")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findclassp <name>\n");
                } else {
                    String className = args[1];
                    CommandUtils.dbgPrint(out, "Looking for class prefix \"%s\"\n", className);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, ROMCLASS_STATS | ORPHAN_STATS, className, true, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("findaot")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findaot <name>\n");
                } else {
                    String methodName = args[1];
                    CommandUtils.dbgPrint(out, "Looking for AOT method \"%s\"\n", methodName);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, AOT_STATS | INV_AOT_STATS, methodName, false, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("findaotp")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findaot <name>\n");
                } else {
                    String methodName = args[1];
                    CommandUtils.dbgPrint(out, "Looking for AOT method prefix \"%s\"\n", methodName);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, AOT_STATS | INV_AOT_STATS, methodName, true, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("aotfor")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc aotfor <address>\n");
                } else {
                    long addr = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, AOT_STATS | INV_AOT_STATS, null, true, VoidPointer.cast(addr), false);
                }
            } else if (args[0].equals("rcfor")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc rcfor <address>\n");
                } else {
                    long addr = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, ROMCLASS_STATS | ORPHAN_STATS, null, false, VoidPointer.cast(addr), false);
                }
            } else if (args[0].equals("incache")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc incache <address>\n");
                } else {
                    long addr = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcInCache(out, vm, sharedClassConfig, VoidPointer.cast(addr));
                }
            } else if (args[0].equals("stats")) {
                if (sharedClassConfig.notNull()) {
                    dbgShrcInCache(out, vm, sharedClassConfig, VoidPointer.NULL);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, 0, null, false, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("method")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc method <address>\n");
                } else {
                    long addr = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, FIND_METHOD, null, false, VoidPointer.cast(addr), false);
                }
            } else if (args[0].equals("cachelet")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc incache <address>\n");
                } else {
                    long addr = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcPrintCachelet(out, CacheletWrapperPointer.cast(addr));
                }
            /**
             * JIT profiling data
             */
            } else if (args[0].equals("jitpstats")) {
                if (sharedClassConfig.notNull()) {
                    dbgShrcInCache(out, vm, sharedClassConfig, VoidPointer.NULL);
                    boolean corrupt = (args.length > 1) && "corrupt".equals(args[1]);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, JITPROFILE_STATS, null, false, VoidPointer.NULL, corrupt);
                }
            } else if (args[0].equals("findjitp")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findjitp <name>\n");
                } else {
                    String methodName = args[1];
                    CommandUtils.dbgPrint(out, "Looking for JIT PROFILE method \"%s\"\n", methodName);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, JITPROFILE_STATS, methodName, false, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("findjitpp")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findjitpp <name>\n");
                } else {
                    String methodName = args[1];
                    CommandUtils.dbgPrint(out, "Looking for JIT PROFILE method prefix \"%s\"\n", methodName);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, JITPROFILE_STATS, methodName, true, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("jitpfor")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc jitpfor <address>\n");
                } else {
                    long addr = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, JITPROFILE_STATS, null, false, VoidPointer.cast(addr), false);
                }
            /**
             * JIT hints
             */
            } else if (args[0].equals("jithstats")) {
                if (sharedClassConfig.notNull()) {
                    dbgShrcInCache(out, vm, sharedClassConfig, VoidPointer.NULL);
                    boolean corrupt = (args.length > 1) && "corrupt".equals(args[1]);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStart, metaEnd, JITHINT_STATS, null, false, VoidPointer.NULL, corrupt);
                }
            } else if (args[0].equals("findjith")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findjith <name>\n");
                } else {
                    String methodName = args[1];
                    CommandUtils.dbgPrint(out, "Looking for JIT HINT method \"%s\"\n", methodName);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, JITHINT_STATS, methodName, false, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("findjithp")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc findjithp <name>\n");
                } else {
                    String methodName = args[1];
                    CommandUtils.dbgPrint(out, "Looking for JIT HINT method prefix \"%s\"\n", methodName);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, JITHINT_STATS, methodName, true, VoidPointer.NULL, false);
                }
            } else if (args[0].equals("jithfor")) {
                if (args.length != 2) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc jithfor <address>\n");
                } else {
                    long addr = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
                    dbgShrcPrintAllStats(out, vm, sharedClassConfig, metaStartInCache, metaEndInCache, JITHINT_STATS, null, false, VoidPointer.cast(addr), false);
                }
            } else if (args[0].equals("rtflags")) {
                if (sharedClassConfig.notNull()) {
                    U64 runtimeFlags = sharedClassConfig.runtimeFlags();
                    CommandUtils.dbgPrint(out, "Printing the shared classes runtime flags %s\n", runtimeFlags.getHexValue());
                    printShCFlags(out, runtimeFlags, "RUNTIMEFLAG");
                }
            } else if (args[0].equals("extraflags")) {
                if (sharedClassConfig.notNull()) {
                    ShrcConfig config = dbgShrcReadConfig(sharedClassConfig, out);
                    UDATA extraFlags = config.getCacheStartAddress().extraFlags();
                    CommandUtils.dbgPrint(out, "Printing the shared classes extra flags present in cache header %s\n", extraFlags.getHexValue());
                    printShCFlags(out, extraFlags, "EXTRA_FLAGS");
                }
            } else if (args[0].equals("write")) {
                if (args.length != 2 && args.length != 3) {
                    CommandUtils.dbgPrint(out, "Usage: !shrc write <cachedir> [<cachename>]\n");
                } else {
                    String cacheDir = args[1];
                    String cacheName = args.length == 3 ? args[2] : null;
                    try {
                        dbgShrcWriteCache(out, sharedClassConfig, cacheDir, cacheName);
                    } catch (CorruptDataException e) {
                        /* retry writing only populated areas of cache */
                        CommandUtils.dbgPrint(out, "Unable to write complete cache: %s", e.getMessage());
                        CommandUtils.dbgPrint(out, "Attempting to write only populated areas of cache.\n");
                        dbgShrcWriteCacheByAreas(out, sharedClassConfig, cacheDir, cacheName);
                    }
                }
            } else if (args[0].equals("name")) {
                dbgShrcCacheName(out, sharedClassConfig);
            } else {
                CommandUtils.dbgPrint(out, "Unknown arg(s) : ");
                for (int i = 0; i < args.length; i++) {
                    CommandUtils.dbgPrint(out, args[i] + " ");
                }
                CommandUtils.dbgPrint(out, "\nType !shrc to see all the valid options.\n");
            }
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 88 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class ShrCCommand method dbgShrcHeaderOperations.

/*
	 * @param cacheletIndex -1: no cachelets, 0: cache, > 0: a cachelet
	 */
private Touple<Boolean, Long> dbgShrcHeaderOperations(PrintStream out, J9SharedCacheHeaderPointer header, VoidPointer address, int cacheletIndex) throws CorruptDataException {
    U32 totalBytes, readWriteBytes;
    UDATA readWritePtr, segmentPtr, updatePtr;
    UDATA readWriteStartAddress, romclassStartAddress, metadataStartAddress;
    UDATA debugAreaSize;
    UDATA debugAreaStart;
    UDATA debugAreaEnd;
    UDATA debugAreaUsed;
    UDATA debugAreaPercentUsed;
    UDATA debugLNTUsed;
    UDATA debugLVTUsed;
    UDATA debugLNTNextAdd, debugLVTNextAdd;
    U32 softMaxBytes;
    UDATA getFreeAvailableBytes;
    String indent;
    long freeBytes = 0;
    J9SharedCacheHeaderInfo helper = new J9SharedCacheHeaderInfo(header);
    totalBytes = helper.getTotalBytes();
    softMaxBytes = helper.getSoftMaxBytes();
    readWriteBytes = helper.getReadWriteBytes();
    segmentPtr = helper.getSegmentPtr();
    updatePtr = helper.getUpdatePtr();
    readWritePtr = helper.getReadWritePtr();
    readWriteStartAddress = helper.getReadWriteStart();
    romclassStartAddress = helper.getRomClassesStart();
    // Get the debug area size, then calculate the metadata and debug area offset
    debugAreaSize = helper.getDebugAreaSize();
    metadataStartAddress = helper.getMetaDataStart();
    debugAreaStart = helper.getDebugAreaStart();
    debugAreaEnd = helper.getDebugAreaEnd();
    /* Calculate the amount of LNT and LVT attribute data stored in the cache
		 * Although lineNumberTableNextSRP and localVariableTableNextSRP are SRPs, 
		 * they are defined as UDATA in J9SharedCacheHeader.
		 * Therefore these SRPs needs to be resolved manually here instead of using SelfRelativePointer class.
		 */
    // new UDATA(header.lineNumberTableNextSRPEA().longValue() + header.lineNumberTableNextSRP().longValue());
    debugLNTNextAdd = helper.getLineNumberAreaEnd();
    // new UDATA(header.localVariableTableNextSRPEA().longValue() + header.localVariableTableNextSRP().longValue());
    debugLVTNextAdd = helper.getLocalVariableAreaEnd();
    debugLNTUsed = helper.getDebugLNTUsed();
    debugLVTUsed = helper.getDebugLVTUsed();
    // Calculate the used portion of the debug area
    debugAreaUsed = debugLNTUsed.add(debugLVTUsed);
    if (0 != debugAreaSize.longValue()) {
        debugAreaPercentUsed = new UDATA((debugAreaUsed.longValue() * 100) / debugAreaSize.longValue());
    } else {
        debugAreaPercentUsed = new UDATA(100);
    }
    getFreeAvailableBytes = helper.getFreeAvailableBytes();
    if (null != getFreeAvailableBytes) {
        freeBytes = getFreeAvailableBytes.longValue();
    }
    if (cacheletIndex == -1 || address.isNull()) {
        CommandUtils.dbgPrint(out, "!j9sharedcacheheader %s\n", header.getHexAddress());
        indent = cacheletIndex >= 0 ? "    " : "";
        if (cacheletIndex > 0) {
            CommandUtils.dbgPrint(out, "    ccInitComplete: 0x%x free bytes: %d cacheFullFlags: %d\n", header.ccInitComplete().longValue(), updatePtr.sub(segmentPtr).longValue(), header.cacheFullFlags().longValue());
        } else {
            if (cacheletIndex == -1) {
                CommandUtils.dbgPrint(out, "%scache size       : %d\n", indent, totalBytes.sub(readWriteBytes).longValue());
                if (null != getFreeAvailableBytes) {
                    CommandUtils.dbgPrint(out, "%sfree bytes       : %d\n", indent, freeBytes);
                }
                if (softMaxBytes.eq(U32.MAX)) {
                    CommandUtils.dbgPrint(out, "%ssoftmx bytes     : %d\n", indent, -1);
                } else {
                    CommandUtils.dbgPrint(out, "%ssoftmx bytes     : %d", indent, softMaxBytes.longValue());
                    try {
                        Field field = ShCFlags.class.getField("J9SHR_AVAILABLE_SPACE_FULL");
                        Long flagValue = (Long) field.get(null);
                        if (helper.getCacheFullFlags().anyBitsIn(flagValue)) {
                            CommandUtils.dbgPrint(out, " (J9SHR_AVAILABLE_SPACE_FULL is set)");
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    CommandUtils.dbgPrint(out, "\n");
                }
            }
            CommandUtils.dbgPrint(out, "%sread write area  : %s - %s size %d used %d\n", indent, readWriteStartAddress.getHexValue(), readWritePtr.getHexValue(), readWriteBytes.longValue(), readWritePtr.sub(readWriteStartAddress).longValue());
        }
        CommandUtils.dbgPrint(out, "%ssegment area     : %s - %s size %d\n", indent, romclassStartAddress.getHexValue(), segmentPtr.getHexValue(), segmentPtr.sub(romclassStartAddress).longValue());
        CommandUtils.dbgPrint(out, "%smetadata area    : %s - %s size %d\n", indent, updatePtr.getHexValue(), metadataStartAddress.getHexValue(), metadataStartAddress.sub(updatePtr).longValue());
        CommandUtils.dbgPrint(out, "%sclass debug area : %s - %s size %d used %d (%% used %d)\n", indent, debugAreaStart.getHexValue(), debugAreaEnd.getHexValue(), debugAreaSize.longValue(), debugAreaUsed.longValue(), debugAreaPercentUsed.longValue());
    }
    if (address.isNull()) {
        return new Touple<Boolean, Long>(false, freeBytes);
    }
    if (address.gte(VoidPointer.cast(header)) && address.lt(header.addOffset(J9SharedCacheHeader.SIZEOF))) {
        CommandUtils.dbgPrint(out, "\n0x%x is in the cache%s header", address.getAddress(), cacheletIndex > 0 ? "let" : "");
    } else if (address.gte(VoidPointer.cast(readWriteStartAddress)) && address.lt(VoidPointer.cast(readWritePtr))) {
        CommandUtils.dbgPrint(out, "\n0x%x is in the read write area", address.getAddress());
    } else if (address.gte(VoidPointer.cast(readWritePtr)) && address.lt(VoidPointer.cast(romclassStartAddress))) {
        CommandUtils.dbgPrint(out, "\n0x%x is in the unused part of the read write area", address.getAddress());
    } else if (address.gte(VoidPointer.cast(romclassStartAddress)) && address.lt(VoidPointer.cast(segmentPtr))) {
        CommandUtils.dbgPrint(out, "\n0x%x is in the rom class segment area", address.getAddress());
    } else if (address.gte(VoidPointer.cast(segmentPtr)) && address.lt(VoidPointer.cast(updatePtr))) {
        CommandUtils.dbgPrint(out, "\n0x%x is in unused area between class segments and metadata", address.getAddress());
    } else if (address.gte(VoidPointer.cast(updatePtr)) && address.lt(VoidPointer.cast(metadataStartAddress))) {
        CommandUtils.dbgPrint(out, "\n0x%x is in the metadata area", address.getAddress());
    } else if (!debugAreaSize.eq(0) && address.gte(VoidPointer.cast(metadataStartAddress)) && address.lt(VoidPointer.cast(debugAreaEnd))) {
        if (address.lt(VoidPointer.cast(debugLNTNextAdd))) {
            CommandUtils.dbgPrint(out, "\n0x%x is in the line number table of the class debug area", address.getAddress());
        } else if (address.gt(VoidPointer.cast(debugLVTNextAdd))) {
            CommandUtils.dbgPrint(out, "\n0x%x is in the local variable table of the class debug area", address.getAddress());
        } else {
            CommandUtils.dbgPrint(out, "\n0x%x is in the unused part of the class debug area", address.getAddress());
        }
    } else {
        return new Touple<Boolean, Long>(false, freeBytes);
    }
    if (cacheletIndex > 0) {
        CommandUtils.dbgPrint(out, " of cachelet %d\n", cacheletIndex);
    } else if (cacheletIndex == 0) {
        CommandUtils.dbgPrint(out, " of the main cache\n");
    } else {
        CommandUtils.dbgPrint(out, "\n");
    }
    return new Touple<Boolean, Long>(true, freeBytes);
}
Also used : Field(java.lang.reflect.Field) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) IOException(java.io.IOException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) FileNotFoundException(java.io.FileNotFoundException)

Example 89 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class ShowDumpAgentsCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
        J9RASdumpAgentPointer agent = J9RASdumpAgentPointer.NULL;
        out.println("Registered dump agents\n----------------------");
        while (((agent = seekDumpAgent(vm, agent, null)) != null) && !agent.isNull()) {
            printDumpAgent(vm, agent, context, out);
            out.println("----------------------");
        }
        out.println();
    } catch (CorruptDataException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : J9RASdumpAgentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9RASdumpAgentPointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 90 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class CheckClassHeap method check.

@Override
public void check() {
    try {
        GCSegmentIterator segmentIterator = GCSegmentIterator.fromJ9MemorySegmentList(_javaVM.classMemorySegments(), J9MemorySegment.MEMORY_TYPE_RAM_CLASS);
        while (segmentIterator.hasNext()) {
            J9MemorySegmentPointer segment = segmentIterator.next();
            _engine.clearPreviousObjects();
            GCClassHeapIterator classHeapIterator = GCClassHeapIterator.fromJ9MemorySegment(segment);
            while (classHeapIterator.hasNext()) {
                J9ClassPointer clazz = classHeapIterator.next();
                if (_engine.checkClassHeap(clazz, segment) != CheckBase.J9MODRON_SLOT_ITERATOR_OK) {
                    return;
                }
                _engine.pushPreviousClass(clazz);
            }
        }
    } catch (CorruptDataException e) {
    // TODO: handle exception
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) GCClassHeapIterator(com.ibm.j9ddr.vm29.j9.gc.GCClassHeapIterator) GCSegmentIterator(com.ibm.j9ddr.vm29.j9.gc.GCSegmentIterator)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)221 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)81 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)46 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)41 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)33 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)30 NoSuchElementException (java.util.NoSuchElementException)28 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)25 UDATA (com.ibm.j9ddr.vm29.types.UDATA)20 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)17 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)15 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)11 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)9 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)9 ClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker)8 LinearDumper (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper)8 PatternString (com.ibm.j9ddr.util.PatternString)7 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)7 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)7 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)7