while ( asIt.hasNext( ) )
{
ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
Iterator prIt = as.getProcesses( ).iterator();
while ( prIt.hasNext( ) ){
ImageProcess process = (ImageProcess) prIt.next( );
Iterator runTimesIt = process.getRuntimes( ).iterator();
while ( runTimesIt.hasNext( ) )
{
JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
//Since there doesn't seem to be a matching Kato call to get
//the information for JDWP, lets call NOT_IMPLEMENTED, but really
//attach some information back
ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
String description = "JDI Post Mortem Debugger"; //$NON-NLS-1$
String vmVersion = javaRT.getVersion();
String vmName = "JDI PMD"; //$NON-NLS-1$
int jdwpMajor = 1;
int jdwpMinor = 4;
//We now have all the information for the reply. Put it all together
Vector<Byte> vctr = new Vector<Byte>();
addStringToVector(vctr, description);
addIntToVector(vctr, jdwpMajor);
addIntToVector(vctr, jdwpMinor);
addStringToVector(vctr, vmVersion);
addStringToVector(vctr, vmName);
rpckt.setData(vectorToByte(vctr));
return rpckt;
}
}
}
}else if (cpckt.getCommand() == VIRTUAL_MACHINE_CLASS_PATHS){
logr.log(JDILogger.LEVEL_VERYVERBOSE, "This does not return the actual class path, simply allows JDB to work.");
Vector<Byte> vctr = new Vector<Byte>();
addStringToVector(vctr, "");
addIntToVector(vctr, 0);
addIntToVector(vctr, 0);
ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
rpckt.setData(vectorToByte(vctr));
return rpckt;
} else if (cpckt.getCommand() == VIRTUAL_MACHINE_CLASSES_BY_SIGNATURE){
Vector<Byte> vctr = new Vector<Byte>();
byte []inData = cpckt.getByteData();
String signature = getStringFromBytes(inData, 0);
if (signature.charAt(0) == 'L'){
signature = signature.substring(1, signature.length() - 1);
}
logr.log(JDILogger.LEVEL_VERBOSE, "ClassesBySignature(" + signature + ")"); //$NON-NLS-1$ //$NON-NLS-2$
int count = 0;
Iterator <JavaClass> javaClasses = classes.values().iterator();
while (javaClasses.hasNext()){
JavaClass javaClass = javaClasses.next();
String searched = javaClass.getName();
if (searched.equals(signature)){
count++;
if (javaClass.isArray()){
vctr.add((byte)3);
}else if (isInterface(javaClass.getID().getAddress())){
vctr.add((byte)2);
}else{
vctr.add((byte)1);
}
//vctr.add((byte)1);
addLongToVector(vctr, javaClass.getID().getAddress());
//Verified Prepared and Initialized
addIntToVector(vctr, 1 | 2 | 4);
logr.log(JDILogger.LEVEL_VERYVERBOSE, "Match: " + javaClass.getName() +" " + Long.toHexString(javaClass.getID().getAddress())); //$NON-NLS-1$
}else{
String mangledName = "" + searched + ""; //$NON-NLS-1$ //$NON-NLS-2$
if (mangledName.equals(signature)){
count++;
if (javaClass.isArray()){
vctr.add((byte)3);
}else if (isInterface(javaClass.getID().getAddress())){
vctr.add((byte)2);
}else{
vctr.add((byte)1);
}
//vctr.add((byte)1);
addLongToVector(vctr, javaClass.getID().getAddress());
//Verified Prepared and Initialized
addIntToVector(vctr, 1 | 2 | 4);
logr.log(JDILogger.LEVEL_VERYVERBOSE, "Mangled Match: " + javaClass.getName()); //$NON-NLS-1$
}else{
String secondMangle = "[" + searched + ";"; //$NON-NLS-1$ //$NON-NLS-2$
if (secondMangle.equals(signature)){
count++;
if (javaClass.isArray()){
vctr.add((byte)3);
}else if (isInterface(javaClass.getID().getAddress())){
vctr.add((byte)2);
}else{
vctr.add((byte)1);
}
//vctr.add((byte)1);
addLongToVector(vctr, javaClass.getID().getAddress());
//Verified Prepared and Initialized
addIntToVector(vctr, 1 | 2 | 4);
logr.log(JDILogger.LEVEL_VERYVERBOSE, "Really mangled match: " + javaClass.getName()); //$NON-NLS-1$
}
}
}
}
//Add the count to the front of the vector
addIntToVectorFront(vctr, count);
logr.log(JDILogger.LEVEL_VERYVERBOSE, count+" matches"); //$NON-NLS-1$
ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
rpckt.setData(vectorToByte(vctr));
return rpckt;
}else if (cpckt.getCommand() == VIRTUAL_MACHINE_ALL_CLASSES){
logr.log(JDILogger.LEVEL_VERBOSE, "AllClasses()"); //$NON-NLS-1$
Vector<Byte> vctr = new Vector<Byte>();
int count = 0;
Iterator <JavaClass> classList = classes.values().iterator();
while(classList.hasNext()){
JavaClass javaClass = (JavaClass)classList.next();
long typeID = javaClass.getID().getAddress();
String signature;
if (javaClass.isArray()){
vctr.add((byte)3);
signature = "" + javaClass.getName() + ""; //$NON-NLS-1$ //$NON-NLS-2$
}else if (isInterface(typeID)){
vctr.add((byte)2);
signature = "L" + javaClass.getName() + ";"; //$NON-NLS-1$ //$NON-NLS-2$
}else{
vctr.add((byte)1);
signature = "L" + javaClass.getName() + ";"; //$NON-NLS-1$ //$NON-NLS-2$
}
int status = 7;
addLongToVector(vctr, typeID);
addStringToVector(vctr, signature);
addIntToVector(vctr, status);
count++;
}
logr.log(JDILogger.LEVEL_VERYVERBOSE, " " + count +" class(es) found"); //$NON-NLS-1$ //$NON-NLS-2$
addIntToVectorFront(vctr, count);
ReplyPacket rpckt = new ReplyPacket(cpckt.getSequence(), FLAG_REPLY_PACKET, ERROR_NONE);
rpckt.setData(vectorToByte(vctr));
return rpckt;
}else if (cpckt.getCommand() == VIRTUAL_MACHINE_ALL_THREADS){
logr.log(JDILogger.LEVEL_VERBOSE, "AllThreads()"); //$NON-NLS-1$
Iterator asIt = image.getAddressSpaces( ).iterator();
while ( asIt.hasNext( ) )
{
ImageAddressSpace as = (ImageAddressSpace) asIt.next( );
Iterator prIt = as.getProcesses( ).iterator();
while ( prIt.hasNext( ) )
{
ImageProcess process = (ImageProcess) prIt.next( );
Iterator runTimesIt = process.getRuntimes( ).iterator();
while ( runTimesIt.hasNext( ) )
{
JavaRuntime javaRT = (JavaRuntime) runTimesIt.next( );
Iterator thds = javaRT.getThreads().iterator();
Vector<Byte> vctr = new Vector<Byte>();