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

Java MethodEntryEvent类代码示例

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

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



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

示例1: stopOnEntry

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
/**
 * Suspend the main thread when the program enters the main method of the specified main class.
 * @param debugSession
 *                  the debug session.
 * @param mainClass
 *                  the fully qualified name of the main class.
 * @return
 *        a {@link CompletableFuture} that contains the suspended main thread id.
 */
public static CompletableFuture<Long> stopOnEntry(IDebugSession debugSession, String mainClass) {
    CompletableFuture<Long> future = new CompletableFuture<>();

    EventRequestManager manager = debugSession.getVM().eventRequestManager();
    MethodEntryRequest request = manager.createMethodEntryRequest();
    request.addClassFilter(mainClass);
    request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);

    debugSession.getEventHub().events().filter(debugEvent -> {
        return debugEvent.event instanceof MethodEntryEvent && request.equals(debugEvent.event.request());
    }).subscribe(debugEvent -> {
        Method method = ((MethodEntryEvent) debugEvent.event).method();
        if (method.isPublic() && method.isStatic() && method.name().equals("main")
                && method.signature().equals("([Ljava/lang/String;)V")) {
            deleteEventRequestSafely(debugSession.getVM().eventRequestManager(), request);
            debugEvent.shouldResume = false;
            ThreadReference bpThread = ((MethodEntryEvent) debugEvent.event).thread();
            future.complete(bpThread.uniqueID());
        }
    });
    request.enable();

    return future;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:34,代码来源:DebugUtility.java


示例2: perform

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
@Override
    public void perform(String[] argv, Context ctx) {

        EventRequestManager manager = ctx.getVm().eventRequestManager();
        MethodEntryRequest mer = manager.createMethodEntryRequest();
        mer.setSuspendPolicy(EventRequest.SUSPEND_NONE);
        mer.enable();

        ctx.register(mer, new EventCallback() {
            @Override
            public void handleEvent(Event event) {
                MethodEntryEvent mee = (MethodEntryEvent) event;
                Method method = mee.method();
                System.out.println("--" + method.name());
//                mee.thread().resume();
            }
        });
    }
 
开发者ID:CvvT,项目名称:andbg,代码行数:19,代码来源:track.java


示例3: wrap

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


示例4: jdiMethodEntry

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


示例5: handleMethodEntry

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
/**
 * Filtered method calls/returns are captured lazily by determineStackFrame(event).
 */
void handleMethodEntry(final MethodEntryEvent event, final boolean generateLocals)
    throws IncompatibleThreadStateException, AbsentInformationException
{
  if (!eventFilter().acceptsMethod(event.method(), event.thread()))
  {
    return;
  }
  // adjust the stack frames if necessary
  final StackFrame frame = determineStackFrame(event);
  // handle a pending returned event if necessary
  handlePendingReturned(event.location(), frame, event.thread());
  // record newly observed types and objects if necessary
  handleNewObject(frame, event.thread());
  // resolve the method
  resolveMethod(frame, event.method());
  // record the method call
  dispatcher().dispatchInModelCallEvent(event, frame);
  // handle locals if necessary
  if (generateLocals)
  {
    handleLocals(null, frame, event.location());
  }
}
 
开发者ID:UBPL,项目名称:jive,代码行数:27,代码来源:JDIEventHandlerDelegate.java


示例6: methodEntryEvent

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
/**
* This method is trigger every time one method (in not excluded classes) is called. </br>
* The information that is collected is the following: </br>
* </ul>
* 		<li>Method's name</li>
* 		<li>Method's Class (Class where the method is called)</li>
* 		<li>Method's arguments</li>
* 		<li>Method's Class information (State of the "this" object when the method is called)</li>
* </ul>
* @param event - The event that is going to be processed.
*/
	
  public void methodEntryEvent(MethodEntryEvent event) {
  	
  	ThreadReference thread = event.thread();
     	Method method = event.method();
     	String className = ClassUtils.getClass(method.declaringType());
     	String methodName = method.name();
     	ReferenceType ref=method.declaringType(); //"class" where is declare 
     	List<Data> arguments = processArguments(method,thread);
     	
     	Data argument_this = null;
     	
     	if (!Settings.getInstance().isExcludedThis())
     		argument_this = processThis(event,ref,thread);
     	
     	MethodEntryInfo info = new MethodEntryInfo(methodName,className,arguments,argument_this);

     	synchronized (writer) {
     		writer.writeMethodEntryInfo(info);
     	}	
      
  }
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:34,代码来源:MethodEntryManager.java


示例7: handleEvent

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
/**
* Dispatch incoming events
*/
   
   private void handleEvent(Event event) {
       if (event instanceof ExceptionEvent) {
       	if (!enableProfiling)
       		exceptionManager.exceptionEvent((ExceptionEvent)event);
       } else if (event instanceof MethodEntryEvent) {
       	methodEntryEvent((MethodEntryEvent)event);
       } else if (event instanceof MethodExitEvent) {
       	methodExitEvent((MethodExitEvent)event);
       } else if (event instanceof ThreadDeathEvent) {
           threadeath.threadDeathEvent((ThreadDeathEvent)event);
       } else if (event instanceof VMDeathEvent) {
       	vmDeathEvent((VMDeathEvent)event);
       } else if (event instanceof VMDisconnectEvent) {
           connected = disconnect.vmDisconnectEvent((VMDisconnectEvent)event);
       } 
   }
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:21,代码来源:EventThread.java


示例8: enter

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
@Override
public void enter(MethodEntryEvent event) {
    MethodEntity entity = new MethodEntity();
    com.sun.jdi.Method method = event.method();
    entity.setClassName(method.declaringType().signature());
    entity.setMethodName(method.name());
    entity.setDescription(method.signature());
    MethodTracer tracer = simplify.getTracerMap().get(entity);

    if (tracer != null) {
        parse(tracer, event.thread(), event.location());
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:14,代码来源:Simplify.java


示例9: methodEntryEvent

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
public void methodEntryEvent(MethodEntryEvent evt) {
    synchronized (listeners) {
        for (EventNotifier en : listeners) {
            en.methodEntryEvent(evt);
        }
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:8,代码来源:Debugger.java


示例10: checkEntryExit

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
/**
* Convenient method that compares the method name (extracted from event) with the given set of names.
* @param event
* @param methodName1
* @param methodName2
*/
   private void checkEntryExit(Event event, String methodName1, String methodName2) {
           if (event instanceof MethodEntryEvent) {
               System.out.println("Starting method = " + ((MethodEntryEvent)event).method().toString());
               Assert.assertTrue(((MethodEntryEvent)event).method().toString().equals(methodName1) || ((MethodEntryEvent)event).method().toString().equals(methodName2));
           }else if (event instanceof MethodExitEvent) {
               System.out.println("Exiting method = " + ((MethodExitEvent)event).method().toString());
               Assert.assertTrue(((MethodExitEvent)event).method().toString().equals(methodName1) || ((MethodExitEvent)event).method().toString().equals(methodName2));
           }
   }
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:16,代码来源:TraceCallsTest.java


示例11: handleEvent

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


示例12: dispatchInModelCallEvent

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
/**
 * Creates and dispatches an in-model {@code CallEvent} from the given {@code MethodEntryEvent}
 * and {@code StackFrame}. The stack frame represents the method activation resulting from the
 * call.
 */
@Override
public void dispatchInModelCallEvent(final MethodEntryEvent event, final StackFrame frame)
{
  final IMethodCallEvent initiator = adapter().createMethodCallEvent(event, frame, true,
      manager().generateLocalEvents());
  dispatchEvent(initiator);
  dispatchEvent(adapter().createMethodEnterEvent(initiator, frame.thread()));
}
 
开发者ID:UBPL,项目名称:jive,代码行数:14,代码来源:JiveEventDispatcher.java


示例13: jdiMethodEntry

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
/**
 * Notification of a method invocation in the target VM. This event occurs after entry into the
 * invoked method and before any code has executed. Method entry events are generated for both
 * native and non-native methods.
 * 
 * @param event
 * 
 * @see <a href="">http://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/index.html</a>
 */
@Override
public void jdiMethodEntry(final MethodEntryEvent event)
{
  final Method method = event.location().method();
  if (method.isSynthetic() || method.isBridge() || method.name().contains("$"))
  {
    return;
  }
  //
  this.currentEvent = event;
  this.currentThread = event.thread();
  //
  final long thId = registry.getThreadId(event.thread());
  //
  final long pfrId = registry.methodEntered(thId);
  //
  final long[] eventId = registry.encode(EventHandlerLite.KIND_METHOD_ENTERED);
  //
  System.out.format(EventHandlerLite.ENCODED_METHOD_ENTERED, eventId[0], eventId[1], pfrId,
      eventId[2]);
  //
  System.out.println(registry.decode(eventId));
  //
  this.currentEvent = null;
  this.currentThread = null;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:36,代码来源:EventHandlerLite.java


示例14: methodEntryEvent

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
private void methodEntryEvent(MethodEntryEvent event) {
	String methodName = event.method().toString();
	String className = ClassUtils.getClass(event.method().declaringType());
	if (!excludesClassMethods.isExcluded(className,methodName) && !className.contains("$")){
    	if (enableProfiling)
        	profiler.profileEvent(event);
        else 
        	methodEntryManager.methodEntryEvent(event);
	}
}
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:11,代码来源:EventThread.java


示例15: F3MethodEntryEvent

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


示例16: underlying

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


示例17: methodEntryEvent

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
public void methodEntryEvent(MethodEntryEvent e) {
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:3,代码来源:EventNotifierAdapter.java


示例18: visit

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


示例19: VisitableMethodEntryEvent

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


示例20: processThis

import com.sun.jdi.event.MethodEntryEvent; //导入依赖的package包/类
private Data processThis(MethodEntryEvent event, ReferenceType ref, ThreadReference thread) {

	StackFrame stack=null;

	try {
		stack = thread.frame(0);
	} catch (IncompatibleThreadStateException e) {
		e.printStackTrace();
	}
	
	Value value = stack.thisObject();
	
	Data this_data = utils.getObj("this",value,new ArrayList<Long>());
	
	return this_data;
}
 
开发者ID:DiegoArranzGarcia,项目名称:JavaTracer,代码行数:17,代码来源:MethodEntryManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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