本文介绍了为什么在使用方法入口调试时被调试的程序会变慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jdi 接口来创建调试器,当我使用 MethodEntryRequests 启用方法条目跟踪时,被调试程序的速度减慢了数十倍.我已将主线程的过滤器和挂起策略设置为 SUSPEND_EVENT_THREAD.Classfilter 是有限的,如果我打印任何接收到的事件,它不会显示超过几十个,因此它不应该接收太多.我正在本地调试,并在调试后的 java 程序中使用以下命令行:

I'm using jdi interfaces to create a debugger and when I use MethodEntryRequests to enable method entry tracing the debugged program slows down by factor of tens. I have set filter for main thread and suspend policy to SUSPEND_EVENT_THREAD. Classfilter is limited and if I print any received events it doesn't show more than couple of dozen of those so it shouldn't receive too much of them. I'm debugging locally and having followind kind of command-line with the debugged java program:

-Xdebug -Xrunjdwp:transport=dt_socket,suspend=y,server=y,address=1337

推荐答案

简短的回答是,当设置方法条目时,执行会通过解释器运行.我认为无论如何都没有这个......

The short answer is that execution runs through the interpreter when method entries are set. I don't think there is anyway around this...

过去所有在调试模式下运行的代码都是这种情况,但是 它在 1.4 中得到了增强... 现在 HotSpot 可用于全速"调试,除了方法进入和退出、观察点以及单步执行或包含断点的方法.

This used to be the case for all code running in debug mode but it was enhanced in 1.4... now HotSpot works for 'full-speed' debugging except in the case of method entries and exits, watchpoints and when single stepping or in methods that contain breakpoints.

这篇关于为什么在使用方法入口调试时被调试的程序会变慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:58