sa-jdi

byte value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public void setJCharAt(long offset, char value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public void setJDoubleAt(long offset, double value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public void setJFloatAt(long offset, float value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public void setJIntAt(long offset, int value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public void setJLongAt(long offset, long value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public void setJShortAt(long offset, short value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public void setOopHandleAt(long offset, OopHandle value)
    throws UnmappedAddressException, UnalignedAddressException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public Address addOffsetTo(long offset)
    throws UnsupportedOperationException
  {
    long value = addr + offset;
    if (value == 0L) {
      return null;
    }
    return new ProcAddress(debugger, value);
  }
  
  public OopHandle addOffsetToAsOopHandle(long offset)
    throws UnsupportedOperationException
  {
    long value = addr + offset;
    if (value == 0L) {
      return null;
    }
    return new ProcOopHandle(debugger, value);
  }
  
  public long minus(Address arg)
  {
    if (arg == null) {
      return addr;
    }
    return addr - addr;
  }
  
  public boolean lessThan(Address arg)
  {
    if (arg == null) {
      return false;
    }
    ProcAddress dbxArg = (ProcAddress)arg;
    if ((addr >= 0L) && (addr < 0L)) {
      return true;
    }
    if ((addr < 0L) && (addr >= 0L)) {
      return false;
    }
    return addr < addr;
  }
  
  public boolean lessThanOrEqual(Address arg)
  {
    if (arg == null) {
      return false;
    }
    ProcAddress dbxArg = (ProcAddress)arg;
    if ((addr >= 0L) && (addr < 0L)) {
      return true;
    }
    if ((addr < 0L) && (addr >= 0L)) {
      return false;
    }
    return addr <= addr;
  }
  
  public boolean greaterThan(Address arg)
  {
    if (arg == null) {
      return true;
    }
    ProcAddress dbxArg = (ProcAddress)arg;
    if ((addr >= 0L) && (addr < 0L)) {
      return false;
    }
    if ((addr < 0L) && (addr >= 0L)) {
      return true;
    }
    return addr > addr;
  }
  
  public boolean greaterThanOrEqual(Address arg)
  {
    if (arg == null) {
      return true;
    }
    ProcAddress dbxArg = (ProcAddress)arg;
    if ((addr >= 0L) && (addr < 0L)) {
      return false;
    }
    if ((addr < 0L) && (addr >= 0L)) {
      return true;
    }
    return addr >= addr;
  }
  
  public Address andWithMask(long mask)
    throws UnsupportedOperationException
  {
    long value = addr & mask;
    if (value == 0L) {
      return null;
    }
    return new ProcAddress(debugger, value);
  }
  
  public Address orWithMask(long mask)
    throws UnsupportedOperationException
  {
    long value = addr | mask;
    if (value == 0L) {
      return null;
    }
    return new ProcAddress(debugger, value);
  }
  
  public Address xorWithMask(long mask)
    throws UnsupportedOperationException
  {
    long value = addr ^ mask;
    if (value == 0L) {
      return null;
    }
    return new ProcAddress(debugger, value);
  }
  
  long getValue()
  {
    return addr;
  }
  
  private static void check(boolean arg, String failMessage)
  {
    if (!arg)
    {
      System.err.println(failMessage + ": FAILED");
      System.exit(1);
    }
  }
  
  public static void main(String[] args)
  {
    ProcAddress p1 = new ProcAddress(null, 9223372036854775792L);
    ProcAddress p2 = (ProcAddress)p1.addOffsetTo(10L);
    ProcAddress n1 = (ProcAddress)p2.addOffsetTo(10L);
    ProcAddress n2 = (ProcAddress)n1.addOffsetTo(10L);
    
    check(p1.lessThan(p2), "lessThan 1");
    check(p1.lessThan(n1), "lessThan 2");
    check(p1.lessThan(n2), "lessThan 3");
    check(p2.lessThan(n1), "lessThan 4");
    check(p2.lessThan(n2), "lessThan 5");
    check(n1.lessThan(n2), "lessThan 6");
    
    check(!p1.lessThan(p1), "lessThan 7");
    check(!p2.lessThan(p2), "lessThan 8");
    check(!n1.lessThan(n1), "lessThan 9");
    check(!n2.lessThan(n2), "lessThan 10");
    
    check(!p2.lessThan(p1), "lessThan 11");
    check(!n1.lessThan(p1), "lessThan 12");
    check(!n2.lessThan(p1), "lessThan 13");
    check(!n1.lessThan(p2), "lessThan 14");
    check(!n2.lessThan(p2), "lessThan 15");
    check(!n2.lessThan(n1), "lessThan 16");
    
    check(p1.lessThanOrEqual(p1), "lessThanOrEqual 1");
    check(p2.lessThanOrEqual(p2), "lessThanOrEqual 2");
    check(n1.lessThanOrEqual(n1), "lessThanOrEqual 3");
    check(n2.lessThanOrEqual(n2), "lessThanOrEqual 4");
    
    check(p1.lessThanOrEqual(p2), "lessThanOrEqual 5");
    check(p1.lessThanOrEqual(n1), "lessThanOrEqual 6");
    check(p1.lessThanOrEqual(n2), "lessThanOrEqual 7");
    check(p2.lessThanOrEqual(n1), "lessThanOrEqual 8");
    check(p2.lessThanOrEqual(n2), "lessThanOrEqual 9");
    check(n1.lessThanOrEqual(n2), "lessThanOrEqual 10");
    
    check(!p2.lessThanOrEqual(p1), "lessThanOrEqual 11");
    check(!n1.lessThanOrEqual(p1), "lessThanOrEqual 12");
    check(!n2.lessThanOrEqual(p1), "lessThanOrEqual 13");
    check(!n1.lessThanOrEqual(p2), "lessThanOrEqual 14");
    check(!n2.lessThanOrEqual(p2), "lessThanOrEqual 15");
    check(!n2.lessThanOrEqual(n1), "lessThanOrEqual 16");
    
    check(n2.greaterThan(p1), "greaterThan 1");
    check(n2.greaterThan(p2), "greaterThan 2");
    check(n2.greaterThan(n1), "greaterThan 3");
    check(n1.greaterThan(p1), "greaterThan 4");
    check(n1.greaterThan(p2), "greaterThan 5");
    check(p2.greaterThan(p1), "greaterThan 6");
    
    check(!p1.greaterThan(p1), "greaterThan 7");
    check(!p2.greaterThan(p2), "greaterThan 8");
    check(!n1.greaterThan(n1), "greaterThan 9");
    check(!n2.greaterThan(n2), "greaterThan 10");
    
    check(!p1.greaterThan(n2), "greaterThan 11");
    check(!p2.greaterThan(n2), "greaterThan 12");
    check(!n1.greaterThan(n2), "greaterThan 13");
    check(!p1.greaterThan(n1), "greaterThan 14");
    check(!p2.greaterThan(n1), "greaterThan 15");
    check(!p1.greaterThan(p2), "greaterThan 16");
    
    check(p1.greaterThanOrEqual(p1), "greaterThanOrEqual 1");
    check(p2.greaterThanOrEqual(p2), "greaterThanOrEqual 2");
    check(n1.greaterThanOrEqual(n1), "greaterThanOrEqual 3");
    check(n2.greaterThanOrEqual(n2), "greaterThanOrEqual 4");
    
    check(n2.greaterThanOrEqual(p1), "greaterThanOrEqual 5");
    check(n2.greaterThanOrEqual(p2), "greaterThanOrEqual 6");
    check(n2.greaterThanOrEqual(n1), "greaterThanOrEqual 7");
    check(n1.greaterThanOrEqual(p1), "greaterThanOrEqual 8");
    check(n1.greaterThanOrEqual(p2), "greaterThanOrEqual 9");
    check(p2.greaterThanOrEqual(p1), "greaterThanOrEqual 10");
    
    check(!p1.greaterThanOrEqual(n2), "greaterThanOrEqual 11");
    check(!p2.greaterThanOrEqual(n2), "greaterThanOrEqual 12");
    check(!n1.greaterThanOrEqual(n2), "greaterThanOrEqual 13");
    check(!p1.greaterThanOrEqual(n1), "greaterThanOrEqual 14");
    check(!p2.greaterThanOrEqual(n1), "greaterThanOrEqual 15");
    check(!p1.greaterThanOrEqual(p2), "greaterThanOrEqual 16");
    
    System.err.println("ProcAddress: all tests passed successfully.");
  }
}

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

import java.io.File;
import java.util.List;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.cdbg.CDebugger;
import sun.jvm.hotspot.debugger.cdbg.CFrame;
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
import sun.jvm.hotspot.debugger.cdbg.ProcessControl;

class ProcCDebugger
  implements CDebugger
{
  private ProcDebugger dbg;
  
  ProcCDebugger(ProcDebugger dbg)
  {
    this.dbg = dbg;
  }
  
  public List getThreadList()
    throws DebuggerException
  {
    return dbg.getThreadList();
  }
  
  public List getLoadObjectList()
    throws DebuggerException
  {
    return dbg.getLoadObjectList();
  }
  
  public LoadObject loadObjectContainingPC(Address pc)
    throws DebuggerException
  {
    if (pc == null) {
      return null;
    }
    List objs = getLoadObjectList();
    Object[] arr = objs.toArray();
    
    int mid = -1;
    int low = 0;
    int high = arr.length - 1;
    while (low <= high)
    {
      mid = low + high >> 1;
      LoadObject midVal = (LoadObject)arr[mid];
      long cmp = pc.minus(midVal.getBase());
      if (cmp < 0L)
      {
        high = mid - 1;
      }
      else if (cmp > 0L)
      {
        long size = midVal.getSize();
        if (cmp >= size) {
          low = mid + 1;
        } else {
          return (LoadObject)arr[mid];
        }
      }
      else
      {
        return (LoadObject)arr[mid];
      }
    }
    return null;
  }
  
  public CFrame topFrameForThread(ThreadProxy thread)
    throws DebuggerException
  {
    return dbg.topFrameForThread(thread);
  }
  
  public String getNameOfFile(String fileName)
  {
    return new File(fileName).getName();
  }
  
  public ProcessControl getProcessControl()
    throws DebuggerException
  {
    return null;
  }
  
  public boolean canDemangle()
  {
    return true;
  }
  
  public String demangle(String sym)
  {
    return dbg.demangle(sym);
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.cdbg.CFrame;
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;
import sun.jvm.hotspot.debugger.cdbg.basic.BasicCFrame;

final class ProcCFrame
  extends BasicCFrame
{
  private Address pc;
  private Address fp;
  private ProcCFrame sender;
  private ProcDebugger procDbg;
  
  public Address pc()
  {
    return pc;
  }
  
  public Address localVariableBase()
  {
    return fp;
  }
  
  public CFrame sender(ThreadProxy t)
  {
    return sender;
  }
  
  public ClosestSymbol closestSymbolToPC()
  {
    return procDbg.lookup(procDbg.getAddressValue(pc));
  }
  
  ProcCFrame(ProcDebugger dbg, Address pc, Address fp)
  {
    super(dbg.getCDebugger());
    this.pc = pc;
    this.fp = fp;
    procDbg = dbg;
  }
  
  void setSender(ProcCFrame sender)
  {
    this.sender = sender;
  }
}

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

import java.util.List;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.MachineDescription;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.cdbg.CFrame;
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;

public abstract interface ProcDebugger
  extends JVMDebugger
{
  public abstract MachineDescription getMachineDescription()
    throws DebuggerException;
  
  public abstract String addressValueToString(long paramLong)
    throws DebuggerException;
  
  public abstract boolean readJBoolean(long paramLong)
    throws DebuggerException;
  
  public abstract byte readJByte(long paramLong)
    throws DebuggerException;
  
  public abstract char readJChar(long paramLong)
    throws DebuggerException;
  
  public abstract double readJDouble(long paramLong)
    throws DebuggerException;
  
  public abstract float readJFloat(long paramLong)
    throws DebuggerException;
  
  public abstract int readJInt(long paramLong)
    throws DebuggerException;
  
  public abstract long readJLong(long paramLong)
    throws DebuggerException;
  
  public abstract short readJShort(long paramLong)
    throws DebuggerException;
  
  public abstract long readCInteger(long paramLong1, long paramLong2, boolean paramBoolean)
    throws DebuggerException;
  
  public abstract ProcAddress readAddress(long paramLong)
    throws DebuggerException;
  
  public abstract ProcAddress readCompOopAddress(long paramLong)
    throws DebuggerException;
  
  public abstract ProcOopHandle readOopHandle(long paramLong)
    throws DebuggerException;
  
  public abstract ProcOopHandle readCompOopHandle(long paramLong)
    throws DebuggerException;
  
  public abstract long[] getThreadIntegerRegisterSet(int paramInt)
    throws DebuggerException;
  
  public abstract long getAddressValue(Address paramAddress)
    throws DebuggerException;
  
  public abstract Address newAddress(long paramLong)
    throws DebuggerException;
  
  public abstract List getThreadList()
    throws DebuggerException;
  
  public abstract List getLoadObjectList()
    throws DebuggerException;
  
  public abstract CFrame topFrameForThread(ThreadProxy paramThreadProxy)
    throws DebuggerException;
  
  public abstract ClosestSymbol lookup(long paramLong)
    throws DebuggerException;
  
  public abstract String demangle(String paramString);
}

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

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DebuggerBase;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.DebuggerUtilities;
import sun.jvm.hotspot.debugger.MachineDescription;
import sun.jvm.hotspot.debugger.NotInHeapException;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.debugger.ReadResult;
import sun.jvm.hotspot.debugger.ThreadContext;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.UnalignedAddressException;
import sun.jvm.hotspot.debugger.UnmappedAddressException;
import sun.jvm.hotspot.debugger.cdbg.CDebugger;
import sun.jvm.hotspot.debugger.cdbg.CFrame;
import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
import sun.jvm.hotspot.debugger.cdbg.LoadObjectComparator;
import sun.jvm.hotspot.debugger.proc.amd64.ProcAMD64ThreadFactory;
import sun.jvm.hotspot.debugger.proc.sparc.ProcSPARCThreadFactory;
import sun.jvm.hotspot.debugger.proc.x86.ProcX86ThreadFactory;
import sun.jvm.hotspot.utilities.PlatformInfo;

public class ProcDebuggerLocal
  extends DebuggerBase
  implements ProcDebugger
{
  protected static final int cacheSize = 16777216;
  
  public ProcDebuggerLocal(MachineDescription machDesc, boolean useCache)
  {
    this.machDesc = machDesc;
    
    String cpu = PlatformInfo.getCPU();
    if (cpu.equals("sparc"))
    {
      threadFactory = new ProcSPARCThreadFactory(this);
      pcRegIndex = 33;
      fpRegIndex = 30;
    }
    else if (cpu.equals("x86"))
    {
      threadFactory = new ProcX86ThreadFactory(this);
      pcRegIndex = 14;
      fpRegIndex = 6;
      unalignedAccessesOkay = true;
    }
    else if (cpu.equals("amd64"))
    {
      threadFactory = new ProcAMD64ThreadFactory(this);
      pcRegIndex = 17;
      fpRegIndex = 10;
    }
    else
    {
      throw new RuntimeException("Thread access for CPU architecture " + PlatformInfo.getCPU() + " not yet supported");
    }
    if (useCache)
    {
      int cachePageSize = getPageSize();
      int cacheNumPages = parseCacheNumPagesProperty(16777216 / cachePageSize);
      initCache(cachePageSize, cacheNumPages);
    }
    resetNativePointers();
    clearCacheFields();
  }
  
  public boolean hasProcessList()
    throws DebuggerException
  {
    return false;
  }
  
  public List getProcessList()
    throws DebuggerException
  {
    throw new DebuggerException("Not yet supported");
  }
  
  public synchronized void attach(int processID)
    throws DebuggerException
  {
    checkAttached();
    isCore = false;
    attach0(new Integer(processID).toString());
    attached = true;
    suspended = true;
  }
  
  public synchronized void attach(String executableName, String coreFileName)
    throws DebuggerException
  {
    checkAttached();
    isCore = true;
    topFrameCache = new HashMap();
    attach0(executableName, coreFileName);
    attached = true;
    suspended = true;
  }
  
  public synchronized boolean detach()
  {
    if (!attached) {
      return false;
    }
    try
    {
      boolean bool1;
      if (p_ps_prochandle == 0L) {
        return false;
      }
      detach0();
      clearCache();
      return true;
    }
    catch (Exception e)
    {
      e.printStackTrace();
      return false;
    }
    finally
    {
      resetNativePointers();
      clearCacheFields();
      suspended = false;
      attached = false;
    }
  }
  
  public synchronized void suspend()
    throws DebuggerException
  {
    requireAttach();
    if (suspended) {
      throw new DebuggerException("Process already suspended");
    }
    suspend0();
    suspended = true;
    enableCache();
    reresolveLoadObjects();
  }
  
  public synchronized void resume()
    throws DebuggerException
  {
    requireAttach();
    if (!suspended) {
      throw new DebuggerException("Process not suspended");
    }
    resume0();
    disableCache();
    suspended = false;
  }
  
  public synchronized boolean isSuspended()
    throws DebuggerException
  {
    requireAttach();
    return suspended;
  }
  
  public Address parseAddress(String addressString)
    throws NumberFormatException
  {
    long addr = utils.scanAddress(addressString);
    if (addr == 0L) {
      return null;
    }
    return new ProcAddress(this, addr);
  }
  
  public String getOS()
  {
    return PlatformInfo.getOS();
  }
  
  public String getCPU()
  {
    return PlatformInfo.getCPU();
  }
  
  public boolean hasConsole()
    throws DebuggerException
  {
    return false;
  }
  
  public String consoleExecuteCommand(String cmd)
    throws DebuggerException
  {
    throw new DebuggerException("Can't execute console commands");
  }
  
  public String getConsolePrompt()
    throws DebuggerException
  {
    return "";
  }
  
  public CDebugger getCDebugger()
    throws DebuggerException
  {
    if (cdbg == null) {
      cdbg = new ProcCDebugger(this);
    }
    return cdbg;
  }
  
  public synchronized Address lookup(String objectName, String symbol)
  {
    requireAttach();
    long addr = lookupByName0(objectName, symbol);
    if (addr == 0L) {
      return null;
    }
    return new ProcAddress(this, addr);
  }
  
  public synchronized OopHandle lookupOop(String objectName, String symbol)
  {
    Address addr = lookup(objectName, symbol);
    if (addr == null) {
      return null;
    }
    return addr.addOffsetToAsOopHandle(0L);
  }
  
  public MachineDescription getMachineDescription()
  {
    return machDesc;
  }
  
  public void setMachineDescription(MachineDescription machDesc)
  {
    this.machDesc = machDesc;
    setBigEndian(machDesc.isBigEndian());
    utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian());
  }
  
  public synchronized int getRemoteProcessAddressSize()
    throws DebuggerException
  {
    requireAttach();
    return getRemoteProcessAddressSize0();
  }
  
  public ThreadProxy getThreadForIdentifierAddress(Address addr)
  {
    return threadFactory.createThreadWrapper(addr);
  }
  
  public ThreadProxy getThreadForThreadId(long id)
  {
    return threadFactory.createThreadWrapper(id);
  }
  
  public long readJLong(long address)
    throws UnmappedAddressException, UnalignedAddressException
  {
    checkJavaConfigured();
    if (unalignedAccessesOkay) {
      utils.checkAlignment(address, jintSize);
    } else {
      utils.checkAlignment(address, jlongSize);
    }
    byte[] data = readBytes(address, jlongSize);
    return utils.dataToJLong(data, jlongSize);
  }
  
  public String addressValueToString(long address)
  {
    return utils.addressValueToString(address);
  }
  
  public long readCInteger(long address, long numBytes, boolean isUnsigned)
    throws UnmappedAddressException, UnalignedAddressException
  {
    checkConfigured();
    if (!unalignedAccessesOkay) {
      utils.checkAlignment(address, numBytes);
    } else if (numBytes == 8L) {
      utils.checkAlignment(address, 4L);
    } else {
      utils.checkAlignment(address, numBytes);
    }
    byte[] data = readBytes(address, numBytes);
    return utils.dataToCInteger(data, isUnsigned);
  }
  
  public ProcAddress readAddress(long address)
    throws UnmappedAddressException, UnalignedAddressException
  {
    long value = readAddressValue(address);
    return value == 0L ? null : new ProcAddress(this, value);
  }
  
  public ProcAddress readCompOopAddress(long address)
    throws UnmappedAddressException, UnalignedAddressException
  {
    long value = readCompOopAddressValue(address);
    return value == 0L ? null : new ProcAddress(this, value);
  }
  
  public ProcOopHandle readOopHandle(long address)
    throws UnmappedAddressException, UnalignedAddressException, NotInHeapException
  {
    long value = readAddressValue(address);
    return value == 0L ? null : new ProcOopHandle(this, value);
  }
  
  public ProcOopHandle readCompOopHandle(long address)
  {
    long value = readCompOopAddressValue(address);
    return value == 0L ? null : new ProcOopHandle(this, value);
  }
  
  public void writeBytesToProcess(long address, long numBytes, byte[] data)
    throws UnmappedAddressException, DebuggerException
  {
    if (isCore) {
      throw new DebuggerException("Attached to a core file!");
    }
    writeBytesToProcess0(address, numBytes, data);
  }
  
  public synchronized ReadResult readBytesFromProcess(long address, long numBytes)
    throws DebuggerException
  {
    requireAttach();
    byte[] res = readBytesFromProcess0(address, numBytes);
    if (res != null) {
      return new ReadResult(res);
    }
    return new ReadResult(address);
  }
  
  protected int getPageSize()
  {
    int pagesize = getPageSize0();
    if (pagesize == -1) {
      pagesize = PlatformInfo.getCPU().equals("x86") ? 4096 : 8192;
    }
    return pagesize;
  }
  
  public synchronized long[] getThreadIntegerRegisterSet(int tid)
  {
    requireAttach();
    return getThreadIntegerRegisterSet0(tid);
  }
  
  public long getAddressValue(Address addr)
  {
    if (addr == null) {
      return 0L;
    }
    return ((ProcAddress)addr).getValue();
  }
  
  public Address newAddress(long value)
  {
    if (value == 0L) {
      return null;
    }
    return new ProcAddress(this, value);
  }
  
  public synchronized List getThreadList()
    throws DebuggerException
  {
    requireAttach();
    List res = null;
    if ((isCore) && (threadListCache != null))
    {
      res = threadListCache;
    }
    else
    {
      res = new ArrayList();
      fillThreadList0(res);
      if (isCore) {
        threadListCache = res;
      }
    }
    return res;
  }
  
  public synchronized List getLoadObjectList()
    throws DebuggerException
  {
    requireAttach();
    if (!suspended) {
      throw new DebuggerException("Process not suspended");
    }
    if (loadObjectCache == null) {
      updateLoadObjectCache();
    }
    return loadObjectCache;
  }
  
  public synchronized CFrame topFrameForThread(ThreadProxy thread)
    throws DebuggerException
  {
    requireAttach();
    CFrame res = null;
    if ((isCore) && ((res = (CFrame)topFrameCache.get(thread)) != null)) {
      return res;
    }
    ThreadContext context = thread.getContext();
    int numRegs = context.getNumRegisters();
    long[] regs = new long[numRegs];
    for (int i = 0; i < numRegs; i++) {
      regs[i] = context.getRegister(i);
    }
    res = fillCFrameList0(regs);
    if (isCore) {
      topFrameCache.put(thread, res);
    }
    return res;
  }
  
  public synchronized ClosestSymbol lookup(long address)
  {
    requireAttach();
    return lookupByAddress0(address);
  }
  
  public String demangle(String name)
  {
    return demangle0(name);
  }
  
  private void updateLoadObjectCache()
  {
    List res = new ArrayList();
    nameToDsoMap = new HashMap();
    fillLoadObjectList0(res);
    loadObjectCache = sortLoadObjects(res);
  }
  
  private static List sortLoadObjects(List in)
  {
    Object[] arr = in.toArray();
    Arrays.sort(arr, loadObjectComparator);
    return Arrays.asList(arr);
  }
  
  private long lookupByName(String objectName, String symbolName)
    throws DebuggerException
  {
    if (nameToDsoMap == null) {
      getLoadObjectList();
    }
    SharedObject dso = (SharedObject)nameToDsoMap.get(objectName);
    if (dso != null)
    {
      ProcAddress addr = (ProcAddress)dso.lookupSymbol(symbolName);
      if (addr != null) {
        return addr.getValue();
      }
    }
    return 0L;
  }
  
  private SharedObject findDSOByName(String fullPathName)
  {
    if (loadObjectCache == null) {
      return null;
    }
    for (Iterator iter = loadObjectCache.iterator(); iter.hasNext();)
    {
      SharedObject dso = (SharedObject)iter.next();
      if (dso.getName().equals(fullPathName)) {
        return dso;
      }
    }
    return null;
  }
  
  private void reresolveLoadObjects()
    throws DebuggerException
  {
    if (loadObjectCache == null) {
      return;
    }
    updateLoadObjectCache();
  }
  
  private void checkAttached()
  {
    if (attached)
    {
      if (isCore) {
        throw new DebuggerException("already attached to a core file!");
      }
      throw new DebuggerException("already attached to a process!");
    }
  }
  
  private void requireAttach()
  {
    if (!attached) {
      throw new RuntimeException("not attached to a process or core file!");
    }
  }
  
  private void clearCacheFields()
  {
    loadObjectCache = null;
    nameToDsoMap = null;
    threadListCache = null;
    topFrameCache = null;
  }
  
  private void resetNativePointers()
  {
    p_ps_prochandle = 0L;
    
    libthread_db_handle = 0L;
    p_td_thragent_t = 0L;
    p_td_init = 0L;
    p_td_ta_new = 0L;
    p_td_ta_delete = 0L;
    p_td_ta_thr_iter = 0L;
    p_td_thr_get_info = 0L;
    p_td_ta_map_id2thr = 0L;
    p_td_thr_getgregs = 0L;
    
    classes_jsa_fd = -1;
    p_file_map_header = 0L;
  }
  
  private native void attach0(String paramString)
    throws DebuggerException;
  
  private native void attach0(String paramString1, String paramString2)
    throws DebuggerException;
  
  private native void detach0()
    throws DebuggerException;
  
  private native int getRemoteProcessAddressSize0()
    throws DebuggerException;
  
  private native int getPageSize0()
    throws DebuggerException;
  
  private native long[] getThreadIntegerRegisterSet0(long paramLong)
    throws DebuggerException;
  
  private native void fillThreadList0(List paramList)
    throws DebuggerException;
  
  private native ProcCFrame fillCFrameList0(long[] paramArrayOfLong)
    throws DebuggerException;
  
  private ProcCFrame createSenderFrame(ProcCFrame f, long pc, long fp)
  {
    ProcCFrame sender = new ProcCFrame(this, newAddress(pc), newAddress(fp));
    if (f != null) {
      f.setSender(sender);
    }
    return sender;
  }
  
  private native void fillLoadObjectList0(List paramList)
    throws DebuggerException;
  
  private LoadObject createLoadObject(String fileName, long textsize, long base)
  {
    File f = new File(fileName);
    Address baseAddr = newAddress(base);
    SharedObject res = findDSOByName(fileName);
    if (res != null)
    {
      Address oldBase = res.getBase();
      if (!baseAddr.equals(oldBase)) {
        res.setBase(baseAddr);
      }
    }
    else
    {
      res = new SharedObject(this, fileName, f.length(), baseAddr);
    }
    nameToDsoMap.put(f.getName(), res);
    return res;
  }
  
  private native long lookupByName0(String paramString1, String paramString2)
    throws DebuggerException;
  
  private native ClosestSymbol lookupByAddress0(long paramLong)
    throws DebuggerException;
  
  private ClosestSymbol createClosestSymbol(String name, long offset)
  {
    return new ClosestSymbol(name, offset);
  }
  
  private native byte[] readBytesFromProcess0(long paramLong1, long paramLong2)
    throws DebuggerException;
  
  private native void writeBytesToProcess0(long paramLong1, long paramLong2, byte[] paramArrayOfByte)
    throws DebuggerException;
  
  private native void suspend0()
    throws DebuggerException;
  
  private native void resume0()
    throws DebuggerException;
  
  private native String demangle0(String paramString);
  
  private static native void initIDs()
    throws DebuggerException;
  
  static
  {
    System.loadLibrary("saproc");
    initIDs();
  }
  
  private static LoadObjectComparator loadObjectComparator = new LoadObjectComparator();
  private boolean unalignedAccessesOkay;
  private ProcThreadFactory threadFactory;
  private int pcRegIndex;
  private int fpRegIndex;
  private Map nameToDsoMap;
  private List loadObjects;
  private CDebugger cdbg;
  private boolean suspended;
  private long p_ps_prochandle;
  private long libthread_db_handle;
  private long p_td_thragent_t;
  private long p_td_init;
  private long p_td_ta_new;
  private long p_td_ta_delete;
  private long p_td_ta_thr_iter;
  private long p_td_thr_get_info;
  private long p_td_ta_map_id2thr;
  private long p_td_thr_getgregs;
  private int classes_jsa_fd;
  private long p_file_map_header;
  private boolean attached = false;
  private boolean isCore;
  private List threadListCache;
  private List loadObjectCache;
  private Map topFrameCache;
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.OopHandle;

class ProcOopHandle
  extends ProcAddress
  implements OopHandle
{
  ProcOopHandle(ProcDebugger debugger, long addr)
  {
    super(debugger, addr);
  }
  
  public Address addOffsetTo(long offset)
    throws UnsupportedOperationException
  {
    throw new UnsupportedOperationException("addOffsetTo not applicable to OopHandles (interior object pointers not allowed)");
  }
  
  public Address andWithMask(long mask)
    throws UnsupportedOperationException
  {
    throw new UnsupportedOperationException("andWithMask not applicable to OopHandles (i.e., anything but C addresses)");
  }
  
  public Address orWithMask(long mask)
    throws UnsupportedOperationException
  {
    throw new UnsupportedOperationException("orWithMask not applicable to OopHandles (i.e., anything but C addresses)");
  }
  
  public Address xorWithMask(long mask)
    throws UnsupportedOperationException
  {
    throw new UnsupportedOperationException("xorWithMask not applicable to OopHandles (i.e., anything but C addresses)");
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.ThreadProxy;

public abstract interface ProcThreadFactory
{
  public abstract ThreadProxy createThreadWrapper(Address paramAddress);
  
  public abstract ThreadProxy createThreadWrapper(long paramLong);
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.posix.DSO;

class SharedObject
  extends DSO
{
  private ProcDebugger dbg;
  
  SharedObject(ProcDebugger dbg, String filename, long size, Address relocation)
  {
    super(filename, size, relocation);
    this.dbg = dbg;
  }
  
  protected Address newAddress(long address)
  {
    return dbg.newAddress(address);
  }
  
  protected long getAddressValue(Address addr)
  {
    return dbg.getAddressValue(addr);
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.ThreadContext;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.proc.ProcDebugger;
import sun.jvm.hotspot.utilities.Assert;

public class ProcSPARCThread
  implements ThreadProxy
{
  private ProcDebugger debugger;
  private int id;
  
  public ProcSPARCThread(ProcDebugger debugger, Address addr)
  {
    this.debugger = debugger;
    
    id = ((int)addr.getCIntegerAt(0L, 4L, true));
  }
  
  public ProcSPARCThread(ProcDebugger debugger, long id)
  {
    this.debugger = debugger;
    this.id = ((int)id);
  }
  
  public ThreadContext getContext()
    throws IllegalThreadStateException
  {
    ProcSPARCThreadContext context = new ProcSPARCThreadContext(debugger);
    long[] regs = debugger.getThreadIntegerRegisterSet(id);
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(regs.length == 38, "size of register set must match");
    }
    for (int i = 0; i < regs.length; i++) {
      context.setRegister(i, regs[i]);
    }
    return context;
  }
  
  public boolean canSetContext()
    throws DebuggerException
  {
    return false;
  }
  
  public void setContext(ThreadContext context)
    throws IllegalThreadStateException, DebuggerException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public String toString()
  {
    return "t@" + id;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj == null) || (!(obj instanceof ProcSPARCThread))) {
      return false;
    }
    return id == id;
  }
  
  public int hashCode()
  {
    return id;
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.proc.ProcDebugger;
import sun.jvm.hotspot.debugger.sparc.SPARCThreadContext;

public class ProcSPARCThreadContext
  extends SPARCThreadContext
{
  private ProcDebugger debugger;
  
  public ProcSPARCThreadContext(ProcDebugger debugger)
  {
    this.debugger = debugger;
  }
  
  public void setRegisterAsAddress(int index, Address value)
  {
    setRegister(index, debugger.getAddressValue(value));
  }
  
  public Address getRegisterAsAddress(int index)
  {
    return debugger.newAddress(getRegister(index));
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.proc.ProcDebugger;
import sun.jvm.hotspot.debugger.proc.ProcThreadFactory;

public class ProcSPARCThreadFactory
  implements ProcThreadFactory
{
  private ProcDebugger debugger;
  
  public ProcSPARCThreadFactory(ProcDebugger debugger)
  {
    this.debugger = debugger;
  }
  
  public ThreadProxy createThreadWrapper(Address threadIdentifierAddr)
  {
    return new ProcSPARCThread(debugger, threadIdentifierAddr);
  }
  
  public ThreadProxy createThreadWrapper(long id)
  {
    return new ProcSPARCThread(debugger, id);
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.ThreadContext;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.proc.ProcDebugger;
import sun.jvm.hotspot.utilities.Assert;

public class ProcX86Thread
  implements ThreadProxy
{
  private ProcDebugger debugger;
  private int id;
  
  public ProcX86Thread(ProcDebugger debugger, Address addr)
  {
    this.debugger = debugger;
    
    id = ((int)addr.getCIntegerAt(0L, 4L, true));
  }
  
  public ProcX86Thread(ProcDebugger debugger, long id)
  {
    this.debugger = debugger;
    this.id = ((int)id);
  }
  
  public ThreadContext getContext()
    throws IllegalThreadStateException
  {
    ProcX86ThreadContext context = new ProcX86ThreadContext(debugger);
    long[] regs = debugger.getThreadIntegerRegisterSet(id);
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(regs.length <= 25, "size of register set is greater than 25");
    }
    for (int i = 0; i < regs.length; i++) {
      context.setRegister(i, regs[i]);
    }
    return context;
  }
  
  public boolean canSetContext()
    throws DebuggerException
  {
    return false;
  }
  
  public void setContext(ThreadContext context)
    throws IllegalThreadStateException, DebuggerException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  public String toString()
  {
    return "t@" + id;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj == null) || (!(obj instanceof ProcX86Thread))) {
      return false;
    }
    return id == id;
  }
  
  public int hashCode()
  {
    return id;
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.proc.ProcDebugger;
import sun.jvm.hotspot.debugger.x86.X86ThreadContext;

public class ProcX86ThreadContext
  extends X86ThreadContext
{
  private ProcDebugger debugger;
  
  public ProcX86ThreadContext(ProcDebugger debugger)
  {
    this.debugger = debugger;
  }
  
  public void setRegisterAsAddress(int index, Address value)
  {
    setRegister(index, debugger.getAddressValue(value));
  }
  
  public Address getRegisterAsAddress(int index)
  {
    return debugger.newAddress(getRegister(index));
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.proc.ProcDebugger;
import sun.jvm.hotspot.debugger.proc.ProcThreadFactory;

public class ProcX86ThreadFactory
  implements ProcThreadFactory
{
  private ProcDebugger debugger;
  
  public ProcX86ThreadFactory(ProcDebugger debugger)
  {
    this.debugger = debugger;
  }
  
  public ThreadProxy createThreadWrapper(Address threadIdentifierAddr)
  {
    return new ProcX86Thread(debugger, threadIdentifierAddr);
  }
  
  public ThreadProxy createThreadWrapper(long id)
  {
    return new ProcX86Thread(debugger, id);
  }
}

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

public class ProcessInfo
{
  private String name;
  private int pid;
  
  public ProcessInfo(String name, int pid)
  {
    this.name = name;
    this.p
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