如何在JDI(Java Debug Interface)中设置非阻塞断点?

huangapple 未分类评论46阅读模式
英文:

How to put non-blocking breakpoint in JDI (Java Debug Interface)?

问题

当您在JDI(Java Debug Interface)中有一个BreakpointEventStepEvent时,发生的情况是当前正在执行的程序(被调试程序)被暂停,直到调试器处理完断点事件并恢复被调试程序。但是,如果有很多断点,即使调试器每次收到断点事件后立即恢复被调试程序(调试器和被调试程序之间的通信是通过套接字或共享内存进行的,这不是即时的),这会变得很慢。

但是,如果您想要构建一个工具,只需获取事件信息并稍后处理它们(例如,在构建分析器时等),您如何设置这些断点以不暂停程序?或换句话说,如何以异步方式从运行中的程序中提取堆栈跟踪和变量信息?

英文:

When you have a BreakpointEvent or StepEvent in JDI (Java Debug Interface), what happens is that the currently executing program(debugee) is suspended until the debugger processes the breakpoint event and resumes the debugee.
But if you have many breakpoints this becomes slow, even if the debugger resumes the debugee immediately each time it receives a breakpoint event (communication between debugger and debugee is over sockets or shared memory which is not instant).

But if you'd like to build a tool where you just need the events' information to store them and process them later (e.g. when building a profiler etc.) how can you set these breakpoints not to suspend the program? Or in other words, how can stack traces and variable information be extracted from the running program in an asynchronous way?

huangapple
  • 本文由 发表于 2020年5月5日 01:03:09
  • 转载请务必保留本文链接:https://java.coder-hub.com/61597669.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定