sa-jdi

s ");
    msg.append(targetVersion);
    return msg.toString();
  }
  
  public String getSupportedVersions()
  {
    return supportedVersions;
  }
  
  public String getTargetVersion()
  {
    return targetVersion;
  }
}

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

import sun.jvm.hotspot.debugger.Address;

public class WatcherThread
  extends Thread
{
  public WatcherThread(Address addr)
  {
    super(addr);
  }
  
  public boolean isWatcherThread()
  {
    return true;
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.amd64.AMD64CurrentFrameGuess;
import sun.jvm.hotspot.runtime.amd64.AMD64Frame;
import sun.jvm.hotspot.runtime.amd64.AMD64RegisterMap;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.Field;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class Win32AMD64JavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField lastJavaFPField;
  private static AddressField osThreadField;
  private static Field osThreadThreadHandleField;
  private static final long GUESS_SCAN_RANGE = 131072L;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Win32AMD64JavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    Type anchorType = db.lookupType("JavaFrameAnchor");
    lastJavaFPField = anchorType.getAddressField("_last_Java_fp");
    osThreadField = type.getAddressField("_osthread");
    
    type = db.lookupType("OSThread");
    osThreadThreadHandleField = type.getField("_thread_handle");
  }
  
  public Address getLastJavaFP(Address addr)
  {
    return lastJavaFPField.getValue(addr.addOffsetTo(JavaThread.getAnchorField().getOffset()));
  }
  
  public Address getLastJavaPC(Address addr)
  {
    return null;
  }
  
  public Address getBaseOfStackPointer(Address addr)
  {
    return null;
  }
  
  public Frame getLastFramePD(JavaThread thread, Address addr)
  {
    Address fp = thread.getLastJavaFP();
    if (fp == null) {
      return null;
    }
    Address pc = thread.getLastJavaPC();
    if (pc != null) {
      return new AMD64Frame(thread.getLastJavaSP(), fp, pc);
    }
    return new AMD64Frame(thread.getLastJavaSP(), fp);
  }
  
  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap)
  {
    return new AMD64RegisterMap(thread, updateMap);
  }
  
  public Frame getCurrentFrameGuess(JavaThread thread, Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    AMD64ThreadContext context = (AMD64ThreadContext)t.getContext();
    AMD64CurrentFrameGuess guesser = new AMD64CurrentFrameGuess(context, thread);
    if (!guesser.run(131072L)) {
      return null;
    }
    if (guesser.getPC() == null) {
      return new AMD64Frame(guesser.getSP(), guesser.getFP());
    }
    return new AMD64Frame(guesser.getSP(), guesser.getFP(), guesser.getPC());
  }
  
  public void printThreadIDOn(Address addr, PrintStream tty)
  {
    tty.print(getThreadProxy(addr));
  }
  
  public Address getLastSP(Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    AMD64ThreadContext context = (AMD64ThreadContext)t.getContext();
    return context.getRegisterAsAddress(20);
  }
  
  public ThreadProxy getThreadProxy(Address addr)
  {
    Address osThreadAddr = osThreadField.getValue(addr);
    
    Address threadHandleAddr = osThreadAddr.addOffsetTo(osThreadThreadHandleField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(threadHandleAddr);
  }
  
  public void printInfoOn(Address threadAddr, PrintStream tty) {}
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.runtime.win32_ia64;

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.ia64.IA64ThreadContext;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.ia64.IA64Frame;
import sun.jvm.hotspot.runtime.ia64.IA64RegisterMap;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.CIntegerField;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class Win32IA64JavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField lastJavaIFrameField;
  private static AddressField osThreadField;
  private static CIntegerField osThreadPThreadIDField;
  private static final long GUESS_SCAN_RANGE = 131072L;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Win32IA64JavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    
    lastJavaIFrameField = type.getAddressField("_last_Java_iframe");
    osThreadField = type.getAddressField("_osthread");
    
    type = db.lookupType("OSThread");
    osThreadPThreadIDField = type.getCIntegerField("_pthread_id");
  }
  
  public Address getLastJavaIFrame(Address addr)
  {
    return lastJavaIFrameField.getValue(addr);
  }
  
  public Address getBaseOfStackPointer(Address addr)
  {
    return null;
  }
  
  public Address getLastJavaFP(Address addr)
  {
    return null;
  }
  
  public Address getLastJavaPC(Address addr)
  {
    return null;
  }
  
  public boolean isInterpretedFrame()
  {
    return true;
  }
  
  public Frame getLastFramePD(JavaThread thread, Address addr)
  {
    Address iframe = getLastJavaIFrame(addr);
    Address pc = thread.getLastJavaPC();
    if (iframe == null) {
      return null;
    }
    return new IA64Frame(thread.getLastJavaSP(), iframe, pc);
  }
  
  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap)
  {
    return new IA64RegisterMap(thread, updateMap);
  }
  
  public Frame getCurrentFrameGuess(JavaThread thread, Address addr)
  {
    return getLastFramePD(thread, addr);
  }
  
  public void printThreadIDOn(Address addr, PrintStream tty)
  {
    tty.print(getThreadProxy(addr));
  }
  
  public void printInfoOn(Address threadAddr, PrintStream tty)
  {
    tty.print("Thread id: ");
    printThreadIDOn(threadAddr, tty);
    tty.println("\nLastJavaIFrame: " + getLastJavaIFrame(threadAddr));
  }
  
  public Address getLastSP(Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    IA64ThreadContext context = (IA64ThreadContext)t.getContext();
    return context.getRegisterAsAddress(12);
  }
  
  public ThreadProxy getThreadProxy(Address addr)
  {
    Address osThreadAddr = osThreadField.getValue(addr);
    
    Address pthreadIdAddr = osThreadAddr.addOffsetTo(osThreadPThreadIDField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(pthreadIdAddr);
  }
}

/* Location:
 * Qualified Name:     sun.jvm.hotspot.runtime.win32_ia64.Win32IA64JavaThreadPDAccess
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package sun.jvm.hotspot.runtime.win32_x86;

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.ThreadProxy;
import sun.jvm.hotspot.debugger.x86.X86ThreadContext;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.JavaThreadPDAccess;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.x86.X86CurrentFrameGuess;
import sun.jvm.hotspot.runtime.x86.X86Frame;
import sun.jvm.hotspot.runtime.x86.X86RegisterMap;
import sun.jvm.hotspot.types.AddressField;
import sun.jvm.hotspot.types.Field;
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;

public class Win32X86JavaThreadPDAccess
  implements JavaThreadPDAccess
{
  private static AddressField lastJavaFPField;
  private static AddressField osThreadField;
  private static Field osThreadThreadHandleField;
  private static final long GUESS_SCAN_RANGE = 131072L;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        Win32X86JavaThreadPDAccess.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaThread");
    Type anchorType = db.lookupType("JavaFrameAnchor");
    lastJavaFPField = anchorType.getAddressField("_last_Java_fp");
    osThreadField = type.getAddressField("_osthread");
    
    type = db.lookupType("OSThread");
    osThreadThreadHandleField = type.getField("_thread_handle");
  }
  
  public Address getLastJavaFP(Address addr)
  {
    return lastJavaFPField.getValue(addr.addOffsetTo(JavaThread.getAnchorField().getOffset()));
  }
  
  public Address getLastJavaPC(Address addr)
  {
    return null;
  }
  
  public Address getBaseOfStackPointer(Address addr)
  {
    return null;
  }
  
  public Frame getLastFramePD(JavaThread thread, Address addr)
  {
    Address fp = thread.getLastJavaFP();
    if (fp == null) {
      return null;
    }
    Address pc = thread.getLastJavaPC();
    if (pc != null) {
      return new X86Frame(thread.getLastJavaSP(), fp, pc);
    }
    return new X86Frame(thread.getLastJavaSP(), fp);
  }
  
  public RegisterMap newRegisterMap(JavaThread thread, boolean updateMap)
  {
    return new X86RegisterMap(thread, updateMap);
  }
  
  public Frame getCurrentFrameGuess(JavaThread thread, Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    X86ThreadContext context = (X86ThreadContext)t.getContext();
    X86CurrentFrameGuess guesser = new X86CurrentFrameGuess(context, thread);
    if (!guesser.run(131072L)) {
      return null;
    }
    if (guesser.getPC() == null) {
      return new X86Frame(guesser.getSP(), guesser.getFP());
    }
    return new X86Frame(guesser.getSP(), guesser.getFP(), guesser.getPC());
  }
  
  public void printThreadIDOn(Address addr, PrintStream tty)
  {
    tty.print(getThreadProxy(addr));
  }
  
  public Address getLastSP(Address addr)
  {
    ThreadProxy t = getThreadProxy(addr);
    X86ThreadContext context = (X86ThreadContext)t.getContext();
    return context.getRegisterAsAddress(7);
  }
  
  public ThreadProxy getThreadProxy(Address addr)
  {
    Address osThreadAddr = osThreadField.getValue(addr);
    
    Address threadHandleAddr = osThreadAddr.addOffsetTo(osThreadThreadHandleField.getOffset());
    
    JVMDebugger debugger = VM.getVM().getDebugger();
    return debugger.getThreadForIdentifierAddress(threadHandleAddr);
  }
  
  public void printInfoOn(Address threadAddr, PrintStream tty) {}
}

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

import java.io.PrintStream;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.x86.X86ThreadContext;
import sun.jvm.hotspot.interpreter.Interpreter;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VM;

public class X86CurrentFrameGuess
{
  private X86ThreadContext context;
  private JavaThread thread;
  private Address spFound;
  private Address fpFound;
  private Address pcFound;
  private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.x86.X86Frame.DEBUG") != null;
  
  public X86CurrentFrameGuess(X86ThreadContext context, JavaThread thread)
  {
    this.context = context;
    this.thread = thread;
  }
  
  public boolean run(long regionInBytesToSearch)
  {
    Address sp = context.getRegisterAsAddress(17);
    Address pc = context.getRegisterAsAddress(14);
    Address fp = context.getRegisterAsAddress(6);
    if (sp == null)
    {
      if (thread.getLastJavaSP() != null)
      {
        setValues(thread.getLastJavaSP(), thread.getLastJavaFP(), null);
        return true;
      }
      return false;
    }
    Address end = sp.addOffsetTo(regionInBytesToSearch);
    VM vm = VM.getVM();
    
    setValues(null, null, null);
    if (vm.isJavaPCDbg(pc))
    {
      if (vm.isClientCompiler())
      {
        setValues(sp, fp, pc);
        return true;
      }
      if (vm.getInterpreter().contains(pc))
      {
        if (DEBUG) {
          System.out.println("CurrentFrameGuess: choosing interpreter frame: sp = " + sp + ", fp = " + fp + ", pc = " + pc);
        }
        setValues(sp, fp, pc);
        return true;
      }
      for (long offset = 0L; offset < regionInBytesToSearch; offset += vm.getAddressSize()) {
        try
        {
          Address curSP = sp.addOffsetTo(offset);
          Frame frame = new X86Frame(curSP, null, pc);
          RegisterMap map = thread.newRegisterMap(false);
          while (frame != null)
          {
            if ((frame.isEntryFrame()) && (frame.entryFrameIsFirst()))
            {
              if (DEBUG) {
                System.out.println("CurrentFrameGuess: Choosing sp = " + curSP + ", pc = " + pc);
              }
              setValues(curSP, null, pc);
              return true;
            }
            frame = frame.sender(map);
          }
        }
        catch (Exception e)
        {
          if (DEBUG) {
            System.out.println("CurrentFrameGuess: Exception " + e + " at offset " + offset);
          }
        }
      }
      return false;
    }
    if (DEBUG) {
      System.out.println("CurrentFrameGuess: choosing last Java frame: sp = " + thread.getLastJavaSP() + ", fp = " + thread.getLastJavaFP());
    }
    if (thread.getLastJavaSP() == null) {
      return false;
    }
    setValues(thread.getLastJavaSP(), thread.getLastJavaFP(), null);
    return true;
  }
  
  public Address getSP()
  {
    return spFound;
  }
  
  public Address getFP()
  {
    return fpFound;
  }
  
  public Address getPC()
  {
    return pcFound;
  }
  
  private void setValues(Address sp, Address fp, Address pc)
  {
    spFound = sp;
    fpFound = fp;
    pcFound = pc;
  }
}

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

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

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

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

import java.io.PrintStream;
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.code.CodeBlob;
import sun.jvm.hotspot.code.CodeCache;
import sun.jvm.hotspot.code.NMethod;
import sun.jvm.hotspot.compiler.OopMapSet;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.OopHandle;
import sun.jvm.hotspot.interpreter.Interpreter;
import sun.jvm.hotspot.oops.Method;
import sun.jvm.hotspot.oops.ObjectHeap;
import sun.jvm.hotspot.runtime.BasicObjectLock;
import sun.jvm.hotspot.runtime.Frame;
import sun.jvm.hotspot.runtime.JavaCallWrapper;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.StubRoutines;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMReg;
import sun.jvm.hotspot.types.TypeDataBase;
import sun.jvm.hotspot.utilities.AddressOps;
import sun.jvm.hotspot.utilities.Assert;

public class X86Frame
  extends Frame
{
  private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.x86.X86Frame.DEBUG") != null;
  private static final int LINK_OFFSET = 0;
  private static final int RETURN_ADDR_OFFSET = 1;
  private static final int SENDER_SP_OFFSET = 2;
  private static final int INTERPRETER_FRAME_MIRROR_OFFSET = 2;
  private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -1;
  private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = -2;
  private static final int INTERPRETER_FRAME_METHOD_OFFSET = -3;
  private static int INTERPRETER_FRAME_MDX_OFFSET;
  private static int INTERPRETER_FRAME_CACHE_OFFSET;
  private static int INTERPRETER_FRAME_LOCALS_OFFSET;
  private static int INTERPRETER_FRAME_BCX_OFFSET;
  private static int INTERPRETER_FRAME_INITIAL_SP_OFFSET;
  private static int INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET;
  private static int INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET;
  private static final int ENTRY_FRAME_CALL_WRAPPER_OFFSET = 2;
  private static final int NATIVE_FRAME_INITIAL_PARAM_OFFSET = 2;
  Address raw_fp;
  private Address raw_unextendedSP;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        X86Frame.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    if (VM.getVM().isCore())
    {
      INTERPRETER_FRAME_CACHE_OFFSET = -4;
    }
    else
    {
      INTERPRETER_FRAME_MDX_OFFSET = -4;
      INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1;
    }
    INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1;
    INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1;
    INTERPRETER_FRAME_INITIAL_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1;
    INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
    INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET = INTERPRETER_FRAME_INITIAL_SP_OFFSET;
  }
  
  private void adjustForDeopt()
  {
    if (pc != null)
    {
      CodeBlob cb = VM.getVM().getCodeCache().findBlob(pc);
      if ((cb != null) && (cb.isJavaMethod()))
      {
        NMethod nm = (NMethod)cb;
        if (pc.equals(nm.deoptBegin()))
        {
          if (Assert.ASSERTS_ENABLED) {
            Assert.that(getUnextendedSP() != null, "null SP in Java frame");
          }
          pc = getUnextendedSP().getAddressAt(nm.origPCOffset());
          deoptimized = true;
        }
      }
    }
  }
  
  public X86Frame(Address raw_sp, Address raw_fp, Address pc)
  {
    this.raw_sp = raw_sp;
    raw_unextendedSP = raw_sp;
    this.raw_fp = raw_fp;
    this.pc = pc;
    
    adjustForDeopt();
    if (DEBUG)
    {
      System.out.println("X86Frame(sp, fp, pc): " + this);
      dumpStack();
    }
  }
  
  public X86Frame(Address raw_sp, Address raw_fp)
  {
    this.raw_sp = raw_sp;
    raw_unextendedSP = raw_sp;
    this.raw_fp = raw_fp;
    pc = raw_sp.getAddressAt(-1L * VM.getVM().getAddressSize());
    
    adjustForDeopt();
    if (DEBUG)
    {
      System.out.println("X86Frame(sp, fp): " + this);
      dumpStack();
    }
  }
  
  public X86Frame(Address raw_sp, Address raw_fp, long extension)
  {
    this.raw_sp = raw_sp;
    if (raw_sp == null) {
      raw_unextendedSP = null;
    } else {
      raw_unextendedSP = raw_sp.addOffsetTo(extension);
    }
    this.raw_fp = raw_fp;
    pc = raw_sp.getAddressAt(-1L * VM.getVM().getAddressSize());
    
    adjustForDeopt();
    if (DEBUG)
    {
      System.out.println("X86Frame(sp, fp): " + this);
      dumpStack();
    }
  }
  
  public Object clone()
  {
    X86Frame frame = new X86Frame();
    raw_sp = raw_sp;
    raw_unextendedSP = raw_unextendedSP;
    raw_fp = raw_fp;
    raw_fp = raw_fp;
    pc = pc;
    deoptimized = deoptimized;
    return frame;
  }
  
  public boolean equals(Object arg)
  {
    if (arg == null) {
      return false;
    }
    if (!(arg instanceof X86Frame)) {
      return false;
    }
    X86Frame other = (X86Frame)arg;
    
    return (AddressOps.equal(getSP(), other.getSP())) && (AddressOps.equal(getUnextendedSP(), other.getUnextendedSP())) && (AddressOps.equal(getFP(), other.getFP())) && (AddressOps.equal(getPC(), other.getPC()));
  }
  
  public int hashCode()
  {
    if (raw_sp == null) {
      return 0;
    }
    return raw_sp.hashCode();
  }
  
  public String toString()
  {
    return "sp: " + (getSP() == null ? "null" : getSP().toString()) + ", unextendedSP: " + (getUnextendedSP() == null ? "null" : getUnextendedSP().toString()) + ", fp: " + (getFP() == null ? "null" : getFP().toString()) + ", pc: " + (pc == null ? "null" : pc.toString());
  }
  
  public Address getFP()
  {
    return raw_fp;
  }
  
  public Address getSP()
  {
    return raw_sp;
  }
  
  public Address getID()
  {
    return raw_sp;
  }
  
  public boolean isSignalHandlerFrameDbg()
  {
    return false;
  }
  
  public int getSignalNumberDbg()
  {
    return 0;
  }
  
  public String getSignalNameDbg()
  {
    return null;
  }
  
  public boolean isInterpretedFrameValid()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(isInterpretedFrame(), "Not an interpreted frame");
    }
    if ((getFP() == null) || (getFP().andWithMask(3L) != null)) {
      return false;
    }
    if ((getSP() == null) || (getSP().andWithMask(3L) != null)) {
      return false;
    }
    if (getFP().addOffsetTo(INTERPRETER_FRAME_INITIAL_SP_OFFSET * VM.getVM().getAddressSize()).lessThan(getSP())) {
      return false;
    }
    if (getFP().lessThanOrEqual(getSP())) {
      return false;
    }
    if (getFP().minus(getSP()) > 4096L * VM.getVM().getAddressSize()) {
      return false;
    }
    return true;
  }
  
  public Frame sender(RegisterMap regMap, CodeBlob cb)
  {
    X86RegisterMap map = (X86RegisterMap)regMap;
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    map.setIncludeArgumentOops(false);
    if (isEntryFrame()) {
      return senderForEntryFrame(map);
    }
    if (isInterpretedFrame()) {
      return senderForInterpreterFrame(map);
    }
    if (!VM.getVM().isCore())
    {
      if (cb == null) {
        cb = VM.getVM().getCodeCache().findBlob(getPC());
      } else if (Assert.ASSERTS_ENABLED) {
        Assert.that(cb.equals(VM.getVM().getCodeCache().findBlob(getPC())), "Must be the same");
      }
      if (cb != null) {
        return senderForCompiledFrame(map, cb);
      }
    }
    return new X86Frame(getSenderSP(), getLink(), getSenderPC());
  }
  
  private Frame senderForEntryFrame(X86RegisterMap map)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    X86JavaCallWrapper jcw = (X86JavaCallWrapper)getEntryFrameCallWrapper();
    if (Assert.ASSERTS_ENABLED)
    {
      Assert.that(!entryFrameIsFirst(), "next Java fp must be non zero");
      Assert.that(jcw.getLastJavaSP().greaterThan(getSP()), "must be above this frame on stack");
    }
    X86Frame fr;
    X86Frame fr;
    if (jcw.getLastJavaPC() != null) {
      fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP(), jcw.getLastJavaPC());
    } else {
      fr = new X86Frame(jcw.getLastJavaSP(), jcw.getLastJavaFP());
    }
    map.clear();
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map.getIncludeArgumentOops(), "should be set by clear");
    }
    return fr;
  }
  
  private Frame senderForInterpreterFrame(X86RegisterMap map)
  {
    Address unextendedSP = addressOfStackSlot(-1).getAddressAt(0L);
    Address sp = addressOfStackSlot(2);
    
    return new X86Frame(sp, getLink(), unextendedSP.minus(sp));
  }
  
  private Frame senderForCompiledFrame(X86RegisterMap map, CodeBlob cb)
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(map != null, "map must be set");
    }
    Address sender_sp = null;
    if (VM.getVM().isClientCompiler())
    {
      sender_sp = addressOfStackSlot(2);
    }
    else
    {
      if (Assert.ASSERTS_ENABLED) {
        Assert.that(cb.getFrameSize() >= 0L, "Compiled by Compiler1: do not use");
      }
      sender_sp = getUnextendedSP().addOffsetTo(cb.getFrameSize());
    }
    Address sender_pc = sender_sp.getAddressAt(-1L * VM.getVM().getAddressSize());
    if ((map.getUpdateMap()) && (cb.getOopMaps() != null)) {
      OopMapSet.updateRegisterMap(this, cb, map, true);
    }
    if (VM.getVM().isClientCompiler()) {
      map.setIncludeArgumentOops(cb.callerMustGCArguments(map.getThread()));
    }
    Address saved_fp = null;
    if (VM.getVM().isClientCompiler()) {
      saved_fp = getFP().getAddressAt(0L);
    } else if ((VM.getVM().isServerCompiler()) && ((VM.getVM().getInterpreter().contains(sender_pc)) || (VM.getVM().getStubRoutines().returnsToCallStub(sender_pc)))) {
      saved_fp = sender_sp.getAddressAt(-2L * VM.getVM().getAddressSize());
    }
    return new X86Frame(sender_sp, saved_fp, sender_pc);
  }
  
  protected boolean hasSenderPD()
  {
    return true;
  }
  
  public long frameSize()
  {
    return getSenderSP().minus(getSP()) / VM.getVM().getAddressSize();
  }
  
  public Address getLink()
  {
    return addressOfStackSlot(0).getAddressAt(0L);
  }
  
  public Address getUnextendedSP()
  {
    return raw_unextendedSP;
  }
  
  public Address getSenderPCAddr()
  {
    return addressOfStackSlot(1);
  }
  
  public Address getSenderPC()
  {
    return getSenderPCAddr().getAddressAt(0L);
  }
  
  public Address getNativeParamAddr(int idx)
  {
    return addressOfStackSlot(2 + idx);
  }
  
  public Address getSenderSP()
  {
    return addressOfStackSlot(2);
  }
  
  public Address compiledArgumentToLocationPD(VMReg reg, RegisterMap regMap, int argSize)
  {
    if ((VM.getVM().isCore()) || (VM.getVM().isClientCompiler())) {
      throw new RuntimeException("Should not reach here");
    }
    return oopMapRegToLocation(reg, regMap);
  }
  
  public Address addressOfInterpreterFrameLocals()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_LOCALS_OFFSET);
  }
  
  private Address addressOfInterpreterFrameBCX()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_BCX_OFFSET);
  }
  
  public int getInterpreterFrameBCI()
  {
    Address bcp = addressOfInterpreterFrameBCX().getAddressAt(0L);
    OopHandle methodHandle = addressOfInterpreterFrameMethod().getOopHandleAt(0L);
    Method method = (Method)VM.getVM().getObjectHeap().newOop(methodHandle);
    return bcpToBci(bcp, method);
  }
  
  public Address addressOfInterpreterFrameMDX()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_MDX_OFFSET);
  }
  
  public Address addressOfInterpreterFrameExpressionStack()
  {
    Address monitorEnd = interpreterFrameMonitorEnd().address();
    return monitorEnd.addOffsetTo(-1L * VM.getVM().getAddressSize());
  }
  
  public int getInterpreterFrameExpressionStackDirection()
  {
    return -1;
  }
  
  public Address addressOfInterpreterFrameTOS()
  {
    return getSP();
  }
  
  public Address addressOfInterpreterFrameTOSAt(int slot)
  {
    return addressOfInterpreterFrameTOS().addOffsetTo(slot * VM.getVM().getAddressSize());
  }
  
  public Address getInterpreterFrameSenderSP()
  {
    if (Assert.ASSERTS_ENABLED) {
      Assert.that(isInterpretedFrame(), "interpreted frame expected");
    }
    return addressOfStackSlot(-1).getAddressAt(0L);
  }
  
  public BasicObjectLock interpreterFrameMonitorBegin()
  {
    return new BasicObjectLock(addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_BOTTOM_OFFSET));
  }
  
  public BasicObjectLock interpreterFrameMonitorEnd()
  {
    Address result = addressOfStackSlot(INTERPRETER_FRAME_MONITOR_BLOCK_TOP_OFFSET).getAddressAt(0L);
    if (Assert.ASSERTS_ENABLED)
    {
      Assert.that(AddressOps.gt(getFP(), result), "result must <  than frame pointer");
      Assert.that(AddressOps.lte(getSP(), result), "result must >= than stack pointer");
    }
    return new BasicObjectLock(result);
  }
  
  public int interpreterFrameMonitorSize()
  {
    return BasicObjectLock.size();
  }
  
  public Address addressOfInterpreterFrameMethod()
  {
    return addressOfStackSlot(-3);
  }
  
  public Address addressOfInterpreterFrameCPCache()
  {
    return addressOfStackSlot(INTERPRETER_FRAME_CACHE_OFFSET);
  }
  
  public JavaCallWrapper getEntryFrameCallWrapper()
  {
    return new X86JavaCallWrapper(addressOfStackSlot(2).getAddressAt(0L));
  }
  
  protected Address addressOfSavedOopResult()
  {
    return getSP().addOffsetTo((VM.getVM().isClientCompiler() ? 2 : 3) * VM.getVM().getAddressSize());
  }
  
  protected Address addressOfSavedReceiver()
  {
    return getSP().addOffsetTo(-4L * VM.getVM().getAddressSize());
  }
  
  private void dumpStack()
  {
    if (getFP() != null) {
      for (Address addr = getSP().addOffsetTo(-5L * VM.getVM().getAddressSize()); AddressOps.lte(addr, getFP().addOffsetTo(5L * VM.getVM().getAddressSize())); addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
        System.out.println(addr + ": " + addr.getAddressAt(0L));
      }
    } else {
      for (Address addr = getSP().addOffsetTo(-5L * VM.getVM().getAddressSize()); AddressOps.lte(addr, getSP().addOffsetTo(20L * VM.getVM().getAddressSize())); addr = addr.addOffsetTo(VM.getVM().getAddressSize())) {
        System.out.println(addr + ": " + addr.getAddressAt(0L));
      }
    }
  }
  
  private X86Frame() {}
}

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

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

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

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

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

public class X86JavaCallWrapper
  extends JavaCallWrapper
{
  private static AddressField lastJavaFPField;
  
  static
  {
    VM.registerVMInitializedObserver(new Observer()
    {
      public void update(Observable o, Object data)
      {
        X86JavaCallWrapper.initialize(VM.getVM().getTypeDataBase());
      }
    });
  }
  
  private static synchronized void initialize(TypeDataBase db)
  {
    Type type = db.lookupType("JavaFrameAnchor");
    
    lastJavaFPField = type.getAddressField("_last_Java_fp");
  }
  
  public X86JavaCallWrapper(Address addr)
  {
    super(addr);
  }
  
  public Address getLastJavaFP()
  {
    return lastJavaFPField.getValue(addr.addOffsetTo(anchorField.getOffset()));
  }
}

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

import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.runtime.JavaThread;
import sun.jvm.hotspot.runtime.RegisterMap;
import sun.jvm.hotspot.runtime.VMReg;

public class X86RegisterMap
  extends RegisterMap
{
  public X86RegisterMap(JavaThread thread, boolean updateMap)
  {
    super(thread, updateMap);
  }
  
  protected X86RegisterMap(RegisterMap map)
  {
    super(map);
  }
  
  public Object clone()
  {
    X86RegisterMap retval = new X86RegisterMap(this);
    return retval;
  }
  
  protected void clearPD() {}
  
  protected void initializePD() {}
  
  protected void initializeFromPD(RegisterMap map) {}
  
  protected Address getLocationPD(VMReg reg)
  {
    return null;
  }
}

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

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.CodeSource;
import java.security.PermissionCollection;

public class SALauncherLoader
  extends URLClassLoader
{
  private String[] libpaths;
  
  public String findLibrary(String name)
  {
    name = System.mapLibraryName(name);
    for (int i = 0; i < libpaths.length; i++)
    {
      File file = new File(new File(libpaths[i]), name);
      if (file.exists()) {
        return file.getAbsolutePath();
      }
    }
    return null;
  }
  
  public SALauncherLoader(ClassLoader parent)
  {
    super(getClassPath(), parent);
    String salibpath = System.getProperty("sa.library.path");
    if (salibpath != null) {
      libpaths = salibpath.split(File.pathSeparator);
    } else {
      libpaths = new String[0];
    }
  }
  
  public synchronized Class loadClass(String name, boolean resolve)
    throws ClassNotFoundException
  {
    int i = name.lastIndexOf('.');
    if (i != -1)
    {
      SecurityManager sm = System.getSecurityManager();
      if (sm != null) {
        sm.checkPackageAccess(name.substring(0, i));
      }
    }
    Class clazz = findLoadedClass(name);
    if (clazz != null) {
      return clazz;
    }
    try
    {
      return findClass(name);
    }
    catch (ClassNotFoundException cnfe) {}
    return super.loadClass(name, resolve);
  }
  
  protected PermissionCollection getPermissions(CodeSource codesource)
  {
    PermissionCollection perms = super.getPermissions(codesource);
    perms.add(new RuntimePermission("exitVM"));
    return perms;
  }
  
  private static URL[] getClassPath()
  {
    String s = System.getProperty("java.class.path");
    File[] path = s == null ? new File[0] : getClassPath(s);
    
    return pathToURLs(path);
  }
  
  private static URL[] pathToURLs(File[] path)
  {
    URL[] urls = new URL[path.length];
    for (int i = 0; i < path.length; i++) {
      urls[i] = getFileURL(path[i]);
    }
    return urls;
  }
  
  private static File[] getClassPath(String cp)
  {
    String[] tmp = cp.split(File.pathSeparator);
    File[] paths = new File[tmp.length];
    for (int i = 0; i < paths.length; i++) {
      paths[i] = new File(tmp[i].equals("") ? "." : tmp[i]);
    }
    return paths;
  }
  
  private static URL getFileURL(File file)
  {
    try
    {
      file = file.getCanonicalFile();
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }
    try
    {
      return file.toURI().toURL();
    }
    catch (MalformedURLException mue)
    {
      throw new InternalError(mue.getMessage());
    }
  }
}

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

public class StackTrace
{
  public static void main(String[] args)
  {
    sun.jvm.hotspot.tools.StackTrace.main(args);
  }
}

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

import java.io.PrintStream;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.debugger.AddressException;
import sun.jvm.hotspot.debugger.DebuggerException;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.debugger.MachineDescriptionSPARC64Bit;
import sun.jvm.hotspot.debugger.dbx.DbxDebuggerLocal;

public class TestDebugger
{
  private static final String dbxPathName = "/export/home/kbr/ws/dbx_61/dev/Derived-sparcv9-S2./src/dbx/dbx";
  private static final String[] dbxSvcAgentDSOPathNames = { "/export/home/kbr/main/sa_baseline/src/os/solaris/agent/libsvc_agent_dbx.so" };
  
  private static void usage()
  {
    System.out.println("usage: java TestDebugger [pid]");
    System.out.println("pid must be the process ID of the helloWorld process");
    System.exit(1);
  }
  
  public static void main(String[] args)
  {
    try
    {
      if (args.length != 1) {
        usage();
      }
      int pid = 0;
      try
      {
        pid = Integer.parseInt(args[0]);
      }
      catch (NumberFormatException e)
      {
        usage();
      }
      JVMDebugger debugger = new DbxDebuggerLocal(new MachineDescriptionSPARC64Bit(), "/export/home/kbr/ws/dbx_61/dev/Derived-sparcv9-S2./src/dbx/dbx", dbxSvcAgentDSOPathNames, true);
      try
      {
        debugger.attach(pid);
      }
      catch (DebuggerException e)
      {
        System.err.print("Error attaching to process ID " + pid + ": ");
        if (e.getMessage() != null) {
          System.err.print(e.getMessage());
        }
        System.err.println();
        System.exit(1);
      }
      debugger.configureJavaPrimitiveTypeSizes(1L, 1L, 2L, 8L, 4L, 4L, 8L, 2L);
      
      String loadObjectName = "-";
      
      Address addr = debugger.lookup(loadObjectName, "helloWorldString");
      if (addr == null)
      {
        System.err.println("Error looking up symbol \"helloWorldString\" in context \"" + loadObjectName + "\"");
        
        System.exit(1);
      }
      addr = addr.getAddressAt(0L);
      
      int helloWorldLen = 13;
      byte[] data = new byte[helloWorldLen];
      for (int i = 0; i < helloWorldLen; i++) {
        data[i] = ((byte)(int)addr.getCIntegerAt(i, 1L, false));
      }
     
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