0 Replies Latest reply: Mar 9, 2009 10:32 AM by 843810 RSS

    unable to add method entry & exit request into VM request queue in JDI

    843810
      Hi,im a newbie to java & im trying to develop a simple java debugger.Ive added code that makes method entry & exit event request to VM event queue.But when i try to process event in the queue only VMStart event is in the queue.


      this piece of code setstp request for event
      EventRequestManager erm = vm.eventRequestManager();
             MethodEntryRequest menr = erm.createMethodEntryRequest();
             for (int i=0; i<excludes.length; ++i) {
                  menr.addClassFilter(excludes);
      }
      menr.enable();
      MethodExitRequest mexr = erm.createMethodExitRequest();
      for (int i=0; i<excludes.length; ++i) {
      mexr.addClassExclusionFilter(excludes[i]);
      }
      //mexr.setSuspendPolicy(EventRequest.SUSPEND_NONE);
      mexr.enable();
      expm.start();
      vm.resume();
      }
      this piece of code processes the events in the queue
      public void run()
      {
      EventQueue queue = vm.eventQueue();
      try {
      EventSet eventSet = queue.remove();
      EventIterator it = eventSet.eventIterator();
      while (it.hasNext()) {
      Event et=it.nextEvent();
      System.out.println(et);
      if(et instanceof MethodEntryEvent)
      System.out.println(et);
      else if (et instanceof MethodExitEvent)
      System.out.println(et);
      }
      eventSet.resume();
      } catch (InterruptedException exc) {
      // Ignore
      } catch (VMDisconnectedException discExc) {
      //handleDisconnectedException();
      // break;
      }
      }