sa-jdi

  LongHashMap$Entry(int hash, long key, Object value, Entry next)
  {
    this.hash = hash;
    this.key = key;
    this.value = value;
    this.next = next;
  }
  
  long getKey()
  {
    return key;
  }
  
  Object getValue()
  {
    return value;
  }
  
  Object setValue(Object value)
  {
    Object oldValue = this.value;
    this.value = value;
    return oldValue;
  }
  
  public boolean equals(Object o)
  {
    if (!(o instanceof Entry)) {
      return false;
    }
    Entry e = (Entry)o;
    return (key == e.getKey()) && (LongHashMap.eq(value, e.getValue()));
  }
  
  public int hashCode()
  {
    return hash ^ (value == null ? 0 : value.hashCode());
  }
}

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

import java.util.ConcurrentModificationException;

public class LongHashMap
{
  transient Entry[] table;
  transient int size;
  int threshold;
  final float loadFactor;
  
  static class Entry
  {
    private int hash;
    private long key;
    private Object value;
    private Entry next;
    
    Entry(int hash, long key, Object value, Entry next)
    {
      this.hash = hash;
      this.key = key;
      this.value = value;
      this.next = next;
    }
    
    long getKey()
    {
      return key;
    }
    
    Object getValue()
    {
      return value;
    }
    
    Object setValue(Object value)
    {
      Object oldValue = this.value;
      this.value = value;
      return oldValue;
    }
    
    public boolean equals(Object o)
    {
      if (!(o instanceof Entry)) {
        return false;
      }
      Entry e = (Entry)o;
      return (key == e.getKey()) && (LongHashMap.eq(value, e.getValue()));
    }
    
    public int hashCode()
    {
      return hash ^ (value == null ? 0 : value.hashCode());
    }
  }
  
  transient int modCount = 0;
  
  public LongHashMap(int initialCapacity, float loadFactor)
  {
    if (initialCapacity < 0) {
      throw new IllegalArgumentException("Illegal Initial Capacity: " + initialCapacity);
    }
    if ((loadFactor <= 0.0F) || (Float.isNaN(loadFactor))) {
      throw new IllegalArgumentException("Illegal Load factor: " + loadFactor);
    }
    if (initialCapacity == 0) {
      initialCapacity = 1;
    }
    this.loadFactor = loadFactor;
    table = new Entry[initialCapacity];
    threshold = ((int)(initialCapacity * loadFactor));
  }
  
  public LongHashMap(int initialCapacity)
  {
    this(initialCapacity, 0.75F);
  }
  
  public LongHashMap()
  {
    this(11, 0.75F);
  }
  
  public int size()
  {
    return size;
  }
  
  public boolean isEmpty()
  {
    return size == 0;
  }
  
  public Object get(long key)
  {
    Entry e = getEntry(key);
    return e == null ? null : value;
  }
  
  public boolean containsKey(long key)
  {
    return getEntry(key) != null;
  }
  
  Entry getEntry(long key)
  {
    Entry[] tab = table;
    int hash = (int)key;
    int index = (hash & 0x7FFFFFFF) % tab.length;
    for (Entry e = tab[index]; e != null; e = next) {
      if ((hash == hash) && (key == key)) {
        return e;
      }
    }
    return null;
  }
  
  public boolean containsValue(Object value)
  {
    Entry[] tab = table;
    int i;
    int i;
    if (value == null) {
      for (i = tab.length; i-- > 0;) {
        for (Entry e = tab[i]; e != null; e = next) {
          if (value == null) {
            return true;
          }
        }
      }
    } else {
      for (i = tab.length; i-- > 0;) {
        for (Entry e = tab[i]; e != null; e = next) {
          if (value.equals(value)) {
            return true;
          }
        }
      }
    }
    return false;
  }
  
  public Object put(long key, Object value)
  {
    Entry[] tab = table;
    int hash = (int)key;
    int index = (hash & 0x7FFFFFFF) % tab.length;
    for (Entry e = tab[index]; e != null; e = next) {
      if ((hash == hash) && (key == key))
      {
        Object oldValue = value;
        value = value;
        return oldValue;
      }
    }
    modCount += 1;
    if (size >= threshold)
    {
      rehash();
      tab = table;
      index = (hash & 0x7FFFFFFF) % tab.length;
    }
    size += 1;
    tab[index] = newEntry(hash, key, value, tab[index]);
    return null;
  }
  
  public Object remove(long key)
  {
    Entry e = removeEntryForKey(key);
    return e == null ? null : value;
  }
  
  Entry removeEntryForKey(long key)
  {
    Entry[] tab = table;
    int hash = (int)key;
    int index = (hash & 0x7FFFFFFF) % tab.length;
    
    Entry e = tab[index];
    for (Entry prev = null; e != null; e = next)
    {
      if ((hash == hash) && (key == key))
      {
        modCount += 1;
        if (prev != null) {
          next = next;
        } else {
          tab[index] = next;
        }
        size -= 1;
        return e;
      }
      prev = e;
    }
    return null;
  }
  
  void removeEntry(Entry doomed)
  {
    Entry[] tab = table;
    int index = (hash & 0x7FFFFFFF) % tab.length;
    
    Entry e = tab[index];
    for (Entry prev = null; e != null; e = next)
    {
      if (e == doomed)
      {
        modCount += 1;
        if (prev == null) {
          tab[index] = next;
        } else {
          next = next;
        }
        size -= 1; return;
      }
      prev = e;
    }
    throw new ConcurrentModificationException();
  }
  
  public void clear()
  {
    Entry[] tab = table;
    modCount += 1;
    int index = tab.length;
    for (;;)
    {
      index--;
      if (index < 0) {
        break;
      }
      tab[index] = null;
    }
    size = 0;
  }
  
  void rehash()
  {
    Entry[] oldTable = table;
    int oldCapacity = oldTable.length;
    int newCapacity = oldCapacity * 2 + 1;
    Entry[] newTable = new Entry[newCapacity];
    
    modCount += 1;
    threshold = ((int)(newCapacity * loadFactor));
    table = newTable;
    for (int i = oldCapacity; i-- > 0;) {
      for (old = oldTable[i]; old != null;)
      {
        Entry e = old;
        old = next;
        
        int index = (hash & 0x7FFFFFFF) % newCapacity;
        next = newTable[index];
        newTable[index] = e;
      }
    }
    Entry old;
  }
  
  static boolean eq(Object o1, Object o2)
  {
    return o1 == null ? false : o2 == null ? true : o1.equals(o2);
  }
  
  Entry newEntry(int hash, long key, Object value, Entry next)
  {
    return new Entry(hash, key, value, next);
  }
  
  int capacity()
  {
    return table.length;
  }
  
  float loadFactor()
  {
    return loadFactor;
  }
}

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

import java.io.Serializable;

public abstract interface MachineDescription
  extends Serializable
{
  public abstract long getAddressSize();
  
  public abstract long cIntegerTypeMaxValue(long paramLong, boolean paramBoolean);
  
  public abstract long cIntegerTypeMinValue(long paramLong, boolean paramBoolean);
  
  public abstract boolean isBigEndian();
  
  public abstract boolean isLP64();
}

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

public class MachineDescriptionAMD64
  extends MachineDescriptionTwosComplement
  implements MachineDescription
{
  public long getAddressSize()
  {
    return 8L;
  }
  
  public boolean isLP64()
  {
    return true;
  }
  
  public boolean isBigEndian()
  {
    return false;
  }
}

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

public class MachineDescriptionIA64
  extends MachineDescriptionTwosComplement
  implements MachineDescription
{
  public long getAddressSize()
  {
    return 8L;
  }
  
  public boolean isLP64()
  {
    return true;
  }
  
  public boolean isBigEndian()
  {
    return false;
  }
}

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

public class MachineDescriptionIntelX86
  extends MachineDescriptionTwosComplement
  implements MachineDescription
{
  public long getAddressSize()
  {
    return 4L;
  }
  
  public boolean isBigEndian()
  {
    return false;
  }
}

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

public class MachineDescriptionSPARC32Bit
  extends MachineDescriptionTwosComplement
  implements MachineDescription
{
  public long getAddressSize()
  {
    return 4L;
  }
  
  public boolean isBigEndian()
  {
    return true;
  }
}

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

public class MachineDescriptionSPARC64Bit
  extends MachineDescriptionTwosComplement
  implements MachineDescription
{
  public long getAddressSize()
  {
    return 8L;
  }
  
  public boolean isBigEndian()
  {
    return true;
  }
  
  public boolean isLP64()
  {
    return true;
  }
}

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

public abstract class MachineDescriptionTwosComplement
{
  private static final long[] signedMinValues = { -128L, -32768L, -2147483648L, Long.MIN_VALUE };
  private static final long[] signedMaxValues = { 127L, 32767L, 2147483647L, Long.MAX_VALUE };
  private static final long[] unsignedMaxValues = { 255L, 65535L, 4294967295L, -1L };
  
  public long cIntegerTypeMaxValue(long sizeInBytes, boolean isUnsigned)
  {
    if (isUnsigned) {
      return tableLookup(sizeInBytes, unsignedMaxValues);
    }
    return tableLookup(sizeInBytes, signedMaxValues);
  }
  
  public long cIntegerTypeMinValue(long sizeInBytes, boolean isUnsigned)
  {
    if (isUnsigned) {
      return 0L;
    }
    return tableLookup(sizeInBytes, signedMinValues);
  }
  
  public boolean isLP64()
  {
    return false;
  }
  
  private long tableLookup(long sizeInBytes, long[] table)
  {
    switch ((int)sizeInBytes)
    {
    case 1: 
      return table[0];
    case 2: 
      return table[1];
    case 4: 
      return table[2];
    case 8: 
      return table[3];
    }
    throw new IllegalArgumentException("C integer type of " + sizeInBytes + " not supported");
  }
}

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

import java.io.IOException;
import java.io.PrintStream;
import java.nio.MappedByteBuffer;

public class MappedByteBufferDataSource
  implements DataSource
{
  private MappedByteBuffer buf;
  
  public MappedByteBufferDataSource(MappedByteBuffer buf)
  {
    this.buf = buf;
  }
  
  public byte readByte()
    throws IOException
  {
    return buf.get();
  }
  
  public short readShort()
    throws IOException
  {
    return buf.getShort();
  }
  
  public int readInt()
    throws IOException
  {
    return buf.getInt();
  }
  
  public long readLong()
    throws IOException
  {
    return buf.getLong();
  }
  
  public int read(byte[] b)
    throws IOException
  {
    buf.get(b);return b.length;
  }
  
  public void seek(long pos)
    throws IOException
  {
    try
    {
      buf.position((int)pos);
    }
    catch (IllegalArgumentException e)
    {
      System.err.println("Error seeking to file position 0x" + Long.toHexString(pos));
      throw e;
    }
  }
  
  public long getFilePointer()
    throws IOException
  {
    return buf.position();
  }
  
  public void close()
    throws IOException
  {
    buf = null;
  }
}

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

public class NoSuchSymbolException
  extends RuntimeException
{
  private String symbol;
  
  public NoSuchSymbolException(String symbol)
  {
    this.symbol = symbol;
  }
  
  public NoSuchSymbolException(String symbol, Throwable cause)
  {
    super(cause);
    this.symbol = symbol;
  }
  
  public NoSuchSymbolException(String symbol, String detail)
  {
    super(detail);
    this.symbol = symbol;
  }
  
  public NoSuchSymbolException(String symbol, String detail, Throwable cause)
  {
    super(detail, cause);
    this.symbol = symbol;
  }
  
  public String getSymbol()
  {
    return symbol;
  }
}

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

public class NotInHeapException
  extends AddressException
{
  public NotInHeapException(long addr)
  {
    super(addr);
  }
  
  public NotInHeapException(String detail, long addr)
  {
    super(detail, addr);
  }
}

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

public abstract interface OopHandle
  extends Address
{}

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

public class Page
{
  private long baseAddress;
  private byte[] data;
  private Page prev;
  private Page next;
  private long unmappedPageLength;
  
  public Page(long baseAddress, byte[] data)
  {
    this.baseAddress = baseAddress;
    this.data = data;
  }
  
  public Page(long baseAddress, long unmappedPageLength)
  {
    this.baseAddress = baseAddress;
    this.unmappedPageLength = unmappedPageLength;
  }
  
  public long getBaseAddress()
  {
    return baseAddress;
  }
  
  public long getSize()
  {
    if (data != null) {
      return data.length;
    }
    return unmappedPageLength;
  }
  
  public boolean isMapped()
  {
    return data != null;
  }
  
  public Page getPrev()
  {
    return prev;
  }
  
  public void setPrev(Page prev)
  {
    this.prev = prev;
  }
  
  public Page getNext()
  {
    return next;
  }
  
  public void setNext(Page next)
  {
    this.next = next;
  }
  
  public void getData(long startAddress, long numBytes, int[] destBuf, long destBufOffset)
    throws IndexOutOfBoundsException
  {
    int startOffset = (int)(startAddress - baseAddress);
    if ((data == null) && ((startOffset < 0) || (startOffset + numBytes > baseAddress + unmappedPageLength))) {
      throw new IndexOutOfBoundsException("startAddress = " + startAddress + ", baseAddress = " + baseAddress + ", unmappedPageLength = " + unmappedPageLength);
    }
    for (int i = 0; i < (int)numBytes; i++) {
      if (data != null) {
        destBuf[(i + (int)destBufOffset)] = (data[(i + startOffset)] & 0xFF);
      } else {
        destBuf[(i + (int)destBufOffset)] = -1;
      }
    }
  }
  
  public void getDataAsBytes(long startAddress, long numBytes, byte[] destBuf, long destBufOffset)
    throws IndexOutOfBoundsException
  {
    long startOffset = startAddress - baseAddress;
    if (data == null) {
      throw new RuntimeException("Bug in PageCache; should not fetch from unmapped pages using getDataAsBytes");
    }
    System.arraycopy(data, (int)startOffset, destBuf, (int)destBufOffset, (int)numBytes);
  }
  
  public boolean getBoolean(long address)
  {
    return getByte(address) != 0;
  }
  
  public byte getByte(long address)
  {
    return data[((int)address - (int)baseAddress)];
  }
  
  public short getShort(long address, boolean bigEndian)
  {
    int start = (int)address - (int)baseAddress;
    if (bigEndian) {
      return (short)(data[(start + 1)] & 0xFF | (data[start] & 0xFF) << 8);
    }
    return (short)((data[(start + 1)] & 0xFF) << 8 | data[start] & 0xFF);
  }
  
  public char getChar(long address, boolean bigEndian)
  {
    return (char)getShort(address, bigEndian);
  }
  
  public int getInt(long address, boolean bigEndian)
  {
    int start = (int)address - (int)baseAddress;
    if (bigEndian) {
      return data[(start + 3)] & 0xFF | (data[(start + 2)] & 0xFF) << 8 | (data[(start + 1)] & 0xFF) << 16 | (data[start] & 0xFF) << 24;
    }
    return (data[(start + 3)] & 0xFF) << 24 | (data[(start + 2)] & 0xFF) << 16 | (data[(start + 1)] & 0xFF) << 8 | data[start] & 0xFF;
  }
  
  public long getLong(long address, boolean bigEndian)
  {
    int start = (int)address - (int)baseAddress;
    if (bigEndian) {
      return data[(start + 7)] & 0xFF | (data[(start + 6)] & 0xFF) << 8 | (data[(start + 5)] & 0xFF) << 16 | (data[(start + 4)] & 0xFF) << 24 | (data[(start + 3)] & 0xFF) << 32 | (data[(start + 2)] & 0xFF) << 40 | (data[(start + 1)] & 0xFF) << 48 | (data[start] & 0xFF) << 56;
    }
    return (data[(start + 7)] & 0xFF) << 56 | (data[(start + 6)] & 0xFF) << 48 | (data[(start + 5)] & 0xFF) << 40 | (data[(start + 4)] & 0xFF) << 32 | (data[(start + 3)] & 0xFF) << 24 | (data[(start + 2)] & 0xFF) << 16 | (data[(start + 1)] & 0xFF) << 8 | data[start] & 0xFF;
  }
  
  public float getFloat(long address, boolean bigEndian)
  {
    return Float.intBitsToFloat(getInt(address, bigEndian));
  }
  
  public double getDouble(long address, boolean bigEndian)
  {
    return Double.longBitsToDouble(getLong(address, bigEndian));
  }
}

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

import sun.jvm.hotspot.utilities.Assert;

public class PageCache
{
  private boolean enabled;
  private long pageSize;
  private long maxNumPages;
  private long pageMask;
  private long numPages;
  private PageFetcher fetcher;
  private LongHashMap addressToPageMap;
  private Page lruList;
  
  public PageCache(long pageSize, long maxNumPages, PageFetcher fetcher)
  {
    checkPageInfo(pageSize, maxNumPages);
    this.pageSize = pageSize;
    this.maxNumPages = maxNumPages;
    this.fetcher = fetcher;
    addressToPageMap = new LongHashMap();
    enabled = true;
  }
  
  public synchronized byte[] getData(long startAddress, long numBytes)
    throws UnmappedAddressException
  {
    byte[] data = new byte[(int)numBytes];
    long numRead = 0L;
    while (numBytes > 0L)
    {
      long pageBaseAddress = startAddress & pageMask;
      
      Page page = checkPage(getPage(pageBaseAddress), startAddress);
      
      long pageOffset = startAddress - pageBaseAddress;
      long numBytesFromPage = Math.min(pageSize - pageOffset, numBytes);
      
      page.getDataAsBytes(startAddress, numBytesFromPage, data, numRead);
      
      numRead += numBytesFromPage;
      numBytes -= numBytesFromPage;
      startAddress += numBytesFromPage;
    }
    return data;
  }
  
  public synchronized boolean getBoolean(long address)
  {
    return getByte(address) != 0;
  }
  
  public synchronized byte getByte(long address)
  {
    return checkPage(getPage(address & pageMask), address).getByte(address);
  }
  
  public synchronized short getShort(long address, boolean bigEndian)
  {
    return checkPage(getPage(address & pageMask), address).getShort(address, bigEndian);
  }
  
  public synchronized char getChar(long address, boolean bigEndian)
  {
    return checkPage(getPage(address & pageMask), address).getChar(address, bigEndian);
  }
  
  public synchronized int getInt(long address, boolean bigEndian)
  {
    return checkPage(getPage(address & pageMask), address).getInt(address, bigEndian);
  }
  
  public synchronized long getLong(long address, boolean bigEndian)
  {
    return checkPage(getPage(address & pageMask), address).getLong(address, bigEndian);
  }
  
  public synchronized float getFloat(long address, boolean bigEndian)
  {
    return checkPage(getPage(address & pageMask), address).getFloat(address, bigEndian);
  }
  
  public synchronized double getDouble(long address, boolean bigEndian)
  {
    return checkPage(getPage(address & pageMask), address).getDouble(address, bigEndian);
  }
  
  public synchronized void clear(long startAddress, long numBytes)
  {
    long pageBaseAddress = startAddress & pageMask;
    long endAddress = startAddress + numBytes;
    while (pageBaseAddress < endAddress)
    {
      flushPage(pageBaseAddress);
      pageBaseAddress += pageSize;
    }
  }
  
  public synchronized void clear()
  {
    addressToPageMap.clear();
    lruList = null;
    numPages = 0L;
  }
  
  public synchronized void disable()
  {
    enabled = false;
    clear();
  }
  
  public synchronized void enable()
  {
    enabled = true;
  }
  
  private Page getPage(long pageBaseAddress)
  {
    if ((lruList != null) && 
      (lruList.getBaseAddress() == pageBaseAddress)) {
      return lruList;
    }
    long key = pageBaseAddress;
    Page page = (Page)addressToPageMap.get(key);
    if (page == null)
    {
      page = fetcher.fetchPage(pageBaseAddress, pageSize);
      if (enabled)
      {
        addressToPageMap.put(key, page);
        if (Assert.ASSERTS_ENABLED) {
          Assert.that(page == (Page)addressToPageMap.get(pageBaseAddress), "must have found page in cache!");
        }
        addPageToList(page);
        if (numPages == maxNumPages)
        {
          Page evictedPage = lruList.getPrev();
          
          removePageFromList(evictedPage);
          addressToPageMap.remove(evictedPage.getBaseAddress());
        }
        else
        {
          numPages += 1L;
        }
      }
    }
    else
    {
      removePageFromList(page);
      addPageToList(page);
    }
    return page;
  }
  
  private Page checkPage(Page page, long startAddress)
  {
    if (!page.isMapped()) {
      throw new UnmappedAddressException(startAddress);
    }
    return page;
  }
  
  private int countPages()
  {
    Page page = lruList;
    int num = 0;
    if (page == null) {
      return num;
    }
    do
    {
      num++;
      page = page.getNext();
    } while (page != lruList);
    return num;
  }
  
  private void flushPage(long pageBaseAddress)
  {
    long key = pageBaseAddress;
    Page page = (Page)addressToPageMap.remove(key);
    if (page != null) {
      removePageFromList(page);
    }
  }
  
  private void addPageToList(Page page)
  {
    if (lruList == null)
    {
      lruList = page;
      page.setNext(page);
      page.setPrev(page);
    }
    else
    {
      page.setNext(lruList);
      page.setPrev(lruList.getPrev());
      lruList.getPrev().setNext(page);
      lruList.setPrev(page);
      lruList = page;
    }
  }
  
  private void removePageFromList(Page page)
  {
    if (page.getNext() == page)
    {
      lruList = null;
    }
    else
    {
      if (lruList == page) {
        lruList = page.getNext();
      }
      page.getPrev().setNext(page.getNext());
      page.getNext().setPrev(page.getPrev());
    }
    page.setPrev(null);
    page.setNext(null);
  }
  
  private void checkPageInfo(long pageSize, long maxNumPages)
  {
    if ((pageSize <= 0L) || (maxNumPages <= 0L)) {
      throw new IllegalArgumentException("pageSize and maxNumPages must both be greater than zero");
    }
    long tmpPageSize = pageSize >>> 32;
    if (tmpPageSize != 0L) {
      throw new IllegalArgumentException("pageSize " + pageSize + " too big (must fit within 32 bits)");
    }
    int numNonZeroBits = 0;
    for (int i = 0; i < 32; i++)
    {
      if ((pageSize & 1L) != 0L)
      {
        numNonZeroBits++;
        if ((numNonZeroBits > 1) || (i == 0)) {
          throw new IllegalArgumentException("pageSize " + pageSize + " must be a power of two");
        }
      }
      pageSize >>>= 1;
      if (numNonZeroBits == 0) {
        pageMask = (pageMask << 1 | 1L);
      }
    }
    pageMask ^= 0xFFFFFFFFFFFFFFFF;
  }
}

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

public abstract interface PageFetcher
{
  public abstract Page fetchPage(long paramLong1, long paramLong2);
}

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

import java.io.IOException;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DataSource;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.UnmappedAddressException;

class AddressDataSource
  implements DataSource
{
  private Address addr;
  private long offset;
  
  AddressDataSource(Address addr)
  {
    this.addr = addr;
    offset = 0L;
  }
  
  public byte readByte()
    throws IOException
  {
    try
    {
      byte res = (byte)(int)addr.getCIntegerAt(offset, 1L, false);
      offset += 1L;
      return res;
    }
    catch (UnmappedAddressException e)
    {
      throw ((IOException)new IOException("Unmapped address at 0x" + Long.toHexString(e.getAddress())).initCause(e));
    }
    catch (DebuggerException e)
    {
      throw ((IOException)new IOException().initCause(e));
    }
  }
  
  public short readShort()
    throws IOException
  {
    int b1 = readByte() & 0xFF;
    int b2 = readByte() & 0xFF;
    return (short)(b1 << 8 | b2);
  }
  
  public int readInt()
    throws IOException
  {
    int b1 = readByte() & 0xFF;
    int b2 = readByte() & 0xFF;
    int b3 = readByte() & 0xFF;
    int b4 = readByte() & 0xFF;
    return b1 << 24 | b2 << 16 | b3 << 8 | b4;
  }
  
  public long readLong()
    throws IOException
  {
    long b1 = readByte() & 0xFF;
    long b2 = readByte() & 0xFF;
    long b3 = readByte() & 0xFF;
    long b4 = readByte() & 0xFF;
    long b5 = readByte() & 0xFF;
    long b6 = readByte() & 0xFF;
    long b7 = readByte() & 0xFF;
    long b8 = readByte() & 0xFF;
    return (b1 << 24 | b2 << 16 | b3 << 8 | b4) << 32 | b5 << 24 | b6 << 16 | b7 << 8 | b8;
  }
  
  public int read(byte[] b)
    throws IOException
  {
    for (int i = 0; i < b.length; i++) {
      b[i] = readByte();
    }
    return b.length;
  }
  
  public void seek(long pos)
    throws IOException
  {
    offset = pos;
  }
  
  public long getFilePointer()
    throws IOException
  {
    return offset;
  }
  
  public void close()
    throws IOException
  {}
}

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

import sun.jvm.hotspot.debugger.posix.elf.ELFFileParser;
import sun.jvm.hotspot.utilities.memo.MemoizedObject;

class DSO$ELFFileByAddress
  extends MemoizedObject
{
  private final DSO this$0;
  
  DSO$ELFFileByAddress(DSO paramDSO) {}
  
  protected Object computeValue()
  {
    return ELFFileParser.getParser().parse(new AddressDataSource(DSO.access$100(this$0)));
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.DSO.ELFFileByAddress
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix;

import sun.jvm.hotspot.debugger.posix.elf.ELFFileParser;
import sun.jvm.hotspot.utilities.memo.MemoizedObject;

class DSO$ELFFileByName
  extends MemoizedObject
{
  private final DSO this$0;
  
  DSO$ELFFileByName(DSO paramDSO) {}
  
  protected Object computeValue()
  {
    return ELFFileParser.getParser().parse(DSO.access$000(this$0));
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.DSO.ELFFileByName
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix;

import sun.jvm.hotspot.debugger.posix.elf.ELFFile;
import sun.jvm.hotspot.debugger.posix.elf.ELFHeader;
import sun.jvm.hotspot.utilities.memo.MemoizedBoolean;

class DSO$IsDSO
  extends MemoizedBoolean
{
  private final DSO this$0;
  
  DSO$IsDSO(DSO paramDSO) {}
  
  protected boolean computeValue()
  {
    return this$0.getFile().getHeader().getFileType() == 3;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.DSO.IsDSO
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix;

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.cdbg.BlockSym;
import sun.jvm.hotspot.debugger.cdbg.CDebugInfoDataBase;
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;
import sun.jvm.hotspot.debugger.cdbg.LineNumberInfo;
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
import sun.jvm.hotspot.debugger.posix.elf.ELFException;
import sun.jvm.hotspot.debugger.posix.elf.ELFFile;
import sun.jvm.hotspot.debugger.posix.elf.ELFFileParser;
import sun.jvm.hotspot.debugger.posix.elf.ELFHeader;
import sun.jvm.hotspot.debugger.posix.elf.ELFSymbol;
import sun.jvm.hotspot.utilities.memo.MemoizedBoolean;
import sun.jvm.hotspot.utilities.memo.MemoizedObject;

public abstract class DSO
  implements LoadObject
{
  private MemoizedObject file;
  private String filename;
  private Address addr;
  private long size;
  private IsDSO dso = new IsDSO();
  
  class IsDSO
    extends MemoizedBoolean
  {
    IsDSO() {}
    
    protected boolean computeValue()
    {
      return getFile().getHeader().getFileType() == 3;
    }
  }
  
  class ELFFileByName
    extends MemoizedObject
  {
    ELFFileByName() {}
    
    protected Object computeValue()
    {
      return ELFFileParser.getParser().parse(filename);
    }
  }
  
  class ELFFileByAddress
    extends MemoizedObject
  {
    ELFFileByAddress() {}
    
    protected Object computeValue()
    {
      return ELFFileParser.getParser().parse(new AddressDataSource(addr));
    }
  }
  
  public DSO(String filename, long size, Address relocation)
    throws ELFException
  {
    this.filename = filename;
    this.size = size;
    addr = relocation;
    file = new ELFFileByName();
  }
  
  public DSO(long size, Address relocation)
    throws ELFException
  {
    addr = relocation;
    this.size = size;
    file = new ELFFileByAddress();
  }
  
  public String getName()
  {
    return filename;
  }
  
  public Address getBase()
  {
    return addr;
  }
  
  public void setBase(Address newBase)
  {
    addr = newBase;
    if (filename == null)
    {
      file = new ELFFileByAddress();
      dso = new IsDSO();
    }
  }
  
  public long getSize()
  {
    return size;
  }
  
  public CDebugInfoDataBase getDebugInfoDataBase()
    throws DebuggerException
  {
    return null;
  }
  
  public BlockSym debugInfoForPC(Address pc)
    throws DebuggerException
  {
    return null;
  }
  
  public ClosestSymbol closestSymbolToPC(Address pcAsAddr)
    throws DebuggerException
  {
    boolean dso = isDSO();
    long offset = dso ? pcAsAddr.minus(addr) : getAddressValue(pcAsAddr);
    ELFSymbol sym = getFile().getHeader().getELFSymbol(offset);
    return sym != null ? createClosestSymbol(sym.getName(), offset - sym.getValue()) : null;
  }
  
  public LineNumberInfo lineNumberForPC(Address pc)
    throws DebuggerException
  {
    return null;
  }
  
  public boolean isDSO()
  {
    return dso.getValue();
  }
  
  public Address lookupSymbol(String symbol)
    throws ELFException
  {
    ELFSymbol sym = getFile().getHeader().getELFSymbol(symbol);
    if (sym == null) {
      return null;
    }
    long value = sym.getValue();
    if (isDSO()) {
      return addr.addOffsetTo(value);
    }
    return newAddress(value);
  }
  
  public boolean equals(Object o)
  {
    if ((o == null) || (!(o instanceof DSO))) {
      return false;
    }
    DSO other = (DSO)o;
    return getBase().equals(other.getBase());
  }
  
  public int hashCode()
  {
    return getBase().hashCode();
  }
  
  protected ELFFile getFile()
  {
    return (ELFFile)file.getValue();
  }
  
  protected abstract Address newAddress(long paramLong);
  
  protected abstract long getAddressValue(Address paramAddress);
  
  protected ClosestSymbol createClosestSymbol(String name, long diff)
  {
    return new ClosestSymbol(name, diff);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.DSO
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix.elf;

public class ELFException
  extends RuntimeException
{
  public ELFException() {}
  
  public ELFException(String message)
  {
    super(message);
  }
  
  public ELFException(Throwable cause)
  {
    super(cause);
  }
  
  public ELFException(String message, Throwable cause)
  {
    super(message, cause);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.elf.ELFException
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix.elf;

public abstract interface ELFFile
{
  public static final byte[] ELF_MAGIC_NUMBER = { Byte.MAX_VALUE, 69, 76, 70 };
  public static final byte CLASS_INVALID = 0;
  public static final byte CLASS_32 = 1;
  public static final byte CLASS_64 = 2;
  public static final byte DATA_INVALID = 0;
  public static final byte DATA_LSB = 1;
  public static final byte DATA_MSB = 2;
  public static final byte VERSION_INVALID = 0;
  public static final byte VERSION_CURRENT = 1;
  public static final byte NDX_MAGIC_0 = 0;
  public static final byte NDX_MAGIC_1 = 1;
  public static final byte NDX_MAGIC_2 = 2;
  public static final byte NDX_MAGIC_3 = 3;
  public static final byte NDX_OBJECT_SIZE = 4;
  public static final byte NDX_ENCODING = 5;
  public static final byte NDX_VERSION = 6;
  
  public abstract ELFHeader getHeader();
  
  public abstract void close();
  
  public abstract byte[] getMagicNumber();
  
  public abstract byte getObjectSize();
  
  public abstract byte getEncoding();
  
  public abstract byte getVersion();
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.elf.ELFFile
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix.elf;

class ELFFileParser$ELFFileImpl$ELFHashTableImpl
  implements ELFHashTable
{
  private int num_buckets;
  private int num_chains;
  private int[] buckets;
  private int[] chains;
  private final ELFFileParser.ELFFileImpl this$1;
  
  ELFFileParser$ELFFileImpl$ELFHashTableImpl(ELFFileParser.ELFFileImpl arg1, long offset, int length)
    throws ELFException
  {
    ???.seek(offset);
    num_buckets = ???.readInt();
    num_chains = ???.readInt();
    
    buckets = new int[num_buckets];
    chains = new int[num_chains];
    for (int i = 0; i < num_buckets; i++) {
      buckets[i] = ???.readInt();
    }
    for (int i = 0; i < num_chains; i++) {
      chains[i] = ???.readInt();
    }
    int actual = num_buckets * 4 + num_chains * 4 + 8;
    if (length != actual) {
      throw new ELFException("Error reading string table (read " + actual + "bytes, expected to " + "read " + length + "bytes).");
    }
  }
  
  public ELFSymbol getSymbol(String symbolName)
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.elf.ELFFileParser.ELFFileImpl.ELFHashTableImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix.elf;

import sun.jvm.hotspot.utilities.memo.MemoizedObject;

final class ELFFileParser$ELFFileImpl$ELFHeaderImpl$1
  extends MemoizedObject
{
  private final ELFFileParser.ELFFileImpl.ELFHeaderImpl this$2;
  
  ELFFileParser$ELFFileImpl$ELFHeaderImpl$1(ELFFileParser.ELFFileImpl.ELFHeaderImpl paramELFHeaderImpl, ELFFileParser.ELFFileImpl paramELFFileImpl, long paramLong) {}
  
  public Object computeValue()
  {
    return new ELFFileParser.ELFFileImpl.ELFSectionHeaderImpl(ELFFileParser.ELFFileImpl.ELFHeaderImpl.access$000(this$2), val$sectionHeaderOffset);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.debugger.posix.elf.ELFFileParser.ELFFileImpl.ELFHeaderImpl.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.posix.elf;

import sun.jvm.hotspot.utilities.memo.MemoizedObject;

class ELFFileParser$ELFFileImpl$ELFHeaderImpl
  implements ELFHeader
{
  private byte[] ident;
  private short file_type;
  private short arch;
  private int version;
  private int entry_point;
  private int ph_offset;
  private int sh_offset;
  private int flags;
  private short eh_size;
  private short ph_entry_size;
  private short num_ph;
  private short sh_entry_size;
  private short num_sh;
  private short sh_string_ndx;
  private MemoizedObject[] sectionHeaders;
  private MemoizedObject[] programHeaders;
  private ELFSectionHeader symbolTableSection;
  private ELFSectionHeader dynamicSymbolTableSection;
  private ELFHashTable hashTable;
  private final ELFFileParser.ELFFileImpl this$1;
  
  /* Error */
  ELFFileParser$ELFFileImpl$ELFHeaderImpl(ELFFileParser.ELFFileImpl arg1)
    throws ELFException
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: putfield 1	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:this$1	Lsun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl;
    //   5: aload_0
    //   6: invokespecial 2	java/lang/Object:<init>	()V
    //   9: aload_0
    //   10: bipush 16
    //   12: newarray <illegal type>
    //   14: putfield 3	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:ident	[B
    //   17: aload_0
    //   18: aload_1
    //   19: invokevirtual 4	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readShort	()S
    //   22: putfield 5	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:file_type	S
    //   25: aload_0
    //   26: aload_1
    //   27: invokevirtual 4	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readShort	()S
    //   30: putfield 6	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:arch	S
    //   33: aload_0
    //   34: aload_1
    //   35: invokevirtual 7	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readInt	()I
    //   38: putfield 8	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:version	I
    //   41: aload_0
    //   42: aload_1
    //   43: invokevirtual 7	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readInt	()I
    //   46: putfield 9	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:entry_point	I
    //   49: aload_0
    //   50: aload_1
    //   51: invokevirtual 7	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readInt	()I
    //   54: putfield 10	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:ph_offset	I
    //   57: aload_0
    //   58: aload_1
    //   59: invokevirtual 7	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readInt	()I
    //   62: putfield 11	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:sh_offset	I
    //   65: aload_0
    //   66: aload_1
    //   67: invokevirtual 7	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readInt	()I
    //   70: putfield 12	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:flags	I
    //   73: aload_0
    //   74: aload_1
    //   75: invokevirtual 4	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readShort	()S
    //   78: putfield 13	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:eh_size	S
    //   81: aload_0
    //   82: aload_1
    //   83: invokevirtual 4	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl:readShort	()S
    //   86: putfield 14	sun/jvm/hotspot/debugger/posix/elf/ELFFileParser$ELFFileImpl$ELFHeaderImpl:ph_entry_size	S
    //   89: aload_0
    //   90: aload_1
    //   91: invokevirtual 4	sun/jvm/h
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