mer.addThreadFilter(be.thread());
mer.putProperty("eEvent", eEvent);
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("eEvent", eEvent);
mxr.setEnabled(true);
//System.out.println("\t\t\teventID: " + eEvent.getId());
}
//
// entries.add(eEvent);
//
// //crea step into
// if(vm.eventRequestManager().stepRequests().size()>0)
// {
// vm.eventRequestManager().stepRequests().get(0).disable();
// vm.eventRequestManager().deleteEventRequest(vm.eventRequestManager().stepRequests().get(0));
// }
//
// StepRequest sr = vm.eventRequestManager().createStepRequest(be.thread(), StepRequest.STEP_MIN, StepRequest.STEP_INTO);
// sr.addCountFilter(1);
// sr.putProperty("eEvent", eEvent);
// sr.setEnabled(true);
// }
// /*
// MethodEntryRequest mer = vm.eventRequestManager().createMethodEntryRequest();
// mer.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
// mer.putProperty("eEvent", eEvent);
// mer.setEnabled(true);
//
// MethodExitRequest mxr = vm.eventRequestManager().createMethodExitRequest();
// mxr.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
// mer.putProperty("eEvent", eEvent);
// mxr.setEnabled(true);*/
}
//se esta bajando en el stacktrace
else if(event instanceof MethodEntryEvent)
{/*
System.out.println("\t\t" + event);//////////////////////
if(vm.eventRequestManager().methodEntryRequests().size()>0)
{
habilitarMethodEvents=false;
System.out.println("\t\t\t" + "solicitar eventos metodos: " + habilitarMethodEvents);//////////////////////
//vm.eventRequestManager().deleteEventRequests(vm.eventRequestManager().methodEntryRequests());
//vm.eventRequestManager().deleteEventRequests(vm.eventRequestManager().methodExitRequests());
}
/*
System.out.println("no tuvo que haber entrado aqui!!!");
if(event.request().getProperty("eEvent")==null)
{
System.out.println("extra " + event + ", " + ((MethodEntryEvent) event).thread().frames().size());
printStackTrace(((MethodEntryEvent) event).thread());
}
else{
*/
//System.out.println("\t\t" + event + "," + ((EEvent)event.request().getProperty("eEvent")).getId());//////////////////////
//printStackTrace(((MethodEntryEvent) event).thread());
//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();
//desabiliat otros steps requests
if(vm.eventRequestManager().stepRequests().size()>0)
vm.eventRequestManager().stepRequests().get(vm.eventRequestManager().stepRequests().size()-1).disable();
StepRequest sr = vm.eventRequestManager().createStepRequest(((MethodEntryEvent) event).thread(), StepRequest.STEP_LINE, StepRequest.STEP_OUT);
//sr.addCountFilter(1);
sr.putProperty("eEvent", event.request().getProperty("eEvent"));
sr.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
sr.setEnabled(true);
//}
}
else if(event instanceof MethodExitEvent)
{
/*System.out.println("\t\t" + event);//////////////////////
//generar evento
generatedEvents.add(dataManager.createMethodExitEvent((MethodExitEvent) event));
habilitarMethodEvents=false;
System.out.println("\t\t\t" + "solicitar eventos metodos: " + habilitarMethodEvents);//////////////////////
//vm.eventRequestManager().deleteEventRequests(vm.eventRequestManager().methodEntryRequests());
//vm.eventRequestManager().deleteEventRequests(vm.eventRequestManager().methodExitRequests());
// if(event.request().getProperty("eEvent")==null)
// {System.out.println("extra " + event + ", " + ((MethodExitEvent) event).thread().frames().size());
// printStackTrace(((MethodExitEvent) event).thread());
// }
// else{*/
//System.out.println("\t\t" + event + ", " + ((EEvent)event.request().getProperty("eEvent")).getId());//////////////////////
//printStackTrace(((MethodExitEvent) event).thread());
//System.out.println("method exit event depth: " + ((MethodExitEvent) event).thread().frames().size());
//System.out.println("method exit request depth: " + ((EStackFrameLocatableEvent)event.request().getProperty("eEvent")).getStackFrame().getDepth());
//if(((MethodExitEvent) event).thread().frames().size()==((EStackFrameLocatableEvent)event.request().getProperty("eEvent")).getStackFrame().getDepth())
{
//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 step into
/*StepRequest s = null;
for(StepRequest se : vm.eventRequestManager().stepRequests())
{
Long id=((EEvent)se.getProperty("eEvent")).getId();
if(id!=null && id.equals(((EEvent)event.request().getProperty("eEvent")).getId()))
{
mer=se;
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)
{
//System.out.println(event + "... " + (((StepRequest)event.request()).depth()==StepRequest.STEP_INTO ? "IN" : "OUT"));//////////////////////
//printStackTrace(((StepEvent) event).thread());
/*
if(((StepRequest)event.request()).depth()==StepRequest.STEP_INTO)
{
event.request().disable();
vm.eventRequestManager().deleteEventRequest(event.request());
StepRequest sr = vm.eventRequestManager().createStepRequest(((StepEvent) event).thread(), StepRequest.STEP_MIN, StepRequest.STEP_OUT);
sr.addCountFilter(1);
sr.putProperty("eEvent", event.request().getProperty("eEvent"));
sr.setEnabled(true);
//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)mx.getProperty("eEvent")).getId()))
{
mxr=mx;
break;
}
}
mxr.disable();
}
else
{
event.request().disable();
vm.eventRequestManager().deleteEventRequest(event.request());
StepRequest sr = vm.eventRequestManager().createStepRequest(((StepEvent) event).thread(), StepRequest.STEP_MIN, StepRequest.STEP_INTO);
sr.addCountFilter(1);
sr.putProperty("eEvent", event.request().getProperty("eEvent"));
sr.setEnabled(true);
//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)mx.getProperty("eEvent")).getId()))
{
mxr=mx;
break;
}
}
mxr.enable();
}
/*
if(((StepRequest)event.request()).depth()==StepRequest.STEP_INTO)
{
System.out.println("IN: " + event + "... " + ((StepEvent) event).thread().frameCount());
event.request().disable();
vm.eventRequestManager().deleteEventRequest(event.request());
StepRequest sr = vm.eventRequestManager().createStepRequest(((StepEvent) event).thread(), StepRequest.STEP_MIN, StepRequest.STEP_OUT);
sr.addCountFilter(1);
sr.setEnabled(true);
}
else
{
System.out.println("OUT: " + event + "... " + ((StepEvent) event).thread().frameCount());
event.request().disable();
vm.eventRequestManager().deleteEventRequest(event.request());
StepRequest sr = vm.eventRequestManager().createStepRequest(((StepEvent) event).thread(), StepRequest.STEP_MIN, StepRequest.STEP_INTO);
sr.addCountFilter(1);
sr.setEnabled(true);
}
*/
//System.out.println("\t\t" + event + "... " + ((StepEvent) event).location() + ", " + ((EEvent)event.request().getProperty("eEvent")).getId());//////////////////////
//printStackTrace(((StepEvent) event).thread());
//System.out.println("offical depth: " + ((EStackFrameLocatableEvent) event.request().getProperty("eEvent")).getStackFrame().getDepth());
//System.out.println("real: " + ((StepEvent) event).thread().frameCount());
//generar otro step out
if(((EStackFrameLocatableEvent) event.request().getProperty("eEvent")).getStackFrame().getDepth()<((StepEvent) event).thread().frameCount())
{
}
else
{
//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());