Print this page
4719 Common patchset for jdk1.7 support preparation


  39     public static void
  40     main(String[] args)
  41     {
  42         if (args.length != 1) {
  43             System.err.println("usage: java TestFunctionLookup <command>");
  44             System.exit(1);
  45         }
  46         String cmd = args[0];
  47 
  48         Consumer consumer = new LocalConsumer();
  49         try {
  50             consumer.open();
  51             consumer.compile(kernelLookupProgram);
  52             consumer.enable();
  53             consumer.go();
  54             Aggregate a;
  55             Number address;
  56             String f;
  57             boolean done = false;
  58             for (int i = 0; (i < 20) && !done; ++i) {
  59                 Thread.currentThread().sleep(100);
  60                 a = consumer.getAggregate();
  61                 for (Aggregation agg : a.getAggregations()) {
  62                     for (Tuple tuple : agg.asMap().keySet()) {
  63                         address = (Number)tuple.get(0).getValue();
  64                         if (address instanceof Integer) {
  65                             int addr = (Integer)address;
  66                             f = consumer.lookupKernelFunction(addr);
  67                         } else {
  68                             long addr = (Long)address;
  69                             f = consumer.lookupKernelFunction(addr);
  70                         }
  71                         if (f.equals("genunix`cv_wakeup")) {
  72                             System.out.println(f);
  73                             done = true;
  74                         }
  75                     }
  76                 }
  77             }
  78             consumer.close();
  79         } catch (Exception e) {
  80             e.printStackTrace();
  81             System.exit(1);
  82         }
  83 
  84         consumer = new LocalConsumer();
  85         try {
  86             consumer.open();
  87             int pid = consumer.createProcess(cmd);
  88             consumer.compile(userLookupProgram);
  89             consumer.enable();
  90             consumer.go();
  91             Thread.currentThread().sleep(500);
  92             Aggregate a = consumer.getAggregate();
  93             Number address;
  94             String f;
  95             for (Aggregation agg : a.getAggregations()) {
  96                 for (Tuple tuple : agg.asMap().keySet()) {
  97                     address = (Number)tuple.get(0).getValue();
  98                     if (address instanceof Integer) {
  99                         int addr = (Integer)address;
 100                         f = consumer.lookupUserFunction(pid, addr);
 101                     } else {
 102                         long addr = (Long)address;
 103                         f = consumer.lookupUserFunction(pid, addr);
 104                     }
 105                     System.out.println(f);
 106                 }
 107             }
 108             consumer.close();
 109         } catch (Exception e) {
 110             e.printStackTrace();
 111             System.exit(1);


  39     public static void
  40     main(String[] args)
  41     {
  42         if (args.length != 1) {
  43             System.err.println("usage: java TestFunctionLookup <command>");
  44             System.exit(1);
  45         }
  46         String cmd = args[0];
  47 
  48         Consumer consumer = new LocalConsumer();
  49         try {
  50             consumer.open();
  51             consumer.compile(kernelLookupProgram);
  52             consumer.enable();
  53             consumer.go();
  54             Aggregate a;
  55             Number address;
  56             String f;
  57             boolean done = false;
  58             for (int i = 0; (i < 20) && !done; ++i) {
  59                 Thread.sleep(100);
  60                 a = consumer.getAggregate();
  61                 for (Aggregation agg : a.getAggregations()) {
  62                     for (Tuple tuple : agg.asMap().keySet()) {
  63                         address = (Number)tuple.get(0).getValue();
  64                         if (address instanceof Integer) {
  65                             int addr = (Integer)address;
  66                             f = consumer.lookupKernelFunction(addr);
  67                         } else {
  68                             long addr = (Long)address;
  69                             f = consumer.lookupKernelFunction(addr);
  70                         }
  71                         if (f.equals("genunix`cv_wakeup")) {
  72                             System.out.println(f);
  73                             done = true;
  74                         }
  75                     }
  76                 }
  77             }
  78             consumer.close();
  79         } catch (Exception e) {
  80             e.printStackTrace();
  81             System.exit(1);
  82         }
  83 
  84         consumer = new LocalConsumer();
  85         try {
  86             consumer.open();
  87             int pid = consumer.createProcess(cmd);
  88             consumer.compile(userLookupProgram);
  89             consumer.enable();
  90             consumer.go();
  91             Thread.sleep(500);
  92             Aggregate a = consumer.getAggregate();
  93             Number address;
  94             String f;
  95             for (Aggregation agg : a.getAggregations()) {
  96                 for (Tuple tuple : agg.asMap().keySet()) {
  97                     address = (Number)tuple.get(0).getValue();
  98                     if (address instanceof Integer) {
  99                         int addr = (Integer)address;
 100                         f = consumer.lookupUserFunction(pid, addr);
 101                     } else {
 102                         long addr = (Long)address;
 103                         f = consumer.lookupUserFunction(pid, addr);
 104                     }
 105                     System.out.println(f);
 106                 }
 107             }
 108             consumer.close();
 109         } catch (Exception e) {
 110             e.printStackTrace();
 111             System.exit(1);