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;
}
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;
}
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();
}
Aggregations