agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot-8003348 Sdiff agent/src/share/classes/sun/jvm/hotspot

agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java

Print this page
8003348: SA can not read core file on OS X


1500                             }
1501 
1502 
1503                         };
1504                     VM.getVM().getCodeCache().iterate(v);
1505                 }
1506             }
1507         },
1508         new Command("where", "where { -a | id }", false) {
1509             public void doit(Tokens t) {
1510                 if (t.countTokens() != 1) {
1511                     usage();
1512                 } else {
1513                     String name = t.nextToken();
1514                     Threads threads = VM.getVM().getThreads();
1515                     boolean all = name.equals("-a");
1516                     for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
1517                         ByteArrayOutputStream bos = new ByteArrayOutputStream();
1518                         thread.printThreadIDOn(new PrintStream(bos));
1519                         if (all || bos.toString().equals(name)) {
1520                             out.println(bos.toString() + " = " + thread.getAddress());
1521                             HTMLGenerator gen = new HTMLGenerator(false);
1522                             try {
1523                                 out.println(gen.genHTMLForJavaStackTrace(thread));
1524                             } catch (Exception e) {
1525                                 err.println("Error: " + e);
1526                                 if (verboseExceptions) {
1527                                     e.printStackTrace(err);
1528                                 }
1529                             }
1530                             if (!all) return;
1531                         }
1532                     }
1533                     if (!all) out.println("Couldn't find thread " + name);
1534                 }
1535             }
1536         },
1537         new Command("thread", "thread { -a | id }", false) {
1538             public void doit(Tokens t) {
1539                 if (t.countTokens() != 1) {
1540                     usage();
1541                 } else {
1542                     String name = t.nextToken();
1543                     Threads threads = VM.getVM().getThreads();
1544                     boolean all = name.equals("-a");
1545                     for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
1546                         ByteArrayOutputStream bos = new ByteArrayOutputStream();
1547                         thread.printThreadIDOn(new PrintStream(bos));
1548                         if (all || bos.toString().equals(name)) {
1549                             out.println(bos.toString() + " = " + thread.getAddress());
1550                             if (!all) return;
1551                         }
1552                     }
1553                     out.println("Couldn't find thread " + name);
1554                 }
1555             }
1556         },
1557 
1558         new Command("threads", false) {
1559             public void doit(Tokens t) {
1560                 if (t.countTokens() != 0) {
1561                     usage();
1562                 } else {
1563                     Threads threads = VM.getVM().getThreads();
1564                     for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
1565                         thread.printThreadIDOn(out);
1566                         out.println(" " + thread.getThreadName());
1567                     }
1568                 }
1569             }




1500                             }
1501 
1502 
1503                         };
1504                     VM.getVM().getCodeCache().iterate(v);
1505                 }
1506             }
1507         },
1508         new Command("where", "where { -a | id }", false) {
1509             public void doit(Tokens t) {
1510                 if (t.countTokens() != 1) {
1511                     usage();
1512                 } else {
1513                     String name = t.nextToken();
1514                     Threads threads = VM.getVM().getThreads();
1515                     boolean all = name.equals("-a");
1516                     for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
1517                         ByteArrayOutputStream bos = new ByteArrayOutputStream();
1518                         thread.printThreadIDOn(new PrintStream(bos));
1519                         if (all || bos.toString().equals(name)) {
1520                             out.println("Thread " + bos.toString() + " Address: " + thread.getAddress());
1521                             HTMLGenerator gen = new HTMLGenerator(false);
1522                             try {
1523                                 out.println(gen.genHTMLForJavaStackTrace(thread));
1524                             } catch (Exception e) {
1525                                 err.println("Error: " + e);
1526                                 if (verboseExceptions) {
1527                                     e.printStackTrace(err);
1528                                 }
1529                             }
1530                             if (!all) return;
1531                         }
1532                     }
1533                     if (!all) out.println("Couldn't find thread " + name);
1534                 }
1535             }
1536         },
1537         new Command("thread", "thread { -a | id }", false) {
1538             public void doit(Tokens t) {
1539                 if (t.countTokens() != 1) {
1540                     usage();
1541                 } else {
1542                     String name = t.nextToken();
1543                     Threads threads = VM.getVM().getThreads();
1544                     boolean all = name.equals("-a");
1545                     for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
1546                         ByteArrayOutputStream bos = new ByteArrayOutputStream();
1547                         thread.printThreadIDOn(new PrintStream(bos));
1548                         if (all || bos.toString().equals(name)) {
1549                             out.println("Thread " + bos.toString() + " Address " + thread.getAddress());
1550                             if (!all) return;
1551                         }
1552                     }
1553                     out.println("Couldn't find thread " + name);
1554                 }
1555             }
1556         },
1557 
1558         new Command("threads", false) {
1559             public void doit(Tokens t) {
1560                 if (t.countTokens() != 0) {
1561                     usage();
1562                 } else {
1563                     Threads threads = VM.getVM().getThreads();
1564                     for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
1565                         thread.printThreadIDOn(out);
1566                         out.println(" " + thread.getThreadName());
1567                     }
1568                 }
1569             }


agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File