sa-jdi

$0);
        finderFrame.getContentPane().add(panel);
        HSDB.access$1600(this$0).add(finderFrame);
        GraphicsUtilities.reshapeToAspectRatio(finderFrame, 1.3333334F, 0.6F, finderFrame.getParent().getSize());
        
        GraphicsUtilities.centerInContainer(finderFrame);
        finderFrame.show();
      }
    });
  }
}

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

import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import sun.jvm.hotspot.ui.GraphicsUtilities;
import sun.jvm.hotspot.ui.ProgressBarPanel;

final class HSDB$HeapProgress$1
  implements Runnable
{
  private final HSDB.HeapProgress this$1;
  
  HSDB$HeapProgress$1(HSDB.HeapProgress paramHeapProgress) {}
  
  public void run()
  {
    HSDB.HeapProgress.access$4902(this$1, new JInternalFrame(HSDB.HeapProgress.access$5000(this$1)));
    HSDB.HeapProgress.access$4900(this$1).setResizable(true);
    HSDB.HeapProgress.access$4900(this$1).setIconifiable(true);
    HSDB.HeapProgress.access$4900(this$1).getContentPane().setLayout(new BorderLayout());
    HSDB.HeapProgress.access$5102(this$1, new ProgressBarPanel(HSDB.HeapProgress.access$5200(this$1)));
    HSDB.HeapProgress.access$4900(this$1).getContentPane().add(HSDB.HeapProgress.access$5100(this$1), "Center");
    HSDB.access$1600(HSDB.HeapProgress.access$5300(this$1)).add(HSDB.HeapProgress.access$4900(this$1));
    HSDB.HeapProgress.access$4900(this$1).pack();
    GraphicsUtilities.constrainToSize(HSDB.HeapProgress.access$4900(this$1), HSDB.HeapProgress.access$4900(this$1).getParent().getSize());
    GraphicsUtilities.centerInContainer(HSDB.HeapProgress.access$4900(this$1));
    HSDB.HeapProgress.access$4900(this$1).show();
  }
}

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

import sun.jvm.hotspot.ui.ProgressBarPanel;

final class HSDB$HeapProgress$2
  implements Runnable
{
  private final HSDB.HeapProgress this$1;
  
  HSDB$HeapProgress$2(HSDB.HeapProgress paramHeapProgress, double paramDouble) {}
  
  public void run()
  {
    HSDB.HeapProgress.access$5100(this$1).setValue(val$fractionOfHeapVisited);
  }
}

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

import javax.swing.JDesktopPane;
import javax.swing.JMenuItem;
import sun.jvm.hotspot.runtime.VM;

final class HSDB$HeapProgress$3
  implements Runnable
{
  private final HSDB.HeapProgress this$1;
  
  HSDB$HeapProgress$3(HSDB.HeapProgress paramHeapProgress) {}
  
  public void run()
  {
    HSDB.access$1600(HSDB.HeapProgress.access$5300(this$1)).remove(HSDB.HeapProgress.access$4900(this$1));
    HSDB.access$1600(HSDB.HeapProgress.access$5300(this$1)).repaint();
    if (VM.getVM().getRevPtrs() != null) {
      HSDB.access$3000(HSDB.HeapProgress.access$5300(this$1)).setEnabled(false);
    }
  }
}

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

import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JMenuItem;
import javax.swing.SwingUtilities;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.ui.GraphicsUtilities;
import sun.jvm.hotspot.ui.ProgressBarPanel;
import sun.jvm.hotspot.utilities.HeapProgressThunk;

class HSDB$HeapProgress
  implements HeapProgressThunk
{
  private JInternalFrame frame;
  private ProgressBarPanel bar;
  private String windowTitle;
  private String progressBarTitle;
  private HSDB.CleanupThunk cleanup;
  private final HSDB this$0;
  
  HSDB$HeapProgress(HSDB paramHSDB, String windowTitle)
  {
    this(paramHSDB, windowTitle, "Percentage of heap visited", null);
  }
  
  HSDB$HeapProgress(HSDB paramHSDB, String windowTitle, String progressBarTitle)
  {
    this(paramHSDB, windowTitle, progressBarTitle, null);
  }
  
  HSDB$HeapProgress(HSDB paramHSDB, String windowTitle, String progressBarTitle, HSDB.CleanupThunk cleanup)
  {
    this.windowTitle = windowTitle;
    this.progressBarTitle = progressBarTitle;
    this.cleanup = cleanup;
  }
  
  public void heapIterationFractionUpdate(final double fractionOfHeapVisited)
  {
    if (frame == null) {
      SwingUtilities.invokeLater(new Runnable()
      {
        public void run()
        {
          frame = new JInternalFrame(windowTitle);
          frame.setResizable(true);
          frame.setIconifiable(true);
          frame.getContentPane().setLayout(new BorderLayout());
          bar = new ProgressBarPanel(progressBarTitle);
          frame.getContentPane().add(bar, "Center");
          HSDB.access$1600(this$0).add(frame);
          frame.pack();
          GraphicsUtilities.constrainToSize(frame, frame.getParent().getSize());
          GraphicsUtilities.centerInContainer(frame);
          frame.show();
        }
      });
    }
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        bar.setValue(fractionOfHeapVisited);
      }
    });
  }
  
  public void heapIterationComplete()
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        HSDB.access$1600(this$0).remove(frame);
        HSDB.access$1600(this$0).repaint();
        if (VM.getVM().getRevPtrs() != null) {
          HSDB.access$3000(this$0).setEnabled(false);
        }
      }
    });
    if (cleanup != null) {
      cleanup.heapIterationComplete();
    }
  }
}

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

import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import sun.jvm.hotspot.ui.GraphicsUtilities;
import sun.jvm.hotspot.ui.ObjectHistogramPanel;

final class HSDB$ObjectHistogramCleanupThunk$1
  implements Runnable
{
  private final HSDB.ObjectHistogramCleanupThunk this$1;
  
  HSDB$ObjectHistogramCleanupThunk$1(HSDB.ObjectHistogramCleanupThunk paramObjectHistogramCleanupThunk) {}
  
  public void run()
  {
    JInternalFrame histoFrame = new JInternalFrame("Object Histogram");
    histoFrame.setResizable(true);
    histoFrame.setClosable(true);
    histoFrame.setIconifiable(true);
    histoFrame.getContentPane().setLayout(new BorderLayout());
    ObjectHistogramPanel panel = new ObjectHistogramPanel(this$1.histo);
    panel.addPanelListener(HSDB.ObjectHistogramCleanupThunk.access$4100(this$1));
    histoFrame.getContentPane().add(panel);
    HSDB.access$1600(HSDB.ObjectHistogramCleanupThunk.access$4100(this$1)).add(histoFrame);
    GraphicsUtilities.reshapeToAspectRatio(histoFrame, 1.3333334F, 0.6F, histoFrame.getParent().getSize());
    
    GraphicsUtilities.centerInContainer(histoFrame);
    histoFrame.show();
  }
}

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

import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.SwingUtilities;
import sun.jvm.hotspot.oops.ObjectHistogram;
import sun.jvm.hotspot.ui.GraphicsUtilities;
import sun.jvm.hotspot.ui.ObjectHistogramPanel;

class HSDB$ObjectHistogramCleanupThunk
  implements HSDB.CleanupThunk
{
  ObjectHistogram histo;
  private final HSDB this$0;
  
  HSDB$ObjectHistogramCleanupThunk(HSDB paramHSDB, ObjectHistogram histo)
  {
    this.histo = histo;
  }
  
  public void heapIterationComplete()
  {
    SwingUtilities.invokeLater(new Runnable()
    {
      public void run()
      {
        JInternalFrame histoFrame = new JInternalFrame("Object Histogram");
        histoFrame.setResizable(true);
        histoFrame.setClosable(true);
        histoFrame.setIconifiable(true);
        histoFrame.getContentPane().setLayout(new BorderLayout());
        ObjectHistogramPanel panel = new ObjectHistogramPanel(histo);
        panel.addPanelListener(this$0);
        histoFrame.getContentPane().add(panel);
        HSDB.access$1600(this$0).add(histoFrame);
        GraphicsUtilities.reshapeToAspectRatio(histoFrame, 1.3333334F, 0.6F, histoFrame.getParent().getSize());
        
        GraphicsUtilities.centerInContainer(histoFrame);
        histoFrame.show();
      }
    });
  }
}

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

class HSDB$SignalInfo
{
  public int sigNum;
  public String sigName;
  private final HSDB this$0;
  
  HSDB$SignalInfo(HSDB paramHSDB) {}
}

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

import sun.jvm.hotspot.runtime.JavaVFrame;
import sun.jvm.hotspot.ui.AnnotatedMemoryPanel;

abstract class HSDB$StackWalker
  implements Runnable
{
  protected JavaVFrame vf;
  protected AnnotatedMemoryPanel annoPanel;
  private final HSDB this$0;
  
  HSDB$StackWalker(HSDB paramHSDB, JavaVFrame vf, AnnotatedMemoryPanel annoPanel)
  {
    this.vf = vf;
    this.annoPanel = annoPanel;
  }
}

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

import sun.jvm.hotspot.oops.HeapVisitor;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.runtime.VM;

class HSDB$VisitHeap
  implements Runnable
{
  HeapVisitor visitor;
  private final HSDB this$0;
  
  HSDB$VisitHeap(HSDB paramHSDB, HeapVisitor visitor)
  {
    this.visitor = visitor;
  }
  
  public void run()
  {
    VM.getVM().getObjectHeap().iterate(visitor);
  }
}

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

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import java.util.StringTokenizer;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import sun.jvm.hotspot.code.CodeBlob;
import sun.jvm.hotspot.code.CodeCache;
import sun.jvm.hotspot.compiler.OopMapSet;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.AddressException;
import sun.jvm.hotspot.debugger.Debugger;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.PSOldGen;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.PSPermGen;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.PSYoungGen;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.ParallelScavengeHeap;
import sun.jvm.hotspot.gc_interface.CollectedHeap;
import sun.jvm.hotspot.interpreter.Interpreter;
import sun.jvm.hotspot.interpreter.InterpreterCodelet;
import sun.jvm.hotspot.memory.GenCollectedHeap;
import sun.jvm.hotspot.memory.Generation;
import sun.jvm.hotspot.memory.Universe;
import sun.jvm.hotspot.oops.HeapVisitor;
import sun.jvm.hotspot.oops.Instance;
import sun.jvm.hotspot.oops.InstanceKlass;
import sun.jvm.hotspot.oops.Klass;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.oops.ObjectHistogram;
import sun.jvm.hotspot.oops.Oop;
import sun.jvm.hotspot.oops.Symbol;
import sun.jvm.hotspot.runtime.AddressVisitor;
import sun.jvm.hotspot.runtime.BasicObjectLock;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaVFrame;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VFrame;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.ui.AnnotatedMemoryPanel;
import sun.jvm.hotspot.ui.Annotation;
import sun.jvm.hotspot.ui.CommandProcessorPanel;
import sun.jvm.hotspot.ui.DeadlockDetectionPanel;
import sun.jvm.hotspot.ui.DebuggerConsolePanel;
import sun.jvm.hotspot.ui.FindByQueryPanel;
import sun.jvm.hotspot.ui.FindInCodeCachePanel;
import sun.jvm.hotspot.ui.FindInHeapPanel;
import sun.jvm.hotspot.ui.FindPanel;
import sun.jvm.hotspot.ui.GraphicsUtilities;
import sun.jvm.hotspot.ui.HeapParametersPanel;
import sun.jvm.hotspot.ui.Inspector;
import sun.jvm.hotspot.ui.JavaStackTracePanel;
import sun.jvm.hotspot.ui.JavaThreadsPanel;
import sun.jvm.hotspot.ui.MemoryViewer;
import sun.jvm.hotspot.ui.MonitorCacheDumpPanel;
import sun.jvm.hotspot.ui.ObjectHistogramPanel;
import sun.jvm.hotspot.ui.ObjectHistogramPanel.Listener;
import sun.jvm.hotspot.ui.ObjectListPanel;
import sun.jvm.hotspot.ui.ProgressBarPanel;
import sun.jvm.hotspot.ui.SAListener;
import sun.jvm.hotspot.ui.SAPanel;
import sun.jvm.hotspot.ui.SysPropsPanel;
import sun.jvm.hotspot.ui.ThreadInfoPanel;
import sun.jvm.hotspot.ui.VMFlagsPanel;
import sun.jvm.hotspot.ui.VMVersionInfoPanel;
import sun.jvm.hotspot.ui.classbrowser.ClassBrowserPanel;
import sun.jvm.hotspot.ui.classbrowser.CodeViewerPanel;
import sun.jvm.hotspot.ui.classbrowser.HTMLGenerator;
import sun.jvm.hotspot.ui.tree.OopTreeNodeAdapter;
import sun.jvm.hotspot.ui.tree.SimpleTreeNode;
import sun.jvm.hotspot.utilities.AddressOps;
import sun.jvm.hotspot.utilities.Assert;
import sun.jvm.hotspot.utilities.FindObjectByType;
import sun.jvm.hotspot.utilities.HeapProgressThunk;
import sun.jvm.hotspot.utilities.LivenessPath;
import sun.jvm.hotspot.utilities.LivenessPathList;
import sun.jvm.hotspot.utilities.ProgressiveHeapVisitor;
import sun.jvm.hotspot.utilities.ReversePtrsAnalysis;
import sun.jvm.hotspot.utilities.SystemDictionaryHelper;
import sun.jvm.hotspot.utilities.WorkerThread;

public class HSDB
  implements ObjectHistogramPanel.Listener, SAListener
{
  private HotSpotAgent agent;
  private JDesktopPane desktop;
  private boolean attached;
  private List attachMenuItems;
  private List detachMenuItems;
  private JMenu toolsMenu;
  private JMenuItem showDbgConsoleMenuItem;
  private JMenuItem computeRevPtrsMenuItem;
  private JInternalFrame attachWaitDialog;
  private JInternalFrame threadsFrame;
  private JInternalFrame consoleFrame;
  private WorkerThread workerThread;
  private String pidText;
  private int pid;
  private String execPath;
  private String coreFilename;
  
  public static void main(String[] args)
  {
    new HSDB(args).run();
  }
  
  private void doUsage()
  {
    System.out.println("Usage:  java HSDB [[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 HSDB(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 run()
  {
    agent = new HotSpotAgent();
    workerThread = new WorkerThread();
    attachMenuItems = new ArrayList();
    detachMenuItems = new ArrayList();
    
    JFrame frame = new JFrame("HSDB - HotSpot Debugger");
    frame.setSize(800, 600);
    frame.setDefaultCloseOperation(3);
    
    JMenuBar menuBar = new JMenuBar();
    
    JMenu menu = new JMenu("File");
    menu.setMnemonic(70);
    
    JMenuItem item = createMenuItem("Attach to HotSpot process...", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showAttachDialog();
      }
    });
    item.setAccelerator(KeyStroke.getKeyStroke(65, 8));
    item.setMnemonic(65);
    menu.add(item);
    attachMenuItems.add(item);
    
    item = createMenuItem("Open HotSpot core file...", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showOpenCoreFileDialog();
      }
    });
    item.setAccelerator(KeyStroke.getKeyStroke(79, 8));
    item.setMnemonic(79);
    menu.add(item);
    attachMenuItems.add(item);
    
    item = createMenuItem("Connect to debug server...", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showConnectDialog();
      }
    });
    item.setAccelerator(KeyStroke.getKeyStroke(83, 8));
    item.setMnemonic(83);
    menu.add(item);
    attachMenuItems.add(item);
    
    item = createMenuItem("Detach", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.detach();
      }
    });
    item.setAccelerator(KeyStroke.getKeyStroke(68, 8));
    item.setMnemonic(83);
    menu.add(item);
    detachMenuItems.add(item);
    
    setMenuItemsEnabled(detachMenuItems, false);
    
    menu.addSeparator();
    
    item = createMenuItem("Exit", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        System.exit(0);
      }
    });
    item.setAccelerator(KeyStroke.getKeyStroke(88, 8));
    item.setMnemonic(88);
    menu.add(item);
    menuBar.add(menu);
    
    toolsMenu = new JMenu("Tools");
    toolsMenu.setMnemonic(84);
    
    item = createMenuItem("Class Browser", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        showClassBrowser();
      }
    });
    item.setMnemonic(66);
    
    toolsMenu.add(item);
    
    item = createMenuItem("Code Viewer", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        showCodeViewer();
      }
    });
    item.setMnemonic(67);
    
    toolsMenu.add(item);
    
    item = createMenuItem("Compute Reverse Ptrs", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.fireComputeReversePtrs();
      }
    });
    computeRevPtrsMenuItem = item;
    item.setMnemonic(77);
    toolsMenu.add(item);
    
    item = createMenuItem("Deadlock Detection", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showDeadlockDetectionPanel();
      }
    });
    item.setMnemonic(68);
    toolsMenu.add(item);
    
    item = createMenuItem("Find Object by Query", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showFindByQueryPanel();
      }
    });
    item.setMnemonic(81);
    toolsMenu.add(item);
    
    item = createMenuItem("Find Pointer", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showFindPanel();
      }
    });
    item.setMnemonic(80);
    toolsMenu.add(item);
    
    item = createMenuItem("Find Value In Heap", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showFindInHeapPanel();
      }
    });
    item.setMnemonic(86);
    toolsMenu.add(item);
    
    item = createMenuItem("Find Value In Code Cache", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showFindInCodeCachePanel();
      }
    });
    item.setMnemonic(65);
    toolsMenu.add(item);
    
    item = createMenuItem("Heap Parameters", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showHeapParametersPanel();
      }
    });
    item.setMnemonic(72);
    toolsMenu.add(item);
    
    item = createMenuItem("Inspector", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        showInspector(null);
      }
    });
    item.setMnemonic(82);
    item.setAccelerator(KeyStroke.getKeyStroke(82, 8));
    toolsMenu.add(item);
    
    item = createMenuItem("Memory Viewer", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        showMemoryViewer();
      }
    });
    item.setMnemonic(77);
    toolsMenu.add(item);
    
    item = createMenuItem("Monitor Cache Dump", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showMonitorCacheDumpPanel();
      }
    });
    item.setMnemonic(68);
    toolsMenu.add(item);
    
    item = createMenuItem("Object Histogram", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showObjectHistogram();
      }
    });
    item.setMnemonic(79);
    toolsMenu.add(item);
    
    item = createMenuItem("Show System Properties", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        showSystemProperties();
      }
    });
    item.setMnemonic(83);
    toolsMenu.add(item);
    
    item = createMenuItem("Show VM Version", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        showVMVersion();
      }
    });
    item.setMnemonic(77);
    toolsMenu.add(item);
    
    item = createMenuItem("Show -XX flags", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        showCommandLineFlags();
      }
    });
    item.setMnemonic(88);
    toolsMenu.add(item);
    
    toolsMenu.setEnabled(false);
    menuBar.add(toolsMenu);
    
    JMenu windowsMenu = new JMenu("Windows");
    windowsMenu.setMnemonic(87);
    item = createMenuItem("Console", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showConsole();
      }
    });
    item.setMnemonic(67);
    windowsMenu.add(item);
    showDbgConsoleMenuItem = createMenuItem("Debugger Console", new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        HSDB.this.showDebuggerConsole();
      }
    });
    showDbgConsoleMenuItem.setMnemonic(68);
    windowsMenu.add(showDbgConsoleMenuItem);
    showDbgConsoleMenuItem.setEnabled(false);
    
    menuBar.add(windowsMenu);
    
    frame.setJMenuBar(menuBar);
    
    desktop = new JDesktopPane();
    frame.getContentPane().add(desktop);
    GraphicsUtilities.reshapeToAspectRatio(frame, 1.3333334F, 0.75F, Toolkit.getDefaultToolkit().getScreenSize());
    GraphicsUtilities.centerInContainer(frame, Toolkit.getDefaultToolkit().getScreenSize());
    frame.setVisible(true);
    
    Runtime.getRuntime().addShutdownHook(new Thread()
    {
      public void run()
      {
        HSDB.this.detachDebugger();
      }
    });
    if (pidText != null) {
      attach(pidText);
    } else if (execPath != null) {
      attach(execPath, coreFilename);
    }
  }
  
  private void showAttachDialog()
  {
    setMenuItemsEnabled(attachMenuItems, false);
    final JInternalFrame attachDialog = new JInternalFrame("Attach to HotSpot process");
    attachDialog.getContentPane().setLayout(new BorderLayout());
    
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, 0));
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    attachDialog.setBackground(panel.getBackground());
    
    panel.add(new JLabel("Enter process ID:"));
    final JTextField pidTextField = new JTextField(10);
    ActionListener attacher = new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        attachDialog.setVisible(false);
        desktop.remove(attachDialog);
        workerThread.invokeLater(new Runnable()
        {
          public void run()
          {
            HSDB.this.attach(val$pidTextField.getText());
          }
        });
      }
    };
    pidTextField.addActionListener(attacher);
    panel.add(pidTextField);
    attachDialog.getContentPane().add(panel, "North");
    
    Box vbox = Box.createVerticalBox();
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, 1));
    panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    JTextArea ta = new JTextArea("Enter the process ID of a currently-running HotSpot process. On Solaris and most Unix operating systems, this can be determined by typing \"ps -u <your username> | grep java\"; the process ID is the first number which appears on the resulting line. On Windows, the process ID is present in the Task Manager, which can be brought up while logged on to the desktop by pressing Ctrl-Alt-Delete.");
    
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setEditable(false);
    ta.setBackground(panel.getBackground());
    panel.add(ta);
    vbox.add(panel);
    
    Box hbox = Box.createHorizontalBox();
    hbox.add(Box.createGlue());
    JButton button = new JButton("OK");
    button.addActionListener(attacher);
    hbox.add(button);
    hbox.add(Box.createHorizontalStrut(20));
    button = new JButton("Cancel");
    button.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        attachDialog.setVisible(false);
        desktop.remove(attachDialog);
        HSDB.this.setMenuItemsEnabled(attachMenuItems, true);
      }
    });
    hbox.add(button);
    hbox.add(Box.createGlue());
    panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(hbox);
    vbox.add(panel);
    
    attachDialog.getContentPane().add(vbox, "South");
    
    desktop.add(attachDialog);
    attachDialog.setSize(400, 300);
    GraphicsUtilities.centerInContainer(attachDialog);
    attachDialog.show();
    pidTextField.requestFocus();
  }
  
  private void showOpenCoreFileDialog()
  {
    setMenuItemsEnabled(attachMenuItems, false);
    final JInternalFrame dialog = new JInternalFrame("Open Core File");
    dialog.getContentPane().setLayout(new BorderLayout());
    
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, 1));
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    dialog.setBackground(panel.getBackground());
    
    Box hbox = Box.createHorizontalBox();
    Box vbox = Box.createVerticalBox();
    vbox.add(new JLabel("Path to core file:"));
    vbox.add(new JLabel("Path to Java executable:"));
    hbox.add(vbox);
    
    vbox = Box.createVerticalBox();
    final JTextField corePathField = new JTextField(40);
    final JTextField execPathField = new JTextField(40);
    vbox.add(corePathField);
    vbox.add(execPathField);
    hbox.add(vbox);
    
    JButton browseCorePath = new JButton("Browse ..");
    JButton browseExecPath = new JButton("Browse ..");
    browseCorePath.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        JFileChooser fileChooser = new JFileChooser(new File("."));
        int retVal = fileChooser.showOpenDialog(dialog);
        if (retVal == 0) {
          corePathField.setText(fileChooser.getSelectedFile().getPath());
        }
      }
    });
    browseExecPath.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        JFileChooser fileChooser = new JFileChooser(new File("."));
        int retVal = fileChooser.showOpenDialog(dialog);
        if (retVal == 0) {
          execPathField.setText(fileChooser.getSelectedFile().getPath());
        }
      }
    });
    vbox = Box.createVerticalBox();
    vbox.add(browseCorePath);
    vbox.add(browseExecPath);
    hbox.add(vbox);
    
    panel.add(hbox);
    dialog.getContentPane().add(panel, "North");
    
    ActionListener attacher = new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
        desktop.remove(dialog);
        workerThread.invokeLater(new Runnable()
        {
          public void run()
          {
            HSDB.this.attach(val$execPathField.getText(), val$corePathField.getText());
          }
        });
      }
    };
    corePathField.addActionListener(attacher);
    execPathField.addActionListener(attacher);
    
    vbox = Box.createVerticalBox();
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, 1));
    panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    JTextArea ta = new JTextArea("Enter the full path names to the core file from a HotSpot process and the Java executable from which it came. The latter is typically located in the JDK/JRE directory under the directory jre/bin/<arch>/native_threads.");
    
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setEditable(false);
    ta.setBackground(panel.getBackground());
    panel.add(ta);
    vbox.add(panel);
    
    hbox = Box.createHorizontalBox();
    hbox.add(Box.createGlue());
    JButton button = new JButton("OK");
    button.addActionListener(attacher);
    hbox.add(button);
    hbox.add(Box.createHorizontalStrut(20));
    button = new JButton("Cancel");
    button.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
        desktop.remove(dialog);
        HSDB.this.setMenuItemsEnabled(attachMenuItems, true);
      }
    });
    hbox.add(button);
    hbox.add(Box.createGlue());
    panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(hbox);
    vbox.add(panel);
    
    dialog.getContentPane().add(vbox, "South");
    
    desktop.add(dialog);
    dialog.setSize(500, 300);
    GraphicsUtilities.centerInContainer(dialog);
    dialog.show();
    corePathField.requestFocus();
  }
  
  private void showConnectDialog()
  {
    setMenuItemsEnabled(attachMenuItems, false);
    final JInternalFrame dialog = new JInternalFrame("Connect to HotSpot Debug Server");
    dialog.getContentPane().setLayout(new BorderLayout());
    
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, 0));
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    dialog.setBackground(panel.getBackground());
    
    panel.add(new JLabel("Enter machine name:"));
    final JTextField pidTextField = new JTextField(40);
    ActionListener attacher = new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
        desktop.remove(dialog);
        workerThread.invokeLater(new Runnable()
        {
          public void run()
          {
            HSDB.this.connect(val$pidTextField.getText());
          }
        });
      }
    };
    pidTextField.addActionListener(attacher);
    panel.add(pidTextField);
    dialog.getContentPane().add(panel, "North");
    
    Box vbox = Box.createVerticalBox();
    panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, 1));
    panel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    JTextArea ta = new JTextArea("Enter the name of a machine on which the HotSpot \"Debug Server\" is running and is attached to a process or core file.");
    
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setEditable(false);
    ta.setBackground(panel.getBackground());
    panel.add(ta);
    vbox.add(panel);
    
    Box hbox = Box.createHorizontalBox();
    hbox.add(Box.createGlue());
    JButton button = new JButton("OK");
    button.addActionListener(attacher);
    hbox.add(button);
    hbox.add(Box.createHorizontalStrut(20));
    button = new JButton("Cancel");
    button.addActionListener(new ActionListener()
    {
      public void actionPerformed(ActionEvent e)
      {
        dialog.setVisible(false);
        desktop.remove(dialog);
        HSDB.this.setMenuItemsEnabled(attachMenuItems, true);
      }
    });
    hbox.add(button);
    hbox.add(Box.createGlue());
    panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(hbox);
    vbox.add(panel);
    
    dialog.getContentPane().add(vbox, "South");
    
    desktop.add(dialog);
    dialog.setSize(400, 300);
    GraphicsUtilities.centerInContainer(dialog);
    dialog.show();
    pidTextField.requestFocus();
  }
  
  public void showThreadOopInspector(JavaThread thread)
  {
    showInspector(new OopTreeNodeAdapter(thread.getThreadObj(), null));
  }
  
  public void showInspector(SimpleTreeNode adapter)
  {
    showPanel("Inspector", new Inspector(adapter), 1.0F, 0.65F);
  }
  
  public void showLiveness(Oop oop, LivenessPathList liveness)
  {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    PrintStream tty = new PrintStream(bos);
    int numPaths = liveness.size();
    for (int i = 0; i < numPaths; i++)
    {
      tty.println("Path " + (i + 1) + " of " + numPaths + ":");
      liveness.get(i).printOn(tty);
    }
    JTextArea ta = new JTextArea(bos.toString());
    ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setEditable(false);
    
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    
    JScrollPane scroller = new JScrollPane();
    scroller.getViewport().add(ta);
    
    panel.add(scroller, "Center");
    
    bos = new ByteArrayOutputStream();
    tty = new PrintStream(bos);
    tty.print("Liveness result for ");
    Oop.printOopValueOn(oop, tty);
    
    JInternalFrame frame = new JInternalFrame(bos.toString());
    frame.setResizable(true);
    frame.setClosable(true);
    frame.setIconifiable(true);
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(panel, "Center");
    frame.pack();
    desktop.add(frame);
    GraphicsUtilities.reshapeToAspectRatio(frame, 2.5F, 0.5F, frame.getParent().getSize());
    frame.show();
  }
  
  private void fireComputeReversePtrs()
  {
    if (VM.getVM().getRevPtrs() != null)
    {
      computeRevPtrsMenuItem.setEnabled(false);
      return;
    }
    workerThread.invokeLater(new Runnable()
    {
      public void run()
      {
        HSDB.HeapProgress progress = new HSDB.HeapProgress(HSDB.this, "Reverse Pointers Analysis");
        try
        {
          ReversePtrsAnalysis analysis = new ReversePtrsAnalysis();
          analysis.setHeapProgressThunk(progress);
          analysis.run();
          computeRevPtrsMenuItem.setEnabled(false);
        }
        catch (OutOfMemoryError e)
        {
          final String errMsg = HSDB.this.formatMessage(e.toString(), 80);
          SwingUtilities.invokeLater(new Runnable()
          {
            public void run()
            {
              JOptionPane.showInternalMessageDialog(desktop, "Error computing reverse pointers:" + errMsg, "Error", 2);
            }
          });
        }
        finally
        {
          progress.heapIterationComplete();
        }
      }
    });
  }
  
  class SignalInfo
  {
    public int sigNum;
    public String sigName;
    
    SignalInfo() {}
  }
  
  abstract class StackWalker
    implements Runnable
  {
    protected JavaVFrame vf;
    protected AnnotatedMemoryPanel annoPanel;
    
    StackWalker(JavaVFrame vf, AnnotatedMemoryPanel annoPanel)
    {
      this.vf = vf;
      this.annoPanel = annoPanel;
    }
  }
  
  public void showThreadStackMemory(final JavaThread thread)
  {
    JavaVFrame vframe = getLastJavaVFrame(thread);
    if (vframe == null)
    {
      JOptionPane.showInternalMessageDialog(desktop, "Thread \"" + thread.getThreadName() + "\" has no Java frames on its stack", "Show Stack Memory", 1);
      
      return;
    }
    JInternalFrame stackFrame = new JInternalFrame("Stack Memory for " + thread.getThreadName());
    stackFrame.getContentPane().setLayout(new BorderLayout());
    stackFrame.setResizable(true);
    stackFrame.setClosable(true);
    stackFrame.setIconifiable(true);
    final long addressSize = agent.getTypeDataBase().getAddressSize();
    boolean is64Bit = addressSize == 8L;
    
    Frame tmpFrame = thread.getCurrentFrameGuess();
    Address sp = tmpFrame.getSP();
    Address starting = sp;
    Address maxSP = starting;
    Address minSP = starting;
    RegisterMap tmpMap = thread.newRegisterMap(false);
    while ((tmpFrame != null) && (!tmpFrame.isFirstFrame()))
    {
      tmpFrame = tmpFrame.sender(tmpMap);
      if (tmpFrame != null)
      {
        sp = tmpFrame.getSP();
        if (sp != null)
        {
          maxSP = AddressOps.max(maxSP, sp);
          minSP = AddressOps.min(minSP, sp);
        }
      }
    }
    AnnotatedMemoryPanel annoMemPanel = new AnnotatedMemoryPanel(agent.getDebugger(), is64Bit, starting, minSP.addOffsetTo(-8192L), maxSP.addOffsetTo(8192L));
    
    stackFrame.getContentPane().add(annoMemPanel, "Center");
    desktop.add(stackFrame);
    GraphicsUtilities.reshapeToAspectRatio(stackFrame, 1.3333334F, 0.85F, stackFrame.getParent().getSize());
    stackFrame.show();
    
    workerThread.invokeLater(new StackWalker(vframe, annoMemPanel, thread)
    {
      public void run()
      {
        Address startAddr = null;
        
        Map interruptedFrameMap = new HashMap();
        
        Frame tmpFrame = thread.getCurrentFrameGuess();
        RegisterMap tmpMap = thread.newRegisterMap(false);
        while ((tmpFrame != null) && (!tmpFrame.isFirstFrame()))
        {
          if (tmpFrame.isSignalHandlerFrameDbg())
          {
            Frame interruptedFrame = tmpFrame.sender(tmpMap);
            HSDB.SignalInfo info = new HSDB.SignalInfo(HSDB.this);
            sigNum = tmpFrame.getSignalNumberDbg();
            sigName = tmpFrame.getSignalNameDbg();
            interruptedFrameMap.put(interruptedFrame, info);
          }
          tmpFrame = tmpFrame.sender(tmpMap);
        }
        while (vf != null)
        {
          String anno = null;
          JavaVFrame curVFrame = vf;
          Frame curFrame = curVFrame.getFrame();
          Method interpreterFrameMethod = null;
          if (curVFrame.isInterpretedFrame())
          {
            anno = "Interpreted frame";
          }
          else
          {
            anno = "Compiled frame";
            if (curVFrame.isDeoptimized()) {
              anno = anno + " (deoptimized)";
            }
          }
          if (curVFrame.mayBeImpreciseDbg()) {
            anno = anno + "; information may be imprecise";
          }
          if (curVFrame.isInterpretedFrame())
          {
            InterpreterCodelet codelet = VM.getVM().getInterpreter().getCodeletContaining(curFrame.getPC());
            String description = null;
            if (codelet != null) {
              descriptio
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