use of com.ibm.j9ddr.vm29.j9.J9JavaStackIterator in project openj9 by eclipse.
the class FindStackValueCommand method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (0 == args.length) {
out.println("Usage error: Missing stackvalue to search for. See usage.");
printUsage(out);
return;
} else if (1 < args.length) {
out.println("Usage error: Too many stackvalues to search for. See usage.");
printUsage(out);
return;
}
try {
long address = CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64);
UDATAPointer value = UDATAPointer.cast(address);
GCVMThreadListIterator gcvmThreadListIterator = GCVMThreadListIterator.from();
while (gcvmThreadListIterator.hasNext()) {
J9VMThreadPointer vmThreadPointer = gcvmThreadListIterator.next();
J9JavaStackPointer javaStackPointer = vmThreadPointer.stackObject();
J9JavaStackIterator javaStackIterator = J9JavaStackIterator.fromJ9JavaStack(javaStackPointer);
boolean found = false;
UDATA relativeSP = new UDATA(javaStackPointer.end().sub(vmThreadPointer.sp()));
while (javaStackIterator.hasNext()) {
J9JavaStackPointer stack = javaStackIterator.next();
UDATAPointer localEnd = stack.end().sub(1).add(1);
UDATAPointer search = localEnd.sub(relativeSP);
while (!search.eq(localEnd)) {
if (search.at(0).longValue() == value.longValue()) {
if (!found) {
out.append(String.format("!j9vmthread %s\n", Long.toHexString(vmThreadPointer.getAddress())));
found = true;
}
out.append(String.format("\tFound at %s\n", Long.toHexString(search.getAddress())));
}
search = search.add(1);
}
}
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.j9.J9JavaStackIterator in project openj9 by eclipse.
the class DTFJJavaThread method walkSections.
private void walkSections() {
sections = new ArrayList<Object>();
J9JavaStackIterator stacks;
try {
stacks = J9JavaStackIterator.fromJ9JavaStack(thread.stackObject());
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
sections.add(cd);
return;
}
// JEXTRACT seems to be hard coded to only return 1 stack section ... walking the stack finds more than one.
int count = 0;
while (stacks.hasNext() && count < 1) {
J9JavaStackPointer stack = stacks.next();
try {
long size = stack.size().longValue();
long baseAddress = stack.end().longValue() - size;
J9DDRImageSection newSection = DTFJContext.getImageSection(baseAddress, getSectionName());
newSection.setSize(size);
sections.add(newSection);
count++;
} catch (Throwable t) {
CorruptData cd = J9DDRDTFJUtils.handleAsCorruptData(DTFJContext.getProcess(), t);
sections.add(cd);
}
}
}
Aggregations