sa-jdi

White()
  {
    char ch;
    while (((ch = sdePeek()) == ' ') || (ch == '\t')) {
      sdeAdvance();
    }
  }
  
  void ignoreLine()
  {
    char ch;
    while (((ch = sdeRead()) != '\n') && (ch != '\r')) {}
    if ((ch == '\r') && (sdePeek() == '\n')) {
      sdeAdvance();
    }
    ignoreWhite();
  }
  
  int readNumber()
  {
    int value = 0;
    
    ignoreWhite();
    char ch;
    while (((ch = sdePeek()) >= '0') && (ch <= '9'))
    {
      sdeAdvance();
      value = value * 10 + ch - 48;
    }
    ignoreWhite();
    return value;
  }
  
  void storeFile(int fileId, String sourceName, String sourcePath)
  {
    assureFileTableSize();
    fileTable[fileIndex].fileId = fileId;
    fileTable[fileIndex].sourceName = sourceName;
    fileTable[fileIndex].sourcePath = sourcePath;
    fileIndex += 1;
  }
  
  void fileLine()
  {
    int hasAbsolute = 0;
    
    String sourcePath = null;
    if (sdePeek() == '+')
    {
      sdeAdvance();
      hasAbsolute = 1;
    }
    int fileId = readNumber();
    String sourceName = readLine();
    if (hasAbsolute == 1) {
      sourcePath = readLine();
    }
    storeFile(fileId, sourceName, sourcePath);
  }
  
  void storeLine(int jplsStart, int jplsEnd, int jplsLineInc, int njplsStart, int njplsEnd, int fileId)
  {
    assureLineTableSize();
    lineTable[lineIndex].jplsStart = jplsStart;
    lineTable[lineIndex].jplsEnd = jplsEnd;
    lineTable[lineIndex].jplsLineInc = jplsLineInc;
    lineTable[lineIndex].njplsStart = njplsStart;
    lineTable[lineIndex].njplsEnd = njplsEnd;
    lineTable[lineIndex].fileId = fileId;
    lineIndex += 1;
  }
  
  void lineLine()
  {
    int lineCount = 1;
    int lineIncrement = 1;
    
    int njplsStart = readNumber();
    if (sdePeek() == '#')
    {
      sdeAdvance();
      currentFileId = readNumber();
    }
    if (sdePeek() == ',')
    {
      sdeAdvance();
      lineCount = readNumber();
    }
    if (sdeRead() != ':') {
      syntax();
    }
    int jplsStart = readNumber();
    if (sdePeek() == ',')
    {
      sdeAdvance();
      lineIncrement = readNumber();
    }
    ignoreLine();
    
    storeLine(jplsStart, jplsStart + lineCount * lineIncrement - 1, lineIncrement, njplsStart, njplsStart + lineCount - 1, currentFileId);
  }
  
  void storeStratum(String stratumId)
  {
    if ((stratumIndex > 0) && 
      (stratumTable[(stratumIndex - 1)].fileIndex == fileIndex) && (stratumTable[(stratumIndex - 1)].lineIndex == lineIndex)) {
      stratumIndex -= 1;
    }
    assureStratumTableSize();
    stratumTable[stratumIndex].id = stratumId;
    stratumTable[stratumIndex].fileIndex = fileIndex;
    stratumTable[stratumIndex].lineIndex = lineIndex;
    stratumIndex += 1;
    currentFileId = 0;
  }
  
  void stratumSection()
  {
    storeStratum(readLine());
  }
  
  void fileSection()
  {
    ignoreLine();
    while (sdePeek() != '*') {
      fileLine();
    }
  }
  
  void lineSection()
  {
    ignoreLine();
    while (sdePeek() != '*') {
      lineLine();
    }
  }
  
  void ignoreSection()
  {
    ignoreLine();
    while (sdePeek() != '*') {
      ignoreLine();
    }
  }
  
  void createJavaStratum()
  {
    baseStratumIndex = stratumIndex;
    storeStratum("Java");
    storeFile(1, jplsFilename, NullString);
    
    storeLine(1, 65536, 1, 1, 65536, 1);
    storeStratum("Aux");
  }
  
  void decode()
  {
    if ((sourceDebugExtension.length() < 4) || (sdeRead() != 'S') || (sdeRead() != 'M') || (sdeRead() != 'A') || (sdeRead() != 'P')) {
      return;
    }
    ignoreLine();
    jplsFilename = readLine();
    defaultStratumId = readLine();
    createJavaStratum();
    for (;;)
    {
      if (sdeRead() != '*') {
        syntax();
      }
      switch (sdeRead())
      {
      case 'S': 
        stratumSection();
        break;
      case 'F': 
        fileSection();
        break;
      case 'L': 
        lineSection();
        break;
      case 'E': 
        storeStratum("*terminator*");
        isValid = true;
        return;
      default: 
        ignoreSection();
      }
    }
  }
  
  void createProxyForAbsentSDE()
  {
    jplsFilename = null;
    defaultStratumId = "Java";
    defaultStratumIndex = stratumIndex;
    createJavaStratum();
    storeStratum("*terminator*");
  }
  
  private int stiLineTableIndex(int sti, int jplsLine)
  {
    int lineIndexStart = stratumTable[sti].lineIndex;
    
    int lineIndexEnd = stratumTable[(sti + 1)].lineIndex;
    for (int i = lineIndexStart; i < lineIndexEnd; i++) {
      if ((jplsLine >= lineTable[i].jplsStart) && (jplsLine <= lineTable[i].jplsEnd)) {
        return i;
      }
    }
    return -1;
  }
  
  private int stiLineNumber(int sti, int lti, int jplsLine)
  {
    return lineTable[lti].njplsStart + (jplsLine - lineTable[lti].jplsStart) / lineTable[lti].jplsLineInc;
  }
  
  private int fileTableIndex(int sti, int fileId)
  {
    int fileIndexStart = stratumTable[sti].fileIndex;
    
    int fileIndexEnd = stratumTable[(sti + 1)].fileIndex;
    for (int i = fileIndexStart; i < fileIndexEnd; i++) {
      if (fileTable[i].fileId == fileId) {
        return i;
      }
    }
    return -1;
  }
  
  private int stiFileTableIndex(int sti, int lti)
  {
    return fileTableIndex(sti, lineTable[lti].fileId);
  }
  
  boolean isValid()
  {
    return isValid;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.SDE
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.PrimitiveValue;
import com.sun.jdi.ShortType;
import com.sun.jdi.VirtualMachine;

public class ShortTypeImpl
  extends PrimitiveTypeImpl
  implements ShortType
{
  ShortTypeImpl(VirtualMachine vm)
  {
    super(vm);
  }
  
  public String signature()
  {
    return "S";
  }
  
  PrimitiveValue convert(PrimitiveValue value)
    throws InvalidTypeException
  {
    return vm.mirrorOf(((PrimitiveValueImpl)value).checkedShortValue());
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.ShortTypeImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.ShortValue;
import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;

public class ShortValueImpl
  extends PrimitiveValueImpl
  implements ShortValue
{
  private short value;
  
  ShortValueImpl(VirtualMachine aVm, short aValue)
  {
    super(aVm);
    
    value = aValue;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj != null) && ((obj instanceof ShortValue))) {
      return (value == ((ShortValue)obj).value()) && (super.equals(obj));
    }
    return false;
  }
  
  public int hashCode()
  {
    return intValue();
  }
  
  public int compareTo(Object obj)
  {
    short other = ((ShortValue)obj).value();
    return value() - other;
  }
  
  public Type type()
  {
    return vm.theShortType();
  }
  
  public short value()
  {
    return value;
  }
  
  public boolean booleanValue()
  {
    return value != 0;
  }
  
  public byte byteValue()
  {
    return (byte)value;
  }
  
  public char charValue()
  {
    return (char)value;
  }
  
  public short shortValue()
  {
    return value;
  }
  
  public int intValue()
  {
    return value;
  }
  
  public long longValue()
  {
    return value;
  }
  
  public float floatValue()
  {
    return value;
  }
  
  public double doubleValue()
  {
    return value;
  }
  
  byte checkedByteValue()
    throws InvalidTypeException
  {
    if ((value > 127) || (value < -128)) {
      throw new InvalidTypeException("Can't convert " + value + " to byte");
    }
    return super.checkedByteValue();
  }
  
  char checkedCharValue()
    throws InvalidTypeException
  {
    if ((value > 65535) || (value < 0)) {
      throw new InvalidTypeException("Can't convert " + value + " to char");
    }
    return super.checkedCharValue();
  }
  
  public String toString()
  {
    return "" + value;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.ShortValueImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.AbsentInformationException;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.InvalidStackFrameException;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.LocalVariable;
import com.sun.jdi.Location;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.StackFrame;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.Value;
import com.sun.jdi.VirtualMachine;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.oops.Array;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.runtime.BasicType;
import sun.jvm.hotspot.runtime.JavaVFrame;
import sun.jvm.hotspot.runtime.StackValueCollection;
import sun.jvm.hotspot.utilities.Assert;

public class StackFrameImpl
  extends MirrorImpl
  implements StackFrame
{
  private boolean isValid = true;
  private final ThreadReferenceImpl thread;
  private final JavaVFrame saFrame;
  private final Location location;
  private Map visibleVariables = null;
  private ObjectReference thisObject = null;
  
  StackFrameImpl(VirtualMachine vm, ThreadReferenceImpl thread, JavaVFrame jvf)
  {
    super(vm);
    this.thread = thread;
    saFrame = jvf;
    
    sun.jvm.hotspot.oops.Method SAMethod = jvf.getMethod();
    
    ReferenceType rt = ((VirtualMachineImpl)vm).referenceType(SAMethod.getMethodHolder());
    
    location = new LocationImpl(vm, rt, SAMethod, jvf.getBCI());
  }
  
  private void validateStackFrame()
  {
    if (!isValid) {
      throw new InvalidStackFrameException("Thread has been resumed");
    }
  }
  
  JavaVFrame getJavaVFrame()
  {
    return saFrame;
  }
  
  public Location location()
  {
    validateStackFrame();
    return location;
  }
  
  public ThreadReference thread()
  {
    validateStackFrame();
    return thread;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj != null) && ((obj instanceof StackFrameImpl)))
    {
      StackFrameImpl other = (StackFrameImpl)obj;
      return saFrame.equals(saFrame);
    }
    return false;
  }
  
  public int hashCode()
  {
    return saFrame.hashCode();
  }
  
  public ObjectReference thisObject()
  {
    validateStackFrame();
    MethodImpl currentMethod = (MethodImpl)location.method();
    if ((currentMethod.isStatic()) || (currentMethod.isNative())) {
      return null;
    }
    if (thisObject == null)
    {
      StackValueCollection values = saFrame.getLocals();
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(values.size() > 0, "this is missing");
      }
      OopHandle handle = values.oopHandleAt(0);
      ObjectHeap heap = vm.saObjectHeap();
      thisObject = vm.objectMirror(heap.newOop(handle));
    }
    return thisObject;
  }
  
  private void createVisibleVariables()
    throws AbsentInformationException
  {
    if (visibleVariables == null)
    {
      List allVariables = location.method().variables();
      Map map = new HashMap(allVariables.size());
      
      Iterator iter = allVariables.iterator();
      while (iter.hasNext())
      {
        LocalVariableImpl variable = (LocalVariableImpl)iter.next();
        String name = variable.name();
        if (variable.isVisible(this))
        {
          LocalVariable existing = (LocalVariable)map.get(name);
          if ((existing == null) || (variable.hides(existing))) {
            map.put(name, variable);
          }
        }
      }
      visibleVariables = map;
    }
  }
  
  public List visibleVariables()
    throws AbsentInformationException
  {
    validateStackFrame();
    createVisibleVariables();
    List mapAsList = new ArrayList(visibleVariables.values());
    Collections.sort(mapAsList);
    return mapAsList;
  }
  
  public LocalVariable visibleVariableByName(String name)
    throws AbsentInformationException
  {
    validateStackFrame();
    createVisibleVariables();
    return (LocalVariable)visibleVariables.get(name);
  }
  
  public Value getValue(LocalVariable variable)
  {
    List list = new ArrayList(1);
    list.add(variable);
    Map map = getValues(list);
    return (Value)map.get(variable);
  }
  
  public Map getValues(List variables)
  {
    validateStackFrame();
    StackValueCollection values = saFrame.getLocals();
    
    int count = variables.size();
    Map map = new HashMap(count);
    for (int ii = 0; ii < count; ii++)
    {
      LocalVariableImpl variable = (LocalVariableImpl)variables.get(ii);
      if (!variable.isVisible(this)) {
        throw new IllegalArgumentException(variable.name() + " is not valid at this frame location");
      }
      int ss = variable.slot();
      char c = variable.signature().charAt(0);
      BasicType variableType = BasicType.charToBasicType(c);
      ValueImpl valueImpl = getSlotValue(values, variableType, ss);
      map.put(variable, valueImpl);
    }
    return map;
  }
  
  public List getArgumentValues()
  {
    validateStackFrame();
    StackValueCollection values = saFrame.getLocals();
    MethodImpl mmm = (MethodImpl)location.method();
    List argSigs = mmm.argumentSignatures();
    int count = argSigs.size();
    List res = new ArrayList(0);
    
    int slot = mmm.isStatic() ? 0 : 1;
    for (int ii = 0; ii < count; ii++)
    {
      char sigChar = ((String)argSigs.get(ii)).charAt(0);
      BasicType variableType = BasicType.charToBasicType(sigChar);
      res.add(getSlotValue(values, variableType, slot));
      if ((sigChar == 'J') || (sigChar == 'D')) {
        slot++;
      }
      slot++;
    }
    return res;
  }
  
  private ValueImpl getSlotValue(StackValueCollection values, BasicType variableType, int ss)
  {
    ValueImpl valueImpl = null;
    OopHandle handle = null;
    ObjectHeap heap = vm.saObjectHeap();
    if (variableType == BasicType.T_BOOLEAN)
    {
      valueImpl = (BooleanValueImpl)vm.mirrorOf(values.booleanAt(ss));
    }
    else if (variableType == BasicType.T_CHAR)
    {
      valueImpl = (CharValueImpl)vm.mirrorOf(values.charAt(ss));
    }
    else if (variableType == BasicType.T_FLOAT)
    {
      valueImpl = (FloatValueImpl)vm.mirrorOf(values.floatAt(ss));
    }
    else if (variableType == BasicType.T_DOUBLE)
    {
      valueImpl = (DoubleValueImpl)vm.mirrorOf(values.doubleAt(ss));
    }
    else if (variableType == BasicType.T_BYTE)
    {
      valueImpl = (ByteValueImpl)vm.mirrorOf(values.byteAt(ss));
    }
    else if (variableType == BasicType.T_SHORT)
    {
      valueImpl = (ShortValueImpl)vm.mirrorOf(values.shortAt(ss));
    }
    else if (variableType == BasicType.T_INT)
    {
      valueImpl = (IntegerValueImpl)vm.mirrorOf(values.intAt(ss));
    }
    else if (variableType == BasicType.T_LONG)
    {
      valueImpl = (LongValueImpl)vm.mirrorOf(values.longAt(ss));
    }
    else if (variableType == BasicType.T_OBJECT)
    {
      handle = values.oopHandleAt(ss);
      valueImpl = vm.objectMirror(heap.newOop(handle));
    }
    else if (variableType == BasicType.T_ARRAY)
    {
      handle = values.oopHandleAt(ss);
      valueImpl = vm.arrayMirror((Array)heap.newOop(handle));
    }
    else if (variableType == BasicType.T_VOID)
    {
      valueImpl = new VoidValueImpl(vm);
    }
    else
    {
      throw new RuntimeException("Should not read here");
    }
    return valueImpl;
  }
  
  public void setValue(LocalVariable variableIntf, Value valueIntf)
    throws InvalidTypeException, ClassNotLoadedException
  {
    vm.throwNotReadOnlyException("StackFrame.setValue()");
  }
  
  public String toString()
  {
    return location.toString() + " in thread " + thread.toString();
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.StackFrameImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.AbsentInformationException;

class StratumLineInfo
  implements LineInfo
{
  private final String stratumID;
  private final int lineNumber;
  private final String sourceName;
  private final String sourcePath;
  
  StratumLineInfo(String stratumID, int lineNumber, String sourceName, String sourcePath)
  {
    this.stratumID = stratumID;
    this.lineNumber = lineNumber;
    this.sourceName = sourceName;
    this.sourcePath = sourcePath;
  }
  
  public String liStratum()
  {
    return stratumID;
  }
  
  public int liLineNumber()
  {
    return lineNumber;
  }
  
  public String liSourceName()
    throws AbsentInformationException
  {
    if (sourceName == null) {
      throw new AbsentInformationException();
    }
    return sourceName;
  }
  
  public String liSourcePath()
    throws AbsentInformationException
  {
    if (sourcePath == null) {
      throw new AbsentInformationException();
    }
    return sourcePath;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.StratumLineInfo
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.StringReference;
import com.sun.jdi.VirtualMachine;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.OopUtilities;

public class StringReferenceImpl
  extends ObjectReferenceImpl
  implements StringReference
{
  private String value;
  
  StringReferenceImpl(VirtualMachine aVm, Instance oRef)
  {
    super(aVm, oRef);
    value = OopUtilities.stringOopToString(oRef);
  }
  
  public String value()
  {
    return value;
  }
  
  public String toString()
  {
    return "\"" + value() + "\"";
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.StringReferenceImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.ReferenceType;
import com.sun.jdi.ThreadGroupReference;
import com.sun.jdi.VirtualMachine;
import java.util.ArrayList;
import java.util.List;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.oops.OopUtilities;
import sun.jvm.hotspot.runtime.JavaThread;

public class ThreadGroupReferenceImpl
  extends ObjectReferenceImpl
  implements ThreadGroupReference
{
  ThreadGroupReferenceImpl(VirtualMachine aVm, Oop oRef)
  {
    super(aVm, oRef);
  }
  
  protected String description()
  {
    return "ThreadGroupReference " + uniqueID();
  }
  
  public String name()
  {
    return OopUtilities.threadGroupOopGetName(ref());
  }
  
  public ThreadGroupReference parent()
  {
    return vm.threadGroupMirror((Instance)OopUtilities.threadGroupOopGetParent(ref()));
  }
  
  public void suspend()
  {
    vm.throwNotReadOnlyException("ThreadGroupReference.suspend()");
  }
  
  public void resume()
  {
    vm.throwNotReadOnlyException("ThreadGroupReference.resume()");
  }
  
  public List threads()
  {
    Oop[] myThreads = OopUtilities.threadGroupOopGetThreads(ref());
    
    ArrayList myList = new ArrayList(myThreads.length);
    for (int ii = 0; ii < myThreads.length; ii++)
    {
      JavaThread jt = OopUtilities.threadOopGetJavaThread(myThreads[ii]);
      if (jt != null)
      {
        ThreadReferenceImpl xx = vm.threadMirror(jt);
        myList.add(xx);
      }
    }
    return myList;
  }
  
  public List threadGroups()
  {
    Oop[] myGroups = OopUtilities.threadGroupOopGetGroups(ref());
    ArrayList myList = new ArrayList(myGroups.length);
    for (int ii = 0; ii < myGroups.length; ii++)
    {
      ThreadGroupReferenceImpl xx = vm.threadGroupMirror((Instance)myGroups[ii]);
      
      myList.add(xx);
    }
    return myList;
  }
  
  public String toString()
  {
    return "instance of " + referenceType().name() + "(name='" + name() + "', " + "id=" + uniqueID() + ")";
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.ThreadGroupReferenceImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.IncompatibleThreadStateException;
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.ObjectReference;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.StackFrame;
import com.sun.jdi.ThreadGroupReference;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.Value;
import com.sun.jdi.VirtualMachine;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.oops.OopUtilities;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaThreadState;
import sun.jvm.hotspot.runtime.JavaVFrame;
import sun.jvm.hotspot.runtime.MonitorInfo;
import sun.jvm.hotspot.runtime.OSThread;
import sun.jvm.hotspot.runtime.ObjectMonitor;
import sun.jvm.hotspot.utilities.Assert;

public class ThreadReferenceImpl
  extends ObjectReferenceImpl
  implements ThreadReference, JVMTIThreadState
{
  private JavaThread myJavaThread;
  private ArrayList frames;
  private List ownedMonitors;
  private List ownedMonitorsInfo;
  private ObjectReferenceImpl currentContendingMonitor;
  
  ThreadReferenceImpl(VirtualMachine aVm, JavaThread aRef)
  {
    super(aVm, (Instance)aRef.getThreadObj());
    myJavaThread = aRef;
  }
  
  ThreadReferenceImpl(VirtualMachine vm, Instance oRef)
  {
    super(vm, oRef);
    
    myJavaThread = OopUtilities.threadOopGetJavaThread(oRef);
  }
  
  JavaThread getJavaThread()
  {
    return myJavaThread;
  }
  
  protected String description()
  {
    return "ThreadReference " + uniqueID();
  }
  
  public String name()
  {
    return OopUtilities.threadOopGetName(ref());
  }
  
  public void suspend()
  {
    vm.throwNotReadOnlyException("ThreadReference.suspend()");
  }
  
  public void resume()
  {
    vm.throwNotReadOnlyException("ThreadReference.resume()");
  }
  
  public int suspendCount()
  {
    return 1;
  }
  
  public void stop(ObjectReference throwable)
    throws InvalidTypeException
  {
    vm.throwNotReadOnlyException("ThreadReference.stop()");
  }
  
  public void interrupt()
  {
    vm.throwNotReadOnlyException("ThreadReference.interrupt()");
  }
  
  private int jvmtiGetThreadState()
  {
    int state = OopUtilities.threadOopGetThreadStatus(ref());
    if (myJavaThread != null)
    {
      JavaThreadState jts = myJavaThread.getThreadState();
      if (myJavaThread.isBeingExtSuspended()) {
        state |= 0x100000;
      }
      if (jts == JavaThreadState.IN_NATIVE) {
        state |= 0x400000;
      }
      OSThread osThread = myJavaThread.getOSThread();
      if ((osThread != null) && (osThread.interrupted())) {
        state |= 0x200000;
      }
    }
    return state;
  }
  
  public int status()
  {
    int state = jvmtiGetThreadState();
    int status = -1;
    if ((state & 0x1) == 0)
    {
      if ((state & 0x2) != 0) {
        status = 0;
      } else {
        status = 5;
      }
    }
    else if ((state & 0x40) != 0) {
      status = 2;
    } else if ((state & 0x400) != 0) {
      status = 3;
    } else if ((state & 0x8) != 0) {
      status = 4;
    } else if ((state & 0x4) != 0) {
      status = 1;
    }
    return status;
  }
  
  public boolean isSuspended()
  {
    return true;
  }
  
  public boolean isAtBreakpoint()
  {
    return false;
  }
  
  public ThreadGroupReference threadGroup()
  {
    return vm.threadGroupMirror((Instance)OopUtilities.threadOopGetThreadGroup(ref()));
  }
  
  public int frameCount()
    throws IncompatibleThreadStateException
  {
    privateFrames(0, -1);
    return frames.size();
  }
  
  public List frames()
    throws IncompatibleThreadStateException
  {
    return privateFrames(0, -1);
  }
  
  public StackFrame frame(int index)
    throws IncompatibleThreadStateException
  {
    List list = privateFrames(index, 1);
    return (StackFrame)list.get(0);
  }
  
  public List frames(int start, int length)
    throws IncompatibleThreadStateException
  {
    if (length < 0) {
      throw new IndexOutOfBoundsException("length must be greater than or equal to zero");
    }
    return privateFrames(start, length);
  }
  
  private List privateFrames(int start, int length)
    throws IncompatibleThreadStateException
  {
    if (myJavaThread == null) {
      throw new IncompatibleThreadStateException();
    }
    if (frames == null)
    {
      frames = new ArrayList(10);
      JavaVFrame myvf = myJavaThread.getLastJavaVFrameDbg();
      while (myvf != null)
      {
        StackFrame myFrame = new StackFrameImpl(vm, this, myvf);
        
        frames.add(myFrame);
        myvf = myvf.javaSender();
      }
    }
    List retVal;
    List retVal;
    if (frames.size() == 0)
    {
      retVal = new ArrayList(0);
    }
    else
    {
      int toIndex = start + length;
      if (length == -1) {
        toIndex = frames.size();
      }
      retVal = frames.subList(start, toIndex);
    }
    return Collections.unmodifiableList(retVal);
  }
  
  public List ownedMonitors()
    throws IncompatibleThreadStateException
  {
    if (!vm.canGetOwnedMonitorInfo()) {
      throw new UnsupportedOperationException();
    }
    if (myJavaThread == null) {
      throw new IncompatibleThreadStateException();
    }
    if (ownedMonitors != null) {
      return ownedMonitors;
    }
    ownedMonitorsWithStackDepth();
    for (Iterator omi = ownedMonitorsInfo.iterator(); omi.hasNext();) {
      ownedMonitors.add(((MonitorInfoImpl)omi.next()).monitor());
    }
    return ownedMonitors;
  }
  
  public List ownedMonitorsAndFrames()
    throws IncompatibleThreadStateException
  {
    if (!vm.canGetMonitorFrameInfo()) {
      throw new UnsupportedOperationException("target does not support getting Monitor Frame Info");
    }
    if (myJavaThread == null) {
      throw new IncompatibleThreadStateException();
    }
    if (ownedMonitorsInfo != null) {
      return ownedMonitorsInfo;
    }
    ownedMonitorsWithStackDepth();
    return ownedMonitorsInfo;
  }
  
  private void ownedMonitorsWithStackDepth()
  {
    ownedMonitorsInfo = new ArrayList();
    List lockedObjects = new ArrayList();
    List stackDepth = new ArrayList();
    ObjectMonitor waitingMonitor = myJavaThread.getCurrentWaitingMonitor();
    ObjectMonitor pendingMonitor = myJavaThread.getCurrentPendingMonitor();
    OopHandle waitingObj = null;
    if (waitingMonitor != null) {
      waitingObj = waitingMonitor.object();
    }
    OopHandle pendingObj = null;
    if (pendingMonitor != null) {
      pendingObj = pendingMonitor.object();
    }
    JavaVFrame frame = myJavaThread.getLastJavaVFrameDbg();
    int depth = 0;
    while (frame != null)
    {
      List frameMonitors = frame.getMonitors();
      for (Iterator miItr = frameMonitors.iterator(); miItr.hasNext();)
      {
        MonitorInfo mi = (MonitorInfo)miItr.next();
        if ((!mi.eliminated()) || (!frame.isCompiledFrame()))
        {
          OopHandle obj = mi.owner();
          if ((obj != null) && 
          
            (!obj.equals(waitingObj)) && 
            
            (!obj.equals(pendingObj)))
          {
            boolean found = false;
            for (Iterator loItr = lockedObjects.iterator(); loItr.hasNext();) {
              if (obj.equals(loItr.next())) {
                found = true;
              }
            }
            if (!found)
            {
              lockedObjects.add(obj);
              stackDepth.add(new Integer(depth));
            }
          }
        }
      }
      frame = frame.javaSender();
      depth++;
    }
    ObjectHeap heap = vm.saObjectHeap();
    Iterator stk = stackDepth.iterator();
    for (Iterator loItr = lockedObjects.iterator(); loItr.hasNext();)
    {
      Oop obj = heap.newOop((OopHandle)loItr.next());
      ownedMonitorsInfo.add(new MonitorInfoImpl(vm, vm.objectMirror(obj), this, ((Integer)stk.next()).intValue()));
    }
  }
  
  public ObjectReference currentContendedMonitor()
    throws IncompatibleThreadStateException
  {
    if (!vm.canGetCurrentContendedMonitor()) {
      throw new UnsupportedOperationException();
    }
    if (myJavaThread == null) {
      throw new IncompatibleThreadStateException();
    }
    ObjectMonitor mon = myJavaThread.getCurrentWaitingMonitor();
    if (mon == null)
    {
      mon = myJavaThread.getCurrentPendingMonitor();
      if (mon != null)
      {
        OopHandle handle = mon.object();
        
        return vm.objectMirror(vm.saObjectHeap().newOop(handle));
      }
      return null;
    }
    OopHandle handle = mon.object();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(handle != null, "Object.wait() should have an object");
    }
    Oop obj = vm.saObjectHeap().newOop(handle);
    return vm.objectMirror(obj);
  }
  
  public void popFrames(StackFrame frame)
    throws IncompatibleThreadStateException
  {
    vm.throwNotReadOnlyException("ThreadReference.popFrames()");
  }
  
  public void forceEarlyReturn(Value returnValue)
    throws IncompatibleThreadStateException
  {
    vm.throwNotReadOnlyException("ThreadReference.forceEarlyReturn()");
  }
  
  public String toString()
  {
    return "instance of " + referenceType().name() + "(name='" + name() + "', " + "id=" + uniqueID() + ")";
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.ThreadReferenceImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.ReferenceType;
import com.sun.jdi.TypeComponent;
import com.sun.jdi.VirtualMachine;

public abstract class TypeComponentImpl
  extends MirrorImpl
  implements TypeComponent
{
  protected final ReferenceTypeImpl declaringType;
  protected String signature;
  
  TypeComponentImpl(VirtualMachine vm, ReferenceTypeImpl declaringType)
  {
    super(vm);
    this.declaringType = declaringType;
  }
  
  public ReferenceType declaringType()
  {
    return declaringType;
  }
  
  public String signature()
  {
    return signature;
  }
  
  public abstract String name();
  
  public abstract int modifiers();
  
  public abstract boolean isPackagePrivate();
  
  public abstract boolean isPrivate();
  
  public abstract boolean isProtected();
  
  public abstract boolean isPublic();
  
  public abstract boolean isStatic();
  
  public abstract boolean isFinal();
  
  public abstract int hashCode();
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.TypeComponentImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;

public abstract class TypeImpl
  extends MirrorImpl
  implements Type
{
  private String typeName;
  
  TypeImpl(VirtualMachine aVm)
  {
    super(aVm);
  }
  
  public abstract String signature();
  
  public String name()
  {
    if (typeName == null)
    {
      JNITypeParser parser = new JNITypeParser(signature());
      typeName = parser.typeName();
    }
    return typeName;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj != null) && ((obj instanceof Type)))
    {
      Type other = (Type)obj;
      return (signature().equals(other.signature())) && (super.equals(obj));
    }
    return false;
  }
  
  public int hashCode()
  {
    return signature().hashCode();
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.TypeImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.Type;

abstract interface ValueContainer
{
  public abstract Type type()
    throws ClassNotLoadedException;
  
  public abstract Type findType(String paramString)
    throws ClassNotLoadedException;
  
  public abstract String typeName();
  
  public abstract String signature();
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.ValueContainer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.Value;
import com.sun.jdi.VirtualMachine;

abstract class ValueImpl
  extends MirrorImpl
  implements Value
{
  ValueImpl(VirtualMachine aVm)
  {
    super(aVm);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.ValueImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import java.util.List;
import sun.jvm.hotspot.memory.SystemDictionary.ClassVisitor;
import sun.jvm.hotspot.oops.ArrayKlass;
import sun.jvm.hotspot.oops.Klass;

final class VirtualMachineImpl$1
  implements SystemDictionary.ClassVisitor
{
  private final VirtualMachineImpl this$0;
  
  VirtualMachineImpl$1(VirtualMachineImpl paramVirtualMachineImpl, List paramList) {}
  
  public void visit(Klass k)
  {
    for (Klass l = k; l != null; l = l.arrayKlassOrNull()) {
      if ((l instanceof ArrayKlass))
      {
        val$saKlasses.add(l);
      }
      else
      {
        int status = l.getClassStatus();
        if ((status & 0x2) != 0) {
          val$saKlasses.add(l);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.VirtualMachineImpl.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import sun.jvm.hotspot.oops.DefaultHeapVisitor;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Oop;

final class VirtualMachineImpl$2
  extends DefaultHeapVisitor
{
  private final VirtualMachineImpl this$0;
  
  VirtualMachineImpl$2(VirtualMachineImpl paramVirtualMachineImpl, int paramInt, Klass[] paramArrayOfKlass, long[] paramArrayOfLong) {}
  
  public boolean doObj(Oop oop)
  {
    for (int i = 0; i < val$size; i++) {
      if (val$klassArray[i].equals(oop.getKlass()))
      {
        val$retValue[i] += 1L;
        break;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.VirtualMachineImpl.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import java.util.List;
import sun.jvm.hotspot.oops.DefaultHeapVisitor;
import sun.jvm.hotspot.oops.Oop;

final class VirtualMachineImpl$3
  extends DefaultHeapVisitor
{
  private final VirtualMachineImpl this$0;
  
  VirtualMachineImpl$3(VirtualMachineImpl paramVirtualMachineImpl, List paramList) {}
  
  public boolean doObj(Oop oop)
  {
    val$objects.add(this$0.objectMirror(oop));
    return false;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.VirtualMachineImpl.3
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import java.util.List;
import sun.jvm.hotspot.oops.DefaultHeapVisitor;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Oop;

final class VirtualMachineImpl$4
  extends DefaultHeapVisitor
{
  private final VirtualMachineImpl this$0;
  
  VirtualMachineImpl$4(VirtualMachineImpl paramVirtualMachineImpl, Klass paramKlass, List paramList) {}
  
  public boolean doObj(Oop oop)
  {
    if (val$givenKls.equals(oop.getKlass())) {
      val$objects.add(this$0.objectMirror(oop));
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.VirtualMachineImpl.4
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.ReferenceType;
import java.util.List;
import sun.jvm.hotspot.oops.DefaultHeapVisitor;
import sun.jvm.hotspot.oops.Oop;

final class VirtualMachineImpl$5
  extends DefaultHeapVisitor
{
  private final VirtualMachineImpl this$0;
  
  VirtualMachineImpl$5(VirtualMachineImpl paramVirtualMachineImpl, ReferenceType paramReferenceType, List paramList) {}
  
  public boolean doObj(Oop oop)
  {
    ReferenceTypeImpl curType = this$0.referenceType(oop.getKlass());
    if (curType.isAssignableTo(val$givenType)) {
      val$objects.add(this$0.objectMirror(oop));
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.VirtualMachineImpl.5
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;

class VirtualMachineImpl$SoftObjectReference
  extends SoftReference
{
  int count;
  Object key;
  
  VirtualMachineImpl$SoftObjectReference(Object key, ObjectReferenceImpl mirror, ReferenceQueue queue)
  {
    super(mirror, queue);
    count = 1;
    this.key = key;
  }
  
  int count()
  {
    return count;
  }
  
  void incrementCount()
  {
    count += 1;
  }
  
  Object key()
  {
    return key;
  }
  
  ObjectReferenceImpl object()
  {
    return (ObjectReferenceImpl)get();
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.jdi.VirtualMachineImpl.SoftObjectReference
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.jdi;

import com.sun.jdi.BooleanType;
import com.sun.jdi.BooleanValue;
import com.sun.jdi.ByteType;
import com.sun.jdi.ByteValue;
import com.sun.jdi.CharType;
import com.sun.jdi.CharValue;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.DoubleType;
import com.sun.jdi.DoubleValue;
import com.sun.jdi.FloatType;
import com.sun.jdi.FloatValue;
import com.sun.jdi.IntegerType;
import com.sun.jdi.IntegerValue;
import com.sun.jdi.InterfaceType;
import com.sun.jdi.LongType;
import com.sun.jdi.LongValue;
import com.sun.jdi.PathSearchingVirtualMachine;
import com.sun.jdi.PrimitiveType;
import com.sun.jdi.ReferenceType;
import com.sun.jdi.ShortType;
import com.sun.jdi.ShortValue;
import com.sun.jdi.StringReference;
import com.sun.jdi.ThreadGroupReference;
import com.sun.jdi.Type;
import com.sun.jdi.VirtualMachine;
import com.sun.jdi.VirtualMachineManager;
import com.sun.jdi.VoidType;
import com.sun.jdi.VoidValue;
import com.sun.jdi.event.EventQueue;
import com.sun.jdi.request.EventRequestManager;
import com.sun.tools.jdi.VirtualMachineManagerImpl;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Observer;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
import sun.jvm.hotspot.HotSpotAgent;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.memory.SymbolTable;
import sun.jvm.hotspot.memory.SystemDictionary;
import sun.jvm.hotspot.memory.SystemDictionary.ClassVisitor;
import sun.jvm.hotspot.memory.Universe;
import sun.jvm.hotspot.oops.AccessFlags;
import sun.jvm.hotspot.oops.Array;
import sun.jvm.hotspot.oops.ArrayKlass;
import sun.jvm.hotspot.oops.DefaultHeapVisitor;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.InstanceKlass;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.ObjArray;
import sun.jvm.hotspot.oops.ObjArrayKlass;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.oops.Symbol;
import sun.jvm.hotspot.oops.TypeArray;
import sun.jvm.hotspot.oops.TypeArrayKlass;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.Threads;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.utilities.Assert;

public class VirtualMachineImpl
  extends MirrorImpl
  implements PathSearchingVirtualMachine
{
  private HotSpotAgent saAgent = new HotSpotAgent();
  private VM saVM;
  private Universe saUniverse;
  private SystemDictionary saSystemDictionary;
  private SymbolTable saSymbolTable;
  private ObjectHeap saObjectHeap;
  VirtualMachineManager vmmgr;
  private final ThreadGroup threadGroupForJDI;
  private BooleanType theBooleanType;
  private ByteType theByteType;
  private CharType theCharType;
  private ShortType theShortType;
  private IntegerType theIntegerType;
  private LongType theLongType;
  private FloatType theFloatType;
  private DoubleType theDoubleType;
  private VoidType theVoidType;
  private VoidValue voidVal;
  private Map typesByID;
  private List typesBySi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd