当前位置: 首页>>代码示例>>Java>>正文


Java ModificationWatchpointEvent类代码示例

本文整理汇总了Java中com.sun.jdi.event.ModificationWatchpointEvent的典型用法代码示例。如果您正苦于以下问题:Java ModificationWatchpointEvent类的具体用法?Java ModificationWatchpointEvent怎么用?Java ModificationWatchpointEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModificationWatchpointEvent类属于com.sun.jdi.event包,在下文中一共展示了ModificationWatchpointEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: wrap

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
public static F3Event wrap(F3VirtualMachine f3vm, Event evt) {
    if (evt == null) {
        return null;
    }
    if (evt instanceof AccessWatchpointEvent) {
        return new F3AccessWatchpointEvent(f3vm, (AccessWatchpointEvent)evt);
    } else if (evt instanceof BreakpointEvent) {
        return new F3BreakpointEvent(f3vm, (BreakpointEvent)evt);
    } else if (evt instanceof ClassPrepareEvent) {
        return new F3ClassPrepareEvent(f3vm, (ClassPrepareEvent)evt);
    } else if (evt instanceof ClassUnloadEvent) {
        return new F3ClassUnloadEvent(f3vm, (ClassUnloadEvent)evt);
    } else if (evt instanceof ExceptionEvent) {
        return new F3ExceptionEvent(f3vm, (ExceptionEvent)evt);
    } else if (evt instanceof MethodEntryEvent) {
        return new F3MethodEntryEvent(f3vm, (MethodEntryEvent)evt);
    } else if (evt instanceof MethodExitEvent) {
        return new F3MethodExitEvent(f3vm, (MethodExitEvent)evt);
    } else if (evt instanceof ModificationWatchpointEvent) {
        return new F3ModificationWatchpointEvent(f3vm, (ModificationWatchpointEvent)evt);
    } else if (evt instanceof MonitorContendedEnterEvent) {
        return new F3MonitorContendedEnterEvent(f3vm, (MonitorContendedEnterEvent)evt);
    } else if (evt instanceof MonitorContendedEnteredEvent) {
        return new F3MonitorContendedEnteredEvent(f3vm, (MonitorContendedEnteredEvent)evt);
    } else if (evt instanceof MonitorWaitEvent) {
        return new F3MonitorWaitEvent(f3vm, (MonitorWaitEvent)evt);
    } else if (evt instanceof MonitorWaitedEvent) {
        return new F3MonitorWaitedEvent(f3vm, (MonitorWaitedEvent)evt);
    } else if (evt instanceof StepEvent) {
        return new F3StepEvent(f3vm, (StepEvent)evt);
    } else if (evt instanceof ThreadDeathEvent) {
        return new F3ThreadDeathEvent(f3vm, (ThreadDeathEvent)evt);
    } else if (evt instanceof ThreadStartEvent) {
        return new F3ThreadStartEvent(f3vm, (ThreadStartEvent)evt);
    } else if (evt instanceof VMDeathEvent) {
        return new F3VMDeathEvent(f3vm, (VMDeathEvent)evt);
    } else if (evt instanceof VMDisconnectEvent) {
        return new F3VMDisconnectEvent(f3vm, (VMDisconnectEvent)evt);
    } else if (evt instanceof VMStartEvent) {
        return new F3VMStartEvent(f3vm, (VMStartEvent)evt);
    } else if (evt instanceof WatchpointEvent) {
        return new F3WatchpointEvent(f3vm, (WatchpointEvent)evt);
    } else if (evt instanceof LocatableEvent) {
        return new F3LocatableEvent(f3vm, (LocatableEvent)evt);
    } else {
        return new F3Event(f3vm, evt);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:49,代码来源:F3Event.java

示例2: jdiModificationWatchpoint

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
@Override
public void jdiModificationWatchpoint(final ModificationWatchpointEvent event)
{
  if (!override && !owner.isStarted())
  {
    return;
  }
  try
  {
    delegate.handleFieldWrite(event);
  }
  catch (final Throwable e)
  {
    JiveDebugPlugin.log(e);
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:17,代码来源:JDIEventHandler.java

示例3: processWatchEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
/**
 * Processes modification event for the given watch point by storing the new
 * values and caller information, and then by registered listeners
 * 
 * @param event
 *            the modification event. It provides information about the
 *            current / new values and the affected instance, as well as the
 *            caller (thread, method, etc.).
 * @param watchPoint
 *            the watch point to which the event belongs.
 * @param target
 *            the debug target in which the event occurred
 */
public void processWatchEvent(WatchpointEvent event, AbstractBreakpoint watchPoint,
		IJavaDebugTarget target) {
	if (!watchPoint.isTrackingActive()) {
		return;
	}
	long currTime = System.currentTimeMillis();
	ObjectReference instance = event.object();
	VariableHistory history = (VariableHistory)getHistory(instance, watchPoint, target);		
	boolean notifyInstanceAdded = history.getAllValues().size() == 0;
	boolean eventModificationEvent = event instanceof ModificationWatchpointEvent;
	Value value = eventModificationEvent ? ((ModificationWatchpointEvent) event)
			.valueToBe() : ((WatchpointEvent)event).valueCurrent();
	history.addValue(value, currTime, event.thread(),
			eventModificationEvent);
	for (IBreakpointListener listener : listeners) {
		if (notifyInstanceAdded) {
			listener.notifyInstanceAdded(watchPoint, instance, target);
		}
		listener.notifyBreakpointHit(watchPoint, instance, target);
	}
	
}
 
开发者ID:bilalsal,项目名称:EclipseTracer,代码行数:36,代码来源:BreakpointsManager.java

示例4: processBreakpointEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
public void processBreakpointEvent(ObjectReference instance, BreakpointEvent event,
		Breakpoint breakpoint, JDIDebugTarget target) {
	if (!breakpoint.isTrackingActive()) {
		return;
	}
	long currTime = System.currentTimeMillis();
	LineBreakpointHistory history = (LineBreakpointHistory)getHistory(instance, breakpoint, target);		
	boolean notifyInstanceAdded = history.getAllValues().size() == 0;
	boolean eventModificationEvent = event instanceof ModificationWatchpointEvent;
	history.addValue(currTime, event.thread());
	for (IBreakpointListener listener : listeners) {
		if (notifyInstanceAdded) {
			listener.notifyInstanceAdded(breakpoint, instance, target);
		}
		listener.notifyBreakpointHit(breakpoint, instance, target);
	}
}
 
开发者ID:bilalsal,项目名称:EclipseTracer,代码行数:18,代码来源:BreakpointsManager.java

示例5: checkWatchPointEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
/**
* Checks the type of WatchpointEvent and validates type of field-being-watched
* @param wpEvent
*/
   private void checkWatchPointEvent(WatchpointEvent wpEvent) {
       if (wpEvent instanceof AccessWatchpointEvent) {
           Assert.assertTrue(((AccessWatchpointEvent)wpEvent).valueCurrent().type().name().equals("float"));
           Assert.assertTrue(wpEvent.getClass().toString().equals("class org.f3.jdi.event.F3AccessWatchpointEvent"));
       } else if (wpEvent instanceof ModificationWatchpointEvent) {
           Assert.assertTrue(((ModificationWatchpointEvent)wpEvent).valueCurrent().type().name().equals("float"));
           Assert.assertTrue(wpEvent.getClass().toString().equals("class org.f3.jdi.event.F3ModificationWatchpointEvent"));
       }
   }
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:14,代码来源:WatchAccessModificationTest.java

示例6: handleEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
@Override
public boolean handleEvent(final Event event, final JDIDebugTarget target,
    final boolean suspendVote, final EventSet eventSet)
{
  if (owner.isActive())
  {
    owner.jdiHandler().jdiModificationWatchpoint((ModificationWatchpointEvent) event);
  }
  return true;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:11,代码来源:EventHandlerFactory.java

示例7: handleFieldWrite

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
/**
 * Field reads/writes are registered only for non-filtered classes.
 */
void handleFieldWrite(final ModificationWatchpointEvent event)
    throws IncompatibleThreadStateException, AbsentInformationException
{
  final StackFrame frame = determineStackFrame(event);
  handleNewObject(frame, event.thread());
  // dispatch a new object for the array value, if appropriate
  if (manager().generateArrayEvents() && event.valueToBe() instanceof ArrayReference)
  {
    // dispatch a new array event and the respective cell assignments
    handleNewArray((ArrayReference) event.valueToBe(), event.location(), frame);
  }
  dispatcher().dispatchFieldWriteEvent(event);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:17,代码来源:JDIEventHandlerDelegate.java

示例8: jdiModificationWatchpoint

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
/**
 * Notification of a field modification in the target VM.
 * 
 * @param event
 * 
 * @see <a href="">http://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/index.html</a>
 */
@Override
public void jdiModificationWatchpoint(final ModificationWatchpointEvent event)
{
  final Method method = event.location().method();
  if (method.isSynthetic() || method.isBridge() || method.name().contains("$"))
  {
    return;
  }
  final Field field = event.field();
  if (field.isSynthetic() || field.name().contains("$"))
  {
    return;
  }
  //
  this.currentEvent = event;
  this.currentThread = event.thread();
  //
  final long fId = registry.getFieldId(field);
  //
  final long oId = registry.getObjectId(event.object());
  //
  final long vId = registry.getValueId(event.valueToBe());
  //
  final long[] eventId = registry.encode(EventHandlerLite.KIND_FIELD_WRITE);
  //
  System.out.format(EventHandlerLite.ENCODED_FIELD_WRITE, eventId[0], eventId[1], oId, fId, vId);
  //
  System.out.print(registry.decode(eventId));
  System.out.print(registry.decodeObject(oId));
  System.out.print(registry.decodeField(fId));
  System.out.println(registry.decodeValue(vId));
  //
  this.currentEvent = null;
  this.currentThread = null;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:43,代码来源:EventHandlerLite.java

示例9: main

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
public static void main(String[] args)
    throws IOException, InterruptedException {

  //VirtualMachine vm = launchTarget(sb.toString());
  VirtualMachine vm = launchTarget(CLASS_NAME);

  System.out.println("Vm launched");

  // process events
  EventQueue eventQueue = vm.eventQueue();
  // resume the vm

  Process process = vm.process();


  // Copy target's output and error to our output and error.
  Thread outThread = new StreamRedirectThread("out reader", process.getInputStream());
  Thread errThread = new StreamRedirectThread("error reader", process.getErrorStream());

  errThread.start();
  outThread.start();

  boolean connected = true;
  int watched = 0;
  while (connected) {
    EventSet eventSet = eventQueue.remove();
    for (Event event : eventSet) {
      System.out.println("FieldMonitor-main receives: "+event);
      if (event instanceof VMStartEvent) {
        addClassWatch(vm);
      } else if (event instanceof VMDeathEvent
          || event instanceof VMDisconnectEvent) {
        // exit
        connected = false;
      } else if (event instanceof ClassPrepareEvent) {
        // watch field on loaded class
        System.out.println("ClassPrepareEvent");
        ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event;
        ReferenceType refType = classPrepEvent
            .referenceType();
        addFieldWatch(vm, refType);
      } else if (event instanceof ModificationWatchpointEvent) {
        watched++;
        System.out.println("sleep for 500 ms");
        Thread.sleep(500);

        ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent) event;
        System.out.println("old="
            + modEvent.valueCurrent());
        System.out.println("new=" + modEvent.valueToBe());
      }
    }
    System.out.println("resume...");
    eventSet.resume();
  }
  // Shutdown begins when event thread terminates
  try {
      errThread.join(); // Make sure output is forwarded
      outThread.join();
  } catch (InterruptedException exc) {
      // we don't interrupt
  }

  if (watched != 11) { // init + 10 modifications in TestPostFieldModification class
      throw new Error("Expected to receive 11 times ModificationWatchpointEvent, but got "+watched);
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:68,代码来源:FieldMonitor.java

示例10: F3ModificationWatchpointEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
public F3ModificationWatchpointEvent(F3VirtualMachine f3vm, ModificationWatchpointEvent underlying) {
    super(f3vm, underlying);
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:4,代码来源:F3ModificationWatchpointEvent.java

示例11: underlying

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
@Override
protected ModificationWatchpointEvent underlying() {
    return (ModificationWatchpointEvent) super.underlying();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:5,代码来源:F3ModificationWatchpointEvent.java

示例12: VisitableModificationWatchpointEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
public VisitableModificationWatchpointEvent(
        ModificationWatchpointEvent event) {
    this.event = event;
}
 
开发者ID:adrianherrera,项目名称:jdivisitor,代码行数:5,代码来源:VisitableModificationWatchpointEvent.java

示例13: visit

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
@Override
public void visit(ModificationWatchpointEvent event) {
}
 
开发者ID:adrianherrera,项目名称:jdivisitor,代码行数:4,代码来源:EmptyEventVisitor.java

示例14: dispatchFieldWriteEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
@Override
public void dispatchFieldWriteEvent(final ModificationWatchpointEvent event)
{
  dispatchEvent(adapter().createFieldWriteEvent(event));
}
 
开发者ID:UBPL,项目名称:jive,代码行数:6,代码来源:JiveEventDispatcher.java

示例15: handleEvent

import com.sun.jdi.event.ModificationWatchpointEvent; //导入依赖的package包/类
@Override
public boolean handleEvent(Event event, JDIDebugTarget target, boolean suspendVote, EventSet eventSet) {
	/*if (event instanceof WatchpointEvent)
		System.out.println(event + " on " + FieldLVal.makeFieldLVal(((WatchpointEvent)event).object(), ((WatchpointEvent)event).field()).toString());
	else if (event instanceof com.sun.jdi.event.ClassPrepareEvent)
		System.out.println("Prep " + ((com.sun.jdi.event.ClassPrepareEvent)event).referenceType().name());
	else
		System.out.println(event);*/
	synchronized (SideEffectHandler.this) {
		if (effectsMap == null)  // We're not currently tracking side effects.
			return true;
		if (event instanceof WatchpointEvent) {
			WatchpointEvent watchEvent = (WatchpointEvent)event;
			//System.out.println(event + " on " + FieldLVal.makeFieldLVal(watchEvent.object(), watchEvent.field()).toString());
			ObjectReference obj = watchEvent.object();
			if (obj != null && obj.uniqueID() > maxID) {
				//System.out.println("Ignoring new object " + obj.toString());
				return true;
			}
			if (watchEvent instanceof ModificationWatchpointEvent) {
				ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent)watchEvent;
				if (!modEvent.location().method().isStaticInitializer())  // If the field is modified in a static initializer, it must be the initialization of a static field of a newly-loaded class, which we don't want to revert.
					recordEffect(FieldLVal.makeFieldLVal(obj, modEvent.field()), modEvent.valueCurrent(), modEvent.valueToBe());
				return true;
			} else if (watchEvent instanceof AccessWatchpointEvent) {
				AccessWatchpointEvent readEvent = (AccessWatchpointEvent)watchEvent;
				Value oldVal = readEvent.valueCurrent();
				if (oldVal instanceof ArrayReference) {
					FieldLVal lval = FieldLVal.makeFieldLVal(obj, readEvent.field());
					backupArray(lval, oldVal);
					if (canDisable && !changedFields.contains(lval) && Utils.incrementMap(accessCounts, this) >= 10) {  // Disabling is slow, so we only do it for frequently-accessed fields.
						try {
							disabledWatchpoints.add(this);
							setEnabled(false);
						} catch (CoreException e) {
							throw new RuntimeException(e);
						}
					}
				}
				/*else
				System.out.println("Ignoring read on non-array Object");*/
				return true;
			}
		}
		return super.handleEvent(event, target, suspendVote, eventSet);
	}
}
 
开发者ID:jgalenson,项目名称:codehint,代码行数:48,代码来源:SideEffectHandler.java


注:本文中的com.sun.jdi.event.ModificationWatchpointEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。