Search in sources :

Example 6 with ISymbol

use of com.ibm.j9ddr.corereaders.memory.ISymbol in project openj9 by eclipse.

the class WindowsProcessAddressSpace method getEnvironmentSymbols.

/**
 *  This method returns a list of symbols with the name "_environ"
 *
 *  @return LinkedList instance of symbols with the name "_environ"
 *  @throws CorruptDataException
 */
private LinkedList<ISymbol> getEnvironmentSymbols() throws CorruptDataException {
    List<IModule> modules = getModules();
    LinkedList<ISymbol> symbols = new LinkedList<ISymbol>();
    for (IModule thisModule : modules) {
        try {
            for (ISymbol thisSymbol : thisModule.getSymbols()) {
                if (thisSymbol.getName().equals("_environ")) {
                    symbols.add(thisSymbol);
                }
            }
        } catch (DataUnavailableException e) {
            continue;
        }
    }
    return symbols;
}
Also used : IModule(com.ibm.j9ddr.corereaders.memory.IModule) DataUnavailableException(com.ibm.j9ddr.DataUnavailableException) ISymbol(com.ibm.j9ddr.corereaders.memory.ISymbol) LinkedList(java.util.LinkedList)

Example 7 with ISymbol

use of com.ibm.j9ddr.corereaders.memory.ISymbol in project openj9 by eclipse.

the class WindowsProcessAddressSpace method getEnvironmentVariables.

/**
 * This method tries to get environment variables by iterating through modules.
 * It returns the one with environment var "IBM_JAVA_COMMAND_LINE"
 * If there is no module with IBM_JAVA_COMMAND_LINE, then it returns the last one.
 *
 * @return Properties instance of environment variables.
 * @throws DataUnavailableException
 * @throws CorruptDataException
 */
public Properties getEnvironmentVariables() throws DataUnavailableException, CorruptDataException {
    if (null == environment) {
        LinkedList<ISymbol> environSymbols = getEnvironmentSymbols();
        ISymbol environ = null;
        if (0 == environSymbols.size()) {
            throw new DataUnavailableException("Couldn't find environment symbol");
        }
        /* There might be more than one module with environment variables. Use the one that has IBM_JAVA_COMMAND_LINE */
        for (int i = 0; i < environSymbols.size(); i++) {
            environ = environSymbols.get(i);
            long environPointer = getPointerAt(environ.getAddress());
            environment = EnvironmentUtils.readEnvironment(this, environPointer);
            if (environment.containsKey("IBM_JAVA_COMMAND_LINE")) {
                break;
            }
        }
    }
    return environment;
}
Also used : DataUnavailableException(com.ibm.j9ddr.DataUnavailableException) ISymbol(com.ibm.j9ddr.corereaders.memory.ISymbol)

Example 8 with ISymbol

use of com.ibm.j9ddr.corereaders.memory.ISymbol in project openj9 by eclipse.

the class J9DDRImageModule method getSymbols.

/* (non-Javadoc)
	 * @see com.ibm.dtfj.image.ImageModule#getSymbols()
	 */
public Iterator<?> getSymbols() {
    Collection<? extends ISymbol> symbols;
    try {
        symbols = delegate.getSymbols();
    } catch (DataUnavailableException e) {
        // JEXTRACT slightly arbitrary code here. DTFJ/JExtract uses the base address of the .text section as the
        // address of the corrupt data. We do the same for compatibility's sake.
        Collection<? extends IMemoryRange> memoryRanges = delegate.getMemoryRanges();
        long baseAddress = 0;
        for (IMemoryRange range : memoryRanges) {
            if (range.getName().contains(".text")) {
                baseAddress = range.getBaseAddress();
                break;
            }
        }
        return Collections.singletonList(new J9DDRCorruptData(process, e.getMessage(), baseAddress)).iterator();
    }
    List<ImageSymbol> dtfjSymbols = new ArrayList<ImageSymbol>(symbols.size());
    for (ISymbol symbol : symbols) {
        dtfjSymbols.add(new J9DDRImageSymbol(symbol.getName(), new J9DDRImagePointer(process, symbol.getAddress())));
    }
    return dtfjSymbols.iterator();
}
Also used : IMemoryRange(com.ibm.j9ddr.corereaders.memory.IMemoryRange) DataUnavailableException(com.ibm.j9ddr.DataUnavailableException) ImageSymbol(com.ibm.dtfj.image.ImageSymbol) ISymbol(com.ibm.j9ddr.corereaders.memory.ISymbol) ArrayList(java.util.ArrayList) Collection(java.util.Collection)

Aggregations

ISymbol (com.ibm.j9ddr.corereaders.memory.ISymbol)8 LinkedList (java.util.LinkedList)4 DataUnavailableException (com.ibm.j9ddr.DataUnavailableException)3 IModule (com.ibm.j9ddr.corereaders.memory.IModule)3 Symbol (com.ibm.j9ddr.corereaders.memory.Symbol)3 CorruptCoreException (com.ibm.j9ddr.corereaders.CorruptCoreException)2 IMemoryRange (com.ibm.j9ddr.corereaders.memory.IMemoryRange)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ArrayList (java.util.ArrayList)2 ImageSymbol (com.ibm.dtfj.image.ImageSymbol)1 CorruptDataException (com.ibm.j9ddr.CorruptDataException)1 MemoryFault (com.ibm.j9ddr.corereaders.memory.MemoryFault)1 Module (com.ibm.j9ddr.corereaders.memory.Module)1 RuntimeFunction (com.ibm.j9ddr.corereaders.minidump.unwind.RuntimeFunction)1 UnwindModule (com.ibm.j9ddr.corereaders.minidump.unwind.UnwindModule)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 Properties (java.util.Properties)1 Logger (java.util.logging.Logger)1