Example #1
0
 @StubMethod
 public void start0(final ThreadMirror threadMirror) {
   ClassMirror threadClass = getVM().findBootstrapClassMirror(Thread.class.getName());
   final MethodMirror runMethod;
   final MethodMirror exitMethod;
   try {
     runMethod = threadClass.getDeclaredMethod("run");
     exitMethod = threadClass.getDeclaredMethod("exit");
   } catch (NoSuchMethodException e) {
     throw new RuntimeException(e);
   }
   Thread thread =
       new Thread("Holographic thread (" + Reflection.getThreadName(threadMirror) + ")") {
         @Override
         public void run() {
           try {
             try {
               runMethod.invoke(threadMirror, threadMirror);
               exitMethod.invoke(threadMirror, threadMirror);
             } catch (MirrorInvocationTargetException e) {
               throw new RuntimeException(e);
             } catch (IllegalAccessException e) {
               throw new RuntimeException(e);
             }
           } finally {
             getVM().threadExited(threadMirror);
           }
         }
       };
   thread.start();
   getVM().threadStarted(threadMirror);
 }
Example #2
0
  @StubMethod
  public ObjectArrayMirror getStackTrace(ThreadMirror thread) {
    VirtualMachineMirror vm = getVM();

    List<FrameMirror> trace = thread.getStackTrace();
    int size = trace.size();
    ClassMirror stackTraceElementClass =
        vm.findBootstrapClassMirror(StackTraceElement.class.getName());
    ObjectArrayMirror result = (ObjectArrayMirror) stackTraceElementClass.newArray(size);
    for (int i = 0; i < size; i++) {
      result.set(i, HolographInternalUtils.stackTraceElementForFrameMirror(vm, trace.get(i)));
    }
    return result;
  }
 @StubMethod
 public int getClassAccessFlags(ClassMirror klass) {
   return klass.getModifiers();
 }