use of com.ibm.dtfj.image.Image in project openj9 by eclipse.
the class ImageTest method getProcessorCountTest.
@Test
public void getProcessorCountTest() {
for (int i = 0; i != ddrTestObjects.size(); i++) {
Image ddrImg = (Image) ddrTestObjects.get(i);
Image jextractImg = (Image) jextractTestObjects.get(i);
imageComparator.testEquals(ddrImg, jextractImg, ImageComparator.PROCESSOR_COUNT);
}
}
use of com.ibm.dtfj.image.Image in project openj9 by eclipse.
the class ImageTest method getIPAddressesTest.
@Test
public void getIPAddressesTest() {
for (int i = 0; i != ddrTestObjects.size(); i++) {
Image ddrImg = (Image) ddrTestObjects.get(i);
Image jextractImg = (Image) jextractTestObjects.get(i);
imageComparator.testEquals(ddrImg, jextractImg, ImageComparator.IP_ADDRESSES);
}
}
use of com.ibm.dtfj.image.Image in project openj9 by eclipse.
the class ImageTest method getCreationTimeTest.
@Test
public void getCreationTimeTest() {
for (int i = 0; i != ddrTestObjects.size(); i++) {
Image ddrImg = (Image) ddrTestObjects.get(i);
Image jextractImg = (Image) jextractTestObjects.get(i);
imageComparator.testEquals(ddrImg, jextractImg, ImageComparator.CREATION_TIME);
}
}
use of com.ibm.dtfj.image.Image in project openj9 by eclipse.
the class ImageTest method getProcessorTypeTest.
@Test
public void getProcessorTypeTest() {
for (int i = 0; i != ddrTestObjects.size(); i++) {
Image ddrImg = (Image) ddrTestObjects.get(i);
Image jextractImg = (Image) jextractTestObjects.get(i);
imageComparator.testEquals(ddrImg, jextractImg, ImageComparator.PROCESSOR_TYPE);
}
}
use of com.ibm.dtfj.image.Image in project openj9 by eclipse.
the class DDRLibraryAdapter method constructLibraryList.
/**
* Constructs the list of libraries required using the DDR implementation of the DTFJ Image* API.
* This ensures that the correct classloading is used for determining which libraries to collect.
* @param coreFile core file to process
*/
@SuppressWarnings({ "unchecked" })
private void constructLibraryList(final File coreFile) {
moduleNames = new ArrayList<String>();
ImageFactory factory = new J9DDRImageFactory();
final Image image;
final boolean isAIX;
try {
image = factory.getImage(coreFile);
isAIX = image.getSystemType().toLowerCase().startsWith("aix");
} catch (IOException e) {
logger.log(SEVERE, "Could not open core file", e);
errorMessages.add(e.getMessage());
return;
} catch (CorruptDataException e) {
logger.log(SEVERE, "Could not determine system type", e);
errorMessages.add(e.getMessage());
return;
} catch (DataUnavailable e) {
logger.log(SEVERE, "Could not determine system type", e);
errorMessages.add(e.getMessage());
return;
}
for (Iterator spaces = image.getAddressSpaces(); spaces.hasNext(); ) {
ImageAddressSpace space = (ImageAddressSpace) spaces.next();
for (Iterator procs = space.getProcesses(); procs.hasNext(); ) {
ImageProcess proc = (ImageProcess) procs.next();
try {
// add the executable to the list of libraries to be collected
ImageModule exe = proc.getExecutable();
moduleNames.add(exe.getName());
for (Iterator libraries = proc.getLibraries(); libraries.hasNext(); ) {
ImageModule module = (ImageModule) libraries.next();
String key = null;
try {
// handle CDE thrown by getName(), as this is required further on this call needs to succeed
if (isAIX) {
key = module.getName();
// check on AIX if module is the .a file or library
int pos = key.indexOf(".a(");
if ((pos != -1) && (key.lastIndexOf(')') == key.length() - 1)) {
key = key.substring(0, pos + 2);
}
} else {
key = module.getName();
}
logger.fine("Module : " + key);
if (!moduleNames.contains(key)) {
// don't store duplicate libraries
moduleNames.add(key);
}
} catch (Exception e) {
logger.log(WARNING, "Error getting module name", e);
}
}
} catch (DataUnavailable e) {
logger.log(WARNING, "Error getting library list", e);
errorMessages.add(e.getMessage());
} catch (com.ibm.dtfj.image.CorruptDataException e) {
logger.log(WARNING, "Error getting library list", e);
errorMessages.add(e.getMessage());
}
}
}
}
Aggregations