sa-jdi

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("LinuxAddress: all tests passed successfully.");
  }
}

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

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.amd64.AMD64ThreadContext;
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;
import sun.jvm.hotspot.debugger.linux.amd64.LinuxAMD64CFrame;
import sun.jvm.hotspot.debugger.linux.sparc.LinuxSPARCCFrame;
import sun.jvm.hotspot.debugger.linux.x86.LinuxX86CFrame;
import sun.jvm.hotspot.debugger.sparc.SPARCThreadContext;
import sun.jvm.hotspot.debugger.x86.X86ThreadContext;

class LinuxCDebugger
  implements CDebugger
{
  private LinuxDebugger dbg;
  
  LinuxCDebugger(LinuxDebugger 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
  {
    String cpu = dbg.getCPU();
    if (cpu.equals("x86"))
    {
      X86ThreadContext context = (X86ThreadContext)thread.getContext();
      Address ebp = context.getRegisterAsAddress(6);
      if (ebp == null) {
        return null;
      }
      Address pc = context.getRegisterAsAddress(14);
      if (pc == null) {
        return null;
      }
      return new LinuxX86CFrame(dbg, ebp, pc);
    }
    if (cpu.equals("amd64"))
    {
      AMD64ThreadContext context = (AMD64ThreadContext)thread.getContext();
      Address rbp = context.getRegisterAsAddress(10);
      if (rbp == null) {
        return null;
      }
      Address pc = context.getRegisterAsAddress(17);
      if (pc == null) {
        return null;
      }
      return new LinuxAMD64CFrame(dbg, rbp, pc);
    }
    if (cpu.equals("sparc"))
    {
      SPARCThreadContext context = (SPARCThreadContext)thread.getContext();
      Address sp = context.getRegisterAsAddress(14);
      if (sp == null) {
        return null;
      }
      Address pc = context.getRegisterAsAddress(15);
      if (pc == null) {
        return null;
      }
      return new LinuxSPARCCFrame(dbg, sp, pc, LinuxDebuggerLocal.getAddressSize());
    }
    throw new DebuggerException(cpu + " is not yet supported");
  }
  
  public String getNameOfFile(String fileName)
  {
    return new File(fileName).getName();
  }
  
  public ProcessControl getProcessControl()
    throws DebuggerException
  {
    return null;
  }
  
  public boolean canDemangle()
  {
    return false;
  }
  
  public String demangle(String sym)
  {
    throw new UnsupportedOperationException();
  }
}

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

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.cdbg.ClosestSymbol;

public abstract interface LinuxDebugger
  extends JVMDebugger
{
  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 LinuxAddress readAddress(long paramLong)
    throws DebuggerException;
  
  public abstract LinuxAddress readCompOopAddress(long paramLong)
    throws DebuggerException;
  
  public abstract LinuxOopHandle readOopHandle(long paramLong)
    throws DebuggerException;
  
  public abstract LinuxOopHandle 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();
  
  public abstract List getLoadObjectList();
  
  public abstract ClosestSymbol lookup(long paramLong);
}

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

import sun.jvm.hotspot.debugger.DebuggerUtilities;
import sun.jvm.hotspot.debugger.UnalignedAddressException;

final class LinuxDebuggerLocal$1
  extends DebuggerUtilities
{
  private final LinuxDebuggerLocal this$0;
  
  LinuxDebuggerLocal$1(LinuxDebuggerLocal paramLinuxDebuggerLocal, long x0, boolean x1)
  {
    super(x0, x1);
  }
  
  public void checkAlignment(long address, long alignment)
  {
    if ((address % alignment != 0L) && ((alignment != 8L) || (address % 4L != 0L))) {
      throw new UnalignedAddressException("Trying to read at address: " + addressValueToString(address) + " with alignment: " + alignment, address);
    }
  }
}

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

class LinuxDebuggerLocal$1AttachTask
  implements LinuxDebuggerLocal.WorkerThreadTask
{
  int pid;
  private final LinuxDebuggerLocal this$0;
  
  LinuxDebuggerLocal$1AttachTask(LinuxDebuggerLocal paramLinuxDebuggerLocal) {}
  
  public void doit(LinuxDebuggerLocal debugger)
  {
    LinuxDebuggerLocal.access$100(debugger, pid);
    LinuxDebuggerLocal.access$202(debugger, true);
    LinuxDebuggerLocal.access$302(debugger, false);
    LinuxDebuggerLocal.access$400(this$0);
  }
}

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

class LinuxDebuggerLocal$1DetachTask
  implements LinuxDebuggerLocal.WorkerThreadTask
{
  boolean result = false;
  private final LinuxDebuggerLocal this$0;
  
  LinuxDebuggerLocal$1DetachTask(LinuxDebuggerLocal paramLinuxDebuggerLocal) {}
  
  public void doit(LinuxDebuggerLocal debugger)
  {
    LinuxDebuggerLocal.access$500(debugger);
    LinuxDebuggerLocal.access$202(debugger, false);
    result = true;
  }
}

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

class LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask
  implements LinuxDebuggerLocal.WorkerThreadTask
{
  int lwp_id;
  long[] result;
  private final LinuxDebuggerLocal this$0;
  
  LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask(LinuxDebuggerLocal paramLinuxDebuggerLocal) {}
  
  public void doit(LinuxDebuggerLocal debugger)
  {
    result = LinuxDebuggerLocal.access$800(debugger, lwp_id);
  }
}

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

import sun.jvm.hotspot.debugger.cdbg.ClosestSymbol;

class LinuxDebuggerLocal$1LookupByAddressTask
  implements LinuxDebuggerLocal.WorkerThreadTask
{
  long addr;
  ClosestSymbol result;
  private final LinuxDebuggerLocal this$0;
  
  LinuxDebuggerLocal$1LookupByAddressTask(LinuxDebuggerLocal paramLinuxDebuggerLocal) {}
  
  public void doit(LinuxDebuggerLocal debugger)
  {
    result = LinuxDebuggerLocal.access$900(debugger, addr);
  }
}

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

import sun.jvm.hotspot.debugger.Address;

class LinuxDebuggerLocal$1LookupByNameTask
  implements LinuxDebuggerLocal.WorkerThreadTask
{
  String objectName;
  String symbol;
  Address result;
  private final LinuxDebuggerLocal this$0;
  
  LinuxDebuggerLocal$1LookupByNameTask(LinuxDebuggerLocal paramLinuxDebuggerLocal) {}
  
  public void doit(LinuxDebuggerLocal debugger)
  {
    long addr = LinuxDebuggerLocal.access$600(debugger, objectName, symbol);
    result = (addr == 0L ? null : new LinuxAddress(debugger, LinuxDebuggerLocal.access$700(this$0, addr, symbol)));
  }
}

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

import sun.jvm.hotspot.debugger.ReadResult;

class LinuxDebuggerLocal$1ReadBytesFromProcessTask
  implements LinuxDebuggerLocal.WorkerThreadTask
{
  long address;
  long numBytes;
  ReadResult result;
  private final LinuxDebuggerLocal this$0;
  
  LinuxDebuggerLocal$1ReadBytesFromProcessTask(LinuxDebuggerLocal paramLinuxDebuggerLocal) {}
  
  public void doit(LinuxDebuggerLocal debugger)
  {
    byte[] res = LinuxDebuggerLocal.access$1000(debugger, address, numBytes);
    if (res != null) {
      result = new ReadResult(res);
    } else {
      result = new ReadResult(address);
    }
  }
}

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

import sun.jvm.hotspot.debugger.DebuggerException;

class LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread
  extends Thread
{
  LinuxDebuggerLocal debugger;
  LinuxDebuggerLocal.WorkerThreadTask task;
  DebuggerException lastException;
  private final LinuxDebuggerLocal this$0;
  
  public LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread(LinuxDebuggerLocal paramLinuxDebuggerLocal1, LinuxDebuggerLocal debugger)
  {
    this.debugger = debugger;
    setDaemon(true);
  }
  
  public void run()
  {
    synchronized (LinuxDebuggerLocal.access$000(this$0))
    {
      for (;;)
      {
        if (task != null)
        {
          lastException = null;
          try
          {
            task.doit(debugger);
          }
          catch (DebuggerException exp)
          {
            lastException = exp;
          }
          task = null;
          LinuxDebuggerLocal.access$000(this$0).notifyAll();
        }
        try
        {
          LinuxDebuggerLocal.access$000(this$0).wait();
        }
        catch (InterruptedException x) {}
      }
    }
  }
  
  public LinuxDebuggerLocal.WorkerThreadTask execute(LinuxDebuggerLocal.WorkerThreadTask task)
    throws DebuggerException
  {
    synchronized (LinuxDebuggerLocal.access$000(this$0))
    {
      this.task = task;
      LinuxDebuggerLocal.access$000(this$0).notifyAll();
      while (this.task != null) {
        try
        {
          LinuxDebuggerLocal.access$000(this$0).wait();
        }
        catch (InterruptedException x) {}
      }
      if (lastException != null) {
        throw new DebuggerException(lastException);
      }
      return task;
    }
  }
}

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

import sun.jvm.hotspot.debugger.DebuggerException;

abstract interface LinuxDebuggerLocal$WorkerThreadTask
{
  public abstract void doit(LinuxDebuggerLocal paramLinuxDebuggerLocal)
    throws DebuggerException;
}

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

import java.io.File;
import java.util.ArrayList;
import java.util.List;
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.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.ClosestSymbol;
import sun.jvm.hotspot.debugger.cdbg.LoadObject;
import sun.jvm.hotspot.utilities.PlatformInfo;

public class LinuxDebuggerLocal
  extends DebuggerBase
  implements LinuxDebugger
{
  private boolean useGCC32ABI;
  private boolean attached;
  private long p_ps_prochandle;
  private boolean isCore;
  private LinuxCDebugger cdbg;
  private List threadList;
  private List loadObjectList;
  
  private ClosestSymbol createClosestSymbol(String name, long offset)
  {
    return new ClosestSymbol(name, offset);
  }
  
  private LoadObject createLoadObject(String fileName, long textsize, long base)
  {
    File f = new File(fileName);
    Address baseAddr = newAddress(base);
    return new SharedObject(this, fileName, f.length(), baseAddr);
  }
  
  private static native void init0()
    throws DebuggerException;
  
  private native void attach0(int paramInt)
    throws DebuggerException;
  
  private native void attach0(String paramString1, String paramString2)
    throws DebuggerException;
  
  private native void detach0()
    throws DebuggerException;
  
  private native long lookupByName0(String paramString1, String paramString2)
    throws DebuggerException;
  
  private native ClosestSymbol lookupByAddress0(long paramLong)
    throws DebuggerException;
  
  private native long[] getThreadIntegerRegisterSet0(int paramInt)
    throws DebuggerException;
  
  private native byte[] readBytesFromProcess0(long paramLong1, long paramLong2)
    throws DebuggerException;
  
  public static native int getAddressSize();
  
  class LinuxDebuggerLocalWorkerThread
    extends Thread
  {
    LinuxDebuggerLocal debugger;
    LinuxDebuggerLocal.WorkerThreadTask task;
    DebuggerException lastException;
    
    public LinuxDebuggerLocalWorkerThread(LinuxDebuggerLocal debugger)
    {
      this.debugger = debugger;
      setDaemon(true);
    }
    
    public void run()
    {
      synchronized (workerThread)
      {
        for (;;)
        {
          if (task != null)
          {
            lastException = null;
            try
            {
              task.doit(debugger);
            }
            catch (DebuggerException exp)
            {
              lastException = exp;
            }
            task = null;
            workerThread.notifyAll();
          }
          try
          {
            workerThread.wait();
          }
          catch (InterruptedException x) {}
        }
      }
    }
    
    public LinuxDebuggerLocal.WorkerThreadTask execute(LinuxDebuggerLocal.WorkerThreadTask task)
      throws DebuggerException
    {
      synchronized (workerThread)
      {
        this.task = task;
        workerThread.notifyAll();
        while (this.task != null) {
          try
          {
            workerThread.wait();
          }
          catch (InterruptedException x) {}
        }
        if (lastException != null) {
          throw new DebuggerException(lastException);
        }
        return task;
      }
    }
  }
  
  private LinuxDebuggerLocalWorkerThread workerThread = null;
  
  public LinuxDebuggerLocal(MachineDescription machDesc, boolean useCache)
    throws DebuggerException
  {
    this.machDesc = machDesc;
    utils = new DebuggerUtilities(machDesc.getAddressSize(), machDesc.isBigEndian())
    {
      public void checkAlignment(long address, long alignment)
      {
        if ((address % alignment != 0L) && ((alignment != 8L) || (address % 4L != 0L))) {
          throw new UnalignedAddressException("Trying to read at address: " + addressValueToString(address) + " with alignment: " + alignment, address);
        }
      }
    };
    if (useCache) {
      if (getCPU().equals("ia64")) {
        initCache(16384L, parseCacheNumPagesProperty(1024));
      } else {
        initCache(4096L, parseCacheNumPagesProperty(4096));
      }
    }
    workerThread = new LinuxDebuggerLocalWorkerThread(this);
    workerThread.start();
  }
  
  public boolean hasProcessList()
    throws DebuggerException
  {
    return false;
  }
  
  public List getProcessList()
    throws DebuggerException
  {
    throw new DebuggerException("getProcessList not implemented yet");
  }
  
  private void checkAttached()
    throws DebuggerException
  {
    if (attached)
    {
      if (isCore) {
        throw new DebuggerException("attached to a core dump already");
      }
      throw new DebuggerException("attached to a process already");
    }
  }
  
  private void requireAttach()
  {
    if (!attached) {
      throw new RuntimeException("not attached to a process or a core!");
    }
  }
  
  private void findABIVersion()
    throws DebuggerException
  {
    if ((lookupByName0("libjvm.so", "__vt_10JavaThread") != 0L) || (lookupByName0("libjvm_g.so", "__vt_10JavaThread") != 0L)) {
      useGCC32ABI = false;
    } else {
      useGCC32ABI = true;
    }
  }
  
  public synchronized void attach(int processID)
    throws DebuggerException
  {
    checkAttached();
    threadList = new ArrayList();
    loadObjectList = new ArrayList();
    
    WorkerThreadTask task = new WorkerThreadTask()
    {
      int pid;
      
      public void doit(LinuxDebuggerLocal debugger)
      {
        debugger.attach0(pid);
        attached = true;
        isCore = false;
        LinuxDebuggerLocal.this.findABIVersion();
      }
    };
    pid = processID;
    workerThread.execute(task);
  }
  
  public synchronized void attach(String execName, String coreName)
  {
    checkAttached();
    threadList = new ArrayList();
    loadObjectList = new ArrayList();
    attach0(execName, coreName);
    attached = true;
    isCore = true;
    findABIVersion();
  }
  
  public synchronized boolean detach()
  {
    if (!attached) {
      return false;
    }
    threadList = null;
    loadObjectList = null;
    if (isCore)
    {
      detach0();
      attached = false;
      return true;
    }
    WorkerThreadTask task = new WorkerThreadTask()
    {
      boolean result = false;
      
      public void doit(LinuxDebuggerLocal debugger)
      {
        debugger.detach0();
        attached = false;
        result = true;
      }
    };
    workerThread.execute(task);
    return result;
  }
  
  public Address parseAddress(String addressString)
    throws NumberFormatException
  {
    long addr = utils.scanAddress(addressString);
    if (addr == 0L) {
      return null;
    }
    return new LinuxAddress(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("No debugger console available on Linux");
  }
  
  public String getConsolePrompt()
    throws DebuggerException
  {
    return null;
  }
  
  private long handleGCC32ABI(long addr, String symbol)
    throws DebuggerException
  {
    if ((useGCC32ABI) && (symbol.startsWith("_ZTV"))) {
      return addr + 2L * machDesc.getAddressSize();
    }
    return addr;
  }
  
  public synchronized Address lookup(String objectName, String symbol)
  {
    requireAttach();
    if (!attached) {
      return null;
    }
    if (isCore)
    {
      long addr = lookupByName0(objectName, symbol);
      return addr == 0L ? null : new LinuxAddress(this, handleGCC32ABI(addr, symbol));
    }
    WorkerThreadTask task = new WorkerThreadTask()
    {
      String objectName;
      String symbol;
      Address result;
      
      public void doit(LinuxDebuggerLocal debugger)
      {
        long addr = debugger.lookupByName0(objectName, symbol);
        result = (addr == 0L ? null : new LinuxAddress(debugger, LinuxDebuggerLocal.this.handleGCC32ABI(addr, symbol)));
      }
    };
    objectName = objectName;
    symbol = symbol;
    workerThread.execute(task);
    return result;
  }
  
  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 ThreadProxy getThreadForIdentifierAddress(Address addr)
  {
    return new LinuxThread(this, addr);
  }
  
  public ThreadProxy getThreadForThreadId(long id)
  {
    return new LinuxThread(this, id);
  }
  
  public String addressValueToString(long address)
  {
    return utils.addressValueToString(address);
  }
  
  public LinuxAddress readAddress(long address)
    throws UnmappedAddressException, UnalignedAddressException
  {
    long value = readAddressValue(address);
    return value == 0L ? null : new LinuxAddress(this, value);
  }
  
  public LinuxAddress readCompOopAddress(long address)
    throws UnmappedAddressException, UnalignedAddressException
  {
    long value = readCompOopAddressValue(address);
    return value == 0L ? null : new LinuxAddress(this, value);
  }
  
  public LinuxOopHandle readOopHandle(long address)
    throws UnmappedAddressException, UnalignedAddressException, NotInHeapException
  {
    long value = readAddressValue(address);
    return value == 0L ? null : new LinuxOopHandle(this, value);
  }
  
  public LinuxOopHandle readCompOopHandle(long address)
    throws UnmappedAddressException, UnalignedAddressException, NotInHeapException
  {
    long value = readCompOopAddressValue(address);
    return value == 0L ? null : new LinuxOopHandle(this, value);
  }
  
  public synchronized long[] getThreadIntegerRegisterSet(int lwp_id)
    throws DebuggerException
  {
    requireAttach();
    if (isCore) {
      return getThreadIntegerRegisterSet0(lwp_id);
    }
    WorkerThreadTask task = new WorkerThreadTask()
    {
      int lwp_id;
      long[] result;
      
      public void doit(LinuxDebuggerLocal debugger)
      {
        result = debugger.getThreadIntegerRegisterSet0(lwp_id);
      }
    };
    lwp_id = lwp_id;
    workerThread.execute(task);
    return result;
  }
  
  public long readCInteger(long address, long numBytes, boolean isUnsigned)
    throws UnmappedAddressException, UnalignedAddressException
  {
    if (numBytes == 8L) {
      utils.checkAlignment(address, 4L);
    } else {
      utils.checkAlignment(address, numBytes);
    }
    byte[] data = readBytes(address, numBytes);
    return utils.dataToCInteger(data, isUnsigned);
  }
  
  public long readJLong(long address)
    throws UnmappedAddressException, UnalignedAddressException
  {
    utils.checkAlignment(address, jintSize);
    byte[] data = readBytes(address, jlongSize);
    return utils.dataToJLong(data, jlongSize);
  }
  
  public long getAddressValue(Address addr)
  {
    if (addr == null) {
      return 0L;
    }
    return ((LinuxAddress)addr).getValue();
  }
  
  public Address newAddress(long value)
  {
    if (value == 0L) {
      return null;
    }
    return new LinuxAddress(this, value);
  }
  
  public List getThreadList()
  {
    requireAttach();
    return threadList;
  }
  
  public List getLoadObjectList()
  {
    requireAttach();
    return loadObjectList;
  }
  
  public synchronized ClosestSymbol lookup(long addr)
  {
    requireAttach();
    if (isCore) {
      return lookupByAddress0(addr);
    }
    WorkerThreadTask task = new WorkerThreadTask()
    {
      long addr;
      ClosestSymbol result;
      
      public void doit(LinuxDebuggerLocal debugger)
      {
        result = debugger.lookupByAddress0(addr);
      }
    };
    addr = addr;
    workerThread.execute(task);
    return result;
  }
  
  public CDebugger getCDebugger()
  {
    if (cdbg == null)
    {
      String cpu = getCPU();
      if (cpu.equals("ia64")) {
        return null;
      }
      cdbg = new LinuxCDebugger(this);
    }
    return cdbg;
  }
  
  public synchronized ReadResult readBytesFromProcess(long address, long numBytes)
    throws UnmappedAddressException, DebuggerException
  {
    requireAttach();
    if (isCore)
    {
      byte[] res = readBytesFromProcess0(address, numBytes);
      return res != null ? new ReadResult(res) : new ReadResult(address);
    }
    WorkerThreadTask task = new WorkerThreadTask()
    {
      long address;
      long numBytes;
      ReadResult result;
      
      public void doit(LinuxDebuggerLocal debugger)
      {
        byte[] res = debugger.readBytesFromProcess0(address, numBytes);
        if (res != null) {
          result = new ReadResult(res);
        } else {
          result = new ReadResult(address);
        }
      }
    };
    address = address;
    numBytes = numBytes;
    workerThread.execute(task);
    return result;
  }
  
  public void writeBytesToProcess(long address, long numBytes, byte[] data)
    throws UnmappedAddressException, DebuggerException
  {
    throw new DebuggerException("Unimplemented");
  }
  
  static
  {
    System.loadLibrary("saproc");
    init0();
  }
  
  static abstract interface WorkerThreadTask
  {
    public abstract void doit(LinuxDebuggerLocal paramLinuxDebuggerLocal)
      throws DebuggerException;
  }
}

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

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

class LinuxOopHandle
  extends LinuxAddress
  implements OopHandle
{
  LinuxOopHandle(LinuxDebugger debugger, long addr)
  {
    super(debugger, addr);
  }
  
  public boolean equals(Object arg)
  {
    if (arg == null) {
      return false;
    }
    if (!(arg instanceof LinuxOopHandle)) {
      return false;
    }
    return addr == 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.linux.LinuxOopHandle
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.linux;

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

class LinuxThread
  implements ThreadProxy
{
  private LinuxDebugger debugger;
  private int lwp_id;
  
  LinuxThread(LinuxDebugger debugger, Address addr)
  {
    this.debugger = debugger;
    
    lwp_id = ((int)addr.getCIntegerAt(0L, 4L, true));
  }
  
  LinuxThread(LinuxDebugger debugger, long id)
  {
    this.debugger = debugger;
    lwp_id = ((int)id);
  }
  
  public boolean equals(Object obj)
  {
    if ((obj == null) || (!(obj instanceof LinuxThread))) {
      return false;
    }
    return lwp_id == lwp_id;
  }
  
  public int hashCode()
  {
    return lwp_id;
  }
  
  public String toString()
  {
    return Integer.toString(lwp_id);
  }
  
  public ThreadContext getContext()
    throws IllegalThreadStateException
  {
    long[] data = debugger.getThreadIntegerRegisterSet(lwp_id);
    ThreadContext context = LinuxThreadContextFactory.createThreadContext(debugger);
    for (int i = 0; i < data.length; i++) {
      context.setRegister(i, data[i]);
    }
    return context;
  }
  
  public boolean canSetContext()
    throws DebuggerException
  {
    return false;
  }
  
  public void setContext(ThreadContext context)
    throws IllegalThreadStateException, DebuggerException
  {
    throw new DebuggerException("Unimplemented");
  }
}

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

import sun.jvm.hotspot.debugger.ThreadContext;
import sun.jvm.hotspot.debugger.linux.amd64.LinuxAMD64ThreadContext;
import sun.jvm.hotspot.debugger.linux.ia64.LinuxIA64ThreadContext;
import sun.jvm.hotspot.debugger.linux.sparc.LinuxSPARCThreadContext;
import sun.jvm.hotspot.debugger.linux.x86.LinuxX86ThreadContext;

class LinuxThreadContextFactory
{
  static ThreadContext createThreadContext(LinuxDebugger dbg)
  {
    String cpu = dbg.getCPU();
    if (cpu.equals("x86")) {
      return new LinuxX86ThreadContext(dbg);
    }
    if (cpu.equals("amd64")) {
      return new LinuxAMD64ThreadContext(dbg);
    }
    if (cpu.equals("ia64")) {
      return new LinuxIA64ThreadContext(dbg);
    }
    if (cpu.equals("sparc")) {
      return new LinuxSPARCThreadContext(dbg);
    }
    throw new RuntimeException("cpu " + cpu + " is not yet supported");
  }
}

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

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

class SharedObject
  extends DSO
{
  private LinuxDebugger dbg;
  
  SharedObject(LinuxDebugger 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.linux.SharedObject
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.linux.sparc;

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;
import sun.jvm.hotspot.debugger.linux.LinuxDebugger;

public final class LinuxSPARCCFrame
  extends BasicCFrame
{
  public static int SPARC_STACK_BIAS;
  private static int address_size;
  private Address pc;
  private Address sp;
  private LinuxDebugger dbg;
  
  public LinuxSPARCCFrame(LinuxDebugger dbg, Address sp, Address pc, int address_size)
  {
    super(dbg.getCDebugger());
    this.sp = sp;
    this.pc = pc;
    this.dbg = dbg;
    address_size = address_size;
    if (address_size == 8) {
      SPARC_STACK_BIAS = 2047;
    } else {
      SPARC_STACK_BIAS = 0;
    }
  }
  
  public ClosestSymbol closestSymbolToPC()
  {
    return dbg.lookup(dbg.getAddressValue(pc()));
  }
  
  public Address pc()
  {
    return pc;
  }
  
  public Address localVariableBase()
  {
    return sp;
  }
  
  public CFrame sender(ThreadProxy thread)
  {
    if (sp == null) {
      return null;
    }
    Address nextSP = sp.getAddressAt(14 * address_size + SPARC_STACK_BIAS);
    if (nextSP == null) {
      return null;
    }
    Address nextPC = sp.getAddressAt(15 * address_size + SPARC_STACK_BIAS);
    if (nextPC == null) {
      return null;
    }
    return new LinuxSPARCCFrame(dbg, nextSP, nextPC, address_size);
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.linux.LinuxDebugger;
import sun.jvm.hotspot.debugger.sparc.SPARCThreadContext;

public class LinuxSPARCThreadContext
  extends SPARCThreadContext
{
  private LinuxDebugger debugger;
  
  public LinuxSPARCThreadContext(LinuxDebugger 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.linux.sparc.LinuxSPARCThreadContext
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger.linux.x86;

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;
import sun.jvm.hotspot.debugger.linux.LinuxDebugger;
import sun.jvm.hotspot.debugger.x86.X86ThreadContext;

public final class LinuxX86CFrame
  extends BasicCFrame
{
  private static final int ADDRESS_SIZE = 4;
  private Address pc;
  private Address ebp;
  private LinuxDebugger dbg;
  
  public LinuxX86CFrame(LinuxDebugger dbg, Address ebp, Address pc)
  {
    super(dbg.getCDebugger());
    this.ebp = ebp;
    this.pc = pc;
    this.dbg = dbg;
  }
  
  public ClosestSymbol closestSymbolToPC()
  {
    return dbg.lookup(dbg.getAddressValue(pc()));
  }
  
  public Address pc()
  {
    return pc;
  }
  
  public Address localVariableBase()
  {
    return ebp;
  }
  
  public CFrame sender(ThreadProxy thread)
  {
    X86ThreadContext context = (X86ThreadContext)thread.getContext();
    Address esp = context.getRegisterAsAddress(7);
    if ((ebp == null) || (ebp.lessThan(esp))) {
      return null;
    }
    if (dbg.getAddressValue(ebp) % 4L != 0L) {
      return null;
    }
    Address nextEBP = ebp.getAddressAt(0L);
    if (nextEBP == null) {
      return null;
    }
    Address nextPC = ebp.getAddressAt(4L);
    if (nextPC == null) {
      return null;
    }
    return new LinuxX86CFrame(dbg, nextEBP, nextPC);
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.linux.LinuxDebugger;
import sun.jvm.hotspot.debugger.x86.X86ThreadContext;

public class LinuxX86ThreadContext
  extends X86ThreadContext
{
  private LinuxDebugger debugger;
  
  public LinuxX86ThreadContext(LinuxDebugger 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.linux.x86.LinuxX86ThreadContext
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.debugger;

class LongHashMap$Entry
{
  private int hash;
  private long key;
  private Object value;
  private Entry next;
  
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