1 30 31 37 38 package jbet.cmd; 39 import jbet.*; 40 import java.io.*; 41 import java.util.*; 42 43 public class listbbs implements Command 44 { 45 public int helplevel() { return 3; } 46 public String shorthelp() { return "list basic blocks in a method"; } 47 public String longhelp() { 48 return 49 "jbet listbbs <class>.<method>\t\tList basic blocks\n"; } 50 51 public void run (Lexer lexer) throws Exception 52 { 53 lexer.match(Token.END_OF_OPTS); 54 Object thing = lexer.getThing(Jbet.default_class); 55 MethodInfo mi; 56 lexer.term(); 57 if (thing instanceof MethodInfo) 58 mi = (MethodInfo)thing; 59 else { 60 Jbet.error.println("listbbs: not a method"); 61 return; 62 } 63 64 Vector bbs = InstrBlock.FindBasicBlocks (mi, null); 65 66 for (int i = 0; i < bbs.size(); i++) 67 ((Block)(bbs.elementAt (i))).printinfo (Jbet.output, true); 68 69 Jbet.output.println (); 70 } 71 } 72 | Popular Tags |