use of com.ibm.dtfj.image.javacore.JCImageThread in project openj9 by eclipse.
the class ImageProcessBuilder method addImageThread.
/**
* @param Properties with String key and String value
*/
public ImageThread addImageThread(long nativeThreadID, long systemThreadID, Properties properties) throws BuilderFailureException {
try {
ImagePointer pointer = fImageAddressSpace.getPointer(nativeThreadID);
JCImageThread thread = fImageProcess.getImageThread(pointer);
if (thread == null) {
thread = new JCImageThread(pointer);
if (registers != null) {
// Add the registers to the first thread
for (Iterator it = registers.entrySet().iterator(); it.hasNext(); ) {
Map.Entry me = (Map.Entry) it.next();
ImageRegister ir = new JCImageRegister((String) me.getKey(), (Number) me.getValue());
thread.addRegister(ir);
}
registers = null;
}
fImageProcess.addImageThread(thread);
}
for (Iterator it = properties.entrySet().iterator(); it.hasNext(); ) {
Map.Entry me = (Map.Entry) it.next();
thread.addProperty(me.getKey(), me.getValue());
}
if (systemThreadID != IBuilderData.NOT_AVAILABLE) {
pointer = fImageAddressSpace.getPointer(systemThreadID);
thread.setSystemThreadID(pointer);
}
return thread;
} catch (JCInvalidArgumentsException e) {
throw new BuilderFailureException(e);
}
}
use of com.ibm.dtfj.image.javacore.JCImageThread in project openj9 by eclipse.
the class ImageProcessBuilder method addImageStackSection.
/**
* Add a stack section to an existing image thread
* @param thread The native thread
* @param section The section we want to add
*/
public ImageSection addImageStackSection(ImageThread thread, ImageSection section) {
JCImageThread thread2 = (JCImageThread) thread;
thread2.addImageStackSection(section);
return section;
}
use of com.ibm.dtfj.image.javacore.JCImageThread in project openj9 by eclipse.
the class JCJavaRuntime method findJavaThread.
/**
* NON-DTFJ
* <br>
* <b>For internal building purposes only</b>. Do not call outside the DTFJ implementation.
* <br><br>
* In most cases, the threadID is the tid in a javacore, but in some other occasions, the id
* passed could be the system_thread_id or even the native thread. If a java thread is not
* found via tid, see if it can be found indirectly by an image thread that may be associated
* with the java thread (the image thread has a system thread ID as well as a native thread ID).
* @param threadID usually, tid in a javacore, may be id of some other internal vm datastructure.
* @return found java thread or null.
*/
public JCJavaThread findJavaThread(long threadID) {
Object javaThread = null;
fIDLookupKey.setKey(threadID);
if ((javaThread = fJavaThreads.get(fIDLookupKey)) == null) {
Iterator it = fJavaThreads.values().iterator();
while (javaThread == null && it.hasNext()) {
JCJavaThread jThread = (JCJavaThread) it.next();
JCImageThread imageThread = jThread.internalGetImageThread();
if (imageThread != null) {
// lookup via systemthreadID
ImagePointer pointer = imageThread.getSystemThreadID();
long address = (pointer != null) ? pointer.getAddress() : IBuilderData.NOT_AVAILABLE;
if (address != IBuilderData.NOT_AVAILABLE && address == threadID) {
javaThread = jThread;
} else // lookup via nativethreadID. This is always set for any valid image thread.
{
pointer = imageThread.getInternalID();
if (pointer.getAddress() == threadID) {
javaThread = jThread;
}
}
}
}
}
return (JCJavaThread) javaThread;
}
use of com.ibm.dtfj.image.javacore.JCImageThread in project openj9 by eclipse.
the class ImageProcessBuilder method addImageStackFrame.
public ImageStackFrame addImageStackFrame(long nativeThreadID, String name, long baseAddress, long procAddress) {
ImagePointer pointer = fImageAddressSpace.getPointer(nativeThreadID);
JCImageThread thread = fImageProcess.getImageThread(pointer);
ImagePointer ip = procAddress != IBuilderData.NOT_AVAILABLE ? fImageAddressSpace.getPointer(procAddress) : null;
JCImageStackFrame stackFrame = new JCImageStackFrame(name, null, ip);
if (thread != null) {
JCImageThread thrd = (JCImageThread) thread;
thrd.addImageStackFrame(stackFrame);
}
return stackFrame;
}
Aggregations