• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LocatableEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: wrap

import com.sun.jdi.event.LocatableEvent; //导入依赖的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: handleMethodEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
@Override
protected boolean handleMethodEvent(LocatableEvent event, Method method, JDIThread thread, boolean suspendVote) {
	//System.out.println("Checking " + method.declaringType().name() + "." + method.name());
	if (!method.isNative())
		return true;
	//System.out.println("Really checking " + method.declaringType().name() + "." + method.name());
	String name = method.declaringType().name();
	if (!name.startsWith("java.") && !name.startsWith("sun.")) {
		//System.out.println("Killing " + method.declaringType().name() + "." + method.name());
		try {
			thread.stop(exceptionObj);
		} catch (DebugException e) {
			throw new RuntimeException(e);
		}
	}
	return true;
}
 
开发者ID:jgalenson,项目名称:codehint,代码行数:18,代码来源:NativeHandler.java


示例3: getThisObject

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
protected ObjectReference getThisObject(SuspendContextImpl context, LocatableEvent event) throws EvaluateException {
  ThreadReferenceProxyImpl thread = context.getThread();
  if(thread != null) {
    StackFrameProxyImpl stackFrameProxy = thread.frame(0);
    if(stackFrameProxy != null) {
      return stackFrameProxy.thisObject();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:Breakpoint.java


示例4: calculateEventClass

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
@Override
protected String calculateEventClass(EvaluationContextImpl context, LocatableEvent event) throws EvaluateException {
  String className = null;
  final ObjectReference thisObject = (ObjectReference)context.getThisObject();
  if (thisObject != null) {
    className = thisObject.referenceType().name();
  }
  else {
    final StackFrameProxyImpl frame = context.getFrameProxy();
    if (frame != null) {
      className = frame.location().declaringType().name();
    }
  }
  return className;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:LineBreakpoint.java


示例5: matchesEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
public boolean matchesEvent(@NotNull final LocatableEvent event, final DebugProcessImpl process) throws EvaluateException {
  if (getMethodName() == null || mySignature == null) {
    return false;
  }
  final Method method = event.location().method();
  return method != null && method.name().equals(getMethodName()) && method.signature().equals(mySignature.getName(process));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MethodBreakpoint.java


示例6: matchesEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
public boolean matchesEvent(@NotNull final LocatableEvent event, final DebugProcessImpl process) throws EvaluateException {
  if (myMethodName == null || mySignature == null) {
    return false;
  }
  final Method method = event.location().method();
  return method != null && method.name().equals(myMethodName) && method.signature().equals(mySignature.getName(process));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:MethodBreakpoint.java


示例7: createVarAssignEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
IJiveEvent createVarAssignEvent(final LocatableEvent event, final StackFrame frame,
    final com.sun.jdi.Value newValue, final IContourMember varInstance, final String typeName)
{
  final IThreadValue threadId = resolveThread(frame);
  final IValue value = resolveValue(frame.thread(), newValue, typeName);
  // defensively record the location when the event is provided
  if (event != null)
  {
    executionState().nextLine(threadId, resolveLine(event.location()));
  }
  final ILineValue line = executionState().currentLine(threadId);
  return eventFactory().createVarAssignEvent(threadId, line, value, varInstance);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:14,代码来源:EventFactoryAdapter.java


示例8: createVarDeleteEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
IJiveEvent createVarDeleteEvent(final LocatableEvent event, final StackFrame frame,
    final IContourMember varInstance)
{
  final IThreadValue threadId = resolveThread(frame);
  // defensively record the location when the event is provided
  if (event != null)
  {
    executionState().nextLine(threadId, resolveLine(event.location()));
  }
  final ILineValue line = executionState().currentLine(threadId);
  return eventFactory().createVarDeleteEvent(threadId, line, varInstance);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:13,代码来源:EventFactoryAdapter.java


示例9: dispatchVarDeleteEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
/**
 * Creates and dispatches a local variable {@code JiveVarDeleteEvent}.
 */
@Override
public void dispatchVarDeleteEvent(final LocatableEvent event, final StackFrame frame,
    final IContourMember varInstance)
{
  dispatchEvent(adapter().createVarDeleteEvent(event, frame, varInstance));
}
 
开发者ID:UBPL,项目名称:jive,代码行数:10,代码来源:JiveEventDispatcher.java


示例10: handleEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
@Override
public boolean handleEvent(Event event, JDIDebugTarget target, boolean suspendVote, EventSet eventSet) {
	try {
		//System.out.println("Reflection: " + event);
		ThreadReference thread = ((LocatableEvent)event).thread();
		StackFrame stack = thread.frame(0);
		ObjectReference fieldValue = stack.thisObject();
		ReferenceType fieldType = fieldValue.referenceType();
		//String className = ((ObjectReference)fieldValue.getValue(fieldType.fieldByName("clazz"))).invokeMethod(thread, event.virtualMachine().classesByName("java.lang.Class").get(0).methodsByName("getName").get(0), new ArrayList<Value>(0), 0).toString();  // Calling methods in the child JVM seems to crash here.
		//String className = ((StringReference)((ObjectReference)fieldValue.getValue(fieldType.fieldByName("clazz"))).getValue(event.virtualMachine().classesByName("java.lang.Class").get(0).fieldByName("name"))).value();  // This works in JDK 7 but breaks in JDK 8 (because getting fields no longer calls SecurityManager.checkMemberAccess).
		String className = ((ClassObjectReference)fieldValue.getValue(fieldType.fieldByName("clazz"))).reflectedType().name();
		String fieldName = ((StringReference)fieldValue.getValue(fieldType.fieldByName("name"))).value();
		Field field = event.virtualMachine().classesByName(className).get(0).fieldByName(fieldName);
		List<Value> argValues = stack.getArgumentValues();
		ObjectReference obj = (ObjectReference)argValues.get(0);
		if (!field.isStatic() && obj == null)
			return true;  // The execution will crash.
		Value oldValue = field.isStatic() ? field.declaringType().getValue(field) : obj.getValue(field);
		if (argValues.size() == 2) {  // We're setting the value of a field.
			Value newValue = argValues.get(1);
			if (newValue instanceof ObjectReference && EclipseUtils.isPrimitive(field.signature()))  // Unbox primitive values.
				newValue = ((ObjectReference)newValue).getValue(((ReferenceType)newValue.type()).fieldByName("value"));
			recordEffect(FieldLVal.makeFieldLVal(obj, field), oldValue, newValue);
		} else if (oldValue instanceof ArrayReference)  // We're reading the value of an array.
			backupArray(FieldLVal.makeFieldLVal(obj, field), oldValue);
	} catch (IncompatibleThreadStateException e) {
		throw new RuntimeException(e);
	}
	return true;
}
 
开发者ID:jgalenson,项目名称:codehint,代码行数:31,代码来源:SideEffectHandler.java


示例11: processLocatableEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
@Override
public boolean processLocatableEvent(final SuspendContextCommandImpl action, final LocatableEvent event) throws EventProcessingException {
  final SuspendContextImpl context = action.getSuspendContext();
  if(!isValid()) {
    context.getDebugProcess().getRequestsManager().deleteRequest(this);
    return false;
  }

  final String[] title = {DebuggerBundle.message("title.error.evaluating.breakpoint.condition") };

  try {
    final StackFrameProxyImpl frameProxy = context.getThread().frame(0);
    if (frameProxy == null) {
      // might be if the thread has been collected
      return false;
    }

    final EvaluationContextImpl evaluationContext = new EvaluationContextImpl(
      action.getSuspendContext(),
      frameProxy,
      getThisObject(context, event)
    );

    if(!evaluateCondition(evaluationContext, event)) {
      return false;
    }

    title[0] = DebuggerBundle.message("title.error.evaluating.breakpoint.action");
    runAction(evaluationContext, event);
  }
  catch (final EvaluateException ex) {
    if(ApplicationManager.getApplication().isUnitTestMode()) {
      System.out.println(ex.getMessage());
      return false;
    }

    throw new EventProcessingException(title[0], ex.getMessage(), ex);
  } 

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:Breakpoint.java


示例12: runAction

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
private void runAction(final EvaluationContextImpl context, LocatableEvent event) {
  final DebugProcessImpl debugProcess = context.getDebugProcess();
  if (isLogEnabled() || isLogExpressionEnabled()) {
    final StringBuilder buf = StringBuilderSpinAllocator.alloc();
    try {
      if (myXBreakpoint.isLogMessage()) {
        buf.append(getEventMessage(event));
        buf.append("\n");
      }
      if (isLogExpressionEnabled()) {
        if(!debugProcess.isAttached()) {
          return;
        }

        final TextWithImports expressionToEvaluate = getLogMessage();
        try {
          ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(getProject(), new EvaluatingComputable<ExpressionEvaluator>() {
            @Override
            public ExpressionEvaluator compute() throws EvaluateException {
              return EvaluatorBuilderImpl.build(expressionToEvaluate, ContextUtil.getContextElement(context), ContextUtil.getSourcePosition(context));
            }
          });
          final Value eval = evaluator.evaluate(context);
          final String result = eval instanceof VoidValue ? "void" : DebuggerUtils.getValueAsString(context, eval);
          buf.append(result);
        }
        catch (EvaluateException e) {
          buf.append(DebuggerBundle.message("error.unable.to.evaluate.expression"));
          buf.append(" \"");
          buf.append(expressionToEvaluate);
          buf.append("\"");
          buf.append(" : ");
          buf.append(e.getMessage());
        }
        buf.append("\n");
      }
      if (buf.length() > 0) {
        debugProcess.printToConsole(buf.toString());
      }
    }
    finally {
      StringBuilderSpinAllocator.dispose(buf);
    }
  }
  if (isRemoveAfterHit()) {
    handleTemporaryBreakpointHit(debugProcess);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:Breakpoint.java


示例13: calculateEventClass

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
protected String calculateEventClass(EvaluationContextImpl context, LocatableEvent event) throws EvaluateException {
  return event.location().declaringType().name();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:Breakpoint.java


示例14: evaluateCondition

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
public boolean evaluateCondition(@NotNull EvaluationContextImpl context, @NotNull LocatableEvent event) throws EvaluateException {
  if (!matchesEvent(event, context.getDebugProcess())) {
    return false;
  }
  return super.evaluateCondition(context, event);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:MethodBreakpoint.java


示例15: processLocatableEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
@Override
public boolean processLocatableEvent(SuspendContextCommandImpl action, LocatableEvent event)
  throws EventProcessingException {
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:FilteredRequestorImpl.java


示例16: getThisObject

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
protected ObjectReference getThisObject(SuspendContextImpl context, LocatableEvent event) throws EvaluateException {
  if(event instanceof ExceptionEvent) {
    return ((ExceptionEvent) event).exception();
  }
  return super.getThisObject(context, event);    //To change body of overriden methods use Options | File Templates.
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ExceptionBreakpoint.java


示例17: getEventMessage

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
public String getEventMessage(LocatableEvent event) {
  String exceptionName = (getQualifiedName() != null)? getQualifiedName() : CommonClassNames.JAVA_LANG_THROWABLE;
  String threadName    = null;
  if (event instanceof ExceptionEvent) {
    ExceptionEvent exceptionEvent = (ExceptionEvent)event;
    try {
      exceptionName = exceptionEvent.exception().type().name();
      threadName = exceptionEvent.thread().name();
    }
    catch (Exception ignore) {
    }
  }
  final Location location = event.location();
  final String locationQName = DebuggerUtilsEx.getLocationMethodQName(location);
  String locationFileName;
  try {
    locationFileName = location.sourceName();
  }
  catch (AbsentInformationException e) {
    locationFileName = "";
  }
  final int locationLine = Math.max(0, location.lineNumber());
  if (threadName != null) {
    return DebuggerBundle.message(
      "exception.breakpoint.console.message.with.thread.info", 
      exceptionName, 
      threadName,
      locationQName,
      locationFileName,
      locationLine
    );
  }
  else {
    return DebuggerBundle.message(
      "exception.breakpoint.console.message", 
      exceptionName,
      locationQName,
      locationFileName,
      locationLine
    );
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:ExceptionBreakpoint.java


示例18: evaluateCondition

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
public boolean evaluateCondition(EvaluationContextImpl context, LocatableEvent event) throws EvaluateException {
  return matchesEvent(event) && super.evaluateCondition(context, event);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:WildcardMethodBreakpoint.java


示例19: matchesEvent

import com.sun.jdi.event.LocatableEvent; //导入依赖的package包/类
public boolean matchesEvent(final LocatableEvent event){
  final Method method = event.location().method();
  return method != null && getMethodName().equals(method.name());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:WildcardMethodBreakpoint.java


示例20: F3LocatableEvent

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Data类代码示例发布时间:2022-05-23
下一篇:
Java AttachmentPartImpl类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap