sa-jdi

d Name:     sun.jvm.hotspot.bugspot.tree.ObjectTreeNodeAdapter.Counter
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.bugspot.tree;

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.cdbg.DefaultObjectVisitor;
import sun.jvm.hotspot.debugger.cdbg.FieldIdentifier;
import sun.jvm.hotspot.ui.tree.SimpleTreeNode;

class ObjectTreeNodeAdapter$Fetcher
  extends DefaultObjectVisitor
{
  private int index;
  private int curField;
  private SimpleTreeNode child;
  private final ObjectTreeNodeAdapter this$0;
  
  public ObjectTreeNodeAdapter$Fetcher(ObjectTreeNodeAdapter paramObjectTreeNodeAdapter, int index)
  {
    this.index = index;
  }
  
  public SimpleTreeNode getChild()
  {
    return child;
  }
  
  public void doBit(FieldIdentifier f, long val)
  {
    if (curField == index) {
      child = new LongTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doInt(FieldIdentifier f, long val)
  {
    if (curField == index) {
      child = new LongTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doEnum(FieldIdentifier f, long val, String enumName)
  {
    if (curField == index) {
      child = new EnumTreeNodeAdapter(enumName, val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doFloat(FieldIdentifier f, float val)
  {
    if (curField == index) {
      child = new FloatTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doDouble(FieldIdentifier f, double val)
  {
    if (curField == index) {
      child = new DoubleTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doPointer(FieldIdentifier f, Address val)
  {
    if (curField == index) {
      child = new AddressTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doArray(FieldIdentifier f, Address val)
  {
    if (curField == index) {
      child = new AddressTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doRef(FieldIdentifier f, Address val)
  {
    if (curField == index) {
      child = new AddressTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
  
  public void doCompound(FieldIdentifier f, Address val)
  {
    if (curField == index) {
      child = new ObjectTreeNodeAdapter(val, f, this$0.getTreeTableMode());
    }
    curField += 1;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.bugspot.tree.ObjectTreeNodeAdapter.Fetcher
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.bugspot.tree;

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.cdbg.DefaultObjectVisitor;
import sun.jvm.hotspot.debugger.cdbg.FieldIdentifier;

class ObjectTreeNodeAdapter$Finder
  extends DefaultObjectVisitor
{
  private FieldIdentifier id;
  private int curField;
  private int index = -1;
  
  public ObjectTreeNodeAdapter$Finder(FieldIdentifier id)
  {
    this.id = id;
  }
  
  public int getIndex()
  {
    return index;
  }
  
  public void doBit(FieldIdentifier f, long val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doInt(FieldIdentifier f, long val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doEnum(FieldIdentifier f, long val, String enumName)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doFloat(FieldIdentifier f, float val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doDouble(FieldIdentifier f, double val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doPointer(FieldIdentifier f, Address val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doArray(FieldIdentifier f, Address val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doRef(FieldIdentifier f, Address val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
  
  public void doCompound(FieldIdentifier f, Address val)
  {
    if (f.equals(id)) {
      index = curField;
    }
    curField += 1;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.bugspot.tree.ObjectTreeNodeAdapter.Finder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.bugspot.tree;

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.cdbg.DefaultObjectVisitor;
import sun.jvm.hotspot.debugger.cdbg.FieldIdentifier;
import sun.jvm.hotspot.debugger.cdbg.Type;
import sun.jvm.hotspot.ui.tree.SimpleTreeNode;

public class ObjectTreeNodeAdapter
  extends FieldTreeNodeAdapter
{
  private Address addr;
  
  public ObjectTreeNodeAdapter(Address addr, FieldIdentifier id)
  {
    this(addr, id, false);
  }
  
  public ObjectTreeNodeAdapter(Address addr, FieldIdentifier id, boolean treeTableMode)
  {
    super(id, treeTableMode);
    this.addr = addr;
  }
  
  public int getChildCount()
  {
    if (addr == null) {
      return 0;
    }
    Counter c = new Counter();
    getType().iterateObject(addr, c);
    return c.getNumFields();
  }
  
  public SimpleTreeNode getChild(int index)
  {
    if (addr == null) {
      return null;
    }
    Fetcher f = new Fetcher(index);
    getType().iterateObject(addr, f);
    return f.getChild();
  }
  
  public boolean isLeaf()
  {
    return addr == null;
  }
  
  public int getIndexOfChild(SimpleTreeNode child)
  {
    FieldIdentifier id = ((FieldTreeNodeAdapter)child).getID();
    Finder f = new Finder(id);
    getType().iterateObject(addr, f);
    return f.getIndex();
  }
  
  public String getValue()
  {
    if (addr != null) {
      return addr.toString();
    }
    return "NULL";
  }
  
  static class Counter
    extends DefaultObjectVisitor
  {
    private int numFields;
    
    public int getNumFields()
    {
      return numFields;
    }
    
    public void doBit(FieldIdentifier f, long val)
    {
      numFields += 1;
    }
    
    public void doInt(FieldIdentifier f, long val)
    {
      numFields += 1;
    }
    
    public void doEnum(FieldIdentifier f, long val, String enumName)
    {
      numFields += 1;
    }
    
    public void doFloat(FieldIdentifier f, float val)
    {
      numFields += 1;
    }
    
    public void doDouble(FieldIdentifier f, double val)
    {
      numFields += 1;
    }
    
    public void doPointer(FieldIdentifier f, Address val)
    {
      numFields += 1;
    }
    
    public void doArray(FieldIdentifier f, Address val)
    {
      numFields += 1;
    }
    
    public void doRef(FieldIdentifier f, Address val)
    {
      numFields += 1;
    }
    
    public void doCompound(FieldIdentifier f, Address addr)
    {
      numFields += 1;
    }
  }
  
  class Fetcher
    extends DefaultObjectVisitor
  {
    private int index;
    private int curField;
    private SimpleTreeNode child;
    
    public Fetcher(int index)
    {
      this.index = index;
    }
    
    public SimpleTreeNode getChild()
    {
      return child;
    }
    
    public void doBit(FieldIdentifier f, long val)
    {
      if (curField == index) {
        child = new LongTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doInt(FieldIdentifier f, long val)
    {
      if (curField == index) {
        child = new LongTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doEnum(FieldIdentifier f, long val, String enumName)
    {
      if (curField == index) {
        child = new EnumTreeNodeAdapter(enumName, val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doFloat(FieldIdentifier f, float val)
    {
      if (curField == index) {
        child = new FloatTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doDouble(FieldIdentifier f, double val)
    {
      if (curField == index) {
        child = new DoubleTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doPointer(FieldIdentifier f, Address val)
    {
      if (curField == index) {
        child = new AddressTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doArray(FieldIdentifier f, Address val)
    {
      if (curField == index) {
        child = new AddressTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doRef(FieldIdentifier f, Address val)
    {
      if (curField == index) {
        child = new AddressTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
    
    public void doCompound(FieldIdentifier f, Address val)
    {
      if (curField == index) {
        child = new ObjectTreeNodeAdapter(val, f, getTreeTableMode());
      }
      curField += 1;
    }
  }
  
  static class Finder
    extends DefaultObjectVisitor
  {
    private FieldIdentifier id;
    private int curField;
    private int index = -1;
    
    public Finder(FieldIdentifier id)
    {
      this.id = id;
    }
    
    public int getIndex()
    {
      return index;
    }
    
    public void doBit(FieldIdentifier f, long val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doInt(FieldIdentifier f, long val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doEnum(FieldIdentifier f, long val, String enumName)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doFloat(FieldIdentifier f, float val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doDouble(FieldIdentifier f, double val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doPointer(FieldIdentifier f, Address val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doArray(FieldIdentifier f, Address val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doRef(FieldIdentifier f, Address val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
    
    public void doCompound(FieldIdentifier f, Address val)
    {
      if (f.equals(id)) {
        index = curField;
      }
      curField += 1;
    }
  }
}

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

import sun.jvm.hotspot.oops.FieldIdentifier;
import sun.jvm.hotspot.ui.tree.FieldTreeNodeAdapter;
import sun.jvm.hotspot.ui.tree.SimpleTreeNode;

final class VariablePanel$1
  extends FieldTreeNodeAdapter
{
  private final VariablePanel this$0;
  
  VariablePanel$1(VariablePanel paramVariablePanel, FieldIdentifier x0, boolean x1)
  {
    super(x0, x1);
  }
  
  public int getChildCount()
  {
    return 0;
  }
  
  public SimpleTreeNode getChild(int i)
  {
    return null;
  }
  
  public boolean isLeaf()
  {
    return false;
  }
  
  public int getIndexOfChild(SimpleTreeNode child)
  {
    return 0;
  }
  
  public String getValue()
  {
    return "<Bad oop>";
  }
}

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

import java.util.ArrayList;
import java.util.List;
import sun.jvm.hotspot.bugspot.tree.AddressTreeNodeAdapter;
import sun.jvm.hotspot.bugspot.tree.DoubleTreeNodeAdapter;
import sun.jvm.hotspot.bugspot.tree.EnumTreeNodeAdapter;
import sun.jvm.hotspot.bugspot.tree.FloatTreeNodeAdapter;
import sun.jvm.hotspot.bugspot.tree.LongTreeNodeAdapter;
import sun.jvm.hotspot.bugspot.tree.ObjectTreeNodeAdapter;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.cdbg.DefaultObjectVisitor;
import sun.jvm.hotspot.debugger.cdbg.FieldIdentifier;
import sun.jvm.hotspot.ui.tree.SimpleTreeNode;

class VariablePanel$CCollector
  extends DefaultObjectVisitor
{
  private List children;
  
  public VariablePanel$CCollector()
  {
    children = new ArrayList();
  }
  
  public int getNumChildren()
  {
    return children.size();
  }
  
  public SimpleTreeNode getChild(int i)
  {
    return (SimpleTreeNode)children.get(i);
  }
  
  public void doBit(FieldIdentifier f, long val)
  {
    children.add(new LongTreeNodeAdapter(val, f, true));
  }
  
  public void doInt(FieldIdentifier f, long val)
  {
    children.add(new LongTreeNodeAdapter(val, f, true));
  }
  
  public void doEnum(FieldIdentifier f, long val, String enumName)
  {
    children.add(new EnumTreeNodeAdapter(enumName, val, f, true));
  }
  
  public void doFloat(FieldIdentifier f, float val)
  {
    children.add(new FloatTreeNodeAdapter(val, f, true));
  }
  
  public void doDouble(FieldIdentifier f, double val)
  {
    children.add(new DoubleTreeNodeAdapter(val, f, true));
  }
  
  public void doPointer(FieldIdentifier f, Address val)
  {
    children.add(new AddressTreeNodeAdapter(val, f, true));
  }
  
  public void doArray(FieldIdentifier f, Address val)
  {
    children.add(new AddressTreeNodeAdapter(val, f, true));
  }
  
  public void doRef(FieldIdentifier f, Address val)
  {
    children.add(new AddressTreeNodeAdapter(val, f, true));
  }
  
  public void doCompound(FieldIdentifier f, Address val)
  {
    children.add(new ObjectTreeNodeAdapter(val, f, true));
  }
}

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

import java.awt.BorderLayout;
import java.awt.Color;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.table.JTableHeader;
import sun.jvm.hotspot.bugspot.tree.AddressTreeNodeAdapter;
import sun.jvm.hotspot.bugspot.tree.EnumTreeNodeAdapter;
import sun.jvm.hotspot.bugspot.tree.ObjectTreeNodeAdapter;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.AddressException;
import sun.jvm.hotspot.debugger.cdbg.CFrame;
import sun.jvm.hotspot.debugger.cdbg.DefaultObjectVisitor;
import sun.jvm.hotspot.debugger.cdbg.Type;
import sun.jvm.hotspot.oops.ConstantPool;
import sun.jvm.hotspot.oops.LocalVariableTableElement;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.oops.NamedFieldIdentifier;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.oops.Symbol;
import sun.jvm.hotspot.runtime.JavaVFrame;
import sun.jvm.hotspot.runtime.StackValueCollection;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.ui.tree.BooleanTreeNodeAdapter;
import sun.jvm.hotspot.ui.tree.CharTreeNodeAdapter;
import sun.jvm.hotspot.ui.tree.FieldTreeNodeAdapter;
import sun.jvm.hotspot.ui.tree.OopTreeNodeAdapter;
import sun.jvm.hotspot.ui.tree.SimpleTreeGroupNode;
import sun.jvm.hotspot.ui.tree.SimpleTreeNode;
import sun.jvm.hotspot.ui.treetable.JTreeTable;
import sun.jvm.hotspot.ui.treetable.SimpleTreeTableModel;

public class VariablePanel
  extends JPanel
{
  private JTreeTable treeTable;
  private SimpleTreeTableModel model;
  private SimpleTreeGroupNode root;
  
  public VariablePanel()
  {
    model = new SimpleTreeTableModel();
    model.setValuesEditable(false);
    root = new SimpleTreeGroupNode();
    model.setRoot(root);
    treeTable = new JTreeTable(model);
    treeTable.setRootVisible(false);
    treeTable.setShowsRootHandles(true);
    treeTable.setShowsIcons(false);
    treeTable.setTreeEditable(false);
    treeTable.getTableHeader().setReorderingAllowed(false);
    treeTable.setCellSelectionEnabled(true);
    treeTable.setSelectionMode(1);
    treeTable.setDragEnabled(true);
    JScrollPane sp = new JScrollPane(treeTable);
    sp.getViewport().setBackground(Color.white);
    
    setLayout(new BorderLayout());
    add(sp, "Center");
  }
  
  public void clear()
  {
    root.removeAllChildren();
    model.fireTreeStructureChanged();
  }
  
  public void update(CFrame fr)
  {
    CCollector coll = new CCollector();
    fr.iterateLocals(coll);
    update(coll);
  }
  
  public void update(JavaVFrame jfr)
  {
    Method m = jfr.getMethod();
    if (!m.hasLocalVariableTable()) {
      return;
    }
    int bci = jfr.getBCI();
    
    LocalVariableTableElement[] locals = m.getLocalVariableTable();
    
    StackValueCollection coll = jfr.getLocals();
    root.removeAllChildren();
    for (int i = 0; i < locals.length; i++)
    {
      LocalVariableTableElement local = locals[i];
      if ((local.getStartBCI() <= bci) && (bci < local.getStartBCI() + local.getLength()))
      {
        SimpleTreeNode node = null;
        Symbol name = null;
        try
        {
          name = m.getConstants().getSymbolAt(local.getNameCPIndex());
          if (name == null)
          {
            System.err.println("Null name at slot " + local.getNameCPIndex() + " for local variable at slot " + local.getSlot());
            
            continue;
          }
        }
        catch (Exception e)
        {
          System.err.println("Unable to fetch name at slot " + local.getNameCPIndex() + " for local variable at slot " + local.getSlot());
          
          e.printStackTrace();
          continue;
        }
        NamedFieldIdentifier f = new NamedFieldIdentifier(name.asString());
        
        Symbol descriptor = null;
        try
        {
          descriptor = m.getConstants().getSymbolAt(local.getDescriptorCPIndex());
        }
        catch (Exception e)
        {
          System.err.println("Unable to fetch descriptor at slot " + local.getDescriptorCPIndex() + " for local variable " + f.getName() + " at slot " + local.getSlot());
          
          e.printStackTrace();
          continue;
        }
        if (descriptor != null)
        {
          switch (descriptor.getByteAt(0L))
          {
          case 70: 
            node = new sun.jvm.hotspot.ui.tree.FloatTreeNodeAdapter(coll.floatAt(local.getSlot()), f, true);
            break;
          case 68: 
            node = new sun.jvm.hotspot.ui.tree.DoubleTreeNodeAdapter(coll.doubleAt(local.getSlot()), f, true);
            break;
          case 67: 
            node = new CharTreeNodeAdapter((char)coll.intAt(local.getSlot()), f, true);
            break;
          case 66: 
          case 73: 
          case 83: 
            node = new sun.jvm.hotspot.ui.tree.LongTreeNodeAdapter(coll.intAt(local.getSlot()), f, true);
            break;
          case 90: 
            node = new BooleanTreeNodeAdapter(coll.intAt(local.getSlot()) != 0, f, true);
            
            break;
          case 74: 
            node = new sun.jvm.hotspot.ui.tree.LongTreeNodeAdapter(coll.longAt(local.getSlot()), f, true);
            break;
          case 69: 
          case 71: 
          case 72: 
          case 75: 
          case 76: 
          case 77: 
          case 78: 
          case 79: 
          case 80: 
          case 81: 
          case 82: 
          case 84: 
          case 85: 
          case 86: 
          case 87: 
          case 88: 
          case 89: 
          default: 
            try
            {
              node = new OopTreeNodeAdapter(VM.getVM().getObjectHeap().newOop(coll.oopHandleAt(local.getSlot())), f, true);
            }
            catch (AddressException e)
            {
              node = new FieldTreeNodeAdapter(f, true)
              {
                public int getChildCount()
                {
                  return 0;
                }
                
                public SimpleTreeNode getChild(int i)
                {
                  return null;
                }
                
                public boolean isLeaf()
                {
                  return false;
                }
                
                public int getIndexOfChild(SimpleTreeNode child)
                {
                  return 0;
                }
                
                public String getValue()
                {
                  return "<Bad oop>";
                }
              };
            }
          }
          if (node != null) {
            root.addChild(node);
          }
        }
      }
    }
    model.fireTreeStructureChanged();
  }
  
  public void update(Address thisAddr, Type type)
  {
    CCollector coll = new CCollector();
    type.iterateObject(thisAddr, coll);
    update(coll);
  }
  
  private void update(CCollector coll)
  {
    root.removeAllChildren();
    for (int i = 0; i < coll.getNumChildren(); i++) {
      root.addChild(coll.getChild(i));
    }
    model.fireTreeStructureChanged();
  }
  
  static class CCollector
    extends DefaultObjectVisitor
  {
    private List children;
    
    public CCollector()
    {
      children = new ArrayList();
    }
    
    public int getNumChildren()
    {
      return children.size();
    }
    
    public SimpleTreeNode getChild(int i)
    {
      return (SimpleTreeNode)children.get(i);
    }
    
    public void doBit(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, long val)
    {
      children.add(new sun.jvm.hotspot.bugspot.tree.LongTreeNodeAdapter(val, f, true));
    }
    
    public void doInt(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, long val)
    {
      children.add(new sun.jvm.hotspot.bugspot.tree.LongTreeNodeAdapter(val, f, true));
    }
    
    public void doEnum(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, long val, String enumName)
    {
      children.add(new EnumTreeNodeAdapter(enumName, val, f, true));
    }
    
    public void doFloat(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, float val)
    {
      children.add(new sun.jvm.hotspot.bugspot.tree.FloatTreeNodeAdapter(val, f, true));
    }
    
    public void doDouble(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, double val)
    {
      children.add(new sun.jvm.hotspot.bugspot.tree.DoubleTreeNodeAdapter(val, f, true));
    }
    
    public void doPointer(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val)
    {
      children.add(new AddressTreeNodeAdapter(val, f, true));
    }
    
    public void doArray(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val)
    {
      children.add(new AddressTreeNodeAdapter(val, f, true));
    }
    
    public void doRef(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val)
    {
      children.add(new AddressTreeNodeAdapter(val, f, true));
    }
    
    public void doCompound(sun.jvm.hotspot.debugger.cdbg.FieldIdentifier f, Address val)
    {
      children.add(new ObjectTreeNodeAdapter(val, f, true));
    }
  }
}

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class Runtime1$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    Runtime1.access$000(VM.getVM().getTypeDataBase());
  }
}

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.code.CodeBlob;
import sun.jvm.hotspot.code.CodeCache;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Field;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class Runtime1
{
  private static Field blobsField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Runtime1.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("Runtime1");
    
    blobsField = type.getField("_blobs");
  }
  
  public Address entryFor(int id)
  {
    return blobFor(id).codeBegin();
  }
  
  public CodeBlob blobFor(int id)
  {
    Address blobAddr = blobsField.getStaticFieldAddress().getAddressAt(id * VM.getVM().getAddressSize());
    return VM.getVM().getCodeCache().createCodeBlobWrapper(blobAddr);
  }
}

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

final class CLHSDB$1
  extends Thread
{
  private final CLHSDB this$0;
  
  CLHSDB$1(CLHSDB paramCLHSDB) {}
  
  public void run()
  {
    CLHSDB.access$000(this$0);
  }
}

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

final class CLHSDB$2
  extends CommandProcessor.DebuggerInterface
{
  private final CLHSDB this$0;
  
  CLHSDB$2(CLHSDB paramCLHSDB) {}
  
  public HotSpotAgent getAgent()
  {
    return CLHSDB.access$100(this$0);
  }
  
  public boolean isAttached()
  {
    return CLHSDB.access$200(this$0);
  }
  
  public void attach(String pid)
  {
    CLHSDB.access$300(this$0, pid);
  }
  
  public void attach(String java, String core)
  {
    CLHSDB.access$400(this$0, java, core);
  }
  
  public void detach()
  {
    CLHSDB.access$000(this$0);
  }
  
  public void reattach()
  {
    if (CLHSDB.access$200(this$0)) {
      CLHSDB.access$000(this$0);
    }
    if (CLHSDB.access$500(this$0) != null) {
      attach(CLHSDB.access$500(this$0));
    } else {
      attach(CLHSDB.access$600(this$0), CLHSDB.access$700(this$0));
    }
  }
}

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

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;
import sun.jvm.hotspot.debugger.DebuggerException;

public class CLHSDB
{
  private HotSpotAgent agent;
  private boolean attached;
  private String pidText;
  private int pid;
  private String execPath;
  private String coreFilename;
  
  public static void main(String[] args)
  {
    new CLHSDB(args).run();
  }
  
  private void run()
  {
    agent = new HotSpotAgent();
    
    Runtime.getRuntime().addShutdownHook(new Thread()
    {
      public void run()
      {
        CLHSDB.this.detachDebugger();
      }
    });
    if (pidText != null) {
      attachDebugger(pidText);
    } else if (execPath != null) {
      attachDebugger(execPath, coreFilename);
    }
    CommandProcessor.DebuggerInterface di = new CommandProcessor.DebuggerInterface()
    {
      public HotSpotAgent getAgent()
      {
        return agent;
      }
      
      public boolean isAttached()
      {
        return attached;
      }
      
      public void attach(String pid)
      {
        CLHSDB.this.attachDebugger(pid);
      }
      
      public void attach(String java, String core)
      {
        CLHSDB.this.attachDebugger(java, core);
      }
      
      public void detach()
      {
        CLHSDB.this.detachDebugger();
      }
      
      public void reattach()
      {
        if (attached) {
          CLHSDB.this.detachDebugger();
        }
        if (pidText != null) {
          attach(pidText);
        } else {
          attach(execPath, coreFilename);
        }
      }
    };
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    
    CommandProcessor cp = new CommandProcessor(di, in, System.out, System.err);
    cp.run(true);
  }
  
  private void doUsage()
  {
    System.out.println("Usage:  java CLHSDB [[pid] | [path-to-java-executable [path-to-corefile]] | help ]");
    System.out.println("           pid:                     attach to the process whose id is 'pid'");
    System.out.println("           path-to-java-executable: Debug a core file produced by this program");
    System.out.println("           path-to-corefile:        Debug this corefile.  The default is 'core'");
    System.out.println("        If no arguments are specified, you can select what to do from the GUI.\n");
    HotSpotAgent.showUsage();
  }
  
  private CLHSDB(String[] args)
  {
    switch (args.length)
    {
    case 0: 
      break;
    case 1: 
      if ((args[0].equals("help")) || (args[0].equals("-help")))
      {
        doUsage();
        System.exit(0);
      }
      try
      {
        int unused = Integer.parseInt(args[0]);
        
        pidText = args[0];
      }
      catch (NumberFormatException e)
      {
        execPath = args[0];
        coreFilename = "core";
      }
    case 2: 
      execPath = args[0];
      coreFilename = args[1];
      break;
    default: 
      System.out.println("HSDB Error: Too many options specified");
      doUsage();
      System.exit(1);
    }
  }
  
  private void attachDebugger(String pidText)
  {
    try
    {
      this.pidText = pidText;
      pid = Integer.parseInt(pidText);
    }
    catch (NumberFormatException e)
    {
      System.err.print("Unable to parse process ID \"" + pidText + "\".\nPlease enter a number.");
    }
    try
    {
      System.err.println("Attaching to process " + pid + ", please wait...");
      
      agent.attach(pid);
      attached = true;
    }
    catch (DebuggerException e)
    {
      String errMsg = formatMessage(e.getMessage(), 80);
      System.err.println("Unable to connect to process ID " + pid + ":\n\n" + errMsg);
      agent.detach();
      return;
    }
  }
  
  private void attachDebugger(String executablePath, String corePath)
  {
    try
    {
      System.err.println("Opening core file, please wait...");
      
      agent.attach(executablePath, corePath);
      attached = true;
    }
    catch (DebuggerException e)
    {
      String errMsg = formatMessage(e.getMessage(), 80);
      System.err.println("Unable to open core file\n" + corePath + ":\n\n" + errMsg);
      agent.detach();
      return;
    }
  }
  
  private void connect(String remoteMachineName)
  {
    try
    {
      System.err.println("Connecting to debug server, please wait...");
      agent.attach(remoteMachineName);
      attached = true;
    }
    catch (DebuggerException e)
    {
      String errMsg = formatMessage(e.getMessage(), 80);
      System.err.println("Unable to connect to machine \"" + remoteMachineName + "\":\n\n" + errMsg);
      agent.detach();
      return;
    }
  }
  
  private void detachDebugger()
  {
    if (!attached) {
      return;
    }
    agent.detach();
    attached = false;
  }
  
  private void detach()
  {
    detachDebugger();
  }
  
  private String formatMessage(String message, int charsPerLine)
  {
    StringBuffer buf = new StringBuffer(message.length());
    StringTokenizer tokenizer = new StringTokenizer(message);
    int curLineLength = 0;
    while (tokenizer.hasMoreTokens())
    {
      String tok = tokenizer.nextToken();
      if (curLineLength + tok.length() > charsPerLine)
      {
        buf.append('\n');
        curLineLength = 0;
      }
      else if (curLineLength != 0)
      {
        buf.append(' ');
        curLineLength++;
      }
      buf.append(tok);
      curLineLength += tok.length();
    }
    return buf.toString();
  }
}

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class BufferBlob$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    BufferBlob.access$000(VM.getVM().getTypeDataBase());
  }
}

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class BufferBlob
  extends CodeBlob
{
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        BufferBlob.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("BufferBlob");
  }
  
  public BufferBlob(Address addr)
  {
    super(addr);
  }
  
  public boolean isBufferBlob()
  {
    return true;
  }
}

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

import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.runtime.VM;

final class CodeBlob$1
  implements Observer
{
  public void update(Observable o, Object data)
  {
    CodeBlob.access$000(VM.getVM().getTypeDataBase());
  }
}

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.compiler.OopMap;
import sun.jvm.hotspot.compiler.OopMapSet;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObject;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.Assert;
import sun.jvm.hotspot.utilities.CStringUtilities;

public class CodeBlob
  extends VMObject
{
  private static AddressField nameField;
  private static CIntegerField sizeField;
  private static CIntegerField headerSizeField;
  private static CIntegerField relocationSizeField;
  private static CIntegerField contentOffsetField;
  private static CIntegerField codeOffsetField;
  private static CIntegerField frameCompleteOffsetField;
  private static CIntegerField dataOffsetField;
  private static CIntegerField frameSizeField;
  private static AddressField oopMapsField;
  private static final int NOT_YET_COMPUTED = -2;
  private static final int UNDEFINED = -1;
  private int linkOffset = -2;
  private static int matcherInterpreterFramePointerReg;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        CodeBlob.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("CodeBlob");
    
    nameField = type.getAddressField("_name");
    sizeField = type.getCIntegerField("_size");
    headerSizeField = type.getCIntegerField("_header_size");
    relocationSizeField = type.getCIntegerField("_relocation_size");
    frameCompleteOffsetField = type.getCIntegerField("_frame_complete_offset");
    contentOffsetField = type.getCIntegerField("_content_offset");
    codeOffsetField = type.getCIntegerField("_code_offset");
    dataOffsetField = type.getCIntegerField("_data_offset");
    frameSizeField = type.getCIntegerField("_frame_size");
    oopMapsField = type.getAddressField("_oop_maps");
    if (VM.getVM().isServerCompiler()) {
      matcherInterpreterFramePointerReg = db.lookupIntConstant("Matcher::interpreter_frame_pointer_reg").intValue();
    }
  }
  
  public CodeBlob(Address addr)
  {
    super(addr);
  }
  
  public boolean isBufferBlob()
  {
    return false;
  }
  
  public boolean isNMethod()
  {
    return false;
  }
  
  public boolean isRuntimeStub()
  {
    return false;
  }
  
  public boolean isDeoptimizationStub()
  {
    return false;
  }
  
  public boolean isUncommonTrapStub()
  {
    return false;
  }
  
  public boolean isExceptionStub()
  {
    return false;
  }
  
  public boolean isSafepointStub()
  {
    return false;
  }
  
  public boolean isJavaMethod()
  {
    return false;
  }
  
  public boolean isNativeMethod()
  {
    return false;
  }
  
  public boolean isOSRMethod()
  {
    return false;
  }
  
  public Address headerBegin()
  {
    return addr;
  }
  
  public Address headerEnd()
  {
    return addr.addOffsetTo(headerSizeField.getValue(addr));
  }
  
  public Address contentBegin()
  {
    return headerBegin().addOffsetTo(contentOffsetField.getValue(addr));
  }
  
  public Address contentEnd()
  {
    return headerBegin().addOffsetTo(dataOffsetField.getValue(addr));
  }
  
  public Address codeBegin()
  {
    return headerBegin().addOffsetTo(contentOffsetField.getValue(addr));
  }
  
  public Address codeEnd()
  {
    return headerBegin().addOffsetTo(dataOffsetField.getValue(addr));
  }
  
  public Address dataBegin()
  {
    return headerBegin().addOffsetTo(dataOffsetField.getValue(addr));
  }
  
  public Address dataEnd()
  {
    return headerBegin().addOffsetTo(sizeField.getValue(addr));
  }
  
  public int getRelocationOffset()
  {
    return (int)headerSizeField.getValue(addr);
  }
  
  public int getContentOffset()
  {
    return (int)contentOffsetField.getValue(addr);
  }
  
  public int getCodeOffset()
  {
    return (int)codeOffsetField.getValue(addr);
  }
  
  public int getDataOffset()
  {
    return (int)dataOffsetField.getValue(addr);
  }
  
  public int getSize()
  {
    return (int)sizeField.getValue(addr);
  }
  
  public int getHeaderSize()
  {
    return (int)headerSizeField.getValue(addr);
  }
  
  public int getContentSize()
  {
    return (int)contentEnd().minus(contentBegin());
  }
  
  public int getCodeSize()
  {
    return (int)codeEnd().minus(codeBegin());
  }
  
  public int getDataSize()
  {
    return (int)dataEnd().minus(dataBegin());
  }
  
  public boolean blobContains(Address addr)
  {
    return (headerBegin().lessThanOrEqual(addr)) && (dataEnd().greaterThan(addr));
  }
  
  public boolean contentContains(Address addr)
  {
    return (contentBegin().lessThanOrEqual(addr)) && (contentEnd().greaterThan(addr));
  }
  
  public boolean codeContains(Address addr)
  {
    return (codeBegin().lessThanOrEqual(addr)) && (codeEnd().greaterThan(addr));
  }
  
  public boolean dataContains(Address addr)
  {
    return (dataBegin().lessThanOrEqual(addr)) && (dataEnd().greaterThan(addr));
  }
  
  public boolean contains(Address addr)
  {
    return contentContains(addr);
  }
  
  public boolean isFrameCompleteAt(Address a)
  {
    return (codeContains(a)) && (a.minus(codeBegin()) >= frameCompleteOffsetField.getValue(addr));
  }
  
  public boolean isZombie()
  {
    return false;
  }
  
  public boolean isLockedByVM()
  {
    return false;
  }
  
  public OopMapSet getOopMaps()
  {
    Address oopMapsAddr = oopMapsField.getValue(addr);
    if (oopMapsAddr == null) {
      return null;
    }
    return new OopMapSet(oopMapsAddr);
  }
  
  public OopMap getOopMapForReturnAddress(Address returnAddress, boolean debugging)
  {
    Address pc = returnAddress;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(getOopMaps() != null, "nope");
    }
    return getOopMaps().findMapAtOffset(pc.minus(codeBegin()), debugging);
  }
  
  public long getFrameSize()
  {
    return VM.getVM().getAddressSize() * frameSizeField.getValue(addr);
  }
  
  public boolean callerMustGCArguments(JavaThread thread)
  {
    return false;
  }
  
  public String getName()
  {
    return CStringUtilities.
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