be.request().putProperty(((BreakpointEvent) event).thread().name(), null);
}
else
{
//generar evento
EEvent eEvent=null;
if(!be.location().method().isConstructor())
generatedEvents.add(eEvent=dataManager.createMethodEntryEvent(be));
else
generatedEvents.add(eEvent=dataManager.createNewObjectEvent(be));
//crea method entry para desactivar method exit cuando empiece a bajar en el stack trace
MethodEntryRequest mer = vm.eventRequestManager().createMethodEntryRequest();
mer.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
mer.addThreadFilter(be.thread());
mer.putProperty("threadName", be.thread().name());
mer.putProperty("eEvent", eEvent);
mer.putProperty("where", "breakpoint");
mer.setEnabled(true);
//crea method exit para cuando salga de este stacktrace
MethodExitRequest mxr = vm.eventRequestManager().createMethodExitRequest();
mxr.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
mxr.addThreadFilter(be.thread());
mxr.putProperty("threadName", be.thread().name());
mxr.putProperty("eEvent", eEvent);
mxr.putProperty("where", "breakpoint");
mxr.setEnabled(true);
}
/*}
else if(!already)
{
//generar evento
EEvent eEvent=null;
if(!be.location().method().isConstructor())
generatedEvents.add(eEvent=dataManager.createMethodEntryEvent(be));
else
generatedEvents.add(eEvent=dataManager.createNewObjectEvent(be));
//crea method entry para desactivar method exit cuando empiece a bajar en el stack trace
MethodEntryRequest mer = vm.eventRequestManager().createMethodEntryRequest();
mer.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
mer.addThreadFilter(be.thread());
mer.putProperty("threadName", be.thread().name());
mer.putProperty("eEvent", eEvent);
mer.putProperty("where", "breakpoint");
mer.setEnabled(true);
//crea method exit para cuando salga de este stacktrace
MethodExitRequest mxr = vm.eventRequestManager().createMethodExitRequest();
mxr.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
mxr.addThreadFilter(be.thread());
mxr.putProperty("threadName", be.thread().name());
mxr.putProperty("eEvent", eEvent);
mxr.putProperty("where", "breakpoint");
mxr.setEnabled(true);
already=true;
}*/
}
//se esta bajando en el stacktrace
else if(event instanceof MethodEntryEvent)
{
//TODO si se esta filtrando por hilos?
//System.out.println("*->" + event + "(" + event.hashCode() + ")" + " -> " + event.request().getProperty("where") + " filter thread: " + event.request().getProperty("threadName"));
//deshabilita method entry
event.request().disable();
//deshabilita method exit
MethodExitRequest mxr = null;
for(MethodExitRequest mx : vm.eventRequestManager().methodExitRequests())
{
Long id=((EEvent)mx.getProperty("eEvent")).getId();
if(id!=null && id.equals(((EEvent)event.request().getProperty("eEvent")).getId()))
{
mxr=mx;
break;
}
}
mxr.disable();
//desabilitar otros steps requests
if(vm.eventRequestManager().stepRequests().size()>0)
vm.eventRequestManager().stepRequests().get(vm.eventRequestManager().stepRequests().size()-1).disable();
//crea step out para cuando regrese a este stack frame
StepRequest sr = vm.eventRequestManager().createStepRequest(((MethodEntryEvent) event).thread(), StepRequest.STEP_LINE, StepRequest.STEP_OUT);
sr.putProperty("eEvent", event.request().getProperty("eEvent"));
sr.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
sr.setEnabled(true);
}
else if(event instanceof MethodExitEvent)
{
//System.out.println("*->" + event + "(" + event.hashCode() + ")" + " -> " + event.request().getProperty("where") + " filter thread: " + event.request().getProperty("threadName"));
//generar evento
generatedEvents.add(dataManager.createMethodExitEvent((MethodExitEvent) event));
//destruye method entry
MethodEntryRequest mer = null;
for(MethodEntryRequest me : vm.eventRequestManager().methodEntryRequests())
{
Long id=((EEvent)me.getProperty("eEvent")).getId();
if(id!=null && id.equals(((EEvent)event.request().getProperty("eEvent")).getId()))
{
mer=me;
break;
}
}
mer.disable();
vm.eventRequestManager().deleteEventRequest(mer);
//destruye method exit
event.request().disable();
vm.eventRequestManager().deleteEventRequest(event.request());
}
//se esta subiendo en el stack trace
else if(event instanceof StepEvent)
{
///////////////
for(BreakpointRequest br : vm.eventRequestManager().breakpointRequests())
{
if(br.location().equals(((StepEvent) event).location()))
{
br.putProperty(((StepEvent) event).thread().name(), "after step event");
}
}
//////////////////////
//generar otro step out
if(((EStackFrameLocatableEvent) event.request().getProperty("eEvent")).getStackFrameLocation().getStackFrame().getDepth()==((StepEvent) event).thread().frameCount())
{
//habilita method entry
MethodEntryRequest mer = null;
for(MethodEntryRequest me : vm.eventRequestManager().methodEntryRequests())
{
Long id=((EEvent) me.getProperty("eEvent")).getId();
if(id!=null && id.equals(((EEvent)event.request().getProperty("eEvent")).getId()))
{
mer=me;
break;
}
}
mer.enable();
//habilita method exit
MethodExitRequest mxr = null;
for(MethodExitRequest mx : vm.eventRequestManager().methodExitRequests())
{
Long id=((EEvent) mx.getProperty("eEvent")).getId();
if(id!=null && id.equals(((EEvent)event.request().getProperty("eEvent")).getId()))
{
mxr=mx;
break;
}
}
mxr.enable();
//destruye step out
event.request().disable();
vm.eventRequestManager().deleteEventRequest(event.request());
//habilita el siguiente step out
if(vm.eventRequestManager().stepRequests().size()>0)
vm.eventRequestManager().stepRequests().get(vm.eventRequestManager().stepRequests().size()-1).enable();
}
}
else if(event instanceof AccessWatchpointEvent)
{
//generar evento
generatedEvents.add(dataManager.createFieldAccessEvent((AccessWatchpointEvent) event));
}
else if(event instanceof ModificationWatchpointEvent)
{
//generar evento
generatedEvents.add(dataManager.createFieldModificationEvent((ModificationWatchpointEvent) event));
}
else if(event instanceof ExceptionEvent)
{
//generar evento
generatedEvents.add(dataManager.createExceptionEvent((ExceptionEvent) event));
}
else if(event instanceof MonitorContendedEnterEvent)
{
//generar evento
generatedEvents.add(dataManager.createMonitorEnterEvent((MonitorContendedEnterEvent) event));
}
else if(event instanceof MonitorContendedEnteredEvent)
{
EEvent eEvent=null;
//generar evento
generatedEvents.add(eEvent = dataManager.createMonitorEnteredEvent((MonitorContendedEnteredEvent) event));
//TODO cuantas veces es necesario poner el method entry para generar el evento, solo unavez por toda la ejecucion?, o cada vez que ocurra un MonitorContendedEnteredEvent
/*
if(((MonitorContendedEnteredEvent) event).thread().name().equals("main") && !put)