< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java

Print this page




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.ui.classbrowser;
  26 
  27 import java.io.*;
  28 import java.util.*;
  29 import sun.jvm.hotspot.asm.*;
  30 import sun.jvm.hotspot.code.*;
  31 import sun.jvm.hotspot.compiler.*;
  32 import sun.jvm.hotspot.debugger.*;
  33 import sun.jvm.hotspot.interpreter.*;
  34 import sun.jvm.hotspot.oops.*;
  35 import sun.jvm.hotspot.runtime.*;
  36 import sun.jvm.hotspot.tools.jcore.*;

  37 import sun.jvm.hotspot.utilities.*;
  38 
  39 public class HTMLGenerator implements /* imports */ ClassConstants {
  40     static class Formatter {
  41         boolean html;
  42         StringBuffer buf = new StringBuffer();
  43 
  44         Formatter(boolean h) {
  45             html = h;
  46         }
  47 
  48         void append(String s) {
  49             buf.append(s);
  50         }
  51 
  52         void append(int s) {
  53             buf.append(s);
  54         }
  55 
  56         void append(char s) {


1911       buf.beginTag("pre");
1912       for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
1913          Method method = vf.getMethod();
1914          buf.append(" - ");
1915          buf.append(genMethodLink(method));
1916          buf.append(" @bci = " + vf.getBCI());
1917 
1918          int lineNumber = method.getLineNumberFromBCI(vf.getBCI());
1919          if (lineNumber != -1) {
1920             buf.append(", line = ");
1921             buf.append(lineNumber);
1922          }
1923 
1924          sun.jvm.hotspot.debugger.Address pc = vf.getFrame().getPC();
1925          if (pc != null) {
1926             buf.append(", pc = ");
1927             buf.link(genPCHref(addressToLong(pc)), pc.toString());
1928          }
1929 
1930          if (!method.isStatic() && !method.isNative()) {

1931             OopHandle oopHandle = vf.getLocals().oopHandleAt(0);
1932 
1933             if (oopHandle != null) {
1934                buf.append(", oop = ");
1935                buf.append(oopHandle.toString());




1936             }
1937          }
1938 
1939          if (vf.isCompiledFrame()) {
1940             buf.append(" (Compiled");
1941          }
1942          else if (vf.isInterpretedFrame()) {
1943             buf.append(" (Interpreted");
1944          }
1945 
1946          if (vf.mayBeImpreciseDbg()) {
1947             buf.append("; information may be imprecise");
1948          }
1949          buf.append(")");
1950          buf.br();
1951       }
1952 
1953       buf.endTag("pre");
1954       buf.genHTMLEpilogue();
1955       return buf.toString();




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.ui.classbrowser;
  26 
  27 import java.io.*;
  28 import java.util.*;
  29 import sun.jvm.hotspot.asm.*;
  30 import sun.jvm.hotspot.code.*;
  31 import sun.jvm.hotspot.compiler.*;
  32 import sun.jvm.hotspot.debugger.*;
  33 import sun.jvm.hotspot.interpreter.*;
  34 import sun.jvm.hotspot.oops.*;
  35 import sun.jvm.hotspot.runtime.*;
  36 import sun.jvm.hotspot.tools.jcore.*;
  37 import sun.jvm.hotspot.types.*;
  38 import sun.jvm.hotspot.utilities.*;
  39 
  40 public class HTMLGenerator implements /* imports */ ClassConstants {
  41     static class Formatter {
  42         boolean html;
  43         StringBuffer buf = new StringBuffer();
  44 
  45         Formatter(boolean h) {
  46             html = h;
  47         }
  48 
  49         void append(String s) {
  50             buf.append(s);
  51         }
  52 
  53         void append(int s) {
  54             buf.append(s);
  55         }
  56 
  57         void append(char s) {


1912       buf.beginTag("pre");
1913       for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
1914          Method method = vf.getMethod();
1915          buf.append(" - ");
1916          buf.append(genMethodLink(method));
1917          buf.append(" @bci = " + vf.getBCI());
1918 
1919          int lineNumber = method.getLineNumberFromBCI(vf.getBCI());
1920          if (lineNumber != -1) {
1921             buf.append(", line = ");
1922             buf.append(lineNumber);
1923          }
1924 
1925          sun.jvm.hotspot.debugger.Address pc = vf.getFrame().getPC();
1926          if (pc != null) {
1927             buf.append(", pc = ");
1928             buf.link(genPCHref(addressToLong(pc)), pc.toString());
1929          }
1930 
1931          if (!method.isStatic() && !method.isNative()) {
1932             try {
1933                OopHandle oopHandle = vf.getLocals().oopHandleAt(0);
1934 
1935                if (oopHandle != null) {
1936                   buf.append(", oop = ");
1937                   buf.append(oopHandle.toString());
1938                }
1939             } catch (WrongTypeException e) {
1940               // Do nothing.
1941               // It might be caused by JIT'ed inline frame.
1942             }
1943          }
1944 
1945          if (vf.isCompiledFrame()) {
1946             buf.append(" (Compiled");
1947          }
1948          else if (vf.isInterpretedFrame()) {
1949             buf.append(" (Interpreted");
1950          }
1951 
1952          if (vf.mayBeImpreciseDbg()) {
1953             buf.append("; information may be imprecise");
1954          }
1955          buf.append(")");
1956          buf.br();
1957       }
1958 
1959       buf.endTag("pre");
1960       buf.genHTMLEpilogue();
1961       return buf.toString();


< prev index next >